Friday, 7 November 2014

                                         PROGRAMS

1.Demo:
REPORT ZR_H107_demo.
Skip 5. " This if for blank lines
ULINE.
WRITE: 30 'Hello World!' COLOR 5.
New-line.  "This key worked for new line
WRITE: 30 'Second Line of Program' COLOR 5 INTENSIFIED OFF,
      /30 'Last Line of Program' COLOR 6 INVERSE.
ULINE AT /30(50).

2.Text elements:
REPORT ZR_H107_textelements LINE-SIZE 200.
WRITE: TEXT-1a0.
Skip 5.
uline.
Write /50 'Program for text testing...' COLOR 1.
Write / 'Demo Program Two for Testing'.
ULINE.
WRITE TEXT-1a0 RIGHT-JUSTIFIED COLOR 7.
ULINE.
WRITE: / SYST-MANDT, SYST-UNAME, SYST-DATUM, SYST-UZEIT.


3. System variables:
REPORT ZR_H107_SYST.
ULINE.
SKIP 2.
ULINE.
 FORMAT COLOR 1.
WRITE: SYST-VLINE, SYST-DATUM,
 SYST-VLINE, SYST-UNAME, SYST-VLINE, SYST-UZEIT, SYST-VLINE, SYST-MANDT, SYST-VLINE.
FORMAT COLOR OFF.
ULINE.
WRITE: / SYST-VLINE, SYST-REPID, SYST-VLINE, SYST-PAGNO.

ULINE.

4.  Variables:
REPORT ZR_H107_VARIABLES.
DATA: VAR1 TYPE I, VAR2 TYPE I, VAR3 TYPE I.
VAR1 = 5000.
VAR2 = 6000.
VAR3 = VAR1 - VAR2.
WRITE: / VAR1, VAR2, VAR3.


5.  Parameters:
REPORT ZR_H107_COPA.
PARAMETERS:V1 TYPE I,
                           V2 TYPE I OBLIGATORY,
                           V3 TYPE I DEFAULT 100.
DATA:V4 TYPE I.

                          V4 = V1 + V2 + V3.
WRITE: V4.
input:

output:


6.  Parameters & Constants:
REPORT ZR_H107_COPA.
TYPES: VAR1  TYPE  C  LENGTH  10.
DATA: VAR2 TYPE VAR1.
PARAMETERS P1 TYPE VAR1.
CONSTANTS C1 TYPE VAR1 VALUE '3000'.
VAR2 = 9000.
WRITE: VAR2, P1, C1.
Input:

Output:
7.Do:
REPORT ZR_H107_DO.
PARAMETER VAR1 TYPE I.
DO VAR1 TIMES.
DO SY-INDEX TIMES.

WRITE:'*'.

ENDDO.
NEW-LINE.
ENDDO.

DO VAR1 TIMES.
IF VAR1 >= 0.
VAR1 = VAR1 - 1.

DO VAR1 TIMES.
WRITE: '*'.
ENDDO.

NEW-LINE.
ENDIF.

ENDDO.
input:


output:


8.Checkbox:
.
REPORT  ZR_H107_CHECKBOX NO STANDARD PAGE HEADING.

SELECTION-SCREEN BEGIN OF BLOCK 123 WITH FRAME TITLE TEXT-1A0.
PARAMETERS:INP1 TYPE I,
           INP2 TYPE I.
SELECTION-SCREEN END OF BLOCK 123.

SELECTION-SCREEN BEGIN OF BLOCK 619 WITH FRAME TITLE TEXT-1B0.
PARAMETERS:C1 AS CHECKBOX,
           C2 AS CHECKBOX,
           C3 AS CHECKBOX,
           C4 AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK 619.

DATA:ADD TYPE I,
     SUB TYPE I,
     MUL TYPE I,
     DIV TYPE I.

IF C1 EQ 'X'.
ADD = INP1 + INP2.
WRITE:/ 'ADDITON',ADD.

ELSEIF C2 EQ 'X'.
SUB = INP1 - INP2.
WRITE:/ 'SUBSTRACTION',SUB.


ELSEIF C3 EQ 'X'.
MUL = INP1 * INP2.
WRITE:/ 'MULTIPLICATION',MUL.

ELSEIF C4 EQ 'X'.
DIV = INP1 / INP2.
WRITE:/ 'DIVISION',DIV.


 ELSE.
 WRITE:/ 'PLEASE SELECT THE CHECK BOX'.
 ENDIF.


input:


output:

9.Radio button:
.REPORT  ZR_H107_CHECKBOX NO STANDARD PAGE HEADING.
REPORT  ZR_H107_ASSIGNMENT29.

PARAMETERS:RAD1 RADIOBUTTON GROUP GP1,
           RAD2 RADIOBUTTON GROUP GP1,
           RAD3 RADIOBUTTON GROUP GP1.


IF RAD1 EQ 'X'.
CALL TRANSACTION 'ZCA1'.

ELSEIF RAD2 EQ 'X'.
CALL TRANSACTION 'ZCA2'.

ELSEIF RAD3 EQ 'X'.
CALL TRANSACTION 'ZCA3'.

ENDIF.

*call transacton
*viewname
*zcca1(database table name)
*update

*X

input:

output:



10. String Operations:
REPORT ZR_H107_ST.
DATA: VAR1(20) TYPE C VALUE 'Apple',
            VAR2(20) TYPE C VALUE 'Banana',
            VAR3(20) TYPE C VALUE 'Orange',
            VAR4(60) TYPE C,
            VAR5(60) TYPE C VALUE '      TEST     STRING   GAPS'.

*--
CONCATENATE VAR1
                              VAR3 ‘TEST TWO'
                              VAR2 'TEST' INTO
                              VAR4.
WRITE: / VAR4.

CONCATENATE VAR1
                              VAR3 ‘TEST TWO'
                              VAR2   'TEST' INTO
                              VAR4 SEPARATED BY '-'.
WRITE: / VAR4.
WRITE: / SY-DATUM.
CLEAR: VAR1, VAR2, VAR3.
ULINE.
SPLIT VAR4 AT '-' INTO VAR1 VAR2 VAR3.
WRITE: / VAR1 COLOR 1, VAR2 COLOR 4, VAR3 COLOR 7.
ULINE.
*---
REPLACE '-' IN VAR4 WITH '#'.
WRITE: / VAR4 COLOR 3.
REPLACE 'TEST' IN VAR4 WITH 'DEMO'.
WRITE: / VAR4 COLOR 3.
ULINE.
*---
WRITE: / VAR3 COLOR 1.
TRANSLATE VAR3 TO UPPER CASE.
WRITE: / VAR3 COLOR 4.
ULINE.
*--
WRITE: / VAR2 COLOR 7.
SHIFT VAR2 BY 2 PLACES CIRCULAR.
WRITE: / VAR2 COLOR 1.
*--
ULINE.
WRITE: / VAR5 COLOR 3.
CONDENSE VAR5 NO-GAPS.
WRITE: / VAR5 COLOR 1.
*---
ULINE.
WRITE: / VAR5+5(10).
*---
CLEAR VAR1.
VAR1 = STRLEN (VAR5).
WRITE: / VAR1.

output:

 11 While:
REPORT ZR_H107_WHILE.
DATA VAR1 TYPE I.
WHILE SY-INDEX < 50.
 VAR1 = VAR1 + 20.
 IF VAR1 >= 100.
 EXIT.
 ENDIF.
WRITE:/ SY-INDEX, VAR1.
ENDWHILE.

output:

12.  Structures:
REPORT ZR_H107_STRUCT.
DATA: BEGIN OF S1,
        V1(5)  TYPE  N,
        V2(20) TYPE  C,
        V3     TYPE  I,
        V4(10) TYPE  P DECIMALS 2,
      END OF S1.

S1-V1 = 9000.
S1-V2 = 'Record One'.
s1-v3 = 33.
s1-v4 = '2500.40'.

write:/ s1-v1, s1-v2, s1-v3, s1-v4.

S1-V1 = 9001.
S1-V2 = 'Record Two'.
s1-v3 = 55.
s1-v4 = '4400.40'.

write:/ s1-v1, s1-v2, s1-v3, s1-v4.

output:


13.  Different data types:
REPORT  ZR_H107_DDT.
TYPES: T1(20) TYPE C.        " Elementory Data types
TYPES: BEGIN OF S1,          " Structured data type
        F1  TYPE  N  LENGTH  5,
        F2  TYPE  T1,
        F3  TYPE  I,
        F4  TYPE  P  LENGTH  10 DECIMALS 2,
       END OF S1.

TYPES: S2 TYPE S1 OCCURS 0.  " Table type

DATA: V1 TYPE S1.

DATA: V2 TYPE S2,
      V3 TYPE S2,
      V4 TYPE S2,

      V5 TYPE T1.



REPORT  ZR_H107_ASSIGNMENTS20.

TYPES: BEGIN OF S1,          " Structured data type
        F1  TYPE  N  LENGTH  5,
        F2  TYPE  C  LENGTH  20,
        F3  TYPE  I,
        F4  TYPE  P  LENGTH  10 DECIMALS 2,
       END OF S1.

DATA: IT1 TYPE STANDARD TABLE OF S1.

DATA: IT2 TYPE SORTED TABLE OF S1 WITH UNIQUE KEY F1.

DATA: IT3 TYPE HASHED TABLE OF S1 WITH UNIQUE KEY F1.

DATA: WA TYPE S1.

*--
WA-F1 = 1000.
WA-F2 = 'Tab Record One'.
WA-F3 = 22.
WA-F4 = '3000.30'.

APPEND WA TO IT1.
APPEND WA TO IT2.
CLEAR  WA.

WA-F1 = 1001.
WA-F2 = 'Tab Record Two'.
WA-F3 = 33.
WA-F4 = '7700.30'.

APPEND WA TO IT1.
APPEND WA TO IT2.
CLEAR  WA.

WA-F1 = 1007.
WA-F2 = 'Tab Record Three'.
WA-F3 = 33.
WA-F4 = '7700.30'.

APPEND WA TO IT1.
APPEND WA TO IT2.
CLEAR  WA.

LOOP AT IT1 INTO WA.
  WRITE:/ SY-TABIX, WA-F1, WA-F2, WA-F3, WA-F4.
ENDLOOP.

ULINE.

LOOP AT IT2 INTO WA.
  WRITE:/ SY-TABIX, WA-F1, WA-F2, WA-F3, WA-F4.
ENDLOOP.

ULINE.
IT3[] = IT2[].
LOOP AT IT3 INTO WA.
  WRITE:/ SY-TABIX, WA-F1, WA-F2, WA-F3, WA-F4.
ENDLOOP.
output:




14.  Internal tables:

DATA: BEGIN OF S1 OCCURS 0,
        F1  TYPE  N  LENGTH  5,
        F2  TYPE  C  LENGTH  20,
        F3  TYPE  I,
        F4  TYPE  P  LENGTH  10 DECIMALS 2,
      END OF S1.

S1-F1 = 1000.
S1-F2 = 'Recrod One'.
S1-F3 = 33.
S1-F4 = '5000.40'.

APPEND S1.
CLEAR S1.

S1-F1 = 1001.
S1-F2 = 'Recrod Two'.
*S1-F3 = 77.
S1-F4 = '7500.40'.

APPEND S1.
CLEAR S1.

S1-F1 = 1002.
S1-F2 = 'Recrod Three'.
S1-F3 = 22.
S1-F4 = '5400.40'.

APPEND S1.
CLEAR S1.

LOOP AT S1.
  WRITE:/ S1-F1, S1-F2, S1-F3, S1-F4.
ENDLOOP.

output:


15.  Internal tables:

REPORT  ZR_H107_ASSIGNMENTS18.


TYPES T1(10) TYPE C.

DATA V1 TYPE T1.

TYPES: BEGIN OF S1,
        F1  TYPE  N  LENGTH  5,
        F2  TYPE  T1,
        F3  TYPE  I,
        F4  TYPE  P  LENGTH  10 DECIMALS 2,
       END OF S1.

DATA S2 TYPE S1.

DATA S3 TYPE TABLE OF S1.

S2-F1 = 9000.
S2-F2 = 'Test Data'.
S2-F3 = 11.
S2-F4 = '4000.40'.

APPEND S2 TO S3.
CLEAR  S2.

S2-F1 = 9001.
S2-F2 = 'Test TWO'.
S2-F3 = 33.
S2-F4 = '2400.40'.

APPEND S2 TO S3.
CLEAR  S2.

S2-F1 = 9003.
S2-F2 = 'Test THREE'.
S2-F3 = 66.
S2-F4 = '4500.40'.

APPEND S2 TO S3.
CLEAR  S2.

LOOP AT S3 INTO S2.

  WRITE:/ S2-F1, S2-F2, S2-F3, S2-F4.

ENDLOOP.

output:


16.  Internal tables:

REPORT  ZR_H107_ASSIGNMENTS18.

DATA: BEGIN OF ITAB OCCURS 0,

        F1  TYPE  N  LENGTH  5,

        F2  TYPE  C  LENGTH  20,

        F3  TYPE  I,

        F4  TYPE  P  LENGTH  10  DECIMALS  2,

      END OF ITAB.



ITAB-F1 = 9000.

ITAB-F2 = 'Record One'.

ITAB-F3 = 10.

ITAB-F4 = '500.00'.



APPEND ITAB.

CLEAR  ITAB.



ITAB-F1 = 9000.

ITAB-F2 = 'Record One'.

ITAB-F3 = 20.

ITAB-F4 = '1000.00'.



APPEND ITAB.

CLEAR  ITAB.



ITAB-F1 = 9000.

ITAB-F2 = 'Record One'.

ITAB-F3 = 50.

ITAB-F4 = '5000.00'.



APPEND ITAB.

CLEAR  ITAB.



ITAB-F1 = 9001.

ITAB-F2 = 'Record Two'.

ITAB-F3 = 20.

ITAB-F4 = '2000.00'.



APPEND ITAB.
CLEAR  ITAB.

ITAB-F1 = 9001.
ITAB-F2 = 'Record Two'.
ITAB-F3 = 30.
ITAB-F4 = '3000.00'.

APPEND ITAB.
CLEAR  ITAB.

*--
LOOP AT ITAB.
  WRITE:/ ITAB-F1, ITAB-F2, ITAB-F3, ITAB-F4.
ENDLOOP.

*--
ULINE.

REFRESH ITAB[].


ITAB-F1 = 9000.
ITAB-F2 = 'Record One'.
ITAB-F3 = 10.
ITAB-F4 = '500.00'.

COLLECT ITAB.
CLEAR  ITAB.

ITAB-F1 = 9000.
ITAB-F2 = 'Record One'.
ITAB-F3 = 20.
ITAB-F4 = '1000.00'.

COLLECT ITAB.
CLEAR  ITAB.

ITAB-F1 = 9000.
ITAB-F2 = 'Record One'.
ITAB-F3 = 50.
ITAB-F4 = '5000.00'.

COLLECT ITAB.
CLEAR  ITAB.

ITAB-F1 = 9001.
ITAB-F2 = 'Record Two'.
ITAB-F3 = 20.
ITAB-F4 = '2000.00'.

COLLECT ITAB.
CLEAR  ITAB.

ITAB-F1 = 9001.
ITAB-F2 = 'Record Two'.
ITAB-F3 = 30.
ITAB-F4 = '3000.00'.

COLLECT ITAB.
CLEAR  ITAB.

*--
LOOP AT ITAB.
  WRITE:/ ITAB-F1, ITAB-F2, ITAB-F3, ITAB-F4.
ENDLOOP.

output:

17.  Internal tables:
REPORT  ZR_H107_ASSIGNMENT32 NO STANDARD PAGE HEADING.

DATA:BEGIN OF T1 OCCURS 0,
      V1 TYPE N LENGTH 5,
      V2 TYPE C LENGTH 10,
      V3 TYPE C LENGTH 10,
     END OF T1.

DATA:BEGIN OF T2 OCCURS 0,
      V1 TYPE N LENGTH 5,
      V2 TYPE C LENGTH 10,
      V4 TYPE P LENGTH 10 DECIMALS 2,
     END OF T2.


DATA:BEGIN OF T3 OCCURS 0,
      V1 TYPE N LENGTH 5,
      V2 TYPE C LENGTH 10,
      V3 TYPE C LENGTH 10,
      V4 TYPE P LENGTH 10 DECIMALS 2,
     END OF T3.


T1-V1 = 1.
T1-V2 = 'ARUN'.
T1-V3 = '11-02-1990'.
APPEND T1.
CLEAR T1.


T1-V1 = 2.
T1-V2 = 'VARUN'.
T1-V3 = '24-02-1991'.
APPEND T1.
CLEAR T1.


T1-V1 = 3.
T1-V2 = 'THARUN'.
T1-V3 = '24-02-1995'.
APPEND T1.
CLEAR T1.

T1-V1 = 4.
T1-V2 = 'SIDDU'.
T1-V3 = '08-06-1992'.
APPEND T1.
CLEAR T1.

ULINE AT /1(50).

LOOP AT T1.
WRITE:/1 SY-VLINE,  2(10) T1-V1,
      13 SY-VLINE, 14(10) T1-V2,
      25 SY-VLINE, 26(10) T1-V3,
      37 SY-VLINE,
      50 SY-VLINE.
ENDLOOP.
ULINE AT /1(50).


T2-V1 = 1.
T2-V2 = 'ARUN'.
T2-V4 = '1000'.
APPEND T2.
CLEAR T2.

T2-V1 = 2.
T2-V2 = 'VARUN'.
T2-V4 = '1000.50'.
APPEND T2.
CLEAR T2.


T2-V1 = 3.
T2-V2 = 'THARUN'.
T2-V4 = '1250.780'.
APPEND T2.
CLEAR T2.


T2-V1 = 4.
T2-V2 = 'SIDDU'.
T2-V4 = '3050.780'.
APPEND T2.
CLEAR T2.


LOOP AT T2.
WRITE:/1 SY-VLINE,  2(10) T2-V1,
      13 SY-VLINE, 14(10) T2-V2,
      25 SY-VLINE,
      37 SY-VLINE, 38(10) T2-V4,
      50 SY-VLINE.
ENDLOOP.
ULINE AT /1(50).


LOOP AT T1.
READ TABLE T2 WITH KEY V1 = T1-V1.

MOVE: T1-V1 TO T3-V1,
      T1-V2 TO T3-V2,
      T1-V3 TO T3-V3,
      T2-V4 TO T3-V4.
APPEND T3.

ENDLOOP.


LOOP AT T3.

WRITE:/1 SY-VLINE,  2(10) T3-V1,
      13 SY-VLINE, 14(10) T3-V2,
      25 SY-VLINE, 26(10) T3-V3,
      37 SY-VLINE, 38(10) T3-V4,
      50 SY-VLINE.

ENDLOOP.

ULINE AT /1(50).

output:


18.  Internal tables:
REPORT  ZR_H107_ASSIGNMENT33 NO STANDARD PAGE HEADING.
DATA:BEGIN OF T1 OCCURS 0,
      V1 TYPE N LENGTH 5,
      V2 TYPE C LENGTH 10,
     END OF T1.

DATA:BEGIN OF T2 OCCURS 0,
      V1 TYPE N LENGTH 5,
      V3 TYPE N LENGTH 7,
     END OF T2.


DATA:BEGIN OF T3 OCCURS 0,
      V1 TYPE N LENGTH 5,
      V2 TYPE C LENGTH 10,
      V3 TYPE C LENGTH 7,
     END OF T3.


T1-V1 = 10.
T1-V2 = 'SACHIN'.
APPEND T1.
CLEAR T1.

T1-V1 = 7.
T1-V2 = 'DHONI'.
APPEND T1.
CLEAR T1.

T1-V1 = 44.
T1-V2 = 'SEHWAG'.
APPEND T1.
CLEAR T1.

T1-V1 = 16.
T1-V2 = 'GANGULY'.
APPEND T1.
CLEAR T1.

T1-V1 = 19.
T1-V2 = 'IRFAN'.
APPEND T1.
CLEAR T1.

T2-V1 = 10.
T2-V3 = '4000'.
APPEND T2.
CLEAR T2.

T2-V1 = 7.
T2-V3 = '1000'.
APPEND T2.
CLEAR T2.

T2-V1 = 44.
T2-V3 = '2000'.
APPEND T2.
CLEAR T2.

ULINE AT /1(40).

LOOP AT T1.
WRITE:/1 SY-VLINE,  2(10) T1-V1,
      13 SY-VLINE, 14(10) T1-V2,
      25 SY-VLINE, 40 SY-VLINE.
ENDLOOP.
ULINE AT /1(40).

LOOP AT T2.
WRITE:/1 SY-VLINE,  2(10) T2-V1,
      13 SY-VLINE,
      25 SY-VLINE, 26(10) T2-V3,
      40 SY-VLINE.
ENDLOOP.
ULINE AT /1(40).


LOOP AT T1.
READ TABLE T2 WITH KEY V1 = T1-V1.

MOVE: T1-V1 TO T3-V1,
      T1-V2 TO T3-V2,
      T2-V3 TO T3-V3.

      TRANSLATE T3-V2 TO LOWER CASE.

APPEND T3.
CLEAR T3.

 ENDLOOP.


LOOP AT T3.
WRITE:/1 SY-VLINE,  2(10) T3-V1,
      13 SY-VLINE, 14(10) T3-V2,
      25 SY-VLINE, 26(10) T3-V3,
      40 SY-VLINE.
ENDLOOP.

ULINE AT /1(40).


output:


19.  Control break statements:
REPORT  ZR_H107_CBS.
DATA: BEGIN OF ITAB OCCURS 0,
        F1  TYPE  N  LENGTH  5,
        F2  TYPE  C  LENGTH  20,
        F3  TYPE  I,
        F4  TYPE  P  LENGTH  10  DECIMALS  2,
      END OF ITAB.

ITAB-F1 = 9000.
ITAB-F2 = 'Record One'.
ITAB-F3 = 10.
ITAB-F4 = '500.00'.

APPEND ITAB.
CLEAR  ITAB.

ITAB-F1 = 9000.
ITAB-F2 = 'Record One'.
ITAB-F3 = 20.
ITAB-F4 = '1000.00'.

APPEND ITAB.
CLEAR  ITAB.

ITAB-F1 = 9000.
ITAB-F2 = 'Record One'.
ITAB-F3 = 50.
ITAB-F4 = '5000.00'.

APPEND ITAB.
CLEAR  ITAB.

ITAB-F1 = 9001.
ITAB-F2 = 'Record Two'.
ITAB-F3 = 20.
ITAB-F4 = '2000.00'.

APPEND ITAB.
CLEAR  ITAB.

ITAB-F1 = 9001.
ITAB-F2 = 'Record Two'.
ITAB-F3 = 30.
ITAB-F4 = '3000.00'.

APPEND ITAB.
CLEAR  ITAB.

*--
LOOP AT ITAB.

  AT FIRST.
    SKIP 2.
*    ULINE.
  ENDAT.

  AT NEW F1.
    ULINE.

    WRITE:/ 'New Record for:' COLOR 4, ITAB-F1 COLOR 4.
    ULINE.
  ENDAT.

  WRITE:/ ITAB-F1, ITAB-F2, ITAB-F3, ITAB-F4.

  AT END OF F1.
    ULINE.
    SUM.
    WRITE:/28 ITAB-F3 COLOR 3, ITAB-F4 COLOR 3.
  ENDAT.

  AT LAST.
    ULINE.
    SUM.
    WRITE:/28 ITAB-F3, ITAB-F4.
  ENDAT.

ENDLOOP.

*--
DATA V1 TYPE I.

DESCRIBE TABLE ITAB LINES V1.


WRITE:/ V1.

output:


20.  Control break statements:
REPORT  ZR_H107_ASSIGNMENT30.
DATA:BEGIN OF T1 OCCURS 0,
      V1 TYPE N LENGTH 5,
      V2 TYPE C LENGTH 10,
      V3 TYPE I,
      V4 TYPE P LENGTH 10 DECIMALS 2,
     END OF T1.



T1-V1 = 9000.
T1-V2 = 'RECORD ONE'.
T1-V3 = 99.
T1-V4 = '9.5'.

APPEND T1.
CLEAR T1.

T1-V1 = 9000.
T1-V2 = 'RECORD ONE'.
T1-V3 = 100.
T1-V4 = '10.0'.

APPEND T1.
CLEAR T1.

T1-V1 = 9000.
T1-V2 = 'RECORD ONE'.
T1-V3 = 90.
T1-V4 = '90.0'.

APPEND T1.
CLEAR T1.


T1-V1 = 9000.
T1-V2 = 'RECORD ONE'.
T1-V3 = 92.
T1-V4 = '92.0'.

APPEND T1.
CLEAR T1.

T1-V1 = 9001.
T1-V2 = 'RECORD TWO'.
T1-V3 = 93.
T1-V4 = '9.3'.

APPEND T1.
CLEAR T1.

T1-V1 = 9002.
T1-V2 = 'RECORD TWO'.
T1-V3 = 89.
T1-V4 = '8.9'.

APPEND T1.
CLEAR T1.


T1-V1 = 9002.
T1-V2 = 'RECORD TWO'.
T1-V3 = 82.
T1-V4 = '8.2'.

APPEND T1.
CLEAR T1.


T1-V1 = 9002.
T1-V2 = 'RECORD TWO'.
T1-V3 = 93.
T1-V4 = '9.3'.

APPEND T1.
CLEAR T1.

T1-V1 = 9003.
T1-V2 = 'RECORD THREE'.
T1-V3 = 96.
T1-V4 = '9.6'.

APPEND T1.
CLEAR T1.


T1-V1 = 9003.
T1-V2 = 'RECORD THREE'.
T1-V3 = 98.
T1-V4 = '9.8'.

APPEND T1.
CLEAR T1.


T1-V1 = 9004.
T1-V2 = 'RECORD FOUR'.
T1-V3 = 86.
T1-V4 = '8.6'.

APPEND T1.
CLEAR T1.


T1-V1 = 9005.
T1-V2 = 'RECORD FIVE'.
T1-V3 = 89.
T1-V4 = '8.9'.

APPEND T1.
CLEAR T1.


T1-V1 = 9005.
T1-V2 = 'RECORD FIVE'.
T1-V3 = 86.
T1-V4 = '8.6'.

APPEND T1.
CLEAR T1.


LOOP AT T1.
AT FIRST.
WRITE:/15 'STUDENT MARKS DETAILS'.
ENDAT.

AT NEW V1.
FORMAT COLOR 5.
WRITE:/'MARKS DETAILS FOR:', T1-V1.
ULINE.
FORMAT COLOR OFF.
ENDAT.
WRITE:/1 SY-VLINE,  2(10) T1-V1,
      13 SY-VLINE, 14(10) T1-V2,
      25 SY-VLINE, 26(10) T1-V3,
      37 SY-VLINE, 38(10) T1-V4,
      50 SY-VLINE.

AT END OF V1.
ULINE.
FORMAT COLOR 6.
SUM.
WRITE:25 SY-VLINE, 26(10) T1-V3,
      37 SY-VLINE, 38(10) T1-V4,
      50 SY-VLINE.
FORMAT COLOR OFF.
ENDAT.

AT LAST.
ULINE.
FORMAT COLOR 3.
SUM.
WRITE:25 SY-VLINE, 26(10) T1-V3,
      37 SY-VLINE, 38(10) T1-V4,
      50 SY-VLINE.
FORMAT COLOR OFF.
ENDAT.


ENDLOOP.

output:




21.  Subroutines:

REPORT  ZR_H107_ASSIGNMENTS21.
TABLES ZCLASS_B01.
SELECT * FROM ZCLASS_B01 WHERE GEN = 'M'.
  WRITE:/ SY-DBCNT, ZCLASS_B01-MANDT, ZCLASS_B01-EMPID, ZCLASS_B01-ENAME,
          ZCLASS_B01-DOB, ZCLASS_B01-GEN.

ENDSELECT.


REPORT  ZR_H107_ASSIGNMENTS22.
DATA: BEGIN OF S1 OCCURS 0,
        EMPID  TYPE  N  LENGTH  10,
        ENAME  TYPE  ZCLASS_B01-ENAME,
        DOB    TYPE  ZCLASS_B01-DOB,
      END OF S1.
SELECT EMPID
       ENAME
       DOB INTO S1 FROM ZCLASS_B01.
  APPEND S1
CLEAR  S1.
ENDSELECT.
LOOP AT S1.
  WRITE:/ S1-EMPID, S1-ENAME, S1-DOB.
ENDLOOP.


REPORT  ZR_H107_ASSIGNMENTS23.
TABLES ZCLASS_B01.
SELECT SINGLE * FROM ZCLASS_B01 WHERE GEN = 'F'.
WRITE:/ ZCLASS_B01-EMPID, ZCLASS_B01-ENAME.
ULINE.
SELECT * FROM ZCLASS_B01 UP TO 1 ROWS WHERE GEN = 'F'.
  WRITE:/ ZCLASS_B01-EMPID, ZCLASS_B01-ENAME.
ENDSELECT.
ULINE.
DATA: VAR1 TYPE ZCLASS_B01-EMPID,
      VAR2 TYPE ZCLASS_B01-ENAME.
SELECT SINGLE EMPID
              ENAME INTO (VAR1, VAR2) FROM ZCLASS_B01.
WRITE:/ VAR1, VAR2.


REPORT  ZR_H107_ASSIGNMENTS24.
DATA: BEGIN OF T1 OCCURS 0,
        EMPID  TYPE  ZCLASS_B01-EMPID,
        ENAME  TYPE  ZCLASS_B01-ENAME,
        DOB    TYPE  ZCLASS_B01-DOB,
      END OF T1.
PARAMETERS P_GEN TYPE ZCLASS_B01-GEN.
SELECT EMPID
       ENAME
       DOB INTO TABLE T1
           FROM ZCLASS_B01
           WHERE GEN = P_GEN.
LOOP AT T1.
  WRITE:/ T1-EMPID, T1-ENAME, T1-DOB.
ENDLOOP.




REPORT  ZR_H107_ASSIGNMENTS25.
TYPES: BEGIN OF TY_TAB1,        "
         EMPID  TYPE  ZCLASS_B01-EMPID,
         ENAME  TYPE  ZCLASS_B01-ENAME,
         DOB    TYPE  ZCLASS_B01-DOB,
       END OF TY_TAB1.
TYPES: TY_TAB2 TYPE TABLE OF TY_TAB1.
DATA: T1 TYPE TY_TAB1,
      T2 TYPE TY_TAB2.
DATA: BEGIN OF T3 OCCURS 0,
        EMPID   TYPE  ZCLASS_B02-EMPID,
        SALARY  TYPE  ZCLASS_B02-SALARY,
        CUR     TYPE  ZCLASS_B02-CUR,
      END OF T3.
SELECT-OPTIONS: S_EMPID FOR  T1-EMPID.
SELECT EMPID
       ENAME
       DOB INTO TABLE T2
           FROM ZCLASS_B01
           WHERE EMPID IN S_EMPID.

SELECT EMPID
       SALARY
       CUR INTO TABLE T3
           FROM ZCLASS_B02.
LOOP AT T2 INTO T1.
  READ TABLE T3 WITH KEY EMPID = T1-EMPID.
  WRITE:/ T1-EMPID, T1-ENAME, T1-DOB, T3-SALARY, T3-CUR.
  CLEAR T3.
ENDLOOP.


REPORT  ZR_H107_ASSIGNMENTS26.
DATA: BEGIN OF ITAB OCCURS 0,
         EMPID  TYPE  ZCLASS_B01-EMPID,
         ENAME  TYPE  ZCLASS_B01-ENAME,
         DOB    TYPE  ZCLASS_B01-DOB,
         SALARY TYPE  ZCLASS_B02-SALARY,
         CUR    TYPE  ZCLASS_B02-CUR,
      END OF ITAB.
SELECT ZCLASS_B01~EMPID
       ZCLASS_B01~ENAME
       ZCLASS_B01~DOB
       ZCLASS_B02~SALARY
       ZCLASS_B02~CUR INTO TABLE ITAB
                      FROM ZCLASS_B01 LEFT OUTER JOIN ZCLASS_B02
                        ON ZCLASS_B01~EMPID = ZCLASS_B02~EMPID.
LOOP AT ITAB.
  WRITE:/ ITAB-EMPID, ITAB-ENAME, ITAB-DOB, ITAB-SALARY, ITAB-CUR.
ENDLOOP.



REPORT  ZR_H107_ASSIGNMENTS27.
DATA: BEGIN OF ITAB OCCURS 0,
         EMPID  TYPE  ZCLASS_B01-EMPID,
         ENAME  TYPE  ZCLASS_B01-ENAME,
         DOB    TYPE  ZCLASS_B01-DOB,
      END OF ITAB.
DATA: BEGIN OF ITAB1 OCCURS 0,
        EMPID  TYPE  ZCLASS_B02-EMPID,
        SALARY TYPE  ZCLASS_B02-SALARY,
        CUR    TYPE  ZCLASS_B02-CUR,
      END OF ITAB1.

SELECT-OPTIONS S_EMPID FOR ITAB-EMPID.
SELECT EMPID
       ENAME
       DOB INTO TABLE ITAB
           FROM ZCLASS_B01
           WHERE EMPID IN S_EMPID.

IF NOT ITAB[] IS INITIAL.
  SORT ITAB BY EMPID.
  SELECT EMPID
         SALARY
         CUR INTO TABLE ITAB1
             FROM ZCLASS_B02
             FOR ALL ENTRIES IN ITAB
             WHERE EMPID = ITAB-EMPID.

ENDIF.
LOOP AT ITAB.
  READ TABLE ITAB1 WITH KEY EMPID = ITAB-EMPID.

  IF SY-SUBRC = 0.
    WRITE:/ ITAB-EMPID,
            ITAB-ENAME,
            ITAB-DOB,
            ITAB1-SALARY,
            ITAB1-CUR.
    CLEAR  ITAB1.
  ENDIF.
ENDLOOP.



REPORT  ZR_H107_ASSIGNMENTS28.
DATA ITAB TYPE ZBV01 OCCURS 0 WITH HEADER LINE.
DATA  ZBV01.
SELECT * FROM ZBV01 INTO TABLE ITAB.
LOOP AT ITAB.
  WRITE:/ ITAB-EMPID, ITAB-ENAME, ITAB-SALARY, ITAB-CUR.
ENDLOOP.



REPORT  ZR_H107_ASSIGNMENTS29.
TYPES: A1(10) TYPE C.
TYPES: BEGIN OF B1,
         F1  TYPE  N  LENGTH  5,
         F2  TYPE  A1,
         F3  TYPE  I,
         F4  TYPE  P  LENGTH  10 DECIMALS 2,
       END OF B1.
TYPES: C1 TYPE TABLE OF B1.
DATA: V1  TYPE  A1,
      V2  TYPE  B1,
      V3  TYPE  C1.
DATA: F1  TYPE  ZBS1,
      F2  TYPE  ZBS2,
      F3  TYPE  ZBS3.
DATA: H1  TYPE  ZCLASS_B01,
      H2  TYPE  ZCLASS_B01-EMPID,
      H3  TYPE  ZBV02.
DATA: T1  TYPE  TABLE OF  ZCLASS_B01,
      T2  TYPE  TABLE OF  ZBS2,
      T3  TYPE  TABLE OF  ZBV02.
TABLES: ZCLASS_B01, ZBS2, ZBV02.
PARAMETERS: P1  TYPE  ZBS1,
            P2  TYPE  A1,
            P3  TYPE  NUMC10.



REPORT  ZR_H107_ASSIGNMENTS30.
PARAMETERS P_MATNR TYPE MARD-MATNR.
DATA IT_MARD TYPE MARD OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'ZCLASS_B05' DESTINATION 'ZC810'
  EXPORTING
    F_MATNR = P_MATNR
  TABLES
    F_MARD  = IT_MARD.

LOOP AT IT_MARD.
  WRITE:/ IT_MARD-MANDT, IT_MARD-MATNR, IT_MARD-WERKS, IT_MARD-LGORT, IT_MARD-LABST.
ENDLOOP.



21.  Subroutines:

REPORT  ZR_H107_ASSIGNMENT15 NO STANDARD PAGE HEADING.

DATA: BEGIN OF ITAB OCCURS 0,
        F1(5)  TYPE  N,
        F2(20) TYPE  C,
        F3     TYPE  I,
        F4(10) TYPE  P DECIMALS 2,
      END OF ITAB.


PERFORM ADD_DATA USING '4000' 'Record One' '11' '5000.40'.

PERFORM ADD_DATA USING '4001' 'Record Two' '33' '3300.40'.

PERFORM ADD_DATA USING '4002' 'Record Three' '11' '7700.40'.

PERFORM ADD_DATA USING '4003' 'Record Four' '30' '9900.40'.



LOOP AT ITAB.

WRITE:/ ITAB-F1, ITAB-F2, ITAB-F3, ITAB-F4.

ENDLOOP.

*&---------------------------------------------------------------------*
*&      Form  ADD_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_0034   text
*      -->P_0035   text
*      -->P_0036   text
*      -->P_0037   text
*----------------------------------------------------------------------*
FORM ADD_DATA  USING    VALUE(P_0034)
                        VALUE(P_0035)
                        VALUE(P_0036)
                        VALUE(P_0037).


  ITAB-F1 = P_0034.
  ITAB-F2 = P_0035.
  ITAB-F3 = P_0036.
  ITAB-F4 = P_0037.

  APPEND ITAB.
  CLEAR  ITAB.



ENDFORM.                    " ADD_DATA.

output:


22.  Subroutines:

REPORT  ZR_H107_ASSIGNMENT15 NO STANDARD PAGE HEADING.

REPORT  ZR_H107_ASSIGNMENT16 NO STANDARD PAGE HEADING.

DATA: VAR1  TYPE  I,
      VAR2  TYPE  I,
      VAR3  TYPE  I.

VAR1 = 1000.
VAR2 = 2000.

PERFORM S1.


VAR1 = 1000.
VAR2 = 2000.

PERFORM S2.



VAR1 = 1000.
VAR2 = 2000.

PERFORM S3.


VAR1 = 1000.
VAR2 = 2000.

PERFORM S4.





*&---------------------------------------------------------------------*
*&      Form  S1
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <-- nbsp="" p2="" p="" text="">*----------------------------------------------------------------------*
FORM S1 .

 VAR3 = VAR1 + VAR2.
 WRITE:/ VAR3.

ENDFORM.                    " S1



*&---------------------------------------------------------------------*
*&      Form  S2
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <-- nbsp="" p2="" p="" text="">*----------------------------------------------------------------------*
FORM S2 .

 VAR3 = VAR2 - VAR1.
 WRITE:/ VAR3.

ENDFORM.                    " S2



*&---------------------------------------------------------------------*
*&      Form  S3
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <-- nbsp="" p2="" p="" text="">*----------------------------------------------------------------------*
FORM S3 .

VAR3 = VAR1 * VAR2.
 WRITE:/ VAR3.


ENDFORM.                    " S3



*&---------------------------------------------------------------------*
*&      Form  S4
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <-- nbsp="" p2="" p="" text="">*----------------------------------------------------------------------*
FORM S4 .

VAR3 = VAR2 / VAR1.
 WRITE:/ VAR3.



ENDFORM.                    " S4


output:



23.  Subroutines:

REPORT  ZR_H107_ASSIGNMENT15 NO STANDARD PAGE HEADING.
REPORT  ZR_H107_ASSIGNMENT17 NO STANDARD PAGE HEADING.


PERFORM GET_EKKO USING '3000'.

ULINE.

PERFORM GET_EKKO USING '5000'.
ULINE.
ULINE.

PERFORM GET_EKKO USING '6000'.



*&---------------------------------------------------------------------*
*&      Form  GET_EKKO
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_0010   text
*----------------------------------------------------------------------*
FORM GET_EKKO  USING    VALUE(P_0010).


 DATA IT_EKKO TYPE EKKO OCCURS 0 WITH HEADER LINE.

  SELECT * FROM EKKO INTO TABLE IT_EKKO WHERE BUKRS = P_0010.

  LOOP AT IT_EKKO.
    WRITE:/ IT_EKKO-EBELN, IT_EKKO-BUKRS, IT_EKKO-EKORG, IT_EKKO-LIFNR.
  ENDLOOP.


ENDFORM.                    " GET_EKKO

output:


24.  Subroutines:

REPORT  ZR_H107_ASSIGNMENT15 NO STANDARD PAGE HEADING.
REPORT  ZR_H107_ASSIGNMENT18.

DATA: BEGIN OF IT_EKKO OCCURS 0,
        EBELN  TYPE  EKKO-EBELN,
        BUKRS  TYPE  EKKO-BUKRS,
        EKORG  TYPE  EKKO-EKORG,
        LIFNR  TYPE  EKKO-LIFNR,
      END OF IT_EKKO.

DATA: BEGIN OF IT_EKPO OCCURS 0,
        EBELN  TYPE  EKPO-EBELN,
        EBELP  TYPE  EKPO-EBELP,
        MATNR  TYPE  EKPO-MATNR,
        MENGE  TYPE  EKPO-MENGE,
        NETWR  TYPE  EKPO-NETWR,
      END OF IT_EKPO.

SELECT-OPTIONS S_EBELN FOR IT_EKKO-EBELN.

PERFORM GET_EKKO TABLES S_EBELN
                        IT_EKKO.

IF NOT IT_EKKO[] IS INITIAL.
  SORT IT_EKKO BY EBELN.


 PERFORM GET_EKPO TABLES IT_EKKO
                          IT_EKPO.
ENDIF.


LOOP AT IT_EKPO.

  READ TABLE IT_EKKO WITH KEY EBELN = IT_EKPO-EBELN.

  WRITE:/ IT_EKKO-EBELN,
          IT_EKKO-BUKRS,
          IT_EKKO-EKORG,
          IT_EKKO-LIFNR,
          IT_EKPO-EBELP,
          IT_EKPO-MATNR,
          IT_EKPO-MENGE,
          IT_EKPO-NETWR.
ENDLOOP.




*&---------------------------------------------------------------------*
*&      Form  GET_EKKO
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_S_EBELN  text
*      -->P_IT_EKKO  text
*----------------------------------------------------------------------*
FORM GET_EKKO  TABLES   P_S_EBELN STRUCTURE S_EBELN
                        P_IT_EKKO STRUCTURE IT_EKKO.

     SELECT EBELN
            BUKRS
            EKORG
            LIFNR INTO TABLE P_IT_EKKO
                  FROM EKKO
                  WHERE EBELN IN P_S_EBELN.

ENDFORM.                    " GET_EKKO
*&---------------------------------------------------------------------*
*&      Form  GET_EKPO
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_IT_EKKO  text
*      -->P_IT_EKPO  text
*----------------------------------------------------------------------*
FORM GET_EKPO  TABLES   P_IT_EKKO STRUCTURE IT_EKKO
                        P_IT_EKPO STRUCTURE IT_EKPO.

  SELECT EBELN
         EBELP
         MATNR
         MENGE
         NETWR INTO TABLE P_IT_EKPO
               FROM EKPO
               FOR ALL ENTRIES IN P_IT_EKKO
               WHERE EBELN = P_IT_EKKO-EBELN.


ENDFORM.                    " GET_EKPO


input:

output:


25.  Subroutines:

REPORT  ZR_H107_ASSIGNMENT19.


INCLUDE ZR_H107H__INC.

SELECT-OPTIONS S_EBELN FOR ITAB-EBELN.



PERFORM GET_EKKO IN PROGRAM ZR_H107_ASSIGNMENT18
                 TABLES S_EBELN
                        ITAB.


LOOP AT ITAB.

  WRITE:/ ITAB-EBELN,
          ITAB-BUKRS,
          ITAB-EKORG,
          ITAB-LIFNR.

ENDLOOP.

***********************DATA RETIVAL***********************************


*&---------------------------------------------------------------------*
*&      Form  GET_EKKO
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_S_EBELN  text
*      -->P_IT_EKKO  text
*----------------------------------------------------------------------*
*FORM GET_EKKO  TABLES   P_S_EBELN STRUCTURE S_EBELN
*                        P_IT_EKKO STRUCTURE IT_EKKO.
*
*     SELECT EBELN
*            BUKRS
*            EKORG
*            LIFNR INTO TABLE P_IT_EKKO
*                  FROM EKKO
*                  WHERE EBELN IN P_S_EBELN.
*
*
*
*
*ENDFORM.                    " GET_EKKO


*&---------------------------------------------------------------------*
*&  Include           ZR_H107H__INC
*&---------------------------------------------------------------------*

DATA: BEGIN OF ITAB OCCURS 0,
        EBELN  TYPE  EKKO-EBELN,
        BUKRS  TYPE  EKKO-BUKRS,
        EKORG  TYPE  EKKO-EKORG,
        LIFNR  TYPE  EKKO-LIFNR,
      END OF ITAB.

input:

output:

26.  Subroutines:
REPORT  ZR_H107_ASSIGNMENT20.

INCLUDE ZR_H107_INC.

SELECT-OPTIONS S_EBELN FOR ITAB-EBELN.



PERFORM GET_DATA TABLES S_EBELN
                        ITAB.


LOOP AT ITAB.
  WRITE:/ ITAB-EBELN,
          ITAB-BUKRS,
          ITAB-EKORG,
          ITAB-LIFNR.
ENDLOOP.



INCLUDE ZR_H107_ASSIGNMENT20_GET_DAF01.



*******************************************
***********INCLUDE ZR_H107_INC.************
*******************************************

*DATA: BEGIN OF ITAB OCCURS 0,
*        EBELN  TYPE  EKKO-EBELN,
*        BUKRS  TYPE  EKKO-BUKRS,
*        EKORG  TYPE  EKKO-EKORG,
*        LIFNR  TYPE  EKKO-LIFNR,
*      END OF ITAB.

********************************************
*****PERFORM GET_DATA TABLES S_EBELN********
***************               ITAB.*********
********************************************


* SELECT EBELN
*        BUKRS
*        EKORG
*        LIFNR INTO TABLE P_ITAB
*              FROM EKKO
*              WHERE EBELN IN P_S_EBELN.
*

***********************************************
***INCLUDE ZR_H107_ASSIGNMENT20_GET_DAF01*****
************************************************

input:


output:


27.  Functions:
REPORT  ZR_H107_ASSIGNMENT21 NO STANDARD PAGE HEADING LINE-SIZE 250.

DATA ITAB  LIKE ZHEKKO OCCURS 0 WITH HEADER LINE.

DATA ITAB1 LIKE ZHEKPO OCCURS 0 WITH HEADER LINE.


DATA ITAB2 LIKE ZHT001 OCCURS 0 WITH HEADER LINE.

DATA ITAB3 LIKE ZHT024E OCCURS 0 WITH HEADER LINE.


SELECT-OPTIONS: S_EBELN FOR ITAB-EBELN,
                S_BUKRS FOR ITAB-BUKRS.

    CALL FUNCTION 'ZR_H1071'
      TABLES
        F_EBELN       = S_EBELN
        F_EKKO        = ITAB
        F_EKPO        = ITAB1
        F_T001        = ITAB2
        F_T024E       = ITAB3.

 LOOP AT ITAB.

 READ TABLE ITAB1 WITH KEY EBELN = ITAB-EBELN.
  READ TABLE ITAB2 WITH KEY BUKRS = ITAB-BUKRS.
 READ TABLE ITAB3 WITH KEY EKORG = ITAB-EKORG.



  WRITE:/ ITAB-EBELN,
          ITAB-BUKRS,
          ITAB2-BUTXT,
          ITAB-EKORG,
          ITAB3-EKOTX,
          ITAB-EKGRP,
          ITAB1-EBELP,
          ITAB1-MATNR,
          ITAB1-NETWR.
ENDLOOP.


input:

output:


28.  Functions:
REPORT  ZR_H107_ASSIGNMENT22 NO STANDARD PAGE HEADING LINE-SIZE 300.

DATA ITAB LIKE ZAEKKO OCCURS 0 WITH HEADER LINE.

DATA ITAB1 LIKE ZAEKPO OCCURS 0 WITH HEADER LINE.

DATA ITAB2 LIKE ZAT1 OCCURS 0 WITH HEADER LINE.

DATA ITAB3 LIKE ZAT3 OCCURS 0 WITH HEADER LINE.

DATA ITAB4 LIKE ZAT4 OCCURS 0 WITH HEADER LINE.

DATA ITAB5 LIKE ZAT5 OCCURS 0 WITH HEADER LINE.

DATA ITAB6 LIKE ZAT6 OCCURS 0 WITH HEADER LINE.

SELECT-OPTIONS: S_EBELN FOR ITAB-EBELN,
                S_BUKRS FOR ITAB-BUKRS,
                S_EKORG FOR ITAB-EKORG.

CALL FUNCTION 'ZRA100_EKKO1'
  TABLES
    F_EBELN = S_EBELN
    F_BUKRS = S_BUKRS
    F_EKORG = S_EKORG
    F_EKKO  = ITAB
    F_EKPO  = ITAB1
    F_T001  = ITAB2
    F_T024E = ITAB3
    F_T024  = ITAB4
    F_LFA1  = ITAB5
    F_MAKT  = ITAB6.

LOOP AT ITAB1.

  READ TABLE ITAB WITH KEY EBELN = ITAB1-EBELN.

  READ TABLE ITAB2 WITH KEY BUKRS = ITAB-BUKRS.

  READ TABLE ITAB3 WITH KEY EKORG = ITAB-EKORG.

  READ TABLE ITAB4 WITH KEY EKGRP = ITAB-EKGRP.

  READ TABLE ITAB5 WITH KEY LIFNR = ITAB-LIFNR.

  READ TABLE ITAB6 WITH KEY MATNR = ITAB1-MATNR.



  WRITE:/ ITAB-EBELN,
          ITAB-BUKRS,
          ITAB2-BUTXT,
          ITAB-EKORG,
          ITAB3-EKOTX,
          ITAB-EKGRP,
          ITAB4-EKNAM,
          ITAB-LIFNR,
          ITAB5-NAME1,
          ITAB1-EBELP,
          ITAB1-MATNR,
          ITAB6-MAKTX,
          ITAB1-MENGE,
          ITAB1-NETWR.

ENDLOOP.

input:


output:


29.  Functions:
REPORT  ZR_H107_ASSIGNMENT23 LINE-SIZE 250.

DATA ITAB LIKE ZAAEKPO OCCURS 0 WITH HEADER LINE.

SELECT-OPTIONS: S_EBELN FOR ITAB-EBELN,
                S_BUKRS FOR ITAB-BUKRS,
                S_EKORG FOR ITAB-EKORG.

CALL FUNCTION 'ZRA100_FG06'
  TABLES
    F_EBELN = S_EBELN
    F_BUKRS = S_BUKRS
    F_EKORG = S_EKORG
    O_EKPO  = ITAB.

LOOP AT ITAB.

  WRITE:/ ITAB-EBELN,
          ITAB-BUKRS,
          ITAB-BUTXT,
          ITAB-EKORG,
          ITAB-EKOTX,
          ITAB-EKGRP,
          ITAB-EKNAM,
          ITAB-LIFNR,
          ITAB-NAME1,
          ITAB-EBELN,
          ITAB-MATNR,
          ITAB-MAKTX,
          ITAB-MENGE,
          ITAB-NETWR.

ENDLOOP.

input:

output:


30.  Functions:
REPORT  ZR_H107_ASSIGNMENT24 NO STANDARD PAGE HEADING LINE-SIZE 231.

TYPE-POOLS ZT100.

DATA ITAB TYPE ZT100_EKPO1.

DATA WA TYPE ZT100_EKPO.

DATA TOTAL TYPE P LENGTH 10.


SELECT-OPTIONS: S_EBELN FOR WA-EBELN,
                S_BUKRS FOR WA-BUKRS,
                S_EKORG FOR WA-EKORG.

CALL FUNCTION 'ZRA100_FG08'
  TABLES
    F_EBELN = S_EBELN
    F_BUKRS = S_BUKRS
    F_EKORG = S_EKORG
    I_EKPO  = ITAB.

LOOP AT ITAB INTO WA.

  TOTAL = WA-MENGE * WA-NETWR.

  AT FIRST.

    ULINE.

    FORMAT COLOR 6 INVERSE.

    WRITE:/1 SY-VLINE,   2(10) TEXT-A01,
          13 SY-VLINE,  14(10) TEXT-A02,
          25 SY-VLINE,  26(20) TEXT-A03,
          57 SY-VLINE,  58(10) TEXT-A04,
          69 SY-VLINE,  70(20) TEXT-A05,
          91 SY-VLINE,  92(10) TEXT-A06,
         103 SY-VLINE, 104(20) TEXT-A07,
         125 SY-VLINE, 126(10) TEXT-A08,
         137 SY-VLINE, 138(20) TEXT-A09,
         159 SY-VLINE, 160(10) TEXT-A10,
         171 SY-VLINE, 172(10) TEXT-A11,
         183 SY-VLINE, 184(20) TEXT-A12,
         195 SY-VLINE, 196(10) TEXT-A13,
         207 SY-VLINE, 208(10) TEXT-A14,
         219 SY-VLINE, 220(10) TEXT-A15,
         231 SY-VLINE.

    FORMAT COLOR OFF.

    ULINE.

  ENDAT.

  FORMAT COLOR 5 INVERSE.

  WRITE:/1 SY-VLINE,   2(10) WA-EBELN,
        13 SY-VLINE,  14(10) WA-BUKRS,
        25 SY-VLINE,  26(20) WA-BUTXT,
        57 SY-VLINE,  58(10) WA-EKORG,
        69 SY-VLINE,  70(20) WA-EKOTX,
        91 SY-VLINE,  92(10) WA-EKGRP,
       103 SY-VLINE, 104(20) WA-EKNAM,
       125 SY-VLINE, 126(10) WA-LIFNR,
       137 SY-VLINE, 138(20) WA-NAME1,
       159 SY-VLINE, 160(10) WA-EBELP,
       171 SY-VLINE, 172(10) WA-MATNR,
       183 SY-VLINE, 184(20) WA-MAKTX,
       195 SY-VLINE, 196(10) WA-MENGE,
       207 SY-VLINE, 208(10) WA-NETWR,
       219 SY-VLINE, 220(10) TOTAL NO-ZERO,
       231 SY-VLINE.

  FORMAT COLOR OFF.

ENDLOOP.

ULINE.

input:

output:

31.  Functions:
REPORT  ZR_H107_ASSIGNMENT25 NO STANDARD PAGE HEADING LINE-SIZE 205 MESSAGE-ID ZMSG.

TYPE-POOLS Z100 .

DATA ITAB TYPE Z100_VBAP1.

DATA WA TYPE Z100_VBAP.

DATA TOTAL TYPE P.

SELECT-OPTIONS: S_KUNNR FOR WA-KUNNR.

CALL FUNCTION 'ZRA100_FG09'
  TABLES
    F_KUNNR        = S_KUNNR
    I_VBAP         = ITAB
 EXCEPTIONS
   NO_INPUT       = 1
   NO_DATA        = 2
   OTHERS         = 3.

  IF SY-SUBRC = 1.

  MESSAGE I000 WITH S_KUNNR.

ELSEIF SY-SUBRC = 2.

  MESSAGE E001.

ENDIF.

LOOP AT ITAB INTO WA.

  TOTAL = WA-KWMENG * WA-NETWR.

  AT FIRST.

    ULINE.

    FORMAT COLOR 6 INVERSE.

    WRITE:/1 SY-VLINE,   2(10) TEXT-A01,
          13 SY-VLINE,  14(10) TEXT-A02,
          25 SY-VLINE,  26(20) TEXT-A03,
          47 SY-VLINE,  48(20) TEXT-A04,
          67 SY-VLINE,  68(20) TEXT-A05,
          89 SY-VLINE,  90(10) TEXT-A06,
         101 SY-VLINE, 102(20) TEXT-A07,
         123 SY-VLINE, 124(10) TEXT-A08,
         135 SY-VLINE, 136(10) TEXT-A09,
         147 SY-VLINE, 148(20) TEXT-A10,
         169 SY-VLINE, 170(10) TEXT-A11,
         181 SY-VLINE, 182(10) TEXT-A12,
         193 SY-VLINE, 194(10) TEXT-A14,
         205 SY-VLINE.

    FORMAT COLOR OFF.

    ULINE.

  ENDAT.

  FORMAT COLOR 5 INVERSE.

  WRITE:/1 SY-VLINE,   2(10) WA-VBELN,
        13 SY-VLINE,  14(10) WA-ERDAT,
        25 SY-VLINE,  26(20) WA-ERNAM,
        47 SY-VLINE,  48(20) WA-VKORG,
        67 SY-VLINE,  68(20) WA-VTEXT,
        89 SY-VLINE,  90(10) WA-KUNNR,
       101 SY-VLINE, 102(20) WA-NAME1,
       123 SY-VLINE, 124(10) WA-POSNR,
       135 SY-VLINE, 136(10) WA-MATNR,
       147 SY-VLINE, 148(20) WA-MAKTX,
       169 SY-VLINE, 170(10) WA-KWMENG,
       181 SY-VLINE, 182(10) WA-NETWR,
       193 SY-VLINE, 194(10) TOTAL NO-ZERO,
       205 SY-VLINE.

  FORMAT COLOR OFF.

ENDLOOP.

ULINE.


TYPE-POOL Z100 .

TYPES: BEGIN OF Z100_VBAP,
         VBELN TYPE VBAK-VBELN,
         ERDAT TYPE VBAK-ERDAT,
         ERNAM TYPE VBAK-ERNAM,
         VKORG TYPE VBAK-VKORG,
         VTEXT TYPE TVKOT-VTEXT,
         KUNNR TYPE VBAK-KUNNR,
         NAME1 TYPE KNA1-NAME1,
         POSNR TYPE VBAP-POSNR,
         MATNR TYPE VBAP-MATNR,
         MAKTX TYPE MAKT-MAKTX,
         KWMENG TYPE VBAP-KWMENG,
         NETWR TYPE VBAP-NETWR,
       END OF Z100_VBAP.

TYPES: Z100_VBAP1 TYPE Z100_VBAP OCCURS 0.

input:

output:

35.  Examples:
REPORT  ZR_H107_ASSIGNMENT1 NO STANDARD PAGE HEADING
                                       LINE-SIZE 200.

TYPES:BEGIN OF T_KNA1,
        KUNNR TYPE KNA1-KUNNR,
        NAME1 TYPE KNA1-NAME1,
        ORT01 TYPE KNA1-ORT01,
        PSTLZ TYPE KNA1-PSTLZ,
        STRAS TYPE KNA1-STRAS,
      END OF T_KNA1.

TYPES:BEGIN OF T_KNB1,
        KUNNR TYPE KNB1-KUNNR,
        BUKRS TYPE KNB1-BUKRS,
        ERDAT TYPE KNB1-ERDAT,
        ERNAM TYPE KNB1-ERNAM,
        AKONT TYPE KNB1-AKONT,
      END OF T_KNB1.

TYPES:BEGIN OF T_KNC1,
        KUNNR TYPE KNC1-KUNNR,
        GJAHR TYPE KNC1-GJAHR,
      END OF T_KNC1.

DATA:IT_KNA1 TYPE TABLE OF T_KNA1,
     IT_KNB1 TYPE TABLE OF T_KNB1,
     IT_KNC1 TYPE TABLE OF T_KNC1,
     WA_KNA1 TYPE T_KNA1,
     WA_KNB1 TYPE T_KNB1,
     WA_KNC1 TYPE T_KNC1.

DATA:VAR1 TYPE C LENGTH 20,
     VAR2 TYPE C LENGTH 20,
     CHK.

SELECT-OPTIONS:S_KUNNR FOR WA_KNA1-KUNNR.

SELECT KUNNR
       NAME1
       ORT01
       PSTLZ
       STRAS INTO TABLE IT_KNA1
             FROM KNA1
             WHERE KUNNR IN S_KUNNR.

  IF NOT IT_KNA1[] IS INITIAL.
  SORT IT_KNA1 BY KUNNR.

  SELECT KUNNR
         BUKRS
         ERDAT
         ERNAM
         AKONT INTO TABLE IT_KNB1
               FROM KNB1
               FOR ALL ENTRIES IN IT_KNA1
               WHERE KUNNR = IT_KNA1-KUNNR.

  SELECT KUNNR
         GJAHR INTO TABLE IT_KNC1
               FROM KNC1
               FOR ALL ENTRIES IN IT_KNA1
               WHERE KUNNR = IT_KNA1-KUNNR.
ENDIF.


END-OF-SELECTION.

ULINE AT 1(200).
FORMAT COLOR 1.

WRITE:/1 SY-VLINE,   2(10) 'KUNNR',
      13 SY-VLINE,  14(10) 'NAME1',
      25 SY-VLINE,  26(30) 'ORT01',
      57 SY-VLINE,  58(10) 'PSTLZ',
      69 SY-VLINE,  70(10) 'STRAS',
      81 SY-VLINE,  82(20) 'BUKRS',
     103 SY-VLINE, 104(20) 'VAR2',
     125 SY-VLINE, 126(20) 'ERNAM',
     147 SY-VLINE, 148(15) 'AKONT',
     164 SY-VLINE, 165(10) 'GJAHR',
     200 SY-VLINE.

FORMAT COLOR OFF.
ULINE AT /1(200).


LOOP AT IT_KNC1 INTO WA_KNC1.

  CASE:WA_KNB1-ERDAT+4(2).

    WHEN 1.
      VAR1 = 'JANUARY'.
    WHEN 2.
      VAR2 = 'FEBRUARY'.
    WHEN 3.
      VAR1 = 'MARCH'.
    WHEN 4.
      VAR1 = 'APRIAL'.
    WHEN 5.
      VAR1 = 'MAY'.
    WHEN 6.
      VAR1 = 'JUNE'.
    WHEN 7.
      VAR1 = 'JULY'.
    WHEN 8.
      VAR1 = 'AUGUST'.
    WHEN 9.
      VAR1 = 'SEPTEMBER'.
    WHEN 10.
      VAR1 = 'OCTOBER'.
    WHEN 11.
      VAR1 = 'NOVEMBER'.
    WHEN 12.
      VAR1 = 'DECEMBER'.

  ENDCASE.
  CONCATENATE WA_KNB1-ERDAT+6(2)
              VAR1
              WA_KNB1-ERDAT+0(4) INTO VAR2 SEPARATED BY '-'.

  READ TABLE IT_KNA1 INTO WA_KNA1 WITH KEY KUNNR = WA_KNC1-KUNNR.
  READ TABLE IT_KNB1 INTO WA_KNB1 WITH KEY KUNNR = WA_KNC1-KUNNR.

  WRITE:/1 SY-VLINE,   2(9) WA_KNA1-KUNNR,
        12 SY-VLINE,  14(10) WA_KNA1-NAME1,
        25 SY-VLINE,  26(30) WA_KNA1-ORT01,
        57 SY-VLINE,  58(10) WA_KNA1-PSTLZ,
        69 SY-VLINE,  70(10) WA_KNA1-STRAS,
        81 SY-VLINE,  82(20) WA_KNB1-BUKRS,
       103 SY-VLINE, 104(20) VAR2,
       125 SY-VLINE, 126(20) WA_KNB1-ERNAM,
       147 SY-VLINE, 148(15) WA_KNB1-AKONT,
       164 SY-VLINE, 165(10) WA_KNC1-GJAHR,
       200 SY-VLINE.

ENDLOOP.
ULINE AT /1(200).

input:

output:

36.  Examples:
REPORT  ZR_H107_ASSIGNMENT2 NO STANDARD PAGE HEADING
                                       LINE-SIZE 200.

TYPES:BEGIN OF T_KNA1,
        KUNNR TYPE KNA1-KUNNR,
        NAME1 TYPE KNA1-NAME1,
        ORT01 TYPE KNA1-ORT01,
        PSTLZ TYPE KNA1-PSTLZ,
        STRAS TYPE KNA1-STRAS,
      END OF T_KNA1.

TYPES:BEGIN OF T_KNB1,
        KUNNR TYPE KNB1-KUNNR,
        BUKRS TYPE KNB1-BUKRS,
        ERDAT TYPE KNB1-ERDAT,
        ERNAM TYPE KNB1-ERNAM,
        AKONT TYPE KNB1-AKONT,
      END OF T_KNB1.

TYPES:BEGIN OF T_KNC1,
        KUNNR TYPE KNC1-KUNNR,
        GJAHR TYPE KNC1-GJAHR,
      END OF T_KNC1.

DATA:IT_KNA1 TYPE TABLE OF T_KNA1,
     IT_KNB1 TYPE TABLE OF T_KNB1,
     IT_KNC1 TYPE TABLE OF T_KNC1,
     WA_KNA1 TYPE T_KNA1,
     WA_KNB1 TYPE T_KNB1,
     WA_KNC1 TYPE T_KNC1.

DATA:VAR1 TYPE C LENGTH 20,
     VAR2 TYPE C LENGTH 20.

PARAMETERS P_KUNNR TYPE T_KNA1-KUNNR.

   SELECT KUNNR
          NAME1
          ORT01
          PSTLZ
          STRAS INTO TABLE IT_KNA1
                FROM KNA1
                WHERE KUNNR = P_KUNNR.

IF NOT IT_KNA1[] IS INITIAL.
SORT IT_KNA1 BY KUNNR.

   SELECT KUNNR
          BUKRS
          ERDAT
          ERNAM
          AKONT INTO TABLE IT_KNB1
                FROM KNB1
                FOR ALL ENTRIES IN IT_KNA1
                WHERE KUNNR = IT_KNA1-KUNNR.

   SELECT KUNNR
          GJAHR INTO TABLE IT_KNC1
                FROM KNC1
                FOR ALL ENTRIES IN IT_KNA1
                WHERE KUNNR = IT_KNA1-KUNNR.
ENDIF.

ULINE AT 1(200).
FORMAT COLOR 1.

WRITE:/1 SY-VLINE,   2(10) 'KUNNR',
      12 SY-VLINE,  14(10) 'NAME1',
      25 SY-VLINE,  26(30) 'ORT01',
      57 SY-VLINE,  58(10) 'PSTLZ',
      69 SY-VLINE,  70(10) 'STRAS',
      81 SY-VLINE,  82(20) 'BUKRS',
     103 SY-VLINE, 104(20) 'VAR2',
     125 SY-VLINE, 126(20) 'ERNAM',
     147 SY-VLINE, 148(15) 'AKONT',
     164 SY-VLINE, 165(10) 'GJAHR',
     200 SY-VLINE.

FORMAT COLOR OFF.
ULINE AT /1(200).

LOOP AT IT_KNC1 INTO WA_KNC1.

CASE:WA_KNB1-ERDAT+4(2).

WHEN 1.
VAR1 = 'JANUARY'.
WHEN 2.
VAR2 = 'FEBRUARY'.
WHEN 3.
VAR1 = 'MARCH'.
WHEN 4.
VAR1 = 'APRIAL'.
WHEN 5.
VAR1 = 'MAY'.
WHEN 6.
VAR1 = 'JUNE'.
WHEN 7.
VAR1 = 'JULY'.
WHEN 8.
VAR1 = 'AUGUST'.
WHEN 9.
VAR1 = 'SEPTEMBER'.
WHEN 10.
VAR1 = 'OCTOBER'.
WHEN 11.
VAR1 = 'NOVEMBER'.
WHEN 12.
VAR1 = 'DECEMBER'.

ENDCASE.
CONCATENATE WA_KNB1-ERDAT+6(2)
            VAR1
            WA_KNB1-ERDAT+0(4) INTO VAR2 SEPARATED BY '-'.

READ TABLE IT_KNA1 INTO WA_KNA1 WITH KEY KUNNR = WA_KNC1-KUNNR.
READ TABLE IT_KNB1 INTO WA_KNB1 WITH KEY KUNNR = WA_KNC1-KUNNR.

WRITE:/1 SY-VLINE,   2(10) WA_KNA1-KUNNR,
      12 SY-VLINE,  14(10) WA_KNA1-NAME1,
      25 SY-VLINE,  26(30) WA_KNA1-ORT01,
      57 SY-VLINE,  58(10) WA_KNA1-PSTLZ,
      69 SY-VLINE,  70(10) WA_KNA1-STRAS,
      81 SY-VLINE,  82(20) WA_KNB1-BUKRS,
     103 SY-VLINE, 104(20) VAR2,
     125 SY-VLINE, 126(20) WA_KNB1-ERNAM,
     147 SY-VLINE, 148(15) WA_KNB1-AKONT,
     164 SY-VLINE, 165(10) WA_KNC1-GJAHR,
     200 SY-VLINE.

ENDLOOP.
ULINE AT /1(200).

input:



output:


37.  Examples:
REPORT  ZR_H107_ASSIGNMENT3 NO STANDARD PAGE HEADING
                                      LINE-SIZE 170.

TYPES:BEGIN OF T_KNB1,
        KUNNR TYPE KNB1-KUNNR,
        BUKRS TYPE KNB1-BUKRS,
        ERDAT TYPE KNB1-ERDAT,
        ERNAM TYPE KNB1-ERNAM,
        AKONT TYPE KNB1-AKONT,
      END OF T_KNB1.

TYPES:BEGIN OF T_KNA1,
        KUNNR TYPE KNA1-KUNNR,
        NAME1 TYPE KNA1-NAME1,
        ORT01 TYPE KNA1-ORT01,
        PSTLZ TYPE KNA1-PSTLZ,
        STRAS TYPE KNA1-STRAS,
      END OF T_KNA1.

TYPES:BEGIN OF T_KNC1,
        KUNNR TYPE KNC1-KUNNR,
        GJAHR TYPE KNC1-GJAHR,
      END OF T_KNC1.

DATA:IT_KNA1 TYPE TABLE OF T_KNA1,
     IT_KNB1 TYPE TABLE OF T_KNB1,
     IT_KNC1 TYPE TABLE OF T_KNC1,
     WA_KNA1 TYPE T_KNA1,
     WA_KNB1 TYPE T_KNB1,
     WA_KNC1 TYPE T_KNC1.

DATA:VAR1 TYPE C LENGTH 20,
     VAR2 TYPE C LENGTH 20.

SELECT-OPTIONS:S_KUNNR FOR WA_KNb1-KUNNR,
               S_BUKRS FOR WA_KNB1-BUKRS.

  SELECT  KUNNR
          BUKRS
          ERDAT
          ERNAM
          AKONT INTO TABLE IT_KNB1
                FROM KNB1
                WHERE KUNNR IN S_KUNNR
                AND BUKRS IN S_BUKRS.

IF NOT IT_KNB1[] IS INITIAL.
SORT IT_KNB1 BY KUNNR.

   SELECT KUNNR
          NAME1
          ORT01
          PSTLZ
          STRAS INTO TABLE IT_KNA1
                FROM KNA1
                 FOR ALL ENTRIES IN IT_KNB1
                WHERE KUNNR = IT_KNB1-KUNNR.

   SELECT KUNNR
          GJAHR INTO TABLE IT_KNC1
                FROM KNC1
                FOR ALL ENTRIES IN IT_KNB1
                WHERE KUNNR = IT_KNB1-KUNNR.
ENDIF.

ULINE AT 1(170).
FORMAT COLOR 1.

WRITE:/1 SY-VLINE,   2(10) 'KUNNR',
      12 SY-VLINE,  14(10) 'NAME1',
      25 SY-VLINE,  26(30) 'ORT01',
      57 SY-VLINE,  58(10) 'PSTLZ',
      69 SY-VLINE,  70(10) 'STRAS',
      81 SY-VLINE,  82(20) 'BUKRS',
     103 SY-VLINE, 104(20) 'VAR2',
     125 SY-VLINE, 126(20) 'ERNAM',
     147 SY-VLINE, 148(8)  'AKONT',
     157 SY-VLINE, 158(10) 'GJAHR',
     170 SY-VLINE.

FORMAT COLOR OFF.
ULINE AT /1(170).


LOOP AT IT_KNc1 INTO WA_KNc1.

CASE:WA_KNB1-ERDAT+4(2).

WHEN 1.
VAR1 = 'JANUARY'.
WHEN 2.
VAR1 = 'FEBRUARY'.
WHEN 3.
VAR1 = 'MARCH'.
WHEN 4.
VAR1 = 'APRIAL'.
WHEN 5.
VAR1 = 'MAY'.
WHEN 6.
VAR1 = 'JUNE'.
WHEN 7.
VAR1 = 'JULY'.
WHEN 8.
VAR1 = 'AUGUST'.
WHEN 9.
VAR1 = 'SEPTEMBER'.
WHEN 10.
VAR1 = 'OCTOBER'.
WHEN 11.
VAR1 = 'NOVEMBER'.
WHEN 12.
VAR1 = 'DECEMBER'.

ENDCASE.
CONCATENATE WA_KNB1-ERDAT+6(2)
            VAR1
            WA_KNB1-ERDAT+0(4) INTO VAR2 SEPARATED BY '-'.

READ TABLE IT_KNa1 INTO WA_KNa1 WITH KEY KUNNR = WA_KNc1-KUNNR.
READ TABLE IT_KNb1 INTO WA_KNb1 WITH KEY KUNNR = WA_KNc1-KUNNR.

WRITE:/1 SY-VLINE,   2(10) WA_KNA1-KUNNR,
      12 SY-VLINE,  14(10) WA_KNA1-NAME1,
      25 SY-VLINE,  26(30) WA_KNA1-ORT01,
      57 SY-VLINE,  58(10) WA_KNA1-PSTLZ,
      69 SY-VLINE,  70(10) WA_KNA1-STRAS,
      81 SY-VLINE,  82(20) WA_KNB1-BUKRS,
     103 SY-VLINE, 104(20) VAR2,
     125 SY-VLINE, 126(20) WA_KNB1-ERNAM,
     147 SY-VLINE, 148(8) WA_KNB1-AKONT,
     157 SY-VLINE, 158(10) WA_KNC1-GJAHR,
     170 SY-VLINE.

ENDLOOP.
ULINE AT /1(170).


input:


output:

38.  Examples:
REPORT  ZR_H107_ASSIGNMENT4 NO STANDARD PAGE HEADING
                                      LINE-SIZE 180.

TYPES:BEGIN OF T_KNB1,
        KUNNR TYPE KNB1-KUNNR,
        BUKRS TYPE KNB1-BUKRS,
        ERDAT TYPE KNB1-ERDAT,
        ERNAM TYPE KNB1-ERNAM,
        AKONT TYPE KNB1-AKONT,
      END OF T_KNB1.

TYPES:BEGIN OF T_KNA1,
        KUNNR TYPE KNA1-KUNNR,
        NAME1 TYPE KNA1-NAME1,
        ORT01 TYPE KNA1-ORT01,
        PSTLZ TYPE KNA1-PSTLZ,
        STRAS TYPE KNA1-STRAS,
      END OF T_KNA1.

TYPES:BEGIN OF T_KNC1,
        KUNNR TYPE KNC1-KUNNR,
        GJAHR TYPE KNC1-GJAHR,
      END OF T_KNC1.

DATA:IT_KNA1 TYPE TABLE OF T_KNA1,
     IT_KNB1 TYPE TABLE OF T_KNB1,
     IT_KNC1 TYPE TABLE OF T_KNC1,
     WA_KNA1 TYPE T_KNA1,
     WA_KNB1 TYPE T_KNB1,
     WA_KNC1 TYPE T_KNC1.

DATA:VAR1(20)  TYPE C,
     ERDAT(20) TYPE C.

DATA:DD LIKE  T247-MNR,
     LT LIKE  T247-LTX.

SELECT-OPTIONS:S_KUNNR FOR WA_KNA1-KUNNR.

 SELECT  KUNNR
          BUKRS
          ERDAT
          ERNAM
          AKONT INTO TABLE IT_KNB1
                FROM KNB1
                WHERE KUNNR IN S_KUNNR.

IF NOT IT_KNB1[] IS INITIAL.
SORT IT_KNB1 BY KUNNR.

 SELECT   KUNNR
          NAME1
          ORT01
          PSTLZ
          STRAS INTO TABLE IT_KNA1
                FROM KNA1
                FOR ALL ENTRIES IN IT_KNB1
                WHERE KUNNR = IT_KNB1-KUNNR.

 SELECT   KUNNR
          GJAHR INTO TABLE IT_KNC1
                FROM KNC1
                FOR ALL ENTRIES IN IT_KNB1
                WHERE KUNNR = IT_KNB1-KUNNR.
ENDIF.

ULINE AT 1(180).
FORMAT COLOR 1.

WRITE:/1 SY-VLINE,   2(10) 'KUNNR',
      12 SY-VLINE,  14(10) 'NAME1',
      25 SY-VLINE,  26(30) 'ORT01',
      57 SY-VLINE,  58(10) 'PSTLZ',
      69 SY-VLINE,  70(10) 'STRAS',
      81 SY-VLINE,  82(20) 'BUKRS',
     103 SY-VLINE, 104(20) 'ERDAT',
     125 SY-VLINE, 126(20) 'ERNAM',
     147 SY-VLINE, 148(15) 'AKONT',
     164 SY-VLINE, 165(10) 'GJAHR',
     180 SY-VLINE.

FORMAT COLOR OFF.
ULINE AT /1(180).

LOOP AT IT_KNB1 INTO WA_KNB1.

READ TABLE IT_KNA1 INTO WA_KNA1 WITH KEY KUNNR = WA_KNB1-KUNNR.
READ TABLE IT_KNC1 INTO WA_KNC1 WITH KEY KUNNR = WA_KNB1-KUNNR.

        DD  = WA_KNB1-ERDAT+4(2).


       CALL FUNCTION 'ISP_GET_MONTH_NAME'
         EXPORTING
          DATE               = '00000000'
           MONTH_NUMBER       = DD
           LANGUAGE           = SY-LANGU
        IMPORTING
*          LANGU_BACK         =
          LONGTEXT           = LT
*          SHORTTEXT          =
*        EXCEPTIONS
*          CALENDAR_ID        = 1
*          DATE_ERROR         = 2
*          NOT_FOUND          = 3
*          WRONG_INPUT        = 4
*          OTHERS             = 5
                 .
       IF SY-SUBRC <> 0.
* Implement suitable error handling here
       ENDIF.


      CONCATENATE WA_KNB1-ERDAT+6(2)
       LT
       WA_KNB1-ERDAT+0(4) INTO ERDAT SEPARATED BY '-'.

WRITE:/1 SY-VLINE,   2(10) WA_KNA1-KUNNR,
      12 SY-VLINE,  14(10) WA_KNA1-NAME1,
      25 SY-VLINE,  26(30) WA_KNA1-ORT01,
      57 SY-VLINE,  58(10) WA_KNA1-PSTLZ,
      69 SY-VLINE,  70(10) WA_KNA1-STRAS,
      81 SY-VLINE,  82(20) WA_KNB1-BUKRS,
     103 SY-VLINE, 104(20) ERDAT,
     125 SY-VLINE, 126(20) WA_KNB1-ERNAM,
     147 SY-VLINE, 148(15) WA_KNB1-AKONT,
     164 SY-VLINE, 165(10) WA_KNC1-GJAHR,
     180 SY-VLINE.

ENDLOOP.
ULINE AT /1(180).


input:


output:


39.  Examples:
REPORT  ZR_H107_ASSIGNMENT5 NO STANDARD PAGE HEADING
                                       LINE-SIZE 250.

TYPES: BEGIN OF T_VBAK,
       VBELN TYPE VBAK-VBELN,
       ERDAT TYPE VBAK-ERDAT,
       VKORG TYPE VBAK-VKORG,
       KUNNR TYPE VBAK-KUNNR,
       END OF T_VBAK.

TYPES:BEGIN OF T_VBAP,
      VBELN  TYPE VBAP-VBELN,
      POSNR  TYPE VBAP-POSNR,
      MATNR  TYPE VBAP-MATNR,
      KWMENG TYPE VBAP-KWMENG,
      NETWR  TYPE VBAP-NETWR,
     END OF T_VBAP.

DATA:IT_VBAK TYPE TABLE OF T_VBAK,
     IT_VBAP TYPE TABLE OF T_VBAP,
     WA_VBAK TYPE T_VBAK,
     WA_VBAP TYPE T_VBAP.

DATA: TOTAL TYPE C LENGTH 20,
      G_FLG.

SELECT-OPTIONS: S_VBELN FOR WA_VBAK-VBELN,
                S_ERDAT FOR WA_VBAK-ERDAT,
                S_KUNNR FOR WA_VBAK-KUNNR.

SELECT VBELN
      ERDAT
      VKORG
      KUNNR INTO TABLE IT_VBAK FROM VBAK
      WHERE VBELN IN S_VBELN
      AND ERDAT IN S_ERDAT
      AND KUNNR IN S_KUNNR.

IF NOT IT_VBAK[] IS INITIAL.
  SORT IT_VBAK BY VBELN.

  SELECT VBELN
         POSNR
         MATNR
         KWMENG
         NETWR INTO TABLE IT_VBAP FROM VBAP
         FOR ALL ENTRIES IN IT_VBAK
         WHERE VBELN = IT_VBAK-VBELN.

ENDIF.

ULINE AT 1(130).
FORMAT COLOR 1.

WRITE:/1 SY-VLINE,   2(10) 'vbeln',
      12 SY-VLINE,  13(10) 'erdat',
      24 SY-VLINE,  25(15) 'vkorg',
      41 SY-VLINE,  42(10) 'kunnr',
      53 SY-VLINE,  54(10) 'posnr',
      65 SY-VLINE,  66(10) 'matnr',
      77 SY-VLINE,  78(10) 'kwmeng',
      89 SY-VLINE,  90(10) 'netwr',
     101 SY-VLINE, 102(20) 'total' NO-ZERO,
      30 SY-VLINE.


FORMAT COLOR OFF.
ULINE AT /1(130).

LOOP AT IT_VBAP INTO WA_VBAP.

TOTAL = WA_VBAP-NETWR * WA_VBAP-KWMENG.

 READ TABLE IT_VBAK INTO WA_VBAK WITH KEY VBELN = WA_VBAP-VBELN.

  IF G_FLG IS INITIAL.
    FORMAT COLOR 2 INTENSIFIED OFF.
    G_FLG = 'X'.
  ELSE.
    FORMAT COLOR 2 INTENSIFIED ON.
    CLEAR G_FLG.
  ENDIF.

  WRITE:/1 SY-VLINE,   2(10) WA_VBAK-VBELN,
        12 SY-VLINE,  13(10) WA_VBAK-ERDAT,
        24 SY-VLINE,  25(15) WA_VBAK-VKORG,
        41 SY-VLINE,  42(10) WA_VBAK-KUNNR,
        53 SY-VLINE,  54(10) WA_VBAP-POSNR,
        65 SY-VLINE,  66(10) WA_VBAP-MATNR,
        77 SY-VLINE,  78(10) WA_VBAP-KWMENG,
        89 SY-VLINE,  90(10) WA_VBAP-NETWR,
       101 SY-VLINE, 102(20) TOTAL NO-ZERO,
       130 SY-VLINE.

  AT END OF MATNR.
    ULINE AT /1(130).

    SUM.
    WRITE:/77 SY-VLINE, 78(10)  WA_VBAP-KWMENG,
           89 SY-VLINE, 90(10)  WA_VBAP-NETWR,
          101 SY-VLINE, 102(20)  TOTAL NO-ZERO,
          130 SY-VLINE.

    ULINE AT /1(130).

    AT LAST.
      ULINE AT /1(130).
      SUM.
      TOTAL = WA_VBAP-NETWR * WA_VBAP-KWMENG.

      WRITE:/77 SY-VLINE,  78(10)  WA_VBAP-KWMENG,
             89 SY-VLINE,  90(10)  WA_VBAP-NETWR,
            101 SY-VLINE, 102(20)  TOTAL NO-ZERO,
            130 SY-VLINE.

    ENDAT.
  ENDAT.
ENDLOOP.
ULINE AT /1(130).

input:


output:







40.  Examples:
REPORT  ZR_H107_ASSIGNMENT6 NO STANDARD PAGE HEADING
                                       LINE-SIZE 175.

TYPES:BEGIN OF T_EKKO,
       EBELN TYPE EKKO-EBELN,
       BUKRS TYPE EKKO-BSART,
       BSART TYPE EKKO-BSART,
       AEDAT TYPE EKKO-AEDAT,
       EKORG TYPE EKKO-EKORG,
       EKGRP TYPE EKKO-EKGRP,
      END OF T_EKKO.

TYPES:BEGIN OF T_EKPO,
        EBELN TYPE EKPO-EBELN,
        EBELP TYPE EKPO-EBELP,
        MATNR TYPE EKPO-MATNR,
        WERKS TYPE EKPO-WERKS,
        LGORT TYPE EKPO-LGORT,
        MATKL TYPE EKPO-MATKL,
        MENGE TYPE EKPO-MENGE,
        NETWR TYPE EKPO-NETWR,
      END OF T_EKPO.

DATA:IT_EKKO TYPE TABLE OF T_EKKO,
     IT_EKPO TYPE TABLE OF T_EKPO,
     WA_EKKO TYPE T_EKKO,
     WA_EKPO TYPE T_EKPO.

 SELECT-OPTIONS:S_EBELN FOR WA_EKKO-EBELN,
                S_BUKRS FOR WA_EKKO-BUKRS.

   SELECT EBELN
          BUKRS
          BSART
          AEDAT
          EKORG
          EKGRP INTO TABLE IT_EKKO
                FROM EKKO
                WHERE EBELN IN S_EBELN
                AND BUKRS IN S_BUKRS.

IF NOT IT_EKKO[] IS INITIAL.
SORT IT_EKKO BY EBELN.

   SELECT EBELN
          EBELP
          MATNR
          WERKS
          LGORT
          MATKL
          MENGE
          NETWR INTO TABLE IT_EKPO
                FROM EKPO
                FOR ALL ENTRIES IN IT_EKKO
                WHERE EBELN = IT_EKKO-EBELN.

ENDIF.
ULINE AT 1(175).
FORMAT COLOR 1.

 WRITE:/1 SY-VLINE,   2(10) 'EBELN',
       12 SY-VLINE,  13(10) 'BUKRS',
       24 SY-VLINE,  25(15) 'BSART',
       41 SY-VLINE,  42(10) 'AEDAT',
       53 SY-VLINE,  54(10) 'EKORG',
       65 SY-VLINE,  66(10) 'EKGRP',
       77 SY-VLINE,  78(10) 'EBLP',
       89 SY-VLINE,  90(10) 'MATNR',
      101 SY-VLINE, 102(20) 'WERKS',
      123 SY-VLINE, 124(10) 'LGORT',
      135 SY-VLINE, 136(10) 'MATKL',
      147 SY-VLINE, 148(10) 'MENGE',
      159 SY-VLINE, 160(10) 'NETWR',
      175 SY-VLINE.

FORMAT COLOR OFF.
ULINE AT /1(175).

LOOP AT IT_EKKO INTO WA_EKKO.

  READ TABLE IT_EKPO INTO WA_EKPO WITH KEY EBELN = WA_EKKO-EBELN.

 WRITE:/1 SY-VLINE,   2(10) WA_EKKO-EBELN,
       12 SY-VLINE,  13(10) WA_EKKO-BUKRS,
       24 SY-VLINE,  25(15) WA_EKKO-BSART,
       41 SY-VLINE,  42(10) WA_EKKO-AEDAT,
       53 SY-VLINE,  54(10) WA_EKKO-EKORG,
       65 SY-VLINE,  66(10) WA_EKKO-EKGRP,
       77 SY-VLINE,  78(10) WA_EKPO-EBELP,
       89 SY-VLINE,  90(10) WA_EKPO-MATNR,
      101 SY-VLINE, 102(20) WA_EKPO-WERKS,
      123 SY-VLINE, 124(10) WA_EKPO-LGORT,
      135 SY-VLINE, 136(10) WA_EKPO-MATKL,
      147 SY-VLINE, 148(10) WA_EKPO-MENGE,
      159 SY-VLINE, 160(10) WA_EKPO-NETWR,
      175 SY-VLINE.

    ENDLOOP.
    ULINE AT /1(175).

input:



output:






41.  Examples:
REPORT  ZR_H107_ASSIGNMENT7 NO STANDARD PAGE HEADING
                                      LINE-SIZE 175.

TYPES:BEGIN OF T_EKKO,
       EBELN TYPE EKKO-EBELN,
       BUKRS TYPE EKKO-BSART,
       BSART TYPE EKKO-BSART,
       AEDAT TYPE EKKO-AEDAT,
       EKORG TYPE EKKO-EKORG,
       EKGRP TYPE EKKO-EKGRP,
      END OF T_EKKO.

TYPES:BEGIN OF T_EKPO,
        EBELN TYPE EKPO-EBELN,
        EBELP TYPE EKPO-EBELP,
        MATNR TYPE EKPO-MATNR,
        WERKS TYPE EKPO-WERKS,
        LGORT TYPE EKPO-LGORT,
        MATKL TYPE EKPO-MATKL,
        MENGE TYPE EKPO-MENGE,
        NETWR TYPE EKPO-NETWR,
      END OF T_EKPO.

DATA:IT_EKKO TYPE TABLE OF T_EKKO,
     IT_EKPO TYPE TABLE OF T_EKPO,
     WA_EKKO TYPE T_EKKO,
     WA_EKPO TYPE T_EKPO.

 SELECT-OPTIONS:S_EBELN FOR WA_EKKO-EBELN,
                S_BUKRS FOR WA_EKKO-BUKRS.

   SELECT EBELN
          BUKRS
          BSART
          AEDAT
          EKORG
          EKGRP INTO TABLE IT_EKKO
                FROM EKKO
                WHERE EBELN IN S_EBELN
                AND BUKRS IN S_BUKRS.

IF NOT IT_EKKO[] IS INITIAL.
SORT IT_EKKO BY EBELN.

   SELECT EBELN
          EBELP
          MATNR
          WERKS
          LGORT
          MATKL
          MENGE
          NETWR INTO TABLE IT_EKPO
                FROM EKPO
                FOR ALL ENTRIES IN IT_EKKO
                WHERE EBELN = IT_EKKO-EBELN.

ENDIF.
ULINE AT 1(175).
FORMAT COLOR 6 INVERSE.

 WRITE:/1 SY-VLINE,   2(10) 'EBELN',
       12 SY-VLINE,  13(10) 'BUKRS',
       24 SY-VLINE,  25(15) 'BSART',
       41 SY-VLINE,  42(10) 'AEDAT',
       53 SY-VLINE,  54(10) 'EKORG',
       65 SY-VLINE,  66(10) 'EKGRP',
       77 SY-VLINE,  78(10) 'EBLP',
       89 SY-VLINE,  90(10) 'MATNR',
      101 SY-VLINE, 102(20) 'WERKS',
      123 SY-VLINE, 124(10) 'LGORT',
      135 SY-VLINE, 136(10) 'MATKL',
      147 SY-VLINE, 148(10) 'MENGE',
      159 SY-VLINE, 160(10) 'NETWR',
      175 SY-VLINE.

FORMAT COLOR OFF.
ULINE AT /1(175).

LOOP AT IT_EKKO INTO WA_EKKO.

  READ TABLE IT_EKPO INTO WA_EKPO WITH KEY EBELN = WA_EKKO-EBELN.

    FORMAT COLOR 5 INVERSE.

 WRITE:/1 SY-VLINE,   2(10) WA_EKKO-EBELN,
       12 SY-VLINE,  13(10) WA_EKKO-BUKRS,
       24 SY-VLINE,  25(15) WA_EKKO-BSART,
       41 SY-VLINE,  42(10) WA_EKKO-AEDAT,
       53 SY-VLINE,  54(10) WA_EKKO-EKORG,
       65 SY-VLINE,  66(10) WA_EKKO-EKGRP,
       77 SY-VLINE,  78(10) WA_EKPO-EBELP,
       89 SY-VLINE,  90(10) WA_EKPO-MATNR,
      101 SY-VLINE, 102(20) WA_EKPO-WERKS,
      123 SY-VLINE, 124(10) WA_EKPO-LGORT,
      135 SY-VLINE, 136(10) WA_EKPO-MATKL,
      147 SY-VLINE, 148(10) WA_EKPO-MENGE,
      159 SY-VLINE, 160(10) WA_EKPO-NETWR,
      175 SY-VLINE.

FORMAT COLOR OFF.
ENDLOOP.
ULINE AT /1(175).

input:


output:





42.  Examples:
REPORT  ZR_H107_ASSIGNMENT8 NO STANDARD PAGE HEADING LINE-SIZE 190.

TYPES:BEGIN OF T_EKKO,
       EBELN TYPE EKKO-EBELN,
       BUKRS TYPE EKKO-BSART,
       BSART TYPE EKKO-BSART,
       AEDAT TYPE EKKO-AEDAT,
       EKORG TYPE EKKO-EKORG,
       EKGRP TYPE EKKO-EKGRP,
      END OF T_EKKO.

TYPES:BEGIN OF T_EKPO,
        EBELN TYPE EKPO-EBELN,
        EBELP TYPE EKPO-EBELP,
        MATNR TYPE EKPO-MATNR,
        WERKS TYPE EKPO-WERKS,
        LGORT TYPE EKPO-LGORT,
        MATKL TYPE EKPO-MATKL,
        MENGE TYPE EKPO-MENGE,
        NETWR TYPE EKPO-NETWR,
      END OF T_EKPO.

DATA:IT_EKKO TYPE TABLE OF T_EKKO,
     IT_EKPO TYPE TABLE OF T_EKPO,
     WA_EKKO TYPE T_EKKO,
     WA_EKPO TYPE T_EKPO.

DATA: TOTAL TYPE C LENGTH 20,
      TOTAL1 TYPE C LENGTH 20,
      G_FLAG TYPE C.

SELECT-OPTIONS:S_EBELN FOR WA_EKKO-EBELN,
               S_BUKRS FOR WA_EKKO-BUKRS.

SELECT EBELN
       BUKRS
       BSART
       AEDAT
       EKORG
       EKGRP INTO TABLE IT_EKKO
             FROM EKKO
             WHERE EBELN IN S_EBELN
               AND BUKRS IN S_BUKRS.

IF NOT IT_EKKO[] IS INITIAL.
  SORT IT_EKKO BY EBELN.

  SELECT EBELN
         EBELP
         MATNR
         WERKS
         LGORT
         MATKL
         MENGE
         NETWR INTO TABLE IT_EKPO
               FROM EKPO
               FOR ALL ENTRIES IN IT_EKKO
               WHERE EBELN = IT_EKKO-EBELN.

ENDIF.
ULINE AT 1(190).
FORMAT COLOR 1.

WRITE:/1 SY-VLINE,   2(10) 'EBELN',
      12 SY-VLINE,  13(10) 'BUKRS',
      24 SY-VLINE,  25(15) 'BSART',
      41 SY-VLINE,  42(10) 'AEDAT',
      53 SY-VLINE,  54(10) 'EKORG',
      65 SY-VLINE,  66(10) 'EKGRP',
      77 SY-VLINE,  78(10) 'EBLP',
      89 SY-VLINE,  90(10) 'MATKL',
     101 SY-VLINE, 102(20) 'WERKS',
     123 SY-VLINE, 124(10) 'LGORT',
     135 SY-VLINE, 136(10) 'MATNR',
     147 SY-VLINE, 148(10) 'MENGE',
     159 SY-VLINE, 160(10) 'NETWR',
     171 SY-VLINE, 172(15) 'TOTAL',
     190 SY-VLINE.

FORMAT COLOR OFF.
ULINE AT /1(190).

LOOP AT IT_EKPO INTO WA_EKPO.


  READ TABLE IT_EKKO INTO WA_EKKO WITH KEY EBELN = WA_EKPO-EBELN.

  IF G_FLAG IS INITIAL.
    FORMAT COLOR 2 INTENSIFIED OFF.
    G_FLAG = 'X'.
  ELSE.
    FORMAT COLOR 2 INTENSIFIED ON.
    CLEAR G_FLAG.
  ENDIF.
  TOTAL = WA_EKPO-NETWR * WA_EKPO-MENGE.

  WRITE:/1 SY-VLINE,   2(10) WA_EKKO-EBELN,
        12 SY-VLINE,  13(10) WA_EKKO-BUKRS,
        24 SY-VLINE,  25(15) WA_EKKO-BSART,
        41 SY-VLINE,  42(10) WA_EKKO-AEDAT,
        53 SY-VLINE,  54(10) WA_EKKO-EKORG,
        65 SY-VLINE,  66(10) WA_EKKO-EKGRP,
        77 SY-VLINE,  78(10) WA_EKPO-EBELP,
        89 SY-VLINE,  90(10) WA_EKPO-MATKL,
       101 SY-VLINE, 102(20) WA_EKPO-WERKS,
       123 SY-VLINE, 124(10) WA_EKPO-LGORT,
       135 SY-VLINE, 136(10) WA_EKPO-MATNR,
       147 SY-VLINE, 148(10) WA_EKPO-MENGE,
       159 SY-VLINE, 160(10) WA_EKPO-NETWR,
       171 SY-VLINE, 172(15) TOTAL,
       190 SY-VLINE.



  AT END OF MATNR.
    ULINE AT /1(190).

    SUM.
    WRITE:/147 SY-VLINE, 148(10)  WA_EKPO-MENGE,
           159 SY-VLINE, 160(10)  WA_EKPO-NETWR,
           171 SY-VLINE, 172(20)  TOTAL NO-ZERO,
           190 SY-VLINE.

  ENDAT.
  IF NOT WA_EKPO-MENGE IS INITIAL AND WA_EKPO-NETWR IS INITIAL.
    AT LAST.
      ULINE AT /1(190).
      SUM.
*    TOTAL = TOTAL  + TOTAL1."WA_EKPO-NETWR * WA_EKPO-MENGE.

      WRITE:/147 SY-VLINE, 148(10)  WA_EKPO-MENGE,
             159 SY-VLINE, 160(10)  WA_EKPO-NETWR,
             171 SY-VLINE, 172(20)  TOTAL NO-ZERO,
             190 SY-VLINE.

    ENDAT.
  ENDIF.
ENDLOOP.

ULINE AT /1(175).

input:


output:






43.  Examples:
REPORT  ZR_H107_ASSIGNMENT9 NO STANDARD PAGE HEADING
                                       LINE-SIZE 190.

TYPES:BEGIN OF T_EKKO,
        EBELN TYPE EKKO-EBELN,
        BUKRS TYPE EKKO-BUKRS,
        BSART TYPE EKKO-BSART,
        ERNAM TYPE EKKO-ERNAM,
        AEDAT TYPE EKKO-AEDAT,
        EKORG TYPE EKKO-EKORG,
        EKGRP TYPE EKKO-EKGRP,
      END OF T_EKKO.

TYPES:BEGIN OF T_EKPO,
        EBELN TYPE EKPO-EBELN,
        EBELP TYPE EKPO-EBELP,
        MATNR TYPE EKPO-MATNR,
        WERKS TYPE EKPO-WERKS,
        LGORT TYPE EKPO-LGORT,
      END OF T_EKPO.

DATA:IT_EKPO TYPE TABLE OF T_EKPO,
     IT_EKKO TYPE TABLE OF T_EKKO,
     WA_EKPO TYPE T_EKPO,
     WA_EKKO TYPE T_EKKO.

DATA:VAR1(20)  TYPE C,
     AEDAT(20) TYPE C.

DATA : DD LIKE  T247-MNR,
       LT LIKE  T247-LTX.

SELECT-OPTIONS:S_BUKRS FOR WA_EKKO-BUKRS.

 SELECT   EBELN
          BUKRS
          BSART
          ERNAM
          AEDAT
          EKORG
          EKGRP INTO TABLE IT_EKKO
                FROM EKKO
                WHERE BUKRS IN S_BUKRS.

IF NOT IT_EKKO[] IS INITIAL.
SORT IT_EKKO BY BUKRS.

 SELECT   EBELN
          EBELP
          MATNR
          WERKS
          LGORT INTO TABLE IT_EKPO
                FROM EKPO
                FOR ALL ENTRIES IN IT_EKKO
                WHERE EBELN = IT_EKKO-EBELN.
ENDIF.

ULINE AT 1(190).
FORMAT COLOR 1.

WRITE:/1 SY-VLINE,   2(10) 'EBELN',
      12 SY-VLINE,  14(10) 'BUKRS',
      25 SY-VLINE,  26(30) 'BSART',
      57 SY-VLINE,  58(10) 'ERNAM',
      69 SY-VLINE,  70(10) 'AEDAT',
      81 SY-VLINE,  82(20) 'EKORG',
     103 SY-VLINE, 104(20) 'EKGRP',
     125 SY-VLINE, 126(20) 'EBELP',
     147 SY-VLINE, 148(15) 'MATNR',
     164 SY-VLINE, 165(10) 'WERKS',
     176 SY-VLINE, 177(10) 'LGORT',
     190 SY-VLINE.

FORMAT COLOR OFF.
ULINE AT /1(190).

LOOP AT IT_EKPO INTO WA_EKPO.

READ TABLE IT_EKKO INTO WA_EKKO WITH KEY EBELN = WA_EKPO-EBELN.


      DD  = WA_EKKO-AEDAT+4(2).


         CALL FUNCTION 'ISP_GET_MONTH_NAME'
   EXPORTING
*  DATE              = '00000000'
  LANGUAGE           = SY-LANGU
 MONTH_NUMBER        = DD
 IMPORTING
* LANGU_BACK         =
  LONGTEXT           = LT
* SHORTTEXT          =
* EXCEPTIONS
* CALENDAR_ID        = 1
* DATE_ERROR         = 2
* NOT_FOUND          = 3
* WRONG_INPUT        = 4
* OTHERS             = 5
                                                 .
    IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.


    CONCATENATE WA_EKKO-AEDAT+6(2)
                LT
                WA_EKKO-AEDAT+0(4) INTO AEDAT SEPARATED BY '-'.


WRITE:/1 SY-VLINE,   2(10) WA_EKKO-EBELN,
      12 SY-VLINE,  14(10) WA_EKKO-BUKRS,
      25 SY-VLINE,  26(30) WA_EKKO-BSART,
      57 SY-VLINE,  58(10) WA_EKKO-ERNAM,
      69 SY-VLINE,  70(10) AEDAT,
      81 SY-VLINE,  82(20) WA_EKKO-EKORG,
     103 SY-VLINE, 104(20) WA_EKKO-EKGRP,
     125 SY-VLINE, 126(20) WA_EKPO-EBELP,
     147 SY-VLINE, 148(15) WA_EKPO-MATNR,
     164 SY-VLINE, 165(10) WA_EKPO-WERKS,
     176 SY-VLINE, 177(10) WA_EKPO-LGORT,
     190 SY-VLINE.

ENDLOOP.
ULINE AT /1(190).

input:

output:





44.  Examples:
REPORT  ZR_H107_ASSIGNMENT2 NO STANDARD PAGE HEADING LINE-SIZE 230.

*TYPE-POOLS ZA100.

DATA: IT_VBAK TYPE ZA100_VBA,
      IT_VBAP TYPE ZA100_VB,
      IT_TVKOT TYPE ZA100_TVKO,
      IT_KNA1 TYPE ZA100_KNA,
      IT_MAKT TYPE ZA100_MAK.

DATA: WA_VBAK TYPE ZA100_VBAK,
      WA_VBAP TYPE ZA100_VBAP,
      WA_TVKOT TYPE ZA100_TVKOT,
      WA_KNA1 TYPE ZA100_KNA1,
      WA_MAKT TYPE ZA100_MAKT.


DATA: TOTAL TYPE N LENGTH 10,
      V1    TYPE N LENGTH 10.

SELECT-OPTIONS: S_VBELN FOR WA_VBAK-VBELN,
                S_ERDAT FOR WA_VBAK-ERDAT,
                S_KUNNR FOR WA_VBAK-KUNNR.

SELECT VBELN
       ERDAT
       VKORG
       KUNNR INTO TABLE IT_VBAK
             FROM VBAK
             WHERE VBELN IN S_VBELN
             AND ERDAT IN S_ERDAT
             AND KUNNR IN S_KUNNR.

IF NOT IT_VBAK[] IS INITIAL.
  SORT IT_VBAK BY VBELN.

  SELECT VBELN
         POSNR
         MATNR
         KWMENG
         NETWR INTO TABLE IT_VBAP
               FROM VBAP
               FOR ALL ENTRIES IN IT_VBAK
               WHERE VBELN = IT_VBAK-VBELN.

  SELECT VKORG
         VTEXT INTO TABLE IT_TVKOT
                FROM TVKOT
                FOR ALL ENTRIES IN IT_VBAK
                WHERE VKORG = IT_VBAK-VKORG
                AND SPRAS = SY-LANGU.


  SELECT KUNNR
         NAME1 INTO TABLE IT_KNA1
              FROM KNA1
               FOR ALL ENTRIES IN IT_VBAK
               WHERE KUNNR = IT_VBAK-KUNNR.


  SELECT MATNR
         MAKTX INTO TABLE IT_MAKT
               FROM MAKT
               FOR ALL ENTRIES IN IT_VBAP
               WHERE MATNR = IT_VBAP-MATNR
                 AND SPRAS = SY-LANGU.
ENDIF.



LOOP AT IT_VBAP INTO WA_VBAP.


  TOTAL = WA_VBAP-KWMENG * WA_VBAP-NETWR.

  V1 = V1 + TOTAL.

  AT FIRST.

    ULINE.
    FORMAT COLOR 6 INVERSE.

    WRITE:/1 SY-VLINE,   2(15) TEXT-A01,
          18 SY-VLINE,  19(10) TEXT-A02,
          30 SY-VLINE,  31(20) TEXT-A03,
          52 SY-VLINE,  53(20) TEXT-A06,
          74 SY-VLINE,  75(10) TEXT-A07,
          86 SY-VLINE,  87(20) TEXT-A15,
         108 SY-VLINE, 109(20) TEXT-A08,
         130 SY-VLINE, 131(20) TEXT-A09,
         162 SY-VLINE, 163(30) TEXT-A10,
         184 SY-VLINE, 185(20) TEXT-A11,
         206 SY-VLINE, 207(10) TEXT-A12,
         218 SY-VLINE, 219(10) TEXT-A13,
         230 SY-VLINE.

    FORMAT COLOR 6 OFF.
    ULINE.

  ENDAT.

  READ TABLE IT_VBAK INTO WA_VBAK WITH KEY VBELN = WA_VBAP-VBELN.
  READ TABLE IT_TVKOT INTO WA_TVKOT WITH KEY VKORG = WA_VBAK-VKORG.
  READ TABLE IT_KNA1 INTO WA_KNA1 WITH KEY KUNNR = WA_VBAK-KUNNR.
  READ TABLE IT_MAKT INTO WA_MAKT WITH KEY MATNR = WA_VBAP-MATNR.



  FORMAT COLOR 5 INVERSE.

  WRITE:/1 SY-VLINE,   2(15) WA_VBAK-VBELN,
        18 SY-VLINE,  19(10) WA_VBAK-ERDAT,
        30 SY-VLINE,  31(20) WA_VBAK-VKORG,
        52 SY-VLINE,  53(20) WA_TVKOT-VTEXT,
        74 SY-VLINE,  75(10) WA_VBAK-KUNNR,
        86 SY-VLINE,  87(20) WA_KNA1-NAME1,
       108 SY-VLINE, 109(20) WA_VBAP-POSNR,
       130 SY-VLINE, 131(20) WA_VBAP-MATNR,
       162 SY-VLINE, 163(30) WA_MAKT-MAKTX,
       184 SY-VLINE, 185(20) WA_VBAP-KWMENG,
       206 SY-VLINE, 207(10) WA_VBAP-NETWR,
       218 SY-VLINE, 219(10) TOTAL NO-ZERO,
       230 SY-VLINE.

  AT LAST.

    ULINE.
    SUM.

    WRITE:/184 SY-VLINE, 185(20) WA_VBAP-KWMENG,
         206 SY-VLINE, 207(10) WA_VBAP-NETWR,
         218 SY-VLINE, 219(10) V1 NO-ZERO,
         230 SY-VLINE.
ENDAT.
FORMAT COLOR OFF.
ENDLOOP.

ULINE.


TYPE-POOL ZA100 .

TYPES: BEGIN OF ZA100_VBAK,
       VBELN TYPE VBAK-VBELN,
       ERDAT TYPE VBAK-ERDAT,
       VKORG TYPE VBAK-VKORG,
       KUNNR TYPE VBAK-KUNNR,
       END OF ZA100_VBAK.

TYPES: ZA100_VBA TYPE ZA100_VBAK OCCURS 0.

TYPES: BEGIN OF ZA100_VBAP,
       VBELN TYPE VBAP-VBELN,
       POSNR TYPE VBAP-POSNR,
       MATNR TYPE VBAP-MATNR,
       KWMENG TYPE VBAP-KWMENG,
       NETWR TYPE VBAP-NETWR,
       END OF ZA100_VBAP.

TYPES: ZA100_VB TYPE ZA100_VBAP OCCURS 0.

TYPES: BEGIN OF ZA100_TVKOT,
       VKORG TYPE TVKOT-VKORG,
       VTEXT TYPE TVKOT-VTEXT,
       END OF ZA100_TVKOT.

TYPES: ZA100_TVKO TYPE ZA100_TVKOT OCCURS 0.

TYPES: BEGIN OF ZA100_KNA1,
       KUNNR TYPE KNA1-KUNNR,
       NAME1 TYPE KNA1-NAME1,
       END OF ZA100_KNA1.

TYPES: ZA100_KNA TYPE ZA100_KNA1 OCCURS 0.


TYPES: BEGIN OF ZA100_MAKT,
       MATNR TYPE MAKT-MATNR,
       MAKTX TYPE MAKT-MAKTX,
       END OF ZA100_MAKT.

TYPES: ZA100_MAK TYPE ZA100_MAKT OCCURS 0.


input:



output:





45.  Examples:
REPORT  ZR_H107_ASSIGNMENT11 NO STANDARD PAGE HEADING
                                        LINE-SIZE 175.

TYPES:BEGIN OF T_EKKO,
       EBELN TYPE EKKO-EBELN,
       BUKRS TYPE EKKO-BSART,
       BSART TYPE EKKO-BSART,
       AEDAT TYPE EKKO-AEDAT,
       EKORG TYPE EKKO-EKORG,
       EKGRP TYPE EKKO-EKGRP,
      END OF T_EKKO.

TYPES:BEGIN OF T_EKPO,
        EBELN TYPE EKPO-EBELN,
        EBELP TYPE EKPO-EBELP,
        MATNR TYPE EKPO-MATNR,
        WERKS TYPE EKPO-WERKS,
        LGORT TYPE EKPO-LGORT,
        MATKL TYPE EKPO-MATKL,
        MENGE TYPE EKPO-MENGE,
        NETWR TYPE EKPO-NETWR,
      END OF T_EKPO.

TYPES:BEGIN OF T_T001,
       BUKRS TYPE T001-BUKRS,
       BUTXT TYPE T001-BUTXT,
      END OF T_T001.

TYPES:BEGIN OF T_T024E,
       EKORG TYPE T024E-EKORG,
       EKOTX TYPE T024E-EKOTX,
      END OF T_T024E.

 TYPES:BEGIN OF T_MAKT,
       MATNR TYPE MAKT-MATNR,
       MAKTX TYPE MAKT-MAKTX,
      END OF T_MAKT.

DATA:IT_EKKO   TYPE TABLE OF T_EKKO,
     IT_EKPO   TYPE TABLE OF T_EKPO,
     IT_T001   TYPE TABLE OF T_T001,
     IT_T024E  TYPE TABLE OF T_T024E,
     IT_MAKT  TYPE TABLE OF T_MAKT,
     WA_EKKO   TYPE T_EKKO,
     WA_EKPO   TYPE T_EKPO,
     WA_T001   TYPE T_T001,
     WA_T024E  TYPE T_T024E,
     WA_MAKT  TYPE T_MAKT.

 SELECT-OPTIONS:S_EBELN FOR WA_EKKO-EBELN,
                S_BUKRS FOR WA_EKKO-BUKRS.

   SELECT EBELN
          BUKRS
          BSART
          AEDAT
          EKORG
          EKGRP INTO TABLE IT_EKKO
                FROM EKKO
                WHERE EBELN IN S_EBELN
                AND BUKRS IN S_BUKRS.

IF NOT IT_EKKO[] IS INITIAL.
SORT IT_EKKO BY EBELN.

   SELECT EBELN
          EBELP
          MATNR
          WERKS
          LGORT
          MATKL
          MENGE
          NETWR INTO TABLE IT_EKPO
                FROM EKPO
                FOR ALL ENTRIES IN IT_EKKO
                WHERE EBELN = IT_EKKO-EBELN.

 SELECT BUKRS
        BUTXT  INTO TABLE IT_T001
               FROM T001
               FOR ALL ENTRIES IN IT_EKKO
               WHERE BUKRS = IT_EKKO-BUKRS.

 SELECT EKORG
        EKOTX  INTO TABLE IT_T024E
               FROM T024E
               FOR ALL ENTRIES IN IT_EKKO
               WHERE EKORG = IT_EKKO-EKORG.

SELECT MATNR
       MAKTX   INTO TABLE IT_MAKT
               FROM MAKT
               FOR ALL ENTRIES IN IT_EKPO
               WHERE MATNR = IT_EKPO-MATNR
               AND SPRAS = SY-LANGU.

ENDIF.
ULINE AT 1(175).
FORMAT COLOR 1.

 WRITE:/1 SY-VLINE,   2(10) 'EBELN',
       12 SY-VLINE,  13(10) 'BUKRS',
       24 SY-VLINE,  25(15) 'BSART',
       41 SY-VLINE,  42(10) 'AEDAT',
       53 SY-VLINE,  54(10) 'EKORG',
       65 SY-VLINE,  66(10) 'EKGRP',
       77 SY-VLINE,  78(10) 'EBLP',
       89 SY-VLINE,  90(10) 'MATNR',
      101 SY-VLINE, 102(20) 'WERKS',
      123 SY-VLINE, 124(10) 'LGORT',
      135 SY-VLINE, 136(10) 'MATKL',
      147 SY-VLINE, 148(10) 'MENGE',
      159 SY-VLINE, 160(10) 'NETWR',
      175 SY-VLINE.

FORMAT COLOR OFF.
ULINE AT /1(175).

LOOP AT IT_EKPO INTO WA_EKPO.

  READ TABLE IT_EKKO  INTO WA_EKKO WITH KEY EBELN  = WA_EKPO-EBELN.
  READ TABLE IT_T001  INTO WA_T001 WITH KEY BUKRS  = WA_EKKO-BUKRS.
  READ TABLE IT_T024E INTO WA_T024E WITH KEY EKORG = WA_EKKO-EKORG.
  READ TABLE IT_MAKT  INTO WA_MAKT WITH KEY MATNR  = WA_EKPO-MATNR.

 WRITE:/1 SY-VLINE,   2(10) WA_EKKO-EBELN,
       12 SY-VLINE,  13(10) WA_EKKO-BUKRS,
       24 SY-VLINE,  25(15) WA_T001-BUTXT,
       41 SY-VLINE,  42(10) WA_EKKO-AEDAT,
       53 SY-VLINE,  54(10) WA_EKKO-EKORG,
       65 SY-VLINE,  66(10) WA_T024E-EKOTX,
       77 SY-VLINE,  78(10) WA_EKPO-EBELP,
       89 SY-VLINE,  90(10) WA_EKPO-MATNR,
      101 SY-VLINE, 102(20) WA_MAKT-MAKTX,
      123 SY-VLINE, 124(10) WA_EKPO-LGORT,
      135 SY-VLINE, 136(10) WA_EKPO-MATKL,
      147 SY-VLINE, 148(10) WA_EKPO-MENGE,
      159 SY-VLINE, 160(10) WA_EKPO-NETWR,
      175 SY-VLINE.

    ENDLOOP.
    ULINE AT /1(175).

input:


output:


46.  Reports:
REPORT  ZR_ZH107_REPORTS NO STANDARD PAGE HEADING
                               LINE-SIZE 175
                               LINE-COUNT 25(3).

TYPES:BEGIN OF T_EKKO,
       EBELN TYPE EKKO-EBELN,
       BUKRS TYPE EKKO-BSART,
       BSART TYPE EKKO-BSART,
       AEDAT TYPE EKKO-AEDAT,
       EKORG TYPE EKKO-EKORG,
       EKGRP TYPE EKKO-EKGRP,
      END OF T_EKKO.

TYPES:BEGIN OF T_EKPO,
        EBELN TYPE EKPO-EBELN,
        EBELP TYPE EKPO-EBELP,
        MATNR TYPE EKPO-MATNR,
        WERKS TYPE EKPO-WERKS,
        LGORT TYPE EKPO-LGORT,
        MATKL TYPE EKPO-MATKL,
        MENGE TYPE EKPO-MENGE,
        NETWR TYPE EKPO-NETWR,
      END OF T_EKPO.

DATA:IT_EKKO TYPE TABLE OF T_EKKO,
     IT_EKPO TYPE TABLE OF T_EKPO,
     WA_EKKO TYPE T_EKKO,
     WA_EKPO TYPE T_EKPO.

SELECT-OPTIONS:S_EBELN FOR WA_EKKO-EBELN,
               S_BUKRS FOR WA_EKKO-BUKRS.

*********************************************************
*                      INITIALIZATION                   *
*********************************************************

INITIALIZATION.

  PERFORM INIT_VALUE USING '1000'.

  PERFORM INIT_VALUE USING '2000'.

  PERFORM INIT_VALUE USING '3000'.


*********************************************************
*                      START-OF-SELECTION               *
*********************************************************

 SELECT EBELN
        BUKRS
        BSART
        AEDAT
        EKORG
        EKGRP INTO TABLE IT_EKKO
                FROM EKKO
                WHERE EBELN IN S_EBELN
                AND BUKRS IN S_BUKRS.

IF NOT IT_EKKO[] IS INITIAL.
SORT IT_EKKO BY EBELN.

   SELECT EBELN
          EBELP
          MATNR
          WERKS
          LGORT
          MATKL
          MENGE
          NETWR INTO TABLE IT_EKPO
                FROM EKPO
                FOR ALL ENTRIES IN IT_EKKO
                WHERE EBELN = IT_EKKO-EBELN.

ENDIF.

*********************************************************
*                    END-OF-SELECTION                   *
*********************************************************
END-OF-SELECTION.

LOOP AT IT_EKKO INTO WA_EKKO.

  READ TABLE IT_EKPO INTO WA_EKPO WITH KEY EBELN = WA_EKKO-EBELN.

    FORMAT COLOR 5 INVERSE.

 WRITE:/1 SY-VLINE,   2(10) WA_EKKO-EBELN,
       12 SY-VLINE,  13(10) WA_EKKO-BUKRS,
       24 SY-VLINE,  25(15) WA_EKKO-BSART,
       41 SY-VLINE,  42(10) WA_EKKO-AEDAT,
       53 SY-VLINE,  54(10) WA_EKKO-EKORG,
       65 SY-VLINE,  66(10) WA_EKKO-EKGRP,
       77 SY-VLINE,  78(10) WA_EKPO-EBELP,
       89 SY-VLINE,  90(10) WA_EKPO-MATNR,
      101 SY-VLINE, 102(20) WA_EKPO-WERKS,
      123 SY-VLINE, 124(10) WA_EKPO-LGORT,
      135 SY-VLINE, 136(10) WA_EKPO-MATKL,
      147 SY-VLINE, 148(10) WA_EKPO-MENGE,
      159 SY-VLINE, 160(10) WA_EKPO-NETWR,
      175 SY-VLINE.

FORMAT COLOR OFF.
ENDLOOP.
ULINE AT /1(175).


*********************************************************
*                      TOP-OF-PAGE                      *
*********************************************************
TOP-OF-PAGE.

ULINE AT 1(175).
FORMAT COLOR 6 INVERSE.

 WRITE:/1 SY-VLINE,   2(10) 'EBELN',
       12 SY-VLINE,  13(10) 'BUKRS',
       24 SY-VLINE,  25(15) 'BSART',
       41 SY-VLINE,  42(10) 'AEDAT',
       53 SY-VLINE,  54(10) 'EKORG',
       65 SY-VLINE,  66(10) 'EKGRP',
       77 SY-VLINE,  78(10) 'EBLP',
       89 SY-VLINE,  90(10) 'MATNR',
      101 SY-VLINE, 102(20) 'WERKS',
      123 SY-VLINE, 124(10) 'LGORT',
      135 SY-VLINE, 136(10) 'MATKL',
      147 SY-VLINE, 148(10) 'MENGE',
      159 SY-VLINE, 160(10) 'NETWR',
      175 SY-VLINE.

FORMAT COLOR OFF.
ULINE AT /1(175).



*********************************************************
*                      END-OF-PAGE                      *
*********************************************************
END-OF-PAGE.
 ULINE AT /1(175).
  WRITE:/40 '*** End of Page ***', 80 SY-PAGNO.





*&---------------------------------------------------------------------*
*&      Form  INIT_VALUE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_0115   text
*----------------------------------------------------------------------*
FORM INIT_VALUE  USING    VALUE(P_0115).

 S_BUKRS-LOW    = P_0115.
 S_BUKRS-OPTION = 'EQ'.
 S_BUKRS-SIGN   = 'I'.

  APPEND S_BUKRS.
  CLEAR  S_BUKRS.

ENDFORM.                    " INIT_VALUE


input:



output:


47.  Examples:
REPORT  ZR_H107_REPORTS1 NO STANDARD PAGE HEADING
                               LINE-SIZE 175
                               LINE-COUNT 25(3).

INCLUDE ZR_H107_ASSIGNMENT36_01.    " Data declerations

INCLUDE ZR_H107_ASSIGNMENT36_02.    " Selection-Screen

INCLUDE ZR_H107_ASSIGNMENT36_03.    " Main Program

INCLUDE ZR_H107_ASSIGNMENT36_04.    " Form routines


*&---------------------------------------------------------------------*
*&  Include           ZR_H107_REPORTS_01
*&---------------------------------------------------------------------*

TYPES:BEGIN OF T_EKKO,
       EBELN TYPE EKKO-EBELN,
       BUKRS TYPE EKKO-BSART,
       BSART TYPE EKKO-BSART,
       AEDAT TYPE EKKO-AEDAT,
       EKORG TYPE EKKO-EKORG,
       EKGRP TYPE EKKO-EKGRP,
      END OF T_EKKO.

TYPES:BEGIN OF T_EKPO,
        EBELN TYPE EKPO-EBELN,
        EBELP TYPE EKPO-EBELP,
        MATNR TYPE EKPO-MATNR,
        WERKS TYPE EKPO-WERKS,
        LGORT TYPE EKPO-LGORT,
        MATKL TYPE EKPO-MATKL,
        MENGE TYPE EKPO-MENGE,
        NETWR TYPE EKPO-NETWR,
      END OF T_EKPO.

DATA:IT_EKKO TYPE TABLE OF T_EKKO,
     IT_EKPO TYPE TABLE OF T_EKPO,
     WA_EKKO TYPE T_EKKO,
     WA_EKPO TYPE T_EKPO.

*&---------------------------------------------------------------------*
*&  Include           ZR_H107_REPORTS_02
*&---------------------------------------------------------------------*

SELECT-OPTIONS:S_EBELN FOR WA_EKKO-EBELN,
               S_BUKRS FOR WA_EKKO-BUKRS.


&---------------------------------------------------------------------*
*&  Include           ZR_H107_REPORTS_03
*&---------------------------------------------------------------------*

PERFORM READ_EKKO TABLES S_EBELN
                         S_BUKRS
                         IT_EKKO.

IF NOT IT_EKKO[] IS INITIAL.

  PERFORM READ_EKPO TABLES IT_EKKO
                           IT_EKPO.

ENDIF.

END-OF-SELECTION.

PERFORM PROCESS_DATA TABLES IT_EKKO
                            IT_EKPO.

TOP-OF-PAGE.


PERFORM PROCESS_DATA1 TABLES IT_EKKO
                            IT_EKPO.


END-OF-PAGE.


PERFORM PROCESS_DATA2 TABLES IT_EKKO
                            IT_EKPO.


*&---------------------------------------------------------------------*
*&  Include           ZR_H107_REPORTS_04
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Form  READ_EKKO
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_S_EBELN  text
*      -->P_S_BUKRS  text
*      -->P_IT_EKKO  text
*----------------------------------------------------------------------*
FORM READ_EKKO  TABLES   P_S_EBELN STRUCTURE S_EBELN
                         P_S_BUKRS STRUCTURE S_BUKRS
                         P_IT_EKKO STRUCTURE WA_EKKO.

 SELECT EBELN
        BUKRS
        BSART
        AEDAT
        EKORG
        EKGRP   INTO TABLE IT_EKKO
                FROM EKKO
                WHERE EBELN IN S_EBELN
                AND BUKRS IN S_BUKRS.


ENDFORM.                    " READ_EKKO
*&---------------------------------------------------------------------*
*&      Form  READ_EKPO
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_IT_EKKO  text
*      -->P_IT_EKPO  text
*----------------------------------------------------------------------*
FORM READ_EKPO  TABLES   P_IT_EKKO STRUCTURE WA_EKKO
                         P_IT_EKPO STRUCTURE WA_EKPO.

   SELECT EBELN
          EBELP
          MATNR
          WERKS
          LGORT
          MATKL
          MENGE
          NETWR INTO TABLE IT_EKPO
                FROM EKPO
                FOR ALL ENTRIES IN IT_EKKO
                WHERE EBELN = IT_EKKO-EBELN.




ENDFORM.                    " READ_EKPO
*&---------------------------------------------------------------------*
*&      Form  PROCESS_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_IT_EKKO  text
*      -->P_IT_EKPO  text
*----------------------------------------------------------------------*
FORM PROCESS_DATA  TABLES   P_IT_EKKO STRUCTURE WA_EKKO
                            P_IT_EKPO STRUCTURE WA_EKPO.


 LOOP AT IT_EKKO INTO WA_EKKO.

  READ TABLE IT_EKPO INTO WA_EKPO WITH KEY EBELN = WA_EKKO-EBELN.

    FORMAT COLOR 5 INVERSE.

 WRITE:/1 SY-VLINE,   2(10) WA_EKKO-EBELN,
       12 SY-VLINE,  13(10) WA_EKKO-BUKRS,
       24 SY-VLINE,  25(15) WA_EKKO-BSART,
       41 SY-VLINE,  42(10) WA_EKKO-AEDAT,
       53 SY-VLINE,  54(10) WA_EKKO-EKORG,
       65 SY-VLINE,  66(10) WA_EKKO-EKGRP,
       77 SY-VLINE,  78(10) WA_EKPO-EBELP,
       89 SY-VLINE,  90(10) WA_EKPO-MATNR,
      101 SY-VLINE, 102(20) WA_EKPO-WERKS,
      123 SY-VLINE, 124(10) WA_EKPO-LGORT,
      135 SY-VLINE, 136(10) WA_EKPO-MATKL,
      147 SY-VLINE, 148(10) WA_EKPO-MENGE,
      159 SY-VLINE, 160(10) WA_EKPO-NETWR,
      175 SY-VLINE.

FORMAT COLOR OFF.
ENDLOOP.
ULINE AT /1(175).



ENDFORM.                    " PROCESS_DATA
*&---------------------------------------------------------------------*
*&      Form  PROCESS_DATA1
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_IT_EKKO  text
*      -->P_IT_EKPO  text
*----------------------------------------------------------------------*
FORM PROCESS_DATA1  TABLES   P_IT_EKKO STRUCTURE WA_EKKO
                             P_IT_EKPO STRUCTURE WA_EKPO.

  ULINE AT 1(175).
FORMAT COLOR 6 INVERSE.

 WRITE:/1 SY-VLINE,   2(10) 'EBELN',
       12 SY-VLINE,  13(10) 'BUKRS',
       24 SY-VLINE,  25(15) 'BSART',
       41 SY-VLINE,  42(10) 'AEDAT',
       53 SY-VLINE,  54(10) 'EKORG',
       65 SY-VLINE,  66(10) 'EKGRP',
       77 SY-VLINE,  78(10) 'EBLP',
       89 SY-VLINE,  90(10) 'MATNR',
      101 SY-VLINE, 102(20) 'WERKS',
      123 SY-VLINE, 124(10) 'LGORT',
      135 SY-VLINE, 136(10) 'MATKL',
      147 SY-VLINE, 148(10) 'MENGE',
      159 SY-VLINE, 160(10) 'NETWR',
      175 SY-VLINE.

FORMAT COLOR OFF.
ULINE AT /1(175).



ENDFORM.                    " PROCESS_DATA1
*&---------------------------------------------------------------------*
*&      Form  PROCESS_DATA2
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_IT_EKKO  text
*      -->P_IT_EKPO  text
*----------------------------------------------------------------------*
FORM PROCESS_DATA2  TABLES   P_IT_EKKO STRUCTURE WA_EKKO
                             P_IT_EKPO STRUCTURE WA_EKPO.

  ULINE AT /1(175).
  WRITE:/40 '*** End of Page ***', 80 SY-PAGNO.



ENDFORM.                    " PROCESS_DATA2


input:


output:


48.  Examples:
REPORT  ZR_H107_ASSIGNMENT37 NO STANDARD PAGE HEADING LINE-SIZE 150.

TYPES: BEGIN OF TY_MARD,
         MATNR TYPE MARD-MATNR,
         WERKS TYPE MARD-WERKS,
         LGORT TYPE MARD-LGORT,
         LABST TYPE MARD-LABST,
       END OF TY_MARD.

TYPES: TY_MARD_TAB TYPE TY_MARD OCCURS 0.

TYPES: BEGIN OF TY_MARA,
         MATNR TYPE MARA-MATNR,
         ERSDA TYPE MARA-ERSDA,
         MTART TYPE MARA-MTART,
         PSTAT TYPE MARA-PSTAT,
         MATKL TYPE MARA-MATKL,
       END OF TY_MARA.

TYPES: TY_MARA_TAB TYPE TY_MARA OCCURS 0.

TYPES: BEGIN OF TY_MAKT,
       MATNR TYPE MAKT-MATNR,
       MAKTX TYPE MAKT-MAKTX,
       END OF TY_MAKT.

TYPES: TY_MAKT_TAB TYPE TY_MAKT OCCURS 0.

TYPES: BEGIN OF TY_T001W,
         WERKS TYPE T001W-WERKS,
         NAME1 TYPE T001W-NAME1,
       END OF TY_T001W.

TYPES: TY_T001W_TAB TYPE TY_T001W OCCURS 0.

TYPES: BEGIN OF TY_T001L,
         LGORT TYPE T001L-LGORT,
         LGOBE TYPE T001L-LGOBE,
       END OF TY_T001L.

TYPES: TY_T001L_TAB TYPE TY_T001L OCCURS 0.

DATA: WA_MARD TYPE TY_MARD.

DATA: WA_MARA TYPE TY_MARA.

DATA: WA_MAKT TYPE TY_MAKT.

DATA: WA_T001L TYPE TY_T001L.

DATA: WA_T001W TYPE TY_T001W.

DATA: IT_MARD TYPE TY_MARD_TAB.

DATA: IT_MARA TYPE TY_MARA_TAB.

DATA: IT_MAKT TYPE TY_MAKT_TAB.

DATA: IT_T001W TYPE TY_T001W_TAB.

DATA: IT_T001L TYPE TY_T001L_TAB.

SELECT-OPTIONS S_MATNR FOR WA_MARA-MATNR.

******************************************************
*              START-OF-SELECTION                    *
******************************************************
START-OF-SELECTION.

  SELECT MATNR
         ERSDA
         MTART
         PSTAT
         MATKL INTO TABLE IT_MARA
               FROM MARA
               WHERE MATNR IN S_MATNR.

******************************************************
*              END-OF-SELECTION                      *
******************************************************
END-OF-SELECTION.

SET TITLEBAR 'A02'.

  LOOP AT IT_MARA INTO WA_MARA.

    WRITE:/ WA_MARA-MATNR HOTSPOT,
            WA_MARA-ERSDA,
            WA_MARA-MTART,
            WA_MARA-PSTAT,
            WA_MARA-MATKL.

* HIDE WA_MARA-MATNR.

  ENDLOOP.
******************************************************
*              AT LINE-SELECTION                     *
******************************************************
AT LINE-SELECTION.

  DATA: G_FIELD(20) TYPE C,
        G_VALUE(10) TYPE C.

  GET CURSOR FIELD G_FIELD VALUE G_VALUE.

  IF G_FIELD EQ 'WA_MARA-MATNR'.

  SET TITLEBAR 'A01'.

    SELECT MATNR
           WERKS
           LGORT
           LABST INTO TABLE IT_MARD
                 FROM MARD
                 WHERE MATNR = G_VALUE.

    IF NOT IT_MARD[] IS INITIAL.
      SORT IT_MARD BY MATNR.

      SELECT MATNR
             MAKTX INTO TABLE IT_MAKT
                   FROM MAKT
                   FOR ALL ENTRIES IN IT_MARD
                   WHERE MATNR = IT_MARD-MATNR.

      SELECT WERKS
             NAME1 INTO TABLE IT_T001W
                   FROM T001W
                   FOR ALL ENTRIES IN IT_MARD
                   WHERE WERKS = IT_MARD-WERKS.

      SELECT LGORT
             LGOBE INTO TABLE IT_T001L
                   FROM T001L
                   FOR ALL ENTRIES IN IT_MARD
                   WHERE LGORT = IT_MARD-LGORT.

    ENDIF.

    LOOP AT IT_MARD INTO WA_MARD.

      READ TABLE IT_MAKT INTO WA_MAKT WITH KEY MATNR = WA_MARD-MATNR.

      READ TABLE IT_T001W INTO WA_T001W WITH KEY WERKS = WA_MARD-WERKS.

      READ TABLE IT_T001L INTO WA_T001L WITH KEY LGORT = WA_MARD-LGORT.

      WRITE:/ WA_MARD-MATNR,
              WA_MAKT-MAKTX,
              WA_MARD-WERKS,
              WA_T001W-NAME1,
              WA_MARD-LGORT,
              WA_T001L-LGOBE,
              WA_MARD-LABST.

    ENDLOOP.

  ENDIF.

************************************************************
*                    TOP-OF-PAGE                           *
************************************************************
TOP-OF-PAGE.

ULINE.

WRITE:/30 'Material Header Details' COLOR 6 INVERSE.

ULINE.


************************************************************
*              TOP-OF-PAGE DURING LINE-SELECTION           *
************************************************************
TOP-OF-PAGE DURING LINE-SELECTION.

  ULINE.

  IF G_FIELD EQ 'WA_MARA-MATNR'.

    WRITE:/30 'Material Item Details' COLOR 6 INVERSE.

  ENDIF.

  ULINE.

input:


output:






49.  Examples:
REPORT  ZR_H107_ASSIGNMENT38 NO STANDARD PAGE HEADING.

DATA: BEGIN OF IT_EKKO OCCURS 0,
        EBELN TYPE EKKO-EBELN,
        BUKRS TYPE EKKO-BUKRS,
        BSART TYPE EKKO-BSART,
        LIFNR TYPE EKKO-LIFNR,
        EKORG TYPE EKKO-EKORG,
        EKGRP TYPE EKKO-EKGRP,
      END OF IT_EKKO.

DATA: BEGIN OF IT_EKPO OCCURS 0,
        EBELN TYPE EKPO-EBELN,
        EBELP TYPE EKPO-EBELP,
        MATNR TYPE EKPO-MATNR,
        WERKS TYPE EKPO-WERKS,
        MATKL TYPE EKPO-MATKL,
        MENGE TYPE EKPO-MENGE,
        NETWR TYPE EKPO-NETWR,
      END OF IT_EKPO.

DATA: BEGIN OF IT_MARD OCCURS 0,
        WERKS TYPE MARD-WERKS,
        MATNR TYPE MARD-MATNR,
        PSTAT TYPE MARD-PSTAT,
        LABST TYPE MARD-LABST,
        ERSDA TYPE MARD-ERSDA,
      END OF IT_MARD.

DATA: VAR(1) TYPE C.

SELECT-OPTIONS: S_BUKRS FOR IT_EKKO-BUKRS,
                S_EKORG FOR IT_EKKO-EKORG.

**************************************************************
*                   START-OF-SELECTION                       *
**************************************************************
START-OF-SELECTION.

  SELECT EBELN
         BUKRS
         BSART
         LIFNR
         EKORG
         EKGRP INTO TABLE IT_EKKO
               FROM EKKO
               WHERE BUKRS IN S_BUKRS
                 AND EKORG IN S_EKORG.

**************************************************************
*                     END-OF-SELECTION                       *
**************************************************************
END-OF-SELECTION.

  LOOP AT IT_EKKO.

    SET PF-STATUS 'A01'.


    WRITE:/ VAR AS CHECKBOX,
            IT_EKKO-EBELN,
            IT_EKKO-BUKRS,
            IT_EKKO-BSART,
            IT_EKKO-LIFNR,
            IT_EKKO-EKORG,
            IT_EKKO-EKGRP.

  ENDLOOP.

**************************************************************
*                      AT USER-COMMAND                       *
**************************************************************
AT USER-COMMAND.

  DATA G_EBELN(10) TYPE N.

  DATA G_WERKS(10) TYPE C.

  RANGES: R_EBELN FOR IT_EKKO-EBELN.

  RANGES: R_WERKS FOR IT_EKPO-WERKS.


  IF SY-UCOMM EQ 'BUTTON' AND SY-LSIND = 1.

    REFRESH: R_EBELN[].


    DO.

      READ LINE SY-INDEX FIELD VALUE VAR IT_EKKO-EBELN INTO G_EBELN.

      IF SY-SUBRC <> 0.

        EXIT.

      ELSEIF VAR EQ 'X'.

        R_EBELN-SIGN = 'I'.
        R_EBELN-OPTION = 'EQ'.
        R_EBELN-LOW = G_EBELN.

        APPEND R_EBELN.
        CLEAR R_EBELN.

      ENDIF.

    ENDDO.

    IF NOT R_EBELN[] IS INITIAL.

      REFRESH IT_EKPO.

      SELECT EBELN
             EBELP
             MATNR
             WERKS
             MATKL
             MENGE
             NETWR INTO TABLE IT_EKPO
                   FROM EKPO
                   WHERE EBELN IN R_EBELN.

      LOOP AT IT_EKPO.
        WRITE:/ VAR AS CHECKBOX,
                IT_EKPO-EBELN,
                IT_EKPO-EBELP,
                IT_EKPO-MATNR,
                IT_EKPO-WERKS,
                IT_EKPO-MATKL,
                IT_EKPO-MENGE,
                IT_EKPO-NETWR.

      ENDLOOP.

    ENDIF.

  ELSEIF SY-UCOMM EQ 'SELECT'  AND SY-LSIND = 2.

    REFRESH: R_WERKS[].

    DO.

      READ LINE SY-INDEX FIELD VALUE VAR IT_EKPO-WERKS INTO G_WERKS.

      IF SY-SUBRC <> 0.

        EXIT.

      ELSEIF VAR EQ 'X' .

        R_WERKS-SIGN = 'I'.
        R_WERKS-OPTION = 'EQ'.
        R_WERKS-LOW = G_WERKS.

        APPEND R_WERKS.
        CLEAR R_WERKS.

      ENDIF.

    ENDDO.

    IF NOT R_WERKS[] IS INITIAL.

      REFRESH IT_MARD.

      SELECT WERKS
             MATNR
             PSTAT
             LABST
             ERSDA INTO TABLE IT_MARD
                   FROM MARD
                   WHERE WERKS IN R_WERKS.

*DELETE ADJACENT DUPLICATES FROM IT_MARD.

      LOOP AT IT_MARD.

        WRITE:/ IT_MARD-MATNR,
                IT_MARD-WERKS,
                IT_MARD-PSTAT,
                IT_MARD-LABST,
                IT_MARD-ERSDA,
                SY-TABIX.
      ENDLOOP.
    ENDIF.

  ENDIF.

input:


output:
list1.


list2.


list3.


50.  Examples:
REPORT  ZR_H107_ASSIGNMENT39.

DATA: IT_ITAB TYPE ZTA2 OCCURS 0 WITH HEADER LINE.

TYPES: BEGIN OF TY_EKKO,
         EBELN TYPE EKKO-EBELN,
         BUKRS TYPE EKKO-BUKRS,
         LIFNR TYPE EKKO-LIFNR,
         EKORG TYPE EKKO-EKORG,
       END OF TY_EKKO.

TYPES: TY_EKKO_TAB TYPE TY_EKKO OCCURS 0.

TYPES: BEGIN OF TY_EKPO,
         EBELN TYPE EKPO-EBELN,
         EBELP TYPE EKPO-EBELP,
         MATNR TYPE EKPO-MATNR,
         MATKL TYPE EKPO-MATKL,
         MENGE TYPE EKPO-MENGE,
         NETWR TYPE EKPO-NETWR,
       END OF TY_EKPO.

TYPES: TY_EKPO_TAB TYPE TY_EKPO OCCURS 0.

DATA: WA_EKKO TYPE TY_EKKO.

DATA: WA_EKPO TYPE TY_EKPO.

DATA: IT_EKKO TYPE TY_EKKO_TAB.

DATA: IT_EKPO TYPE TY_EKPO_TAB.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-A01.

SELECT-OPTIONS: S_EBELN FOR IT_ITAB-EBELN,
                S_BUKRS FOR IT_ITAB-BUKRS,
                S_LIFNR FOR IT_ITAB-LIFNR,
                S_EKORG FOR IT_ITAB-EKORG.

SELECTION-SCREEN END OF BLOCK B1.

SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-A02.

PARAMETERS P_LIST TYPE CHAR01 AS LISTBOX VISIBLE LENGTH 15.

SELECTION-SCREEN END OF BLOCK B2.

****************************************************************
*                       INITIALISATION                         *
****************************************************************
INITIALIZATION.

  DATA L_TAB TYPE VRM_VALUES.

  DATA WA_TAB TYPE VRM_VALUE.

  WA_TAB-KEY = '1'.
  WA_TAB-TEXT = 'ALV DISPLAY'.

  APPEND WA_TAB TO L_TAB.

  WA_TAB-KEY = '2'.
  WA_TAB-TEXT = 'GRID DISPLAY'.

  APPEND WA_TAB TO L_TAB.

  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      ID                    = 'P_LIST'
      VALUES                = L_TAB
* EXCEPTIONS
*   ID_ILLEGAL_NAME       = 1
*   OTHERS                = 2
            .
  IF SY-SUBRC <> 0.
* Implement suitable error handling here
  ENDIF.

****************************************************************
*                   START-OF-SELECTION                         *
****************************************************************
START-OF-SELECTION.

  SELECT EBELN
         BUKRS
         LIFNR
         EKORG INTO TABLE IT_EKKO
               FROM EKKO
               WHERE EBELN IN S_EBELN
                 AND BUKRS IN S_BUKRS
                 AND LIFNR IN S_LIFNR
                 AND EKORG IN S_EKORG.

  IF NOT IT_EKKO[] IS INITIAL.
    SORT IT_EKKO BY EBELN.

    SELECT EBELN
           EBELP
           MATNR
           MATKL
           MENGE
           NETWR INTO TABLE IT_EKPO
                 FROM EKPO
                 FOR ALL ENTRIES IN IT_EKKO
                 WHERE EBELN = IT_EKKO-EBELN.

  ENDIF.

****************************************************************
*                     END-OF-SELECTION                         *
****************************************************************
END-OF-SELECTION.

  LOOP AT IT_EKPO INTO WA_EKPO.

    READ TABLE IT_EKKO INTO WA_EKKO WITH KEY EBELN = WA_EKPO-EBELN.

    IT_ITAB-TOTAL = WA_EKPO-MENGE * WA_EKPO-NETWR.

    IF SY-SUBRC = 0.

      MOVE: WA_EKKO-EBELN TO IT_ITAB-EBELN,
            WA_EKKO-BUKRS TO IT_ITAB-BUKRS,
            WA_EKKO-LIFNR TO IT_ITAB-LIFNR,
            WA_EKKO-EKORG TO IT_ITAB-EKORG.

    ENDIF.

    MOVE: WA_EKPO-EBELN TO IT_ITAB-EBELN,
          WA_EKPO-EBELP TO IT_ITAB-EBELP,
          WA_EKPO-MATNR TO IT_ITAB-MATNR,
          WA_EKPO-MATKL TO IT_ITAB-MATKL,
          WA_EKPO-MENGE TO IT_ITAB-MENGE,
          WA_EKPO-NETWR TO IT_ITAB-NETWR.


    APPEND IT_ITAB.
    CLEAR IT_ITAB.

  ENDLOOP.

****************************************************************
*                        ALV DISPLAY                           *
****************************************************************
  IF P_LIST = '1'.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
   EXPORTING
*   I_INTERFACE_CHECK              = ' '
*   I_BYPASSING_BUFFER             =
*   I_BUFFER_ACTIVE                = 'X'
*   I_CALLBACK_PROGRAM             = ' '
*   I_CALLBACK_PF_STATUS_SET       = ' '
*   I_CALLBACK_USER_COMMAND        = ' '

  I_STRUCTURE_NAME               = 'ZTA2'
*   IS_LAYOUT                      =
*   IT_FIELDCAT                    =
*   IT_EXCLUDING                   =
*   IT_SPECIAL_GROUPS              =
*   IT_SORT                        =
*   IT_FILTER                      =
*   IS_SEL_HIDE                    =
*   I_DEFAULT                      = 'X'
*   I_SAVE                         = ' '
*   IS_VARIANT                     =
*   IT_EVENTS                      =
*   IT_EVENT_EXIT                  =
*   IS_PRINT                       =
*   IS_REPREP_ID                   =
*   I_SCREEN_START_COLUMN          = 0
*   I_SCREEN_START_LINE            = 0
*   I_SCREEN_END_COLUMN            = 0
*   I_SCREEN_END_LINE              = 0
*   IR_SALV_LIST_ADAPTER           =
*   IT_EXCEPT_QINFO                =
*   I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER        =
*   ES_EXIT_CAUSED_BY_USER         =
      TABLES
        T_OUTTAB                      = IT_ITAB
* EXCEPTIONS
*   PROGRAM_ERROR                  = 1
*   OTHERS                         = 2
              .
    IF SY-SUBRC <> 0.
* Implement suitable error handling here
    ENDIF.

****************************************************************
*                       GRID DISPLAY                           *
****************************************************************
  ELSE.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
     EXPORTING
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                = ' '
*   I_BUFFER_ACTIVE                   = ' '
*   I_CALLBACK_PROGRAM                = ' '
*   I_CALLBACK_PF_STATUS_SET          = ' '
*   I_CALLBACK_USER_COMMAND           = ' '
*   I_CALLBACK_TOP_OF_PAGE            = ' '
*   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*   I_CALLBACK_HTML_END_OF_LIST       = ' '
       I_STRUCTURE_NAME                  = 'ZTA2'
*   I_BACKGROUND_ID                   = ' '
*   I_GRID_TITLE                      =
*   I_GRID_SETTINGS                   =
*   IS_LAYOUT                         =
*   IT_FIELDCAT                       =
*   IT_EXCLUDING                      =
*   IT_SPECIAL_GROUPS                 =
*   IT_SORT                           =
*   IT_FILTER                         =
*   IS_SEL_HIDE                       =
*   I_DEFAULT                         = 'X'
*   I_SAVE                            = ' '
*   IS_VARIANT                        =
*   IT_EVENTS                         =
*   IT_EVENT_EXIT                     =
*   IS_PRINT                          =
*   IS_REPREP_ID                      =
*   I_SCREEN_START_COLUMN             = 0
*   I_SCREEN_START_LINE               = 0
*   I_SCREEN_END_COLUMN               = 0
*   I_SCREEN_END_LINE                 = 0
*   I_HTML_HEIGHT_TOP                 = 0
*   I_HTML_HEIGHT_END                 = 0
*   IT_ALV_GRAPHICS                   =
*   IT_HYPERLINK                      =
*   IT_ADD_FIELDCAT                   =
*   IT_EXCEPT_QINFO                   =
*   IR_SALV_FULLSCREEN_ADAPTER        =
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER           =
*   ES_EXIT_CAUSED_BY_USER            =
      TABLES
        T_OUTTAB                          = IT_ITAB
* EXCEPTIONS
*   PROGRAM_ERROR                     = 1
*   OTHERS                            = 2
              .
    IF SY-SUBRC <> 0.
* Implement suitable error handling here
    ENDIF.
  ENDIF.

input type1:


output:


input type2:


output:



51.  Examples:
REPORT  ZR_H107_ASSIGNMENT40.


TYPES: BEGIN OF TY_EKKO,
         EBELN TYPE EKKO-EBELN,
         BUKRS TYPE EKKO-BUKRS,
         LIFNR TYPE EKKO-LIFNR,
         EKORG TYPE EKKO-EKORG,
       END OF TY_EKKO.

TYPES: BEGIN OF TY_EKPO,
         EBELN TYPE EKPO-EBELN,
         EBELP TYPE EKPO-EBELP,
         MATNR TYPE EKPO-MATNR,
         MATKL TYPE EKPO-MATKL,
         MENGE TYPE EKPO-MENGE,
         NETWR TYPE EKPO-NETWR,
       END OF TY_EKPO.

TYPES: BEGIN OF TY_FINAL,
         EBELN TYPE EKKO-EBELN,
         BUKRS TYPE EKKO-BUKRS,
         LIFNR TYPE EKKO-LIFNR,
         EKORG TYPE EKKO-EKORG,
         EBELP TYPE EKPO-EBELP,
         MATNR TYPE EKPO-MATNR,
         MATKL TYPE EKPO-MATKL,
         MENGE TYPE EKPO-MENGE,
         NETWR TYPE EKPO-NETWR,
      END OF TY_FINAL.

DATA: IT_ITAB TYPE TY_FINAL OCCURS 0 WITH HEADER LINE.

DATA: IT_EKKO TYPE STANDARD TABLE OF TY_EKKO.

DATA: WA_EKKO LIKE LINE OF IT_EKKO.

DATA: IT_EKPO TYPE STANDARD TABLE OF TY_EKPO.

DATA: WA_EKPO LIKE LINE OF IT_EKPO.

DATA: IT_FIELDS TYPE SLIS_T_FIELDCAT_ALV.

DATA: WA_FIELDS TYPE SLIS_FIELDCAT_ALV.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-A01.

SELECT-OPTIONS: S_EBELN FOR WA_EKKO-EBELN,
                S_BUKRS FOR WA_EKKO-BUKRS,
                S_LIFNR FOR WA_EKKO-LIFNR,
                S_EKORG FOR WA_EKKO-EKORG.

SELECTION-SCREEN END OF BLOCK B1.

****************************************************************
*                   START-OF-SELECTION                         *
****************************************************************
START-OF-SELECTION.

  SELECT EBELN
         BUKRS
         LIFNR
         EKORG INTO TABLE IT_EKKO
               FROM EKKO
               WHERE EBELN IN S_EBELN
                 AND BUKRS IN S_BUKRS
                 AND LIFNR IN S_LIFNR
                 AND EKORG IN S_EKORG.

  IF NOT IT_EKKO[] IS INITIAL.
    SORT IT_EKKO BY EBELN.

    SELECT EBELN
           EBELP
           MATNR
           MATKL
           MENGE
           NETWR INTO TABLE IT_EKPO
                 FROM EKPO
                 FOR ALL ENTRIES IN IT_EKKO
                 WHERE EBELN = IT_EKKO-EBELN.

  ENDIF.

****************************************************************
*                     END-OF-SELECTION                         *
****************************************************************
END-OF-SELECTION.

  PERFORM BUILD_FIELDS USING 'EBELN' 'Purch Doc No' 10 'X' ' ' ' '.
  PERFORM BUILD_FIELDS USING 'BUKRS' 'Comp Code' 10 ' ' ' ' ' '.
  PERFORM BUILD_FIELDS USING 'LIFNR' 'Vendor' 10 ' ' ' ' ' '.
  PERFORM BUILD_FIELDS USING 'EKORG' 'POrg' 10 ' ' ' ' ' '.
  PERFORM BUILD_FIELDS USING 'EBELP' 'Item No' 10 ' ' ' ' ' '.
  PERFORM BUILD_FIELDS USING 'MATNR' 'Mat No' 10 ' ' 'C510' ' '.
  PERFORM BUILD_FIELDS USING 'MATKL' 'Mat Grp' 10 ' ' ' ' ' '.
  PERFORM BUILD_FIELDS USING 'MENGE' 'Qty' 10 ' ' ' ' ' '.
  PERFORM BUILD_FIELDS USING 'NETWR' 'Price' 10 ' ' ' ' 'X'.

  LOOP AT IT_EKPO INTO WA_EKPO.

    READ TABLE IT_EKKO INTO WA_EKKO WITH KEY EBELN = WA_EKPO-EBELN.

    IF SY-SUBRC = 0.

      MOVE: WA_EKKO-EBELN TO IT_ITAB-EBELN,
            WA_EKKO-BUKRS TO IT_ITAB-BUKRS,
            WA_EKKO-LIFNR TO IT_ITAB-LIFNR,
            WA_EKKO-EKORG TO IT_ITAB-EKORG.

    ENDIF.

    MOVE: WA_EKPO-EBELN TO IT_ITAB-EBELN,
          WA_EKPO-EBELP TO IT_ITAB-EBELP,
          WA_EKPO-MATNR TO IT_ITAB-MATNR,
          WA_EKPO-MATKL TO IT_ITAB-MATKL,
          WA_EKPO-MENGE TO IT_ITAB-MENGE,
          WA_EKPO-NETWR TO IT_ITAB-NETWR.

    APPEND IT_ITAB.
    CLEAR IT_ITAB.

  ENDLOOP.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
*     I_INTERFACE_CHECK                 = ' '
*     I_BYPASSING_BUFFER                = ' '
*     I_BUFFER_ACTIVE                   = ' '
     I_CALLBACK_PROGRAM                = SY-REPID
*     I_CALLBACK_PF_STATUS_SET          = ' '
     I_CALLBACK_USER_COMMAND           = 'SECOND_PAGE'
*     I_CALLBACK_TOP_OF_PAGE            = ' '
*     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*     I_CALLBACK_HTML_END_OF_LIST       = ' '
       I_STRUCTURE_NAME                  = 'TY_FINAL'
*     I_BACKGROUND_ID                   = ' '
*     I_GRID_TITLE                      =
*     I_GRID_SETTINGS                   =
*     IS_LAYOUT                         =
     IT_FIELDCAT                       = IT_FIELDS
*     IT_EXCLUDING                      =
*     IT_SPECIAL_GROUPS                 =
*     IT_SORT                           =
*     IT_FILTER                         =
*     IS_SEL_HIDE                       =
*     I_DEFAULT                         = 'X'
*     I_SAVE                            = ' '
*     IS_VARIANT                        =
*     IT_EVENTS                         =
*     IT_EVENT_EXIT                     =
*     IS_PRINT                          =
*     IS_REPREP_ID                      =
*     I_SCREEN_START_COLUMN             = 0
*     I_SCREEN_START_LINE               = 0
*     I_SCREEN_END_COLUMN               = 0
*     I_SCREEN_END_LINE                 = 0
*     I_HTML_HEIGHT_TOP                 = 0
*     I_HTML_HEIGHT_END                 = 0
*     IT_ALV_GRAPHICS                   =
*     IT_HYPERLINK                      =
*     IT_ADD_FIELDCAT                   =
*     IT_EXCEPT_QINFO                   =
*     IR_SALV_FULLSCREEN_ADAPTER        =
*   IMPORTING
*     E_EXIT_CAUSED_BY_CALLER           =
*     ES_EXIT_CAUSED_BY_USER            =
    TABLES
      T_OUTTAB                          = IT_ITAB
*   EXCEPTIONS
*     PROGRAM_ERROR                     = 1
*     OTHERS                            = 2
            .
  IF SY-SUBRC <> 0.
* Implement suitable error handling here
  ENDIF.
*&---------------------------------------------------------------------*
*&      Form  BUILD_FIELDS
*&---------------------------------------------------------------------*
FORM BUILD_FIELDS  USING    VALUE(P_0262)
                            VALUE(P_0263)
                            VALUE(P_10)
                            VALUE(P_0265)
                            VALUE(P_0266)
                            VALUE(P_0267).

  WA_FIELDS-FIELDNAME = P_0262.
  WA_FIELDS-SELTEXT_L = P_0263.
  WA_FIELDS-OUTPUTLEN = P_10.
  WA_FIELDS-KEY = P_0265.
  WA_FIELDS-EMPHASIZE = P_0266.
  WA_FIELDS-DO_SUM = P_0267.

  APPEND WA_FIELDS TO IT_FIELDS.
  CLEAR WA_FIELDS.


ENDFORM.                    " BUILD_FIELDS

*.........................................................

FORM SECOND_PAGE USING L_UCOMM TYPE SY-UCOMM
                       L_FIELD TYPE SLIS_SELFIELD.

  DATA L_VALUE TYPE MARA-MATNR.

  DATA IT_MARA TYPE TABLE OF MARA.

  IF L_FIELD-FIELDNAME = 'MATNR'.

    L_VALUE = L_FIELD-VALUE.

    SELECT * FROM MARA INTO TABLE IT_MARA WHERE MATNR = L_VALUE.

    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
     EXPORTING
*     I_INTERFACE_CHECK              = ' '
*     I_BYPASSING_BUFFER             =
*     I_BUFFER_ACTIVE                = ' '
*     I_CALLBACK_PROGRAM             = ' '
*     I_CALLBACK_PF_STATUS_SET       = ' '
*     I_CALLBACK_USER_COMMAND        = ' '
       I_STRUCTURE_NAME               = 'MARA'
*     IS_LAYOUT                      =
*     IT_FIELDCAT                    =
*     IT_EXCLUDING                   =
*     IT_SPECIAL_GROUPS              =
*     IT_SORT                        =
*     IT_FILTER                      =
*     IS_SEL_HIDE                    =
*     I_DEFAULT                      = 'X'
*     I_SAVE                         = ' '
*     IS_VARIANT                     =
*     IT_EVENTS                      =
*     IT_EVENT_EXIT                  =
*     IS_PRINT                       =
*     IS_REPREP_ID                   =
*     I_SCREEN_START_COLUMN          = 0
*     I_SCREEN_START_LINE            = 0
*     I_SCREEN_END_COLUMN            = 0
*     I_SCREEN_END_LINE              = 0
*     IR_SALV_LIST_ADAPTER           =
*     IT_EXCEPT_QINFO                =
*     I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
*   IMPORTING
*     E_EXIT_CAUSED_BY_CALLER        =
*     ES_EXIT_CAUSED_BY_USER         =
      TABLES
        T_OUTTAB                       = IT_MARA
*   EXCEPTIONS
*     PROGRAM_ERROR                  = 1
*     OTHERS                         = 2
              .
    IF SY-SUBRC <> 0.
* Implement suitable error handling here
    ENDIF.

  ENDIF.

ENDFORM.


input:


output:
list1:


list2:



52.  Examples:
REPORT  ZR_H107_ASSIGNMENT41.

TYPES: BEGIN OF TY_EKKO,
         EBELN TYPE EKKO-EBELN,
         BUKRS TYPE EKKO-BUKRS,
         LIFNR TYPE EKKO-LIFNR,
         EKORG TYPE EKKO-EKORG,
       END OF TY_EKKO.

DATA: IT_EKKO TYPE TABLE OF TY_EKKO,
      WA_EKKO LIKE LINE OF IT_EKKO.

TYPES: BEGIN OF TY_EKPO,
         EBELN TYPE EKPO-EBELN,
         EBELP TYPE EKPO-EBELP,
         MATNR TYPE EKPO-MATNR,
         MATKL TYPE EKPO-MATKL,
         MENGE TYPE EKPO-MENGE,
         NETWR TYPE EKPO-NETWR,
       END OF TY_EKPO.

DATA: IT_EKPO TYPE TABLE OF TY_EKPO,
      WA_EKPO LIKE LINE OF IT_EKPO.

TYPES: BEGIN OF TY_FINAL,
         EBELN TYPE EKKO-EBELN,
         BUKRS TYPE EKKO-BUKRS,
         LIFNR TYPE EKKO-LIFNR,
         EKORG TYPE EKKO-EKORG,
         EBELP TYPE EKPO-EBELP,
         MATNR TYPE EKPO-MATNR,
         MATKL TYPE EKPO-MATKL,
         MENGE TYPE EKPO-MENGE,
         NETWR TYPE EKPO-NETWR,
         CHK,
       END OF TY_FINAL.

DATA: IT_ITAB TYPE TY_FINAL OCCURS 0 WITH HEADER LINE.

DATA: IT_FIELDS TYPE SLIS_T_FIELDCAT_ALV.

DATA: WA_FIELDS TYPE SLIS_FIELDCAT_ALV.

SELECT-OPTIONS: S_EBELN FOR WA_EKKO-EBELN,
                S_BUKRS FOR WA_EKKO-BUKRS,
                S_LIFNR FOR WA_EKKO-LIFNR,
                S_EKORG FOR WA_EKKO-EKORG.

****************************************************************
*                       START-OF-SELECTION                     *
****************************************************************
START-OF-SELECTION.

  SELECT EBELN
         BUKRS
         LIFNR
         EKORG INTO TABLE IT_EKKO
               FROM EKKO
               WHERE EBELN IN S_EBELN
                 AND BUKRS IN S_BUKRS
                 AND LIFNR IN S_LIFNR
                 AND EKORG IN S_EKORG.

  IF NOT IT_EKKO[] IS INITIAL.
    SORT IT_EKKO BY EBELN.

    SELECT EBELN
           EBELP
           MATNR
           MATKL
           MENGE
           NETWR INTO TABLE IT_EKPO
                 FROM EKPO
                 FOR ALL ENTRIES IN IT_EKKO
                 WHERE EBELN = IT_EKKO-EBELN.

  ENDIF.

****************************************************************
*                         END-OF-SELECTION                     *
****************************************************************
END-OF-SELECTION.

  PERFORM BUILD_FIELDS USING 'CHK' 'Check' '10' 'X' ' ' ' ' 'X' 'X'.
  PERFORM BUILD_FIELDS USING 'EBELN' 'Purch Doc No' 10 'X' ' ' ' ' ' ' ' '.
  PERFORM BUILD_FIELDS USING 'BUKRS' 'Comp Code' 10 ' ' ' ' ' ' ' ' ' '.
  PERFORM BUILD_FIELDS USING 'LIFNR' 'Vendor' 10 ' ' ' ' ' ' ' ' ' '.
  PERFORM BUILD_FIELDS USING 'EKORG' 'POrg' 10 ' ' ' ' ' ' ' ' ' '.
  PERFORM BUILD_FIELDS USING 'EBELP' 'Item No' 10 ' ' ' ' ' ' ' ' ' '.
  PERFORM BUILD_FIELDS USING 'MATNR' 'Mat No' 10 ' ' ' ' ' ' ' ' ' '.
  PERFORM BUILD_FIELDS USING 'MATKL' 'Mat Grp' 10 ' ' ' ' ' ' ' ' ' '.
  PERFORM BUILD_FIELDS USING 'MENGE' 'Qty' 10 ' ' ' ' ' ' ' ' ' '.
  PERFORM BUILD_FIELDS USING 'NETWR' 'Price' 10 ' ' ' ' 'X' ' ' ' '.

  LOOP AT IT_EKPO INTO WA_EKPO.

    READ TABLE IT_EKKO INTO WA_EKKO WITH KEY EBELN = WA_EKPO-EBELN.

    IF SY-SUBRC = 0.

      MOVE: WA_EKKO-EBELN TO IT_ITAB-EBELN,
            WA_EKKO-BUKRS TO IT_ITAB-BUKRS,
            WA_EKKO-LIFNR TO IT_ITAB-LIFNR,
            WA_EKKO-EKORG TO IT_ITAB-EKORG.

    ENDIF.

    MOVE: WA_EKPO-EBELN TO IT_ITAB-EBELN,
          WA_EKPO-EBELP TO IT_ITAB-EBELP,
          WA_EKPO-MATNR TO IT_ITAB-MATNR,
          WA_EKPO-MATKL TO IT_ITAB-MATKL,
          WA_EKPO-MENGE TO IT_ITAB-MENGE,
          WA_EKPO-NETWR TO IT_ITAB-NETWR.

    APPEND IT_ITAB.
    CLEAR IT_ITAB.

  ENDLOOP.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
*     I_INTERFACE_CHECK                 = ' '
*     I_BYPASSING_BUFFER                = ' '
*     I_BUFFER_ACTIVE                   = ' '
     I_CALLBACK_PROGRAM                = SY-REPID
     I_CALLBACK_PF_STATUS_SET          = 'MENU_PAINT'
     I_CALLBACK_USER_COMMAND           = 'SECOND_PAGE'
*     I_CALLBACK_TOP_OF_PAGE            = ' '
*     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*     I_CALLBACK_HTML_END_OF_LIST       = ' '
*     I_STRUCTURE_NAME                  = ''
*     I_BACKGROUND_ID                   = ' '
*     I_GRID_TITLE                      =
*     I_GRID_SETTINGS                   =
*     IS_LAYOUT                         =
     IT_FIELDCAT                       = IT_FIELDS
*     IT_EXCLUDING                      =
*     IT_SPECIAL_GROUPS                 =
*     IT_SORT                           =
*     IT_FILTER                         =
*     IS_SEL_HIDE                       =
*     I_DEFAULT                         = 'X'
*     I_SAVE                            = ' '
*     IS_VARIANT                        =
*     IT_EVENTS                         =
*     IT_EVENT_EXIT                     =
*     IS_PRINT                          =
*     IS_REPREP_ID                      =
*     I_SCREEN_START_COLUMN             = 0
*     I_SCREEN_START_LINE               = 0
*     I_SCREEN_END_COLUMN               = 0
*     I_SCREEN_END_LINE                 = 0
*     I_HTML_HEIGHT_TOP                 = 0
*     I_HTML_HEIGHT_END                 = 0
*     IT_ALV_GRAPHICS                   =
*     IT_HYPERLINK                      =
*     IT_ADD_FIELDCAT                   =
*     IT_EXCEPT_QINFO                   =
*     IR_SALV_FULLSCREEN_ADAPTER        =
*   IMPORTING
*     E_EXIT_CAUSED_BY_CALLER           =
*     ES_EXIT_CAUSED_BY_USER            =
    TABLES
      T_OUTTAB                          = IT_ITAB
*   EXCEPTIONS
*     PROGRAM_ERROR                     = 1
*     OTHERS                            = 2
            .
  IF SY-SUBRC <> 0.
* Implement suitable error handling here
  ENDIF.
*&---------------------------------------------------------------------*
*&      Form  BUILD_FIELDS
*&---------------------------------------------------------------------*
FORM BUILD_FIELDS  USING    VALUE(P_0214)
                            VALUE(P_0215)
                            VALUE(P_10)
                            VALUE(P_0217)
                            VALUE(P_0218)
                            VALUE(P_0219)
                            VALUE(P_0220)
                            VALUE(P_0221).

  WA_FIELDS-FIELDNAME = P_0214.
  WA_FIELDS-SELTEXT_L = P_0215.
  WA_FIELDS-OUTPUTLEN = P_10.
  WA_FIELDS-KEY = P_0217.
  WA_FIELDS-EMPHASIZE = P_0218.
  WA_FIELDS-DO_SUM = P_0219.
  WA_FIELDS-CHECKBOX  = P_0220.
  WA_FIELDS-EDIT = P_0221.

  APPEND WA_FIELDS TO IT_FIELDS.
  CLEAR WA_FIELDS.


ENDFORM.                    " BUILD_FIELDS

*-----------------------------------------------------------------

FORM MENU_PAINT USING L_KEYINFO TYPE SLIS_T_EXTAB.

  SET PF-STATUS 'A01'.

ENDFORM.

*---------------------------------------------------------------------
FORM SECOND_PAGE USING L_UCOM  TYPE SY-UCOMM
                       L_FIELD TYPE SLIS_SELFIELD.
  IF L_UCOM EQ 'BUTTON'.

    DATA IT_MARA TYPE TABLE OF MARA.

    DATA L_GRID TYPE REF TO CL_GUI_ALV_GRID.

    RANGES R_MATNR FOR MARD-MATNR.

    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
      IMPORTING
        E_GRID = L_GRID.

    CALL METHOD L_GRID->CHECK_CHANGED_DATA.

    REFRESH R_MATNR[].

    LOOP AT IT_ITAB WHERE CHK = 'X'.

      R_MATNR-SIGN = 'I'.
      R_MATNR-OPTION = 'EQ'.
      R_MATNR-LOW = IT_ITAB-MATNR.

      APPEND R_MATNR.
      CLEAR  R_MATNR.

    ENDLOOP.

    IF NOT R_MATNR[] IS INITIAL.

      SELECT * FROM MARA INTO TABLE IT_MARA WHERE MATNR IN R_MATNR.

      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
     EXPORTING
*   I_INTERFACE_CHECK              = ' '
*   I_BYPASSING_BUFFER             =
*   I_BUFFER_ACTIVE                = ' '
*   I_CALLBACK_PROGRAM             = ' '
*   I_CALLBACK_PF_STATUS_SET       = ' '
*   I_CALLBACK_USER_COMMAND        = ' '
       I_STRUCTURE_NAME               = 'MARA'
*   IS_LAYOUT                      =
*   IT_FIELDCAT                    =
*   IT_EXCLUDING                   =
*   IT_SPECIAL_GROUPS              =
*   IT_SORT                        =
*   IT_FILTER                      =
*   IS_SEL_HIDE                    =
*   I_DEFAULT                      = 'X'
*   I_SAVE                         = ' '
*   IS_VARIANT                     =
*   IT_EVENTS                      =
*   IT_EVENT_EXIT                  =
*   IS_PRINT                       =
*   IS_REPREP_ID                   =
*   I_SCREEN_START_COLUMN          = 0
*   I_SCREEN_START_LINE            = 0
*   I_SCREEN_END_COLUMN            = 0
*   I_SCREEN_END_LINE              = 0
*   IR_SALV_LIST_ADAPTER           =
*   IT_EXCEPT_QINFO                =
*   I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER        =
*   ES_EXIT_CAUSED_BY_USER         =
      TABLES
        T_OUTTAB                       = IT_MARA
* EXCEPTIONS
*   PROGRAM_ERROR                  = 1
*   OTHERS                         = 2
              .
      IF SY-SUBRC <> 0.
* Implement suitable error handling here
      ENDIF.


    ENDIF.

  ENDIF.

ENDFORM.

input:


output:




53.  Examples:
REPORT  ZR_H107_ASSIGNMENT42.

TYPES:BEGIN OF T_LIKP,
       VBELN TYPE LIKP-VBELN,
       ERNAM TYPE LIKP-ERNAM,
       ERDAT TYPE LIKP-ERDAT,
       LDDAT TYPE LIKP-LDDAT,
       VKORG TYPE LIKP-VKORG,
      END OF T_LIKP.

TYPES:BEGIN OF T_LIPS,
        VBELN TYPE LIPS-VBELN,
        MATNR TYPE LIPS-MATNR,
        WERKS TYPE LIPS-WERKS,
        LGORT TYPE LIPS-LGORT,
        MATKL TYPE LIPS-MATKL,
      END OF T_LIPS.

DATA:IT_LIKP TYPE TABLE OF T_LIKP,
     IT_LIPS TYPE TABLE OF T_LIPS,
     WA_LIKP TYPE T_LIKP,
     WA_LIPS TYPE T_LIPS.

DATA: ITAB TYPE  VBAK OCCURS 0,
     WA   TYPE VBAK.


SELECT-OPTIONS:S_VBELN FOR WA_LIKP-VBELN,
               S_VKORG FOR WA_LIKP-VKORG.


*********************************************************
*                      START-OF-SELECTION               *
*********************************************************
START-OF-SELECTION.

 SELECT VBELN
        ERNAM
        ERDAT
        LDDAT
        VKORG INTO TABLE IT_LIKP
              FROM LIKP
              WHERE VBELN IN S_VBELN
              AND VKORG IN S_VKORG.



END-OF-SELECTION.

LOOP AT IT_LIKP INTO WA_LIKP.

    FORMAT COLOR 5 INVERSE.

 WRITE:/1 SY-VLINE,   2(10) WA_LIKP-VBELN HOTSPOT,
       12 SY-VLINE,  13(10) WA_LIKP-ERNAM,
       24 SY-VLINE,  25(15) WA_LIKP-ERDAT,
       41 SY-VLINE,  42(10) WA_LIKP-LDDAT,
       53 SY-VLINE,  54(10) WA_LIKP-VKORG HOTSPOT,
       65 SY-VLINE.

FORMAT COLOR OFF.
ENDLOOP.
ULINE AT /1(65).





*********************************************************************
TOP-OF-PAGE.
  ULINE.

  WRITE:/30 'DELIVERY Document Header Details'.

  ULINE.



*********************************************************************
*                            AT LINE-SELECTION                      *
*********************************************************************
AT LINE-SELECTION.

  DATA: G_FIELD(20) TYPE C,
        G_VALUE(10) TYPE N.

  GET CURSOR FIELD G_FIELD VALUE G_VALUE.

 IF G_FIELD EQ 'WA_LIKP-VBELN'.



 SELECT   VBELN
          MATNR
          WERKS
          LGORT
          MATKL INTO TABLE IT_LIPS
                 FROM LIPS
                 WHERE VBELN = G_VALUE.

 LOOP AT IT_LIPS INTO WA_LIPS.
      WRITE:/ WA_LIPS-VBELN,
              WA_LIPS-MATNR,
              WA_LIPS-WERKS,
              WA_LIPS-LGORT,
              WA_LIPS-MATKL.

       ENDLOOP.

  ELSEIF G_FIELD EQ 'WA_LIKP-VKORG'.



    SELECT * FROM VBAK INTO TABLE ITAB WHERE VKORG = G_VALUE.

   LOOP AT ITAB INTO WA.
      WRITE:/ WA-VBELN, WA-VKGRP, WA-VKBUR, WA-SPART.
    ENDLOOP.

  ENDIF.

.

**********************************************************************

TOP-OF-PAGE DURING LINE-SELECTION.

  ULINE.

  IF G_FIELD EQ 'WA_LIKP-VBELN'.

    WRITE:/30 'DELIVERY Document Item Details'.

  ELSEIF G_FIELD EQ 'WA_LIKP-VKORG'.

    WRITE:/30 'SALES ORGANIZATION Details'.

  ENDIF.

  ULINE.

input:


output:
list1.


list2.


54.  Examples:
REPORT  ZR_H107_ASSIGNMENT43 NO STANDARD PAGE HEADING.


INCLUDE ZR_H107_ASSIGNMENT43_01.    " Data declerations

INCLUDE ZR_H107_ASSIGNMENT43_02.    " Selection-Screen

INCLUDE ZR_H107_ASSIGNMENT43_03.    " Main Program

INCLUDE ZR_H107_ASSIGNMENT43_04.    " Form routines


*&---------------------------------------------------------------------*
*&  Include           ZR_H107_INTERACTIVEREPORTS_1
*&---------------------------------------------------------------------*


TYPES:BEGIN OF T_LIKP,
       VBELN TYPE LIKP-VBELN,
       ERNAM TYPE LIKP-ERNAM,
       ERDAT TYPE LIKP-ERDAT,
       LDDAT TYPE LIKP-LDDAT,
       VKORG TYPE LIKP-VKORG,
      END OF T_LIKP.

TYPES:BEGIN OF T_LIPS,
        VBELN TYPE LIPS-VBELN,
        MATNR TYPE LIPS-MATNR,
        WERKS TYPE LIPS-WERKS,
        LGORT TYPE LIPS-LGORT,
        MATKL TYPE LIPS-MATKL,
      END OF T_LIPS.

DATA:IT_LIKP TYPE TABLE OF T_LIKP,
     IT_LIPS TYPE TABLE OF T_LIPS,
     WA_LIKP TYPE T_LIKP,
     WA_LIPS TYPE T_LIPS.

DATA: ITAB TYPE  VBAK OCCURS 0,
     WA   TYPE VBAK.


*&---------------------------------------------------------------------*
*&  Include           ZR_H107_INTERACTIVEREPORTS_2
*&---------------------------------------------------------------------*


SELECT-OPTIONS:S_VBELN FOR WA_LIKP-VBELN,
               S_VKORG FOR WA_LIKP-VKORG.


*&---------------------------------------------------------------------*
*&  Include           ZR_H107_INTERACTIVEREPORTS_3
*&---------------------------------------------------------------------*

PERFORM READ_LIKP TABLES S_VBELN
                         S_VKORG
                         IT_LIKP.



END-OF-SELECTION.

PERFORM PROCESS_DATA TABLES IT_LIKP.

TOP-OF-PAGE.


PERFORM PROCESS_DATA1 TABLES IT_LIKP.


AT LINE-SELECTION.


PERFORM PROCESS_DATA2 TABLES IT_LIKP.


TOP-OF-PAGE DURING LINE-SELECTION.


PERFORM PROCESS_DATA3 TABLES IT_LIKP.


*&---------------------------------------------------------------------*
*&  Include           ZR_H107_INTERACTIVEREPORTS_4
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Form  READ_LIKP
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_S_VBELN  text
*      -->P_S_VKORG  text
*      -->P_IT_LIKP  text
*----------------------------------------------------------------------*
FORM READ_LIKP  TABLES   P_S_VBELN STRUCTURE S_VBELN
                         P_S_VKORG STRUCTURE S_VKORG
                         P_IT_LIKP STRUCTURE WA_LIKP.

 SELECT VBELN
        ERNAM
        ERDAT
        LDDAT
        VKORG INTO TABLE IT_LIKP
              FROM LIKP
              WHERE VBELN IN S_VBELN
              AND VKORG IN S_VKORG.



ENDFORM.                    " READ_LIKP
*&---------------------------------------------------------------------*
*&      Form  PROCESS_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_IT_LIKP  text
*----------------------------------------------------------------------*
FORM PROCESS_DATA  TABLES   P_IT_LIKP STRUCTURE WA_LIKP.


 WRITE:/1 SY-VLINE,   2(10) 'DELIVERY NUM',
       12 SY-VLINE,  13(10) 'ERNAM',
       24 SY-VLINE,  25(15) 'DATE',
       41 SY-VLINE,  42(10) 'LOADED DATE',
       53 SY-VLINE,  54(10) 'SALES DC NUM',
       65 SY-VLINE.
ULINE AT /1(65).

        LOOP AT IT_LIKP INTO WA_LIKP.

    FORMAT COLOR 5 INVERSE.

 WRITE:/1 SY-VLINE,   2(10) WA_LIKP-VBELN HOTSPOT,
       12 SY-VLINE,  13(10) WA_LIKP-ERNAM,
       24 SY-VLINE,  25(15) WA_LIKP-ERDAT,
       41 SY-VLINE,  42(10) WA_LIKP-LDDAT,
       53 SY-VLINE,  54(10) WA_LIKP-VKORG HOTSPOT,
       65 SY-VLINE.

FORMAT COLOR OFF.
ULINE AT /1(65).

ENDLOOP.





ENDFORM.                    " PROCESS_DATA
*&---------------------------------------------------------------------*
*&      Form  PROCESS_DATA1
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_IT_LIKP  text
*----------------------------------------------------------------------*
FORM PROCESS_DATA1  TABLES   P_IT_LIKP STRUCTURE  WA_LIKP.

ULINE AT /1(65).

  WRITE:/30 'DELIVERY Document Header Details'.

ULINE AT /1(65).



ENDFORM.                    " PROCESS_DATA1
*&---------------------------------------------------------------------*
*&      Form  PROCESS_DATA2
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_IT_LIKP  text
*----------------------------------------------------------------------*
FORM PROCESS_DATA2  TABLES   P_IT_LIKP STRUCTURE  WA_LIKP.


 DATA:G_FIELD(20) TYPE C,
      G_VALUE(10) TYPE C,
      G_VALUE1(10) TYPE N.

  GET CURSOR FIELD G_FIELD VALUE G_VALUE.

 IF G_FIELD EQ 'WA_LIKP-VBELN'.

G_VALUE1 = G_VALUE.

 SELECT   VBELN
          MATNR
          WERKS
          LGORT
          MATKL INTO TABLE IT_LIPS
                 FROM LIPS
                 WHERE VBELN = G_VALUE1.

   WRITE:/1 SY-VLINE,   2(10) 'SALES DOC NUM',
         12 SY-VLINE,  13(10) 'MATERIAL NUM',
         24 SY-VLINE,  25(15) 'PLANT',
         41 SY-VLINE,  42(10) 'STORAGE LOCATION',
         53 SY-VLINE,  54(10) 'MATERIAL GROUP',
         65 SY-VLINE.
      ULINE AT /1(65).

 LOOP AT IT_LIPS INTO WA_LIPS.

  FORMAT COLOR 5 INVERSE.

      WRITE:/1 SY-VLINE,   2(10) WA_LIPS-VBELN,
            12 SY-VLINE,  13(10) WA_LIPS-MATNR,
            24 SY-VLINE,  25(15) WA_LIPS-WERKS,
            41 SY-VLINE,  42(10) WA_LIPS-LGORT,
            53 SY-VLINE,  54(10) WA_LIPS-MATKL,
            65 SY-VLINE.
FORMAT COLOR OFF.
ULINE AT /1(65).

       ENDLOOP.

  ELSEIF G_FIELD EQ 'WA_LIKP-VKORG'.

       WRITE:/1 SY-VLINE,   2(10) 'SALES DOC NUM',
             12 SY-VLINE,  13(10) 'SALES GROUP',
             24 SY-VLINE,  25(15) 'SALES OFFICE',
             41 SY-VLINE,  42(10) 'DIVISION',
             65 SY-VLINE.

             ULINE AT /1(65).


    SELECT * FROM VBAK INTO TABLE ITAB WHERE VKORG = G_VALUE.

   LOOP AT ITAB INTO WA.

   FORMAT COLOR 5 INVERSE.

      WRITE:/1 SY-VLINE,    2(10) WA-VBELN,
             12 SY-VLINE,  13(10) WA-VKGRP,
             24 SY-VLINE,  25(15) WA-VKBUR,
             41 SY-VLINE,  42(10) WA-SPART,
             65 SY-VLINE.

             FORMAT COLOR OFF.

    ULINE AT /1(65).

    ENDLOOP.



  ENDIF.

ENDFORM.                    " PROCESS_DATA2
*&---------------------------------------------------------------------*
*&      Form  PROCESS_DATA3
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_IT_LIKP  text
*----------------------------------------------------------------------*
FORM PROCESS_DATA3  TABLES   P_IT_LIKP STRUCTURE WA_LIKP.

 DATA: G_FIELD(20) TYPE C,
        G_VALUE(10) TYPE N.


ULINE AT /1(65).

  IF G_FIELD EQ 'WA_LIKP-VBELN'.

    WRITE:/30 'DELIVERY Document Item Details'.

  ELSEIF G_FIELD EQ 'WA_LIKP-VKORG'.

    WRITE:/30 'SALES ORGANIZATION Details'.

  ENDIF.

ULINE AT /1(65).

ENDFORM.                    " PROCESS_DATA3


input:


output:
list1:


list2:



55.  Examples:
REPORT  ZR_H107_ASSIGNMENT44.



TYPES:BEGIN OF T_LIKP,
       VBELN TYPE LIKP-VBELN,
       ERNAM TYPE LIKP-ERNAM,
       ERDAT TYPE LIKP-ERDAT,
       LDDAT TYPE LIKP-LDDAT,
       VKORG TYPE LIKP-VKORG,
      END OF T_LIKP.

TYPES:BEGIN OF T_LIPS,
        VBELN TYPE LIPS-VBELN,
        MATNR TYPE LIPS-MATNR,
        WERKS TYPE LIPS-WERKS,
        LGORT TYPE LIPS-LGORT,
        MATKL TYPE LIPS-MATKL,
      END OF T_LIPS.

DATA:IT_LIKP TYPE TABLE OF T_LIKP,
     IT_LIPS TYPE TABLE OF T_LIPS,
     WA_LIKP TYPE T_LIKP,
     WA_LIPS TYPE T_LIPS.

DATA: ITAB TYPE  VBAK OCCURS 0,
     WA   TYPE VBAK.


SELECT-OPTIONS:S_VBELN FOR WA_LIKP-VBELN,
               S_VKORG FOR WA_LIKP-VKORG.


*********************************************************
*                      START-OF-SELECTION               *
*********************************************************
START-OF-SELECTION.

 SELECT VBELN
        ERNAM
        ERDAT
        LDDAT
        VKORG INTO TABLE IT_LIKP
              FROM LIKP
              WHERE VBELN IN S_VBELN
              AND VKORG IN S_VKORG.



END-OF-SELECTION.

LOOP AT IT_LIKP INTO WA_LIKP.

    FORMAT COLOR 5 INVERSE.

 WRITE:/1 SY-VLINE,   2(10) WA_LIKP-VBELN HOTSPOT,
       12 SY-VLINE,  13(10) WA_LIKP-ERNAM,
       24 SY-VLINE,  25(15) WA_LIKP-ERDAT,
       41 SY-VLINE,  42(10) WA_LIKP-LDDAT,
       53 SY-VLINE,  54(10) WA_LIKP-VKORG HOTSPOT,
       65 SY-VLINE.

FORMAT COLOR OFF.
ENDLOOP.
ULINE AT /1(65).





*********************************************************************
TOP-OF-PAGE.
  ULINE.

  WRITE:/30 'DELIVERY Document Header Details'.

  ULINE.



*********************************************************************
*                            AT LINE-SELECTION                      *
*********************************************************************
AT LINE-SELECTION.

  DATA: G_FIELD(20) TYPE C,
        G_VALUE(10) TYPE N.

  GET CURSOR FIELD G_FIELD VALUE G_VALUE.

 IF G_FIELD EQ 'WA_LIKP-VBELN'.



 SELECT   VBELN
          MATNR
          WERKS
          LGORT
          MATKL INTO TABLE IT_LIPS
                 FROM LIPS
                 WHERE VBELN = G_VALUE.

 LOOP AT IT_LIPS INTO WA_LIPS.
      WRITE:/ WA_LIPS-VBELN,
              WA_LIPS-MATNR,
              WA_LIPS-WERKS,
              WA_LIPS-LGORT,
              WA_LIPS-MATKL.

       ENDLOOP.

  ELSEIF G_FIELD EQ 'WA_LIKP-VKORG'.



    SELECT * FROM VBAK INTO TABLE ITAB WHERE VKORG = G_VALUE.

   LOOP AT ITAB INTO WA.
      WRITE:/ WA-VBELN, WA-VKGRP, WA-VKBUR, WA-SPART.
    ENDLOOP.

  ENDIF.

.

**********************************************************************

TOP-OF-PAGE DURING LINE-SELECTION.

  ULINE.

  IF G_FIELD EQ 'WA_LIKP-VBELN'.

    WRITE:/30 'DELIVERY Document Item Details'.

  ELSEIF G_FIELD EQ 'WA_LIKP-VKORG'.

    WRITE:/30 'SALES ORGANIZATION Details'.

  ENDIF.

  ULINE.
input:


output:
list1.





list2.



47.  Examples:
REPORT  ZR_H107_ASSIGNMENT45 NO STANDARD PAGE HEADING.



TYPES:BEGIN OF T_LIKP,
        VKORG TYPE LIKP-VKORG,
        KUNNR TYPE LIKP-KUNNR,
        VBELN TYPE LIKP-VBELN,
        VSTEL TYPE LIKP-VSTEL,
        LFART TYPE LIKP-LFART,
        LDDAT TYPE LIKP-LDDAT,
        LFDAT TYPE LIKP-LFDAT,
    END OF T_LIKP.
TYPES:BEGIN OF T_LIPS,
         VBELN TYPE LIKP-VBELN,
         POSNR TYPE LIPS-POSNR,
         MATNR TYPE LIPS-MATNR,
         MATKL TYPE LIPS-MATKL,
         LFIMG TYPE LIPS-LFIMG,
         MEINS TYPE LIPS-MEINS,
         BRGEW TYPE LIPS-BRGEW,
         GEWEI TYPE LIPS-GEWEI,
     END OF T_LIPS.


TYPES:BEGIN OF T_LIKP1 ,
        VBELN TYPE LIKP-VBELN,
        CHK(1) TYPE  C,
        VKORG TYPE LIKP-VKORG,
        KUNNR TYPE LIKP-KUNNR,
        VSTEL TYPE LIKP-VSTEL,
        LFART TYPE LIKP-LFART,
        LDDAT TYPE LIKP-LDDAT,
        LFDAT TYPE LIKP-LFDAT,
        DELDAYS TYPE I,
        POSNR TYPE LIPS-POSNR,
        MATNR TYPE LIPS-MATNR,
        MATKL TYPE LIPS-MATKL,
        LFIMG TYPE LIPS-LFIMG,
        MEINS TYPE LIPS-MEINS,
        BRGEW TYPE LIPS-BRGEW,
        GEWEI TYPE LIPS-GEWEI,
      END OF T_LIKP1.

DATA: IT_LIKP TYPE TABLE OF T_LIKP,
      WA_LIKP TYPE T_LIKP,
      IT_LIPS TYPE TABLE OF T_LIPS,
      WA_LIPS TYPE T_LIPS,
      IT_LIKP1 TYPE TABLE OF T_LIKP1,
      WA_LIKP1 TYPE T_LIKP1.


TYPE-POOLS SLIS.
DATA: IT_HEADER TYPE SLIS_T_LISTHEADER,
      WA_HEADER TYPE SLIS_LISTHEADER,
      IT_FIELDS TYPE SLIS_T_FIELDCAT_ALV,
      WA_FIELDS TYPE SLIS_FIELDCAT_ALV,
      IT_SORT  TYPE SLIS_T_SORTINFO_ALV,
      WA_SORT  TYPE SLIS_SORTINFO_ALV,
      WA_LAYOUT TYPE SLIS_LAYOUT_ALV.




**************
SELECT-OPTIONS: S_VKORG FOR WA_LIKP-VKORG NO INTERVALS,
                S_KUNNR FOR WA_LIKP-KUNNR.

INITIALIZATION.

  S_VKORG-SIGN = 'I'.
  S_VKORG-OPTION = 'EQ'.
  S_VKORG-LOW = 1000.
  APPEND S_VKORG.
  CLEAR S_VKORG.


  S_VKORG-SIGN = 'I'.
  S_VKORG-OPTION = 'EQ'.
  S_VKORG-LOW = 2000.
  APPEND S_VKORG.
  CLEAR S_VKORG.

  S_VKORG-SIGN = 'I'.
  S_VKORG-OPTION = 'EQ'.
  S_VKORG-LOW = 3000.
  APPEND S_VKORG.
  CLEAR S_VKORG.



START-OF-SELECTION.
  SELECT VKORG
         KUNNR
         VBELN
         VSTEL
         LFART
         LDDAT
         LFDAT INTO  CORRESPONDING FIELDS OF TABLE IT_LIKP
               FROM LIKP
               WHERE VKORG IN S_VKORG
                 AND KUNNR IN S_KUNNR.
  IF NOT IT_LIKP[] IS INITIAL.
    SELECT VBELN
           POSNR
           MATNR
           MATKL
           LFIMG
           MEINS
           BRGEW
           GEWEI INTO CORRESPONDING FIELDS OF TABLE IT_LIPS
                 FROM LIPS
                 FOR ALL ENTRIES IN IT_LIKP
                 WHERE VBELN = IT_LIKP-VBELN.
  ENDIF.

END-OF-SELECTION.

LOOP AT  IT_LIPS INTO WA_LIPS.


    READ TABLE IT_LIKP INTO WA_LIKP WITH KEY VBELN = WA_LIPS-VBELN.
    MOVE:     WA_LIKP-VBELN   TO  WA_LIKP1-VBELN,
              WA_LIKP-VKORG   TO  WA_LIKP1-VKORG,
              WA_LIKP-KUNNR   TO  WA_LIKP1-KUNNR,
              WA_LIKP-VSTEL   TO  WA_LIKP1-VSTEL,
              WA_LIKP-LFART   TO  WA_LIKP1-LFART,
              WA_LIKP-LDDAT   TO  WA_LIKP1-LDDAT,
              WA_LIKP-LFDAT   TO  WA_LIKP1-LFDAT,
              WA_LIPS-POSNR   TO  WA_LIKP1-POSNR,
              WA_LIPS-MATNR   TO  WA_LIKP1-MATNR,
              WA_LIPS-MATKL   TO  WA_LIKP1-MATKL,
              WA_LIPS-LFIMG   TO  WA_LIKP1-LFIMG,
              WA_LIPS-MEINS   TO  WA_LIKP1-MEINS,
              WA_LIPS-BRGEW   TO  WA_LIKP1-BRGEW,
              WA_LIPS-GEWEI   TO  WA_LIKP1-GEWEI.
    APPEND WA_LIKP1 TO IT_LIKP1 .
    CLEAR WA_LIKP1.


  ENDLOOP.
  WA_LIKP1-DELDAYS = WA_LIKP-LFDAT - WA_LIKP-LDDAT.

  PERFORM BUILD_FIELDS USING 'KUNNR' 'CUSTOMER' 15 'X' ' ' ' ' 'C201  ' .

  PERFORM BUILD_FIELDS USING 'VBELN' 'DELIVERY' 20 ' ' 'X ' ' ' 'C101 '.

  PERFORM BUILD_FIELDS USING 'VSTEL' 'SHIPING POINT' 15 ' ' ' ' ' ' 'C301 '.

  PERFORM BUILD_FIELDS USING 'VKORG' 'SALES' 20 ' ' ' ' ' ' 'C310 '.

  PERFORM BUILD_FIELDS USING 'LFART' 'DELIVERY TYPE' 20 ' ' ' ' ' ' ' '.

  PERFORM BUILD_FIELDS USING 'LDDAT' 'LOADING DATE' 15 ' ' ' ' '__-__-____ ' 'C501 '.

  PERFORM BUILD_FIELDS USING 'LFDAT' 'DELIVERY DATE' 15 ' ' ' ' '__-__-____ ' 'C501 '.

  PERFORM BUILD_FIELDS USING 'POSNR' 'DELIVERY ITEM' 15 ' ' ' ' ' ' 'C610 '.

  PERFORM BUILD_FIELDS USING 'MATNR' 'MATIRIAL NO' 15 ' ' ' ' ' ' ' '.

  PERFORM BUILD_FIELDS USING 'MATKL' 'MATIRIAL GROUP' 15 ' ' ' ' ' ' ' '.

  PERFORM BUILD_FIELDS USING 'LFIMG' 'QUANTITY' 15 ' ' ' ' ' ' ' '.

  PERFORM BUILD_FIELDS USING 'MEINS' 'MESURE' 15 ' ' ' ' ' ' 'C501 '.

  PERFORM BUILD_FIELDS USING 'BRGEW' 'GROSS WEIGHT' 15 ' ' ' ' ' ' 'C601 '.

  PERFORM BUILD_FIELDS USING 'GEWEI' 'WEIGHT UNIT' 15 ' ' ' ' ' ' 'C701 '.



  WA_LAYOUT-ZEBRA = 'X'.
  WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.

*--
  WA_SORT-FIELDNAME = 'VBELN'.
  WA_SORT-UP      = 'X'.
  WA_SORT-SUBTOT  = 'X'.

  APPEND WA_SORT TO IT_SORT.



  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                = ' '
*   I_BUFFER_ACTIVE                   = ' '
    I_CALLBACK_PROGRAM                =  SY-CPROG

*   I_CALLBACK_PF_STATUS_SET          = ' '
*   I_CALLBACK_USER_COMMAND           = ' '
     I_CALLBACK_TOP_OF_PAGE            =  'PAGE'
*   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*   I_CALLBACK_HTML_END_OF_LIST       = ' '
*   I_STRUCTURE_NAME                  =
*   I_BACKGROUND_ID                   = ' '
*   I_GRID_TITLE                      =
*   I_GRID_SETTINGS                   =
     IS_LAYOUT                         = WA_LAYOUT

     IT_FIELDCAT                       = IT_FIELDS
*   IT_EXCLUDING                      =
*   IT_SPECIAL_GROUPS                 =
      IT_SORT                           = IT_SORT

*   IT_FILTER                         =
*   IS_SEL_HIDE                       =
*   I_DEFAULT                         = 'X'
*   I_SAVE                            = ' '
*   IS_VARIANT                        =
*   IT_EVENTS                         =
*   IT_EVENT_EXIT                     =
*   IS_PRINT                          =
*   IS_REPREP_ID                      =
*   I_SCREEN_START_COLUMN             = 0
*   I_SCREEN_START_LINE               = 0
*   I_SCREEN_END_COLUMN               = 0
*   I_SCREEN_END_LINE                 = 0
*   I_HTML_HEIGHT_TOP                 = 0
*   I_HTML_HEIGHT_END                 = 0
*   IT_ALV_GRAPHICS                   =
*   IT_HYPERLINK                      =
*   IT_ADD_FIELDCAT                   =
*   IT_EXCEPT_QINFO                   =
*   IR_SALV_FULLSCREEN_ADAPTER        =
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER           =
*   ES_EXIT_CAUSED_BY_USER            =
    TABLES
      T_OUTTAB                          = IT_LIKP1

* EXCEPTIONS
*   PROGRAM_ERROR                     = 1
*   OTHERS                            = 2
            .
  IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.









*&---------------------------------------------------------------------*
*&      Form  BUILD_FIELDS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_0385   text
*      -->P_0386   text
*      -->P_0387   text
*----------------------------------------------------------------------*
FORM PAGE .

WA_HEADER-TYP  = 'H'.
WA_HEADER-INFO = 'Delivery Document Header Details'.

  APPEND WA_HEADER TO IT_HEADER.

  WA_HEADER-TYP  = 'A'.
  WA_HEADER-INFO = 'System Date:'.
  WA_HEADER-KEY  = 'System Date:'.


  CONCATENATE SY-DATUM+6(2)
              SY-DATUM+4(2)
              SY-DATUM+0(4) INTO WA_HEADER-INFO SEPARATED BY '-'.

  APPEND WA_HEADER TO IT_HEADER.

  WA_HEADER-TYP  = 'A'.
  WA_HEADER-INFO = 'delivery Document Header Details'.

  APPEND WA_HEADER TO IT_HEADER.

  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      IT_LIST_COMMENTARY       = IT_HEADER
  I_LOGO                   = 'ZH100'
*   I_END_OF_LIST_GRID       =
*   I_ALV_FORM               =
            .




ENDFORM.                    " PAGE




FORM BUILD_FIELDS  USING    VALUE(P_0385)
                            VALUE(P_0386)
                            VALUE(P_0387)
                            VALUE(P_0388)
                            VALUE(P_0389)
                            VALUE(P_0390)
                            VALUE(P_0391).
  WA_FIELDS-FIELDNAME = P_0385.
  WA_FIELDS-SELTEXT_L = P_0386.
  WA_FIELDS-OUTPUTLEN = P_0387.
  WA_FIELDS-KEY       = P_0388.
  WA_FIELDS-DO_SUM    = P_0389.
  WA_FIELDS-EDIT_MASK = P_0390.
  WA_FIELDS-EMPHASIZE = P_0391.


  APPEND WA_FIELDS TO IT_FIELDS.
  CLEAR  WA_FIELDS.



ENDFORM.                    " BUILD_FIELDS
*&---------------------------------------------------------------------*
*&      Form  PAGE
*&---------------------------------------------------------------------*
REPORT  ZR_H107_ASSIGNMENT45 NO STANDARD PAGE HEADING.



TYPES:BEGIN OF T_LIKP,
        VKORG TYPE LIKP-VKORG,
        KUNNR TYPE LIKP-KUNNR,
        VBELN TYPE LIKP-VBELN,
        VSTEL TYPE LIKP-VSTEL,
        LFART TYPE LIKP-LFART,
        LDDAT TYPE LIKP-LDDAT,
        LFDAT TYPE LIKP-LFDAT,
    END OF T_LIKP.
TYPES:BEGIN OF T_LIPS,
         VBELN TYPE LIKP-VBELN,
         POSNR TYPE LIPS-POSNR,
         MATNR TYPE LIPS-MATNR,
         MATKL TYPE LIPS-MATKL,
         LFIMG TYPE LIPS-LFIMG,
         MEINS TYPE LIPS-MEINS,
         BRGEW TYPE LIPS-BRGEW,
         GEWEI TYPE LIPS-GEWEI,
     END OF T_LIPS.


TYPES:BEGIN OF T_LIKP1 ,
        VBELN TYPE LIKP-VBELN,
        CHK(1) TYPE  C,
        VKORG TYPE LIKP-VKORG,
        KUNNR TYPE LIKP-KUNNR,
        VSTEL TYPE LIKP-VSTEL,
        LFART TYPE LIKP-LFART,
        LDDAT TYPE LIKP-LDDAT,
        LFDAT TYPE LIKP-LFDAT,
        DELDAYS TYPE I,
        POSNR TYPE LIPS-POSNR,
        MATNR TYPE LIPS-MATNR,
        MATKL TYPE LIPS-MATKL,
        LFIMG TYPE LIPS-LFIMG,
        MEINS TYPE LIPS-MEINS,
        BRGEW TYPE LIPS-BRGEW,
        GEWEI TYPE LIPS-GEWEI,
      END OF T_LIKP1.

DATA: IT_LIKP TYPE TABLE OF T_LIKP,
      WA_LIKP TYPE T_LIKP,
      IT_LIPS TYPE TABLE OF T_LIPS,
      WA_LIPS TYPE T_LIPS,
      IT_LIKP1 TYPE TABLE OF T_LIKP1,
      WA_LIKP1 TYPE T_LIKP1.


TYPE-POOLS SLIS.
DATA: IT_HEADER TYPE SLIS_T_LISTHEADER,
      WA_HEADER TYPE SLIS_LISTHEADER,
      IT_FIELDS TYPE SLIS_T_FIELDCAT_ALV,
      WA_FIELDS TYPE SLIS_FIELDCAT_ALV,
      IT_SORT  TYPE SLIS_T_SORTINFO_ALV,
      WA_SORT  TYPE SLIS_SORTINFO_ALV,
      WA_LAYOUT TYPE SLIS_LAYOUT_ALV.




**************
SELECT-OPTIONS: S_VKORG FOR WA_LIKP-VKORG NO INTERVALS,
                S_KUNNR FOR WA_LIKP-KUNNR.

INITIALIZATION.

  S_VKORG-SIGN = 'I'.
  S_VKORG-OPTION = 'EQ'.
  S_VKORG-LOW = 1000.
  APPEND S_VKORG.
  CLEAR S_VKORG.


  S_VKORG-SIGN = 'I'.
  S_VKORG-OPTION = 'EQ'.
  S_VKORG-LOW = 2000.
  APPEND S_VKORG.
  CLEAR S_VKORG.

  S_VKORG-SIGN = 'I'.
  S_VKORG-OPTION = 'EQ'.
  S_VKORG-LOW = 3000.
  APPEND S_VKORG.
  CLEAR S_VKORG.



START-OF-SELECTION.
  SELECT VKORG
         KUNNR
         VBELN
         VSTEL
         LFART
         LDDAT
         LFDAT INTO  CORRESPONDING FIELDS OF TABLE IT_LIKP
               FROM LIKP
               WHERE VKORG IN S_VKORG
                 AND KUNNR IN S_KUNNR.
  IF NOT IT_LIKP[] IS INITIAL.
    SELECT VBELN
           POSNR
           MATNR
           MATKL
           LFIMG
           MEINS
           BRGEW
           GEWEI INTO CORRESPONDING FIELDS OF TABLE IT_LIPS
                 FROM LIPS
                 FOR ALL ENTRIES IN IT_LIKP
                 WHERE VBELN = IT_LIKP-VBELN.
  ENDIF.

END-OF-SELECTION.

LOOP AT  IT_LIPS INTO WA_LIPS.


    READ TABLE IT_LIKP INTO WA_LIKP WITH KEY VBELN = WA_LIPS-VBELN.
    MOVE:     WA_LIKP-VBELN   TO  WA_LIKP1-VBELN,
              WA_LIKP-VKORG   TO  WA_LIKP1-VKORG,
              WA_LIKP-KUNNR   TO  WA_LIKP1-KUNNR,
              WA_LIKP-VSTEL   TO  WA_LIKP1-VSTEL,
              WA_LIKP-LFART   TO  WA_LIKP1-LFART,
              WA_LIKP-LDDAT   TO  WA_LIKP1-LDDAT,
              WA_LIKP-LFDAT   TO  WA_LIKP1-LFDAT,
              WA_LIPS-POSNR   TO  WA_LIKP1-POSNR,
              WA_LIPS-MATNR   TO  WA_LIKP1-MATNR,
              WA_LIPS-MATKL   TO  WA_LIKP1-MATKL,
              WA_LIPS-LFIMG   TO  WA_LIKP1-LFIMG,
              WA_LIPS-MEINS   TO  WA_LIKP1-MEINS,
              WA_LIPS-BRGEW   TO  WA_LIKP1-BRGEW,
              WA_LIPS-GEWEI   TO  WA_LIKP1-GEWEI.
    APPEND WA_LIKP1 TO IT_LIKP1 .
    CLEAR WA_LIKP1.


  ENDLOOP.
  WA_LIKP1-DELDAYS = WA_LIKP-LFDAT - WA_LIKP-LDDAT.

  PERFORM BUILD_FIELDS USING 'KUNNR' 'CUSTOMER' 15 'X' ' ' ' ' 'C201  ' .

  PERFORM BUILD_FIELDS USING 'VBELN' 'DELIVERY' 20 ' ' 'X ' ' ' 'C101 '.

  PERFORM BUILD_FIELDS USING 'VSTEL' 'SHIPING POINT' 15 ' ' ' ' ' ' 'C301 '.

  PERFORM BUILD_FIELDS USING 'VKORG' 'SALES' 20 ' ' ' ' ' ' 'C310 '.

  PERFORM BUILD_FIELDS USING 'LFART' 'DELIVERY TYPE' 20 ' ' ' ' ' ' ' '.

  PERFORM BUILD_FIELDS USING 'LDDAT' 'LOADING DATE' 15 ' ' ' ' '__-__-____ ' 'C501 '.

  PERFORM BUILD_FIELDS USING 'LFDAT' 'DELIVERY DATE' 15 ' ' ' ' '__-__-____ ' 'C501 '.

  PERFORM BUILD_FIELDS USING 'POSNR' 'DELIVERY ITEM' 15 ' ' ' ' ' ' 'C610 '.

  PERFORM BUILD_FIELDS USING 'MATNR' 'MATIRIAL NO' 15 ' ' ' ' ' ' ' '.

  PERFORM BUILD_FIELDS USING 'MATKL' 'MATIRIAL GROUP' 15 ' ' ' ' ' ' ' '.

  PERFORM BUILD_FIELDS USING 'LFIMG' 'QUANTITY' 15 ' ' ' ' ' ' ' '.

  PERFORM BUILD_FIELDS USING 'MEINS' 'MESURE' 15 ' ' ' ' ' ' 'C501 '.

  PERFORM BUILD_FIELDS USING 'BRGEW' 'GROSS WEIGHT' 15 ' ' ' ' ' ' 'C601 '.

  PERFORM BUILD_FIELDS USING 'GEWEI' 'WEIGHT UNIT' 15 ' ' ' ' ' ' 'C701 '.



  WA_LAYOUT-ZEBRA = 'X'.
  WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.

*--
  WA_SORT-FIELDNAME = 'VBELN'.
  WA_SORT-UP      = 'X'.
  WA_SORT-SUBTOT  = 'X'.

  APPEND WA_SORT TO IT_SORT.



  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                = ' '
*   I_BUFFER_ACTIVE                   = ' '
    I_CALLBACK_PROGRAM                =  SY-CPROG

*   I_CALLBACK_PF_STATUS_SET          = ' '
*   I_CALLBACK_USER_COMMAND           = ' '
     I_CALLBACK_TOP_OF_PAGE            =  'PAGE'
*   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*   I_CALLBACK_HTML_END_OF_LIST       = ' '
*   I_STRUCTURE_NAME                  =
*   I_BACKGROUND_ID                   = ' '
*   I_GRID_TITLE                      =
*   I_GRID_SETTINGS                   =
     IS_LAYOUT                         = WA_LAYOUT

     IT_FIELDCAT                       = IT_FIELDS
*   IT_EXCLUDING                      =
*   IT_SPECIAL_GROUPS                 =
      IT_SORT                           = IT_SORT

*   IT_FILTER                         =
*   IS_SEL_HIDE                       =
*   I_DEFAULT                         = 'X'
*   I_SAVE                            = ' '
*   IS_VARIANT                        =
*   IT_EVENTS                         =
*   IT_EVENT_EXIT                     =
*   IS_PRINT                          =
*   IS_REPREP_ID                      =
*   I_SCREEN_START_COLUMN             = 0
*   I_SCREEN_START_LINE               = 0
*   I_SCREEN_END_COLUMN               = 0
*   I_SCREEN_END_LINE                 = 0
*   I_HTML_HEIGHT_TOP                 = 0
*   I_HTML_HEIGHT_END                 = 0
*   IT_ALV_GRAPHICS                   =
*   IT_HYPERLINK                      =
*   IT_ADD_FIELDCAT                   =
*   IT_EXCEPT_QINFO                   =
*   IR_SALV_FULLSCREEN_ADAPTER        =
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER           =
*   ES_EXIT_CAUSED_BY_USER            =
    TABLES
      T_OUTTAB                          = IT_LIKP1

* EXCEPTIONS
*   PROGRAM_ERROR                     = 1
*   OTHERS                            = 2
            .
  IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.









*&---------------------------------------------------------------------*
*&      Form  BUILD_FIELDS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_0385   text
*      -->P_0386   text
*      -->P_0387   text
*----------------------------------------------------------------------*
FORM PAGE .

WA_HEADER-TYP  = 'H'.
WA_HEADER-INFO = 'Delivery Document Header Details'.

  APPEND WA_HEADER TO IT_HEADER.

  WA_HEADER-TYP  = 'A'.
  WA_HEADER-INFO = 'System Date:'.
  WA_HEADER-KEY  = 'System Date:'.


  CONCATENATE SY-DATUM+6(2)
              SY-DATUM+4(2)
              SY-DATUM+0(4) INTO WA_HEADER-INFO SEPARATED BY '-'.

  APPEND WA_HEADER TO IT_HEADER.

  WA_HEADER-TYP  = 'A'.
  WA_HEADER-INFO = 'delivery Document Header Details'.

  APPEND WA_HEADER TO IT_HEADER.

  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      IT_LIST_COMMENTARY       = IT_HEADER
  I_LOGO                   = 'ZH100'
*   I_END_OF_LIST_GRID       =
*   I_ALV_FORM               =
            .




ENDFORM.                    " PAGE




FORM BUILD_FIELDS  USING    VALUE(P_0385)
                            VALUE(P_0386)
                            VALUE(P_0387)
                            VALUE(P_0388)
                            VALUE(P_0389)
                            VALUE(P_0390)
                            VALUE(P_0391).
  WA_FIELDS-FIELDNAME = P_0385.
  WA_FIELDS-SELTEXT_L = P_0386.
  WA_FIELDS-OUTPUTLEN = P_0387.
  WA_FIELDS-KEY       = P_0388.
  WA_FIELDS-DO_SUM    = P_0389.
  WA_FIELDS-EDIT_MASK = P_0390.
  WA_FIELDS-EMPHASIZE = P_0391.


  APPEND WA_FIELDS TO IT_FIELDS.
  CLEAR  WA_FIELDS.



ENDFORM.                    " BUILD_FIELDS
*&---------------------------------------------------------------------*
*&      Form  PAGE
*&---------------------------------------------------------------------*

input:


output:



47.  Examples:
REPORT  ZR_H107_ASSIGNMENT46 NO STANDARD PAGE HEADING LINE-SIZE 350.

TYPES:BEGIN OF T_LIKP,
         VKORG TYPE LIKP-VKORG,
         KUNNR TYPE LIKP-KUNNR,
         VBELN TYPE LIKP-VBELN,
         VSTEL TYPE LIKP-VSTEL,
         LFART TYPE LIKP-LFART,
         LDDAT TYPE LIKP-LDDAT,
         LFDAT TYPE LIKP-LFDAT,
END OF T_LIKP.
TYPES:BEGIN OF T_LIPS,
         VBELN TYPE LIKP-VBELN,
         POSNR TYPE LIPS-POSNR,
         MATNR TYPE LIPS-MATNR,
         MATKL TYPE LIPS-MATKL,
         LFIMG TYPE LIPS-LFIMG,
         MEINS TYPE LIPS-MEINS,
         BRGEW TYPE LIPS-BRGEW,
         GEWEI TYPE LIPS-GEWEI,
         VGBEL TYPE LIPS-VGBEL,
     END OF T_LIPS.


TYPES:BEGIN OF T_LIKP1 ,
         CHK(1) TYPE C,
         VKORG TYPE LIKP-VKORG,
         KUNNR TYPE LIKP-KUNNR,
         VBELN TYPE LIKP-VBELN,
         VSTEL TYPE LIKP-VSTEL,
         LFART TYPE LIKP-LFART,
         LDDAT TYPE LIKP-LDDAT,
         LFDAT TYPE LIKP-LFDAT,
         POSNR TYPE LIPS-POSNR,
         MATNR TYPE LIPS-MATNR,
         MATKL TYPE LIPS-MATKL,
         LFIMG TYPE LIPS-LFIMG,
         MEINS TYPE LIPS-MEINS,
         BRGEW TYPE LIPS-BRGEW,
         GEWEI TYPE LIPS-GEWEI,
         VGBEL TYPE LIPS-VGBEL,
      END OF T_LIKP1.
DATA:IT_LIKP TYPE TABLE OF T_LIKP,
     IT_LIPS TYPE TABLE OF T_LIPS,
     IT_LIKP1 TYPE TABLE OF T_LIKP1,
     WA_LIKP TYPE T_LIKP,
     WA_LIPS TYPE T_LIPS,
     WA_LIKP1 TYPE T_LIKP1.


TYPE-POOLS SLIS.

DATA:IT_FIELDS TYPE SLIS_T_FIELDCAT_ALV,
     IT_SORT   TYPE SLIS_T_SORTINFO_ALV,
     WA_FIELDS TYPE SLIS_FIELDCAT_ALV,
     WA_SORT   TYPE SLIS_SORTINFO_ALV,
     WA_LAYOUT TYPE SLIS_LAYOUT_ALV.

SELECT-OPTIONS: S_VKORG FOR WA_LIKP-VKORG NO INTERVALS,
                S_KUNNR FOR WA_LIKP-KUNNR.

*****************************************************************************
*                    START OF SELECTION                                     *
*****************************************************************************
START-OF-SELECTION.
  SELECT VKORG
         KUNNR
         VBELN
         VSTEL
         LFART
         LDDAT
         LFDAT INTO TABLE IT_LIKP
         FROM LIKP
         WHERE VKORG IN S_VKORG
           AND KUNNR IN S_KUNNR.
  IF NOT IT_LIKP[] IS INITIAL.
    SELECT VBELN
           POSNR
           MATNR
           MATKL
           LFIMG
           MEINS
           BRGEW
           GEWEI
           VGBEL INTO TABLE IT_LIPS
                 FROM LIPS
                 FOR ALL ENTRIES IN IT_LIKP
                 WHERE VBELN = IT_LIKP-VBELN.
  ENDIF.

*****************************************************************************
*                      END OF SELECTION                                     *
*****************************************************************************
END-OF-SELECTION.
  LOOP AT  IT_LIPS INTO WA_LIPS.
    READ TABLE IT_LIKP INTO WA_LIKP WITH KEY VBELN = WA_LIPS-VBELN.
    MOVE:WA_LIKP-VBELN   TO  WA_LIKP1-VBELN,
         WA_LIKP-VKORG   TO  WA_LIKP1-VKORG,
         WA_LIKP-KUNNR   TO  WA_LIKP1-KUNNR,
         WA_LIKP-VSTEL   TO  WA_LIKP1-VSTEL,
         WA_LIKP-LFART   TO  WA_LIKP1-LFART,
         WA_LIKP-LDDAT   TO  WA_LIKP1-LDDAT,
         WA_LIKP-LFDAT   TO  WA_LIKP1-LFDAT,
         WA_LIPS-POSNR   TO  WA_LIKP1-POSNR,
         WA_LIPS-MATNR   TO  WA_LIKP1-MATNR,
         WA_LIPS-MATKL   TO  WA_LIKP1-MATKL,
         WA_LIPS-LFIMG   TO  WA_LIKP1-LFIMG,
         WA_LIPS-MEINS   TO  WA_LIKP1-MEINS,
         WA_LIPS-BRGEW   TO  WA_LIKP1-BRGEW,
         WA_LIPS-GEWEI   TO  WA_LIKP1-GEWEI,
         WA_LIPS-VGBEL   TO  WA_LIKP1-VGBEL.
    APPEND WA_LIKP1 TO IT_LIKP1 .
    CLEAR WA_LIKP1.


  ENDLOOP.

  PERFORM BUILD_FIELDS USING 'CHK'   'Check Box'      10 'X' ' ' ' '           ' ' 'X' 'X' ' '.
  PERFORM BUILD_FIELDS USING 'VBELN' 'DELIVERY'       20 'X' ' ' ' '           ' ' ' ' ' ' ' '.
  PERFORM BUILD_FIELDS USING 'VSTEL' 'SHIPING POINT'  15 ' ' ' ' ' '           'C501 ' ' ' ' ' ' '.

  PERFORM BUILD_FIELDS USING 'VKORG' 'SALES'          20 ' ' ' ' ' '           'C301 ' ' ' ' ' ' '.
  PERFORM BUILD_FIELDS USING 'LFART' 'DELIVERY TYPE'  20 ' ' ' ' ' '           'C410 ' ' ' ' ' ' '.


  PERFORM BUILD_FIELDS USING 'KUNNR' 'CUSTOMER'       15 ' ' ' ' ' '           'C701 ' ' ' ' ' ' '.

  PERFORM BUILD_FIELDS USING 'POSNR' 'DELIVERY ITEM'  15 ' ' ' ' ' '           ' ' ' ' ' ' ' ' .

  PERFORM BUILD_FIELDS USING 'MATNR' 'MATIRIAL NO'    15 ' ' ' ' ' '           ' ' ' ' ' ' ' ' .

  PERFORM BUILD_FIELDS USING 'MATKL' 'MATIRIAL GROUP' 15 ' ' ' ' ' '           ' ' ' ' ' ' ' ' .

  PERFORM BUILD_FIELDS USING 'LFIMG' 'QUANTITY'       15 ' ' ' ' ' '           'C201 ' ' ' ' ' ' ' .
  PERFORM BUILD_FIELDS USING 'MEINS' 'MESURE'         15 ' ' ' ' ' '           ' ' ' ' ' ' ' ' .

  PERFORM BUILD_FIELDS USING 'BRGEW' 'GROSS WEIGHT'   15 ' ' ' ' ' '           'C110 ' ' ' ' ' ' '.

  PERFORM BUILD_FIELDS USING 'GEWEI' 'WEIGHT UNIT'    15 ' ' ' ' ' '           ' ' ' ' ' ' ' ' .

  PERFORM BUILD_FIELDS USING 'VGBEL' 'SALES NO'       15 ' ' ' ' ' '           ' ' ' ' ' ' 'X'.


  WA_SORT-FIELDNAME = 'VBELN'.
  WA_SORT-UP      = 'X'.
  WA_SORT-SUBTOT  = 'X'.




  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
*     I_INTERFACE_CHECK                 = ' '
*     I_BYPASSING_BUFFER                = ' '
*     I_BUFFER_ACTIVE                   = ' '
     I_CALLBACK_PROGRAM                = SY-CPROG
    I_CALLBACK_PF_STATUS_SET          = 'MENU_PAINT'
     I_CALLBACK_USER_COMMAND           = 'SECOND_PAGE'
     I_CALLBACK_TOP_OF_PAGE            = 'TOP_PAGE'
*     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*     I_CALLBACK_HTML_END_OF_LIST       = ' '
*     I_STRUCTURE_NAME                  =
*     I_BACKGROUND_ID                   = ' '
*     I_GRID_TITLE                      =
*     I_GRID_SETTINGS                   =
     IS_LAYOUT                         = WA_LAYOUT
     IT_FIELDCAT                       = IT_FIELDS
*     IT_EXCLUDING                      =
*     IT_SPECIAL_GROUPS                 =
      IT_SORT                           = IT_SORT
*     IT_FILTER                         =
*     IS_SEL_HIDE                       =
*     I_DEFAULT                         = 'X'
*     I_SAVE                            = ' '
*     IS_VARIANT                        =
*     IT_EVENTS                         =
*     IT_EVENT_EXIT                     =
*     IS_PRINT                          =
*     IS_REPREP_ID                      =
*     I_SCREEN_START_COLUMN             = 0
*     I_SCREEN_START_LINE               = 0
*     I_SCREEN_END_COLUMN               = 0
*     I_SCREEN_END_LINE                 = 0
*     I_HTML_HEIGHT_TOP                 = 0
*     I_HTML_HEIGHT_END                 = 0
*     IT_ALV_GRAPHICS                   =
*     IT_HYPERLINK                      =
*     IT_ADD_FIELDCAT                   =
*     IT_EXCEPT_QINFO                   =
*     IR_SALV_FULLSCREEN_ADAPTER        =
*   IMPORTING
*     E_EXIT_CAUSED_BY_CALLER           =
*     ES_EXIT_CAUSED_BY_USER            =
    TABLES
      T_OUTTAB                          = IT_LIKP1
*   EXCEPTIONS
*     PROGRAM_ERROR                     = 1
*     OTHERS                            = 2
            .
  IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


*&---------------------------------------------------------------------*
*&      Form  TOP_PAGE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM TOP_PAGE.


DATA IT_HEADER TYPE SLIS_T_LISTHEADER.
  DATA WA_HEADER TYPE SLIS_LISTHEADER.

  WA_HEADER-TYP  = 'H'.
  WA_HEADER-INFO = 'DELIVERY DOCUMENT  DETAILS'.

  APPEND WA_HEADER TO IT_HEADER.

  WA_HEADER-TYP  = 'S'.
  WA_HEADER-KEY  = 'System Date:'.
  WA_HEADER-INFO = 'SY-DATUM'.

  CONCATENATE SY-DATUM+6(2)
              SY-DATUM+4(2)
              SY-DATUM+0(4) INTO WA_HEADER-INFO SEPARATED BY '-'.

  APPEND WA_HEADER TO IT_HEADER.

  WA_HEADER-TYP  = 'A'.
  WA_HEADER-INFO = 'DELIVERY DOCUMENT  DETAILS'.

  APPEND WA_HEADER TO IT_HEADER.

  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      IT_LIST_COMMENTARY       = IT_HEADER
      I_LOGO                   = 'ZH100'
*     I_END_OF_LIST_GRID       =
*     I_ALV_FORM               =
            .




ENDFORM.                    "TOP_PAGE




*&---------------------------------------------------------------------*
*&      Form  BUILD_FIELDS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_0388   text
*      -->P_0389   text
*      -->P_10     text
*      -->P_0391   text
*      -->P_0392   text
*      -->P_0393   text
*      -->P_0394   text
*      -->P_0395   text
*      -->P_0396   text
*      -->P_0397   text
*----------------------------------------------------------------------*
FORM BUILD_FIELDS  USING    VALUE(P_0388)
                            VALUE(P_0389)
                            VALUE(P_0390)
                            VALUE(P_0391)
                            VALUE(P_0392)
                            VALUE(P_0393)
                            VALUE(P_0394)
                            VALUE(P_0395)
                            VALUE(P_0396)
                            VALUE(P_0397).

  WA_FIELDS-FIELDNAME = P_0388.
  WA_FIELDS-SELTEXT_L = P_0389.
  WA_FIELDS-OUTPUTLEN = P_0390.
  WA_FIELDS-KEY       = P_0391.
  WA_FIELDS-DO_SUM    = P_0392.
  WA_FIELDS-EDIT_MASK = P_0393.
  WA_FIELDS-EMPHASIZE = P_0394.
  WA_FIELDS-CHECKBOX  = P_0395.
  WA_FIELDS-EDIT      = P_0396.
  WA_FIELDS-HOTSPOT   = P_0397.

  APPEND WA_FIELDS TO IT_FIELDS.
  CLEAR  WA_FIELDS.

ENDFORM.                    " BUILD_FIELDS


*&---------------------------------------------------------------------*
*&      Form  MENU_PAINT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM MENU_PAINT USING L_FCODE TYPE SLIS_T_EXTAB.

  SET PF-STATUS 'ZPSLV1'.

ENDFORM.                    "MENU_PAINT


*&---------------------------------------------------------------------*
*&      Form  SECOND_PAGE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM SECOND_PAGE USING F_CODE  TYPE SY-UCOMM
                       F_FIELD TYPE SLIS_SELFIELD.


  DATA I_GRID TYPE REF TO CL_GUI_ALV_GRID.


  RANGES: R_VGBEL FOR WA_LIKP1-VGBEL.
  REFRESH IT_FIELDS[].
  IF I_GRID IS INITIAL.




    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
*    EXPORTING
*                            IR_SALV_FULLSCREEN_ADAPTER       =
                          IMPORTING
*                            ET_EXCLUDING                     =
*                            E_REPID                          =
*                            E_CALLBACK_PROGRAM               =
*                            E_CALLBACK_ROUTINE               =
        E_GRID                                                = I_GRID
*                            ET_FIELDCAT_LVC                  =
*                            ER_TRACE                         =
*                            E_FLG_NO_HTML                    =
*                            ES_LAYOUT_KKBLO                  =
*                            ES_SEL_HIDE                      =
*                            ET_EVENT_EXIT                    =
*                            ER_FORM_TOL                      =
*                            ER_FORM_EOL                      =
    .

  ENDIF.



  IF NOT I_GRID IS INITIAL.
    CALL METHOD I_GRID->CHECK_CHANGED_DATA.
  ENDIF.


  LOOP AT IT_LIKP1 INTO WA_LIKP1  WHERE CHK = 'X'.

    R_VGBEL-SIGN   = 'I'.
    R_VGBEL-OPTION = 'EQ'.
    R_VGBEL-LOW    = WA_LIKP1-VGBEL.

    APPEND R_VGBEL.
  ENDLOOP.

  TYPES:BEGIN OF T_VBAK,
            VBELN  TYPE  VBAK-VBELN,
            ERDAT  TYPE  VBAK-ERDAT,
            VKORG  TYPE  VBAK-VKORG,
            KUNNR  TYPE  VBAK-KUNNR,
            ERNAM  TYPE  VBAK-ERNAM,
         END OF T_VBAK.
  TYPES:BEGIN OF T_VBAP,
            VBELN  TYPE  VBAP-VBELN,
            POSNR  TYPE  VBAP-POSNR,
            MATNR  TYPE  VBAP-MATNR,
            KWMENG  TYPE  VBAP-KWMENG,
            NETWR  TYPE  VBAP-NETWR,
            TOTAL(10)  TYPE  N,
         END OF T_VBAP.
  TYPES:BEGIN OF T_VBAK1 ,
           KUNNR  TYPE VBAK-KUNNR,
           VBELN  TYPE VBAK-VBELN,
           ERDAT(25),
           VKORG  TYPE  VBAK-VKORG,
           ERNAM  TYPE  VBAK-ERNAM,
           POSNR  TYPE VBAP-POSNR,
           MATNR  TYPE VBAP-MATNR,
           KWMENG  TYPE  VBAP-KWMENG,
           NETWR  TYPE  VBAP-NETWR,
           TOTAL(10)  TYPE  N,
         END OF T_VBAK1.


   DATA:VAR1(15) TYPE C,
        ERDAT(15) TYPE C.






  DATA:IT_VBAK TYPE TABLE OF T_VBAK,
       IT_VBAP TYPE TABLE OF T_VBAP,
       IT_VBAK1 TYPE TABLE OF T_VBAK1,
       WA_VBAK TYPE T_VBAK,
       WA_VBAP TYPE T_VBAP,
       WA_VBAK1 TYPE T_VBAK1.



  IF F_CODE EQ 'CHECK'.


    SELECT VBELN
             ERDAT
             VKORG
             KUNNR
             ERNAM INTO TABLE IT_VBAK
                    FROM VBAK
                    WHERE VBELN IN R_VGBEL.
    IF NOT IT_VBAK[] IS INITIAL.
      SELECT VBELN
             POSNR
             MATNR
             KWMENG
             NETWR INTO TABLE IT_VBAP
                   FROM VBAP
                   FOR ALL ENTRIES IN IT_VBAK
                   WHERE VBELN = IT_VBAK-VBELN.
    ENDIF.


    DATA :DD LIKE  T247-MNR,
          LT LIKE  T247-LTX.


  LOOP AT  IT_VBAP INTO WA_VBAP.
      READ TABLE IT_VBAK INTO WA_VBAK WITH KEY VBELN = WA_VBAP-VBELN.
*      TOTAL = WA_VBAK1-KWMENG * WA_VBAK1-NETWR .


      DD  = WA_VBAK-ERDAT+4(2).
  CALL FUNCTION 'ISP_GET_MONTH_NAME'
      EXPORTING
   DATE               = WA_VBAK-ERDAT
    LANGUAGE           = SY-LANGU
**    MONTH_NUMBER       =
    IMPORTING
*   LANGU_BACK         =
    LONGTEXT           = LT
*   SHORTTEXT          =
* EXCEPTIONS
*   CALENDAR_ID        = 1
*   DATE_ERROR         = 2
*   NOT_FOUND          = 3
*   WRONG_INPUT        = 4
*   OTHERS             = 5
              .
    IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.



    CONCATENATE WA_VBAK-ERDAT+6(2)

                LT
                WA_VBAK-ERDAT+0(4) INTO ERDAT SEPARATED BY '-'.



      MOVE:    WA_VBAK-VBELN   TO  WA_VBAK1-VBELN,
               WA_VBAK-VKORG   TO  WA_VBAK1-VKORG,
               WA_VBAK-KUNNR   TO  WA_VBAK1-KUNNR,
*              WA_VBAK-ERDAT   TO  WA_VBAK1-ERDAT,
               ERDAT           TO  WA_VBAK1-ERDAT,
               WA_VBAP-POSNR   TO  WA_VBAK1-POSNR,
               WA_VBAK-ERNAM   TO  WA_VBAK1-ERNAM,
               WA_VBAP-MATNR   TO  WA_VBAK1-MATNR,
               WA_VBAP-KWMENG  TO  WA_VBAK1-KWMENG,
               WA_VBAP-NETWR  TO  WA_VBAK1-NETWR.

      APPEND WA_VBAK1 TO IT_VBAK1.
      CLEAR WA_VBAK1.

    ENDLOOP.


    IF NOT R_VGBEL[] IS INITIAL.

      PERFORM BUILD_S_FIELDS USING 'VBELN' 'Sales Document' ' ' ' '.
      PERFORM BUILD_S_FIELDS USING 'ERDAT' 'Date' 'C501' 25 .
      PERFORM BUILD_S_FIELDS USING 'VKORG' 'Sales Organization' ' ' ' '.
      PERFORM BUILD_S_FIELDS USING 'KUNNR' 'Sold to party' 'C210' ' '.
      PERFORM BUILD_S_FIELDS USING 'ERNAM' 'ernam' 'C301' ' '.
      PERFORM BUILD_S_FIELDS USING 'POSNR' ' sales document item' 'C610' ' '.
      PERFORM BUILD_S_FIELDS USING 'MATNR' 'material number' 'C710' ' '.
      PERFORM BUILD_S_FIELDS USING 'KEMENG' 'Sold-to party' ' ' ' '.
      PERFORM BUILD_S_FIELDS USING 'NETWR' 'Net Value ' ' ' ' '.


      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                = ' '
*   I_BUFFER_ACTIVE                   = ' '
*   I_CALLBACK_PROGRAM                = ' '
*   I_CALLBACK_PF_STATUS_SET          = ' '
*   I_CALLBACK_USER_COMMAND           = ' '
*   I_CALLBACK_TOP_OF_PAGE            = ' '
*   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*   I_CALLBACK_HTML_END_OF_LIST       = ' '
*   I_STRUCTURE_NAME                  =
*   I_BACKGROUND_ID                   = ' '
*   I_GRID_TITLE                      =
*   I_GRID_SETTINGS                   =
*   IS_LAYOUT                         =
     IT_FIELDCAT                        = IT_FIELDS

*      IT_EXCLUDING                   =
*   IT_SPECIAL_GROUPS                 =
*   IT_SORT                           =
*   IT_FILTER                         =
*   IS_SEL_HIDE                       =
*   I_DEFAULT                         = 'X'
*   I_SAVE                            = ' '
*   IS_VARIANT                        =
*   IT_EVENTS                         =
*   IT_EVENT_EXIT                     =
*   IS_PRINT                          =
*   IS_REPREP_ID                      =
*   I_SCREEN_START_COLUMN             = 0
*   I_SCREEN_START_LINE               = 0
*   I_SCREEN_END_COLUMN               = 0
*   I_SCREEN_END_LINE                 = 0
*   I_HTML_HEIGHT_TOP                 = 0
*   I_HTML_HEIGHT_END                 = 0
*   IT_ALV_GRAPHICS                   =
*   IT_HYPERLINK                      =
*   IT_ADD_FIELDCAT                   =
*   IT_EXCEPT_QINFO                   =
*   IR_SALV_FULLSCREEN_ADAPTER        =
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER           =
*   ES_EXIT_CAUSED_BY_USER            =
        TABLES
          T_OUTTAB                          = IT_VBAK1
* EXCEPTIONS
*   PROGRAM_ERROR                     = 1
*   OTHERS                            = 2
                .
      IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDIF.
  ENDIF.

ENDFORM.                    "SECOND_PAGE
*&---------------------------------------------------------------------*
*&      Form  BUILD_S_FIELDS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_0964   text
*      -->P_0965   text
*      -->P_0966   text
*----------------------------------------------------------------------*
FORM BUILD_S_FIELDS  USING    VALUE(P_0964)
                              VALUE(P_0965)
                              VALUE(P_0966)
                              VALUE(P_0967).




  WA_FIELDS-FIELDNAME = P_0964.
  WA_FIELDS-SELTEXT_L = P_0965.
  WA_FIELDS-EMPHASIZE = P_0966.
  WA_FIELDS-OUTPUTLEN = P_0967.



  APPEND WA_FIELDS TO IT_FIELDS.
  CLEAR WA_FIELDS.

ENDFORM.                    " BUILD_S_FIELDS
REPORT  ZR_H107_ASSIGNMENT46 NO STANDARD PAGE HEADING LINE-SIZE 350.

TYPES:BEGIN OF T_LIKP,
         VKORG TYPE LIKP-VKORG,
         KUNNR TYPE LIKP-KUNNR,
         VBELN TYPE LIKP-VBELN,
         VSTEL TYPE LIKP-VSTEL,
         LFART TYPE LIKP-LFART,
         LDDAT TYPE LIKP-LDDAT,
         LFDAT TYPE LIKP-LFDAT,
END OF T_LIKP.
TYPES:BEGIN OF T_LIPS,
         VBELN TYPE LIKP-VBELN,
         POSNR TYPE LIPS-POSNR,
         MATNR TYPE LIPS-MATNR,
         MATKL TYPE LIPS-MATKL,
         LFIMG TYPE LIPS-LFIMG,
         MEINS TYPE LIPS-MEINS,
         BRGEW TYPE LIPS-BRGEW,
         GEWEI TYPE LIPS-GEWEI,
         VGBEL TYPE LIPS-VGBEL,
     END OF T_LIPS.


TYPES:BEGIN OF T_LIKP1 ,
         CHK(1) TYPE C,
         VKORG TYPE LIKP-VKORG,
         KUNNR TYPE LIKP-KUNNR,
         VBELN TYPE LIKP-VBELN,
         VSTEL TYPE LIKP-VSTEL,
         LFART TYPE LIKP-LFART,
         LDDAT TYPE LIKP-LDDAT,
         LFDAT TYPE LIKP-LFDAT,
         POSNR TYPE LIPS-POSNR,
         MATNR TYPE LIPS-MATNR,
         MATKL TYPE LIPS-MATKL,
         LFIMG TYPE LIPS-LFIMG,
         MEINS TYPE LIPS-MEINS,
         BRGEW TYPE LIPS-BRGEW,
         GEWEI TYPE LIPS-GEWEI,
         VGBEL TYPE LIPS-VGBEL,
      END OF T_LIKP1.
DATA:IT_LIKP TYPE TABLE OF T_LIKP,
     IT_LIPS TYPE TABLE OF T_LIPS,
     IT_LIKP1 TYPE TABLE OF T_LIKP1,
     WA_LIKP TYPE T_LIKP,
     WA_LIPS TYPE T_LIPS,
     WA_LIKP1 TYPE T_LIKP1.


TYPE-POOLS SLIS.

DATA:IT_FIELDS TYPE SLIS_T_FIELDCAT_ALV,
     IT_SORT   TYPE SLIS_T_SORTINFO_ALV,
     WA_FIELDS TYPE SLIS_FIELDCAT_ALV,
     WA_SORT   TYPE SLIS_SORTINFO_ALV,
     WA_LAYOUT TYPE SLIS_LAYOUT_ALV.

SELECT-OPTIONS: S_VKORG FOR WA_LIKP-VKORG NO INTERVALS,
                S_KUNNR FOR WA_LIKP-KUNNR.

*****************************************************************************
*                    START OF SELECTION                                     *
*****************************************************************************
START-OF-SELECTION.
  SELECT VKORG
         KUNNR
         VBELN
         VSTEL
         LFART
         LDDAT
         LFDAT INTO TABLE IT_LIKP
         FROM LIKP
         WHERE VKORG IN S_VKORG
           AND KUNNR IN S_KUNNR.
  IF NOT IT_LIKP[] IS INITIAL.
    SELECT VBELN
           POSNR
           MATNR
           MATKL
           LFIMG
           MEINS
           BRGEW
           GEWEI
           VGBEL INTO TABLE IT_LIPS
                 FROM LIPS
                 FOR ALL ENTRIES IN IT_LIKP
                 WHERE VBELN = IT_LIKP-VBELN.
  ENDIF.

*****************************************************************************
*                      END OF SELECTION                                     *
*****************************************************************************
END-OF-SELECTION.
  LOOP AT  IT_LIPS INTO WA_LIPS.
    READ TABLE IT_LIKP INTO WA_LIKP WITH KEY VBELN = WA_LIPS-VBELN.
    MOVE:WA_LIKP-VBELN   TO  WA_LIKP1-VBELN,
         WA_LIKP-VKORG   TO  WA_LIKP1-VKORG,
         WA_LIKP-KUNNR   TO  WA_LIKP1-KUNNR,
         WA_LIKP-VSTEL   TO  WA_LIKP1-VSTEL,
         WA_LIKP-LFART   TO  WA_LIKP1-LFART,
         WA_LIKP-LDDAT   TO  WA_LIKP1-LDDAT,
         WA_LIKP-LFDAT   TO  WA_LIKP1-LFDAT,
         WA_LIPS-POSNR   TO  WA_LIKP1-POSNR,
         WA_LIPS-MATNR   TO  WA_LIKP1-MATNR,
         WA_LIPS-MATKL   TO  WA_LIKP1-MATKL,
         WA_LIPS-LFIMG   TO  WA_LIKP1-LFIMG,
         WA_LIPS-MEINS   TO  WA_LIKP1-MEINS,
         WA_LIPS-BRGEW   TO  WA_LIKP1-BRGEW,
         WA_LIPS-GEWEI   TO  WA_LIKP1-GEWEI,
         WA_LIPS-VGBEL   TO  WA_LIKP1-VGBEL.
    APPEND WA_LIKP1 TO IT_LIKP1 .
    CLEAR WA_LIKP1.


  ENDLOOP.

  PERFORM BUILD_FIELDS USING 'CHK'   'Check Box'      10 'X' ' ' ' '           ' ' 'X' 'X' ' '.
  PERFORM BUILD_FIELDS USING 'VBELN' 'DELIVERY'       20 'X' ' ' ' '           ' ' ' ' ' ' ' '.
  PERFORM BUILD_FIELDS USING 'VSTEL' 'SHIPING POINT'  15 ' ' ' ' ' '           'C501 ' ' ' ' ' ' '.

  PERFORM BUILD_FIELDS USING 'VKORG' 'SALES'          20 ' ' ' ' ' '           'C301 ' ' ' ' ' ' '.
  PERFORM BUILD_FIELDS USING 'LFART' 'DELIVERY TYPE'  20 ' ' ' ' ' '           'C410 ' ' ' ' ' ' '.


  PERFORM BUILD_FIELDS USING 'KUNNR' 'CUSTOMER'       15 ' ' ' ' ' '           'C701 ' ' ' ' ' ' '.

  PERFORM BUILD_FIELDS USING 'POSNR' 'DELIVERY ITEM'  15 ' ' ' ' ' '           ' ' ' ' ' ' ' ' .

  PERFORM BUILD_FIELDS USING 'MATNR' 'MATIRIAL NO'    15 ' ' ' ' ' '           ' ' ' ' ' ' ' ' .

  PERFORM BUILD_FIELDS USING 'MATKL' 'MATIRIAL GROUP' 15 ' ' ' ' ' '           ' ' ' ' ' ' ' ' .

  PERFORM BUILD_FIELDS USING 'LFIMG' 'QUANTITY'       15 ' ' ' ' ' '           'C201 ' ' ' ' ' ' ' .
  PERFORM BUILD_FIELDS USING 'MEINS' 'MESURE'         15 ' ' ' ' ' '           ' ' ' ' ' ' ' ' .

  PERFORM BUILD_FIELDS USING 'BRGEW' 'GROSS WEIGHT'   15 ' ' ' ' ' '           'C110 ' ' ' ' ' ' '.

  PERFORM BUILD_FIELDS USING 'GEWEI' 'WEIGHT UNIT'    15 ' ' ' ' ' '           ' ' ' ' ' ' ' ' .

  PERFORM BUILD_FIELDS USING 'VGBEL' 'SALES NO'       15 ' ' ' ' ' '           ' ' ' ' ' ' 'X'.


  WA_SORT-FIELDNAME = 'VBELN'.
  WA_SORT-UP      = 'X'.
  WA_SORT-SUBTOT  = 'X'.




  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
*     I_INTERFACE_CHECK                 = ' '
*     I_BYPASSING_BUFFER                = ' '
*     I_BUFFER_ACTIVE                   = ' '
     I_CALLBACK_PROGRAM                = SY-CPROG
    I_CALLBACK_PF_STATUS_SET          = 'MENU_PAINT'
     I_CALLBACK_USER_COMMAND           = 'SECOND_PAGE'
     I_CALLBACK_TOP_OF_PAGE            = 'TOP_PAGE'
*     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*     I_CALLBACK_HTML_END_OF_LIST       = ' '
*     I_STRUCTURE_NAME                  =
*     I_BACKGROUND_ID                   = ' '
*     I_GRID_TITLE                      =
*     I_GRID_SETTINGS                   =
     IS_LAYOUT                         = WA_LAYOUT
     IT_FIELDCAT                       = IT_FIELDS
*     IT_EXCLUDING                      =
*     IT_SPECIAL_GROUPS                 =
      IT_SORT                           = IT_SORT
*     IT_FILTER                         =
*     IS_SEL_HIDE                       =
*     I_DEFAULT                         = 'X'
*     I_SAVE                            = ' '
*     IS_VARIANT                        =
*     IT_EVENTS                         =
*     IT_EVENT_EXIT                     =
*     IS_PRINT                          =
*     IS_REPREP_ID                      =
*     I_SCREEN_START_COLUMN             = 0
*     I_SCREEN_START_LINE               = 0
*     I_SCREEN_END_COLUMN               = 0
*     I_SCREEN_END_LINE                 = 0
*     I_HTML_HEIGHT_TOP                 = 0
*     I_HTML_HEIGHT_END                 = 0
*     IT_ALV_GRAPHICS                   =
*     IT_HYPERLINK                      =
*     IT_ADD_FIELDCAT                   =
*     IT_EXCEPT_QINFO                   =
*     IR_SALV_FULLSCREEN_ADAPTER        =
*   IMPORTING
*     E_EXIT_CAUSED_BY_CALLER           =
*     ES_EXIT_CAUSED_BY_USER            =
    TABLES
      T_OUTTAB                          = IT_LIKP1
*   EXCEPTIONS
*     PROGRAM_ERROR                     = 1
*     OTHERS                            = 2
            .
  IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


*&---------------------------------------------------------------------*
*&      Form  TOP_PAGE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM TOP_PAGE.


DATA IT_HEADER TYPE SLIS_T_LISTHEADER.
  DATA WA_HEADER TYPE SLIS_LISTHEADER.

  WA_HEADER-TYP  = 'H'.
  WA_HEADER-INFO = 'DELIVERY DOCUMENT  DETAILS'.

  APPEND WA_HEADER TO IT_HEADER.

  WA_HEADER-TYP  = 'S'.
  WA_HEADER-KEY  = 'System Date:'.
  WA_HEADER-INFO = 'SY-DATUM'.

  CONCATENATE SY-DATUM+6(2)
              SY-DATUM+4(2)
              SY-DATUM+0(4) INTO WA_HEADER-INFO SEPARATED BY '-'.

  APPEND WA_HEADER TO IT_HEADER.

  WA_HEADER-TYP  = 'A'.
  WA_HEADER-INFO = 'DELIVERY DOCUMENT  DETAILS'.

  APPEND WA_HEADER TO IT_HEADER.

  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      IT_LIST_COMMENTARY       = IT_HEADER
      I_LOGO                   = 'ZH100'
*     I_END_OF_LIST_GRID       =
*     I_ALV_FORM               =
            .




ENDFORM.                    "TOP_PAGE




*&---------------------------------------------------------------------*
*&      Form  BUILD_FIELDS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_0388   text
*      -->P_0389   text
*      -->P_10     text
*      -->P_0391   text
*      -->P_0392   text
*      -->P_0393   text
*      -->P_0394   text
*      -->P_0395   text
*      -->P_0396   text
*      -->P_0397   text
*----------------------------------------------------------------------*
FORM BUILD_FIELDS  USING    VALUE(P_0388)
                            VALUE(P_0389)
                            VALUE(P_0390)
                            VALUE(P_0391)
                            VALUE(P_0392)
                            VALUE(P_0393)
                            VALUE(P_0394)
                            VALUE(P_0395)
                            VALUE(P_0396)
                            VALUE(P_0397).

  WA_FIELDS-FIELDNAME = P_0388.
  WA_FIELDS-SELTEXT_L = P_0389.
  WA_FIELDS-OUTPUTLEN = P_0390.
  WA_FIELDS-KEY       = P_0391.
  WA_FIELDS-DO_SUM    = P_0392.
  WA_FIELDS-EDIT_MASK = P_0393.
  WA_FIELDS-EMPHASIZE = P_0394.
  WA_FIELDS-CHECKBOX  = P_0395.
  WA_FIELDS-EDIT      = P_0396.
  WA_FIELDS-HOTSPOT   = P_0397.

  APPEND WA_FIELDS TO IT_FIELDS.
  CLEAR  WA_FIELDS.

ENDFORM.                    " BUILD_FIELDS


*&---------------------------------------------------------------------*
*&      Form  MENU_PAINT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM MENU_PAINT USING L_FCODE TYPE SLIS_T_EXTAB.

  SET PF-STATUS 'ZPSLV1'.

ENDFORM.                    "MENU_PAINT


*&---------------------------------------------------------------------*
*&      Form  SECOND_PAGE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM SECOND_PAGE USING F_CODE  TYPE SY-UCOMM
                       F_FIELD TYPE SLIS_SELFIELD.


  DATA I_GRID TYPE REF TO CL_GUI_ALV_GRID.


  RANGES: R_VGBEL FOR WA_LIKP1-VGBEL.
  REFRESH IT_FIELDS[].
  IF I_GRID IS INITIAL.




    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
*    EXPORTING
*                            IR_SALV_FULLSCREEN_ADAPTER       =
                          IMPORTING
*                            ET_EXCLUDING                     =
*                            E_REPID                          =
*                            E_CALLBACK_PROGRAM               =
*                            E_CALLBACK_ROUTINE               =
        E_GRID                                                = I_GRID
*                            ET_FIELDCAT_LVC                  =
*                            ER_TRACE                         =
*                            E_FLG_NO_HTML                    =
*                            ES_LAYOUT_KKBLO                  =
*                            ES_SEL_HIDE                      =
*                            ET_EVENT_EXIT                    =
*                            ER_FORM_TOL                      =
*                            ER_FORM_EOL                      =
    .

  ENDIF.



  IF NOT I_GRID IS INITIAL.
    CALL METHOD I_GRID->CHECK_CHANGED_DATA.
  ENDIF.


  LOOP AT IT_LIKP1 INTO WA_LIKP1  WHERE CHK = 'X'.

    R_VGBEL-SIGN   = 'I'.
    R_VGBEL-OPTION = 'EQ'.
    R_VGBEL-LOW    = WA_LIKP1-VGBEL.

    APPEND R_VGBEL.
  ENDLOOP.

  TYPES:BEGIN OF T_VBAK,
            VBELN  TYPE  VBAK-VBELN,
            ERDAT  TYPE  VBAK-ERDAT,
            VKORG  TYPE  VBAK-VKORG,
            KUNNR  TYPE  VBAK-KUNNR,
            ERNAM  TYPE  VBAK-ERNAM,
         END OF T_VBAK.
  TYPES:BEGIN OF T_VBAP,
            VBELN  TYPE  VBAP-VBELN,
            POSNR  TYPE  VBAP-POSNR,
            MATNR  TYPE  VBAP-MATNR,
            KWMENG  TYPE  VBAP-KWMENG,
            NETWR  TYPE  VBAP-NETWR,
            TOTAL(10)  TYPE  N,
         END OF T_VBAP.
  TYPES:BEGIN OF T_VBAK1 ,
           KUNNR  TYPE VBAK-KUNNR,
           VBELN  TYPE VBAK-VBELN,
           ERDAT(25),
           VKORG  TYPE  VBAK-VKORG,
           ERNAM  TYPE  VBAK-ERNAM,
           POSNR  TYPE VBAP-POSNR,
           MATNR  TYPE VBAP-MATNR,
           KWMENG  TYPE  VBAP-KWMENG,
           NETWR  TYPE  VBAP-NETWR,
           TOTAL(10)  TYPE  N,
         END OF T_VBAK1.


   DATA:VAR1(15) TYPE C,
        ERDAT(15) TYPE C.






  DATA:IT_VBAK TYPE TABLE OF T_VBAK,
       IT_VBAP TYPE TABLE OF T_VBAP,
       IT_VBAK1 TYPE TABLE OF T_VBAK1,
       WA_VBAK TYPE T_VBAK,
       WA_VBAP TYPE T_VBAP,
       WA_VBAK1 TYPE T_VBAK1.



  IF F_CODE EQ 'CHECK'.


    SELECT VBELN
             ERDAT
             VKORG
             KUNNR
             ERNAM INTO TABLE IT_VBAK
                    FROM VBAK
                    WHERE VBELN IN R_VGBEL.
    IF NOT IT_VBAK[] IS INITIAL.
      SELECT VBELN
             POSNR
             MATNR
             KWMENG
             NETWR INTO TABLE IT_VBAP
                   FROM VBAP
                   FOR ALL ENTRIES IN IT_VBAK
                   WHERE VBELN = IT_VBAK-VBELN.
    ENDIF.


    DATA :DD LIKE  T247-MNR,
          LT LIKE  T247-LTX.


  LOOP AT  IT_VBAP INTO WA_VBAP.
      READ TABLE IT_VBAK INTO WA_VBAK WITH KEY VBELN = WA_VBAP-VBELN.
*      TOTAL = WA_VBAK1-KWMENG * WA_VBAK1-NETWR .


      DD  = WA_VBAK-ERDAT+4(2).
  CALL FUNCTION 'ISP_GET_MONTH_NAME'
      EXPORTING
   DATE               = WA_VBAK-ERDAT
    LANGUAGE           = SY-LANGU
**    MONTH_NUMBER       =
    IMPORTING
*   LANGU_BACK         =
    LONGTEXT           = LT
*   SHORTTEXT          =
* EXCEPTIONS
*   CALENDAR_ID        = 1
*   DATE_ERROR         = 2
*   NOT_FOUND          = 3
*   WRONG_INPUT        = 4
*   OTHERS             = 5
              .
    IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.



    CONCATENATE WA_VBAK-ERDAT+6(2)

                LT
                WA_VBAK-ERDAT+0(4) INTO ERDAT SEPARATED BY '-'.



      MOVE:    WA_VBAK-VBELN   TO  WA_VBAK1-VBELN,
               WA_VBAK-VKORG   TO  WA_VBAK1-VKORG,
               WA_VBAK-KUNNR   TO  WA_VBAK1-KUNNR,
*              WA_VBAK-ERDAT   TO  WA_VBAK1-ERDAT,
               ERDAT           TO  WA_VBAK1-ERDAT,
               WA_VBAP-POSNR   TO  WA_VBAK1-POSNR,
               WA_VBAK-ERNAM   TO  WA_VBAK1-ERNAM,
               WA_VBAP-MATNR   TO  WA_VBAK1-MATNR,
               WA_VBAP-KWMENG  TO  WA_VBAK1-KWMENG,
               WA_VBAP-NETWR  TO  WA_VBAK1-NETWR.

      APPEND WA_VBAK1 TO IT_VBAK1.
      CLEAR WA_VBAK1.

    ENDLOOP.


    IF NOT R_VGBEL[] IS INITIAL.

      PERFORM BUILD_S_FIELDS USING 'VBELN' 'Sales Document' ' ' ' '.
      PERFORM BUILD_S_FIELDS USING 'ERDAT' 'Date' 'C501' 25 .
      PERFORM BUILD_S_FIELDS USING 'VKORG' 'Sales Organization' ' ' ' '.
      PERFORM BUILD_S_FIELDS USING 'KUNNR' 'Sold to party' 'C210' ' '.
      PERFORM BUILD_S_FIELDS USING 'ERNAM' 'ernam' 'C301' ' '.
      PERFORM BUILD_S_FIELDS USING 'POSNR' ' sales document item' 'C610' ' '.
      PERFORM BUILD_S_FIELDS USING 'MATNR' 'material number' 'C710' ' '.
      PERFORM BUILD_S_FIELDS USING 'KEMENG' 'Sold-to party' ' ' ' '.
      PERFORM BUILD_S_FIELDS USING 'NETWR' 'Net Value ' ' ' ' '.


      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                = ' '
*   I_BUFFER_ACTIVE                   = ' '
*   I_CALLBACK_PROGRAM                = ' '
*   I_CALLBACK_PF_STATUS_SET          = ' '
*   I_CALLBACK_USER_COMMAND           = ' '
*   I_CALLBACK_TOP_OF_PAGE            = ' '
*   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*   I_CALLBACK_HTML_END_OF_LIST       = ' '
*   I_STRUCTURE_NAME                  =
*   I_BACKGROUND_ID                   = ' '
*   I_GRID_TITLE                      =
*   I_GRID_SETTINGS                   =
*   IS_LAYOUT                         =
     IT_FIELDCAT                        = IT_FIELDS

*      IT_EXCLUDING                   =
*   IT_SPECIAL_GROUPS                 =
*   IT_SORT                           =
*   IT_FILTER                         =
*   IS_SEL_HIDE                       =
*   I_DEFAULT                         = 'X'
*   I_SAVE                            = ' '
*   IS_VARIANT                        =
*   IT_EVENTS                         =
*   IT_EVENT_EXIT                     =
*   IS_PRINT                          =
*   IS_REPREP_ID                      =
*   I_SCREEN_START_COLUMN             = 0
*   I_SCREEN_START_LINE               = 0
*   I_SCREEN_END_COLUMN               = 0
*   I_SCREEN_END_LINE                 = 0
*   I_HTML_HEIGHT_TOP                 = 0
*   I_HTML_HEIGHT_END                 = 0
*   IT_ALV_GRAPHICS                   =
*   IT_HYPERLINK                      =
*   IT_ADD_FIELDCAT                   =
*   IT_EXCEPT_QINFO                   =
*   IR_SALV_FULLSCREEN_ADAPTER        =
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER           =
*   ES_EXIT_CAUSED_BY_USER            =
        TABLES
          T_OUTTAB                          = IT_VBAK1
* EXCEPTIONS
*   PROGRAM_ERROR                     = 1
*   OTHERS                            = 2
                .
      IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDIF.
  ENDIF.

ENDFORM.                    "SECOND_PAGE
*&---------------------------------------------------------------------*
*&      Form  BUILD_S_FIELDS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_0964   text
*      -->P_0965   text
*      -->P_0966   text
*----------------------------------------------------------------------*
FORM BUILD_S_FIELDS  USING    VALUE(P_0964)
                              VALUE(P_0965)
                              VALUE(P_0966)
                              VALUE(P_0967).




  WA_FIELDS-FIELDNAME = P_0964.
  WA_FIELDS-SELTEXT_L = P_0965.
  WA_FIELDS-EMPHASIZE = P_0966.
  WA_FIELDS-OUTPUTLEN = P_0967.



  APPEND WA_FIELDS TO IT_FIELDS.
  CLEAR WA_FIELDS.

ENDFORM.                    " BUILD_S_FIELDS

input:


output:





48.  Examples:

DATA: BEGIN OF IT_MARD OCCURS 0,
        MATNR  TYPE  MARD-MATNR,
        WERKS  TYPE  MARD-WERKS,
        LGORT  TYPE  MARD-LGORT,
        LABST  TYPE  MARD-LABST,
      END OF IT_MARD.

SELECT-OPTIONS S_MATNR FOR IT_MARD-MATNR.

PARAMETERS P_FILE TYPE IBIPPARMS-PATH.

*****************************************************************************

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

  CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      PROGRAM_NAME  = SYST-CPROG
      DYNPRO_NUMBER = SYST-DYNNR
      FIELD_NAME    = 'P_FILE'
    IMPORTING
      FILE_NAME     = P_FILE.

*****************************************************************************
START-OF-SELECTION.

  SELECT MATNR
         WERKS
         LGORT
         LABST INTO TABLE IT_MARD
               FROM MARD
               WHERE MATNR IN S_MATNR.

********************************************************************
END-OF-SELECTION.

    DATA VAR1 TYPE STRING.

    VAR1 = P_FILE.

    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
*   BIN_FILESIZE                    =
        FILENAME                        = VAR1
*   FILETYPE                        = 'ASC'
*   APPEND                          = ' '
       WRITE_FIELD_SEPARATOR           = 'X'
*   HEADER                          = '00'
*   TRUNC_TRAILING_BLANKS           = ' '
*   WRITE_LF                        = 'X'
*   COL_SELECT                      = ' '
*   COL_SELECT_MASK                 = ' '
*   DAT_MODE                        = ' '
*   CONFIRM_OVERWRITE               = ' '
*   NO_AUTH_CHECK                   = ' '
*   CODEPAGE                        = ' '
*   IGNORE_CERR                     = ABAP_TRUE
*   REPLACEMENT                     = '#'
*   WRITE_BOM                       = ' '
*   TRUNC_TRAILING_BLANKS_EOL       = 'X'
*   WK1_N_FORMAT                    = ' '
*   WK1_N_SIZE                      = ' '
*   WK1_T_FORMAT                    = ' '
*   WK1_T_SIZE                      = ' '
*   WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
*   SHOW_TRANSFER_STATUS            = ABAP_TRUE
*   VIRUS_SCAN_PROFILE              = '/SCET/GUI_DOWNLOAD'
* IMPORTING
*   FILELENGTH                      =
      TABLES
        DATA_TAB                        = IT_MARD
*   FIELDNAMES                      =
   EXCEPTIONS
     FILE_WRITE_ERROR                = 1
     NO_BATCH                        = 2
     GUI_REFUSE_FILETRANSFER         = 3
     INVALID_TYPE                    = 4
     NO_AUTHORITY                    = 5
     UNKNOWN_ERROR                   = 6
     HEADER_NOT_ALLOWED              = 7
     SEPARATOR_NOT_ALLOWED           = 8
     FILESIZE_NOT_ALLOWED            = 9
     HEADER_TOO_LONG                 = 10
     DP_ERROR_CREATE                 = 11
     DP_ERROR_SEND                   = 12
     DP_ERROR_WRITE                  = 13
     UNKNOWN_DP_ERROR                = 14
     ACCESS_DENIED                   = 15
     DP_OUT_OF_MEMORY                = 16
     DISK_FULL                       = 17
     DP_TIMEOUT                      = 18
     FILE_NOT_FOUND                  = 19
     DATAPROVIDER_EXCEPTION          = 20
     CONTROL_FLUSH_ERROR             = 21
     OTHERS                          = 22.

    IF SY-SUBRC = 0.

      WRITE:/ 'File sucessfully downloaded to:', P_FILE.

    ENDIF.

input:




output:


HT-S21-1           1000 1020 0.000
HT-S21-1           1000 1030 0.000
HT-S21-1           1000 1050 900.000
HT-S21-1           1000 1060 0.000




48.  Examples:
REPORT  ZR_H107_ASSIGNMENT63.

DATA: BEGIN OF IT_MARD OCCURS 0,
        MATNR  TYPE  MARD-MATNR,
        WERKS  TYPE  MARD-WERKS,
        LGORT  TYPE  MARD-LGORT,
        LABST  TYPE  MARD-LABST,
      END OF IT_MARD.

DATA: BEGIN OF WA_MARD,
        MATNR  TYPE  MARD-MATNR,
        WERKS  TYPE  MARD-WERKS,
        LGORT  TYPE  MARD-LGORT,
        LABST(20),
      END OF WA_MARD.

SELECT-OPTIONS S_MATNR FOR IT_MARD-MATNR.

PARAMETERS P_FILE TYPE STRING.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

CALL METHOD CL_RSAN_UT_FILES=>F4
  EXPORTING
    I_APPLSERV              = 'X'
    I_TITLE                 = 'Pick AL11 directory...'
    I_GUI_EXTENSION         = SPACE
    I_GUI_EXT_FILTER        = SPACE
*    I_GUI_INITIAL_DIRECTORY =
*    I_APPLSERV_LOGICAL      = 'X'
*    I_APPLSERV_AL11         = 'X'
*  IMPORTING
*    E_CANCELED              =
*    E_LOGICAL_FILE          =
*    E_AL11_CHOSEN           =
  CHANGING
    C_FILE_NAME             = P_FILE
*  EXCEPTIONS
*    FAILED                  = 1
*    OTHERS                  = 2
        .


*****************************************************************************
START-OF-SELECTION.

  SELECT MATNR
         WERKS
         LGORT
         LABST INTO TABLE IT_MARD
               FROM MARD
               WHERE MATNR IN S_MATNR.

********************************************************************
END-OF-SELECTION.

*  OPEN DATASET 'MARD.555' FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

  OPEN DATASET P_FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

  IF SY-SUBRC = 0.

    LOOP AT IT_MARD.

      MOVE: IT_MARD-MATNR TO WA_MARD-MATNR,
            IT_MARD-WERKS TO WA_MARD-WERKS,
            IT_MARD-LGORT TO WA_MARD-LGORT,
            IT_MARD-LABST TO WA_MARD-LABST.

*      TRANSFER WA_MARD TO 'MARD.555'.
      TRANSFER WA_MARD TO P_FILE.
    ENDLOOP.

*    CLOSE DATASET 'MARD.555'.
        CLOSE DATASET P_FILE.
    WRITE:/ 'File created sucessfully...'.
  ENDIF.

input:







output:







48.  Examples:
REPORT  ZR_H107_ASSIGNMENT64.

DATA: BEGIN OF IT_MARD OCCURS 0,
        MATNR  TYPE  MARD-MATNR,
        WERKS  TYPE  MARD-WERKS,
        LGORT  TYPE  MARD-LGORT,
        LABST  TYPE  MARD-LABST,
      END OF IT_MARD.

DATA: BEGIN OF ITAB OCCURS 0,
        MATNR  TYPE  MARD-MATNR,
        WERKS  TYPE  MARD-WERKS,
        LGORT  TYPE  MARD-LGORT,
        LABST  TYPE  MARD-LABST,
        F1(20) TYPE  C,
        F2(1)  TYPE  C,
      END OF ITAB.

SELECT-OPTIONS S_MATNR FOR IT_MARD-MATNR.

START-OF-SELECTION.

  SELECT MATNR
         WERKS
         LGORT
         LABST INTO TABLE IT_MARD
               FROM MARD
               WHERE MATNR IN S_MATNR.

END-OF-SELECTION.

  LOOP AT IT_MARD.

    ITAB-MATNR = IT_MARD-MATNR.
    ITAB-WERKS = IT_MARD-WERKS.
    ITAB-LGORT = IT_MARD-LGORT.
    ITAB-LABST = IT_MARD-LABST.

    ITAB-F2 = CL_ABAP_CHAR_UTILITIES=>CR_LF.

    APPEND ITAB.
    CLEAR  ITAB.

  ENDLOOP.

*---
  DATA: V1 TYPE STRING,
        V2 TYPE STRING,
        V3 TYPE STRING.

  CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
    EXPORTING
      WINDOW_TITLE         = 'Save File...'
*    DEFAULT_EXTENSION    =
*    DEFAULT_FILE_NAME    =
*    WITH_ENCODING        =
*    FILE_FILTER          =
*    INITIAL_DIRECTORY    =
*    PROMPT_ON_OVERWRITE  = 'X'
    CHANGING
      FILENAME             = V1
      PATH                 = V2
      FULLPATH             = V3
*    USER_ACTION          =
*    FILE_ENCODING        =
*  EXCEPTIONS
*    CNTL_ERROR           = 1
*    ERROR_NO_GUI         = 2
*    NOT_SUPPORTED_BY_GUI = 3
*    OTHERS               = 4
          .


  CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
    EXPORTING
*    BIN_FILESIZE              =
      FILENAME                  = V3
*    FILETYPE                  = 'ASC'
*    APPEND                    = SPACE
*    WRITE_FIELD_SEPARATOR     = SPACE
*    HEADER                    = '00'
*    TRUNC_TRAILING_BLANKS     = SPACE
*    WRITE_LF                  = 'X'
*    COL_SELECT                = SPACE
*    COL_SELECT_MASK           = SPACE
*    DAT_MODE                  = SPACE
*    CONFIRM_OVERWRITE         = SPACE
*    NO_AUTH_CHECK             = SPACE
*    CODEPAGE                  = SPACE
*    IGNORE_CERR               = ABAP_TRUE
*    REPLACEMENT               = '#'
*    WRITE_BOM                 = SPACE
*    TRUNC_TRAILING_BLANKS_EOL = 'X'
*    WK1_N_FORMAT              = SPACE
*    WK1_N_SIZE                = SPACE
*    WK1_T_FORMAT              = SPACE
*    WK1_T_SIZE                = SPACE
*    SHOW_TRANSFER_STATUS      = 'X'
*    FIELDNAMES                =
*    WRITE_LF_AFTER_LAST_LINE  = 'X'
*    VIRUS_SCAN_PROFILE        = '/SCET/GUI_DOWNLOAD'
*  IMPORTING
*    FILELENGTH                =
    CHANGING
      DATA_TAB                  = ITAB[]
*  EXCEPTIONS
*    FILE_WRITE_ERROR          = 1
*    NO_BATCH                  = 2
*    GUI_REFUSE_FILETRANSFER   = 3
*    INVALID_TYPE              = 4
*    NO_AUTHORITY              = 5
*    UNKNOWN_ERROR             = 6
*    HEADER_NOT_ALLOWED        = 7
*    SEPARATOR_NOT_ALLOWED     = 8
*    FILESIZE_NOT_ALLOWED      = 9
*    HEADER_TOO_LONG           = 10
*    DP_ERROR_CREATE           = 11
*    DP_ERROR_SEND             = 12
*    DP_ERROR_WRITE            = 13
*    UNKNOWN_DP_ERROR          = 14
*    ACCESS_DENIED             = 15
*    DP_OUT_OF_MEMORY          = 16
*    DISK_FULL                 = 17
*    DP_TIMEOUT                = 18
*    FILE_NOT_FOUND            = 19
*    DATAPROVIDER_EXCEPTION    = 20
*    CONTROL_FLUSH_ERROR       = 21
*    NOT_SUPPORTED_BY_GUI      = 22
*    ERROR_NO_GUI              = 23
*    OTHERS                    = 24
          .
  IF SY-SUBRC <> 0.
* Implement suitable error handling here
  ENDIF.

input:




output:
HT-S21-1          100010200.000                    

HT-S21-1          100010300.000                    

HT-S21-1          10001050900.000                    

HT-S21-1          100010600.000  




REPORT  ZR_H107_ASSIGNMENT73.

DATA: BEGIN OF ITAB OCCURS 0,
        F1(18) TYPE C,
        F2(4)  TYPE C,
        F3(4)  TYPE C,
        F4(20) TYPE C,
      END OF ITAB.

PARAMETERS: P_FILE TYPE STRING.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

CALL METHOD CL_RSAN_UT_FILES=>F4
  EXPORTING
    I_APPLSERV              = SPACE
    I_TITLE                 = 'Read Data From PC File...'
    I_GUI_EXTENSION         = 'TXT'
    I_GUI_EXT_FILTER        = SPACE

  CHANGING
    C_FILE_NAME             = P_FILE.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.

START-OF-SELECTION.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
  EXPORTING
    FILENAME                = P_FILE

  CHANGING
    DATA_TAB                = ITAB[].
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.

END-OF-SELECTION.

LOOP AT ITAB.
  WRITE:/ ITAB-F1, ITAB-F2, ITAB-F3, ITAB-F4.
ENDLOOP. 
 input: 



output:


REPORT  ZR_H107_ASSIGNMENT74.

DATA: BEGIN OF ITAB OCCURS 0,
        F1(10)  TYPE  C,
        F2(20)  TYPE  C,
        F3(20)  TYPE  C,
        F4(20)  TYPE  C,
        F5(6)   TYPE  C,
        F6(20)  TYPE  C,
      END OF ITAB.

PARAMETERS: P_FILE LIKE IBIPPARMS-PATH.

DATA: L_FILE LIKE RLGRAP-FILENAME.
DATA: IT_EXCEL type ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'F4_FILENAME'
 EXPORTING
   PROGRAM_NAME        = SYST-CPROG
   DYNPRO_NUMBER       = SYST-DYNNR
   FIELD_NAME          = 'P_FILE'
 IMPORTING
   FILE_NAME           = P_FILE.


START-OF-SELECTION.
  l_file = p_file.

  CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
      FILENAME                      = L_FILE
      I_BEGIN_COL                   = 1
      I_BEGIN_ROW                   = 1
      I_END_COL                     = 12
      I_END_ROW                     = 62000
    TABLES
      INTERN                        = IT_EXCEL
 EXCEPTIONS
   INCONSISTENT_PARAMETERS       = 1
   UPLOAD_OLE                    = 2
   OTHERS                        = 3
            .
  IF SY-SUBRC <> 0.
* Implement suitable error handling here

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

END-OF-SELECTION.
  LOOP AT IT_EXCEL.

  CASE IT_EXCEL-COL.

    WHEN 1.
      ITAB-F1 = IT_EXCEL-VALUE.
    WHEN 2.
      ITAB-F2 = IT_EXCEL-VALUE.
    WHEN 3.
      ITAB-F3 = IT_EXCEL-VALUE.
    WHEN 4.
      ITAB-F4 = IT_EXCEL-VALUE.
    WHEN 5.
      ITAB-F5 = IT_EXCEL-VALUE.
    WHEN 6.
      ITAB-F6 = IT_EXCEL-VALUE.
  ENDCASE.

  AT END OF ROW.
    APPEND ITAB.
    CLEAR ITAB.
  ENDAT.
ENDLOOP.

LOOP AT ITAB.
  WRITE:/ ITAB-f1, itab-f2,itab-f3,itab-f4, itab-f5, itab-f6.
ENDLOOP.
input:

output:
 input:
output:



REPORT  ZR_H107_ASSIGNMENT75.

DATA: BEGIN OF ITAB OCCURS 0,
        F1  TYPE RF02K-LIFNR,
        F2  TYPE RF02K-BUKRS,
        F3  TYPE RF02K-EKORG,
        F4  TYPE RF02K-KTOKK,
        F5  TYPE LFA1-ANRED,
        F6  TYPE LFA1-NAME1,
        F7  TYPE LFA1-SORTL,
        F8  TYPE LFA1-STRAS,
        F9  TYPE LFA1-LAND1,
        F10 TYPE LFB1-AKONT,
        F11 TYPE LFB1-FDGRV,
        F12 TYPE LFM1-WAERS,
      END OF ITAB.

DATA IT_BDCDATA TYPE BDCDATA OCCURS 0 WITH HEADER LINE.

PARAMETERS P_FILE TYPE STRING.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

  CALL METHOD CL_RSAN_UT_FILES=>F4
    EXPORTING
      I_APPLSERV              = SPACE
      I_TITLE                 = 'Vendor File Upload.....'
      I_GUI_EXTENSION         = 'TXT'
      I_GUI_EXT_FILTER        = SPACE
*    I_GUI_INITIAL_DIRECTORY =
*    I_APPLSERV_LOGICAL      = 'X'
*    I_APPLSERV_AL11         = 'X'
*  IMPORTING
*    E_CANCELED              =
*    E_LOGICAL_FILE          =
*    E_AL11_CHOSEN           =
    CHANGING
      C_FILE_NAME             = P_FILE
*  EXCEPTIONS
*    FAILED                  = 1
*    OTHERS                  = 2
          .
  IF SY-SUBRC <> 0.
* Implement suitable error handling here
  ENDIF.

START-OF-SELECTION.

  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      FILENAME                      = P_FILE
*   FILETYPE                      = 'ASC'
     HAS_FIELD_SEPARATOR           = 'X'
*   HEADER_LENGTH                 = 0
*   READ_BY_LINE                  = 'X'
*   DAT_MODE                      = ' '
*   CODEPAGE                      = ' '
*   IGNORE_CERR                   = ABAP_TRUE
*   REPLACEMENT                   = '#'
*   CHECK_BOM                     = ' '
*   VIRUS_SCAN_PROFILE            =
*   NO_AUTH_CHECK                 = ' '
* IMPORTING
*   FILELENGTH                    =
*   HEADER                        =
    TABLES
      DATA_TAB                      = ITAB
   EXCEPTIONS
     FILE_OPEN_ERROR               = 1
     FILE_READ_ERROR               = 2
     NO_BATCH                      = 3
     GUI_REFUSE_FILETRANSFER       = 4
     INVALID_TYPE                  = 5
     NO_AUTHORITY                  = 6
     UNKNOWN_ERROR                 = 7
     BAD_DATA_FORMAT               = 8
     HEADER_NOT_ALLOWED            = 9
     SEPARATOR_NOT_ALLOWED         = 10
     HEADER_TOO_LONG               = 11
     UNKNOWN_DP_ERROR              = 12
     ACCESS_DENIED                 = 13
     DP_OUT_OF_MEMORY              = 14
     DISK_FULL                     = 15
     DP_TIMEOUT                    = 16
     OTHERS                        = 17
            .
  IF SY-SUBRC <> 0.

  ENDIF.

  LOOP AT ITAB.

*-----1

    IT_BDCDATA-PROGRAM  = 'SAPMF02K'.
    IT_BDCDATA-DYNPRO   = '0100'.
    IT_BDCDATA-DYNBEGIN = 'X'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'RF02K-LIFNR'.
    IT_BDCDATA-FVAL = ITAB-F1.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'RF02K-BUKRS'.
    IT_BDCDATA-FVAL = ITAB-F2.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'RF02K-EKORG'.
    IT_BDCDATA-FVAL = ITAB-F3.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'RF02K-KTOKK'.
    IT_BDCDATA-FVAL = ITAB-F4.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'BDC_OKCODE'.
    IT_BDCDATA-FVAL = '/00'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

*-----2

    IT_BDCDATA-PROGRAM  = 'SAPMF02K'.
    IT_BDCDATA-DYNPRO   = '0110'.
    IT_BDCDATA-DYNBEGIN = 'X'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'LFA1-ANRED'.
    IT_BDCDATA-FVAL = ITAB-F5.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'LFA1-NAME1'.
    IT_BDCDATA-FVAL = ITAB-F6.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'LFA1-SORTL'.
    IT_BDCDATA-FVAL = ITAB-F7.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'LFA1-STRAS'.
    IT_BDCDATA-FVAL = ITAB-F8.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'LFA1-LAND1'.
    IT_BDCDATA-FVAL = ITAB-F9.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'BDC_OKCODE'.
    IT_BDCDATA-FVAL = '/00'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

*-------3

    IT_BDCDATA-PROGRAM  = 'SAPMF02K'.
    IT_BDCDATA-DYNPRO   = '0120'.
    IT_BDCDATA-DYNBEGIN = 'X'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'BDC_OKCODE'.
    IT_BDCDATA-FVAL = '/00'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

*-------4

    IT_BDCDATA-PROGRAM  = 'SAPMF02K'.
    IT_BDCDATA-DYNPRO   = '0130'.
    IT_BDCDATA-DYNBEGIN = 'X'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'BDC_OKCODE'.
    IT_BDCDATA-FVAL = '=ENTR'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

*-------5

    IT_BDCDATA-PROGRAM  = 'SAPMF02K'.
    IT_BDCDATA-DYNPRO   = '0380'.
    IT_BDCDATA-DYNBEGIN = 'X'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'BDC_OKCODE'.
    IT_BDCDATA-FVAL = '=ENTR'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

*-------6

    IT_BDCDATA-PROGRAM  = 'SAPMF02K'.
    IT_BDCDATA-DYNPRO   = '0210'.
    IT_BDCDATA-DYNBEGIN = 'X'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'LFB1-AKONT'.
    IT_BDCDATA-FVAL = ITAB-F10.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'LFB1-FDGRV'.
    IT_BDCDATA-FVAL = ITAB-F11.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'BDC_OKCODE'.
    IT_BDCDATA-FVAL = '/00'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

*-----7

    IT_BDCDATA-PROGRAM  = 'SAPMF02K'.
    IT_BDCDATA-DYNPRO   = '0215'.
    IT_BDCDATA-DYNBEGIN = 'X'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'BDC_OKCODE'.
    IT_BDCDATA-FVAL = '/00'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

*-----8

    IT_BDCDATA-PROGRAM  = 'SAPMF02K'.
    IT_BDCDATA-DYNPRO   = '0220'.
    IT_BDCDATA-DYNBEGIN = 'X'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'BDC_OKCODE'.
    IT_BDCDATA-FVAL = '/00'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

*-----9

    IT_BDCDATA-PROGRAM  = 'SAPMF02K'.
    IT_BDCDATA-DYNPRO   = '0310'.
    IT_BDCDATA-DYNBEGIN = 'X'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'LFM1-WAERS'.
    IT_BDCDATA-FVAL = ITAB-F12.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'BDC_OKCODE'.
    IT_BDCDATA-FVAL = '/00'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

*------10

    IT_BDCDATA-PROGRAM  = 'SAPMF02K'.
    IT_BDCDATA-DYNPRO   = '0320'.
    IT_BDCDATA-DYNBEGIN = 'X'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'BDC_OKCODE'.
    IT_BDCDATA-FVAL = '=ENTR'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

*---
    CALL TRANSACTION 'XK01' USING IT_BDCDATA
                            MODE 'A'
                            UPDATE 'A'.

    REFRESH IT_BDCDATA[].

  ENDLOOP.

 input: 



 output:







REPORT  ZR_H107_ASSIGNMENT76.

DATA: BEGIN OF ITAB OCCURS 0,
        F1  TYPE RF02K-LIFNR,
        F2  TYPE RF02K-BUKRS,
        F3  TYPE RF02K-EKORG,
        F4  TYPE RF02K-KTOKK,
        F5  TYPE LFA1-ANRED,
        F6  TYPE LFA1-NAME1,
        F7  TYPE LFA1-SORTL,
        F8  TYPE LFA1-STRAS,
        F9  TYPE LFA1-LAND1,
        F10 TYPE LFB1-AKONT,
        F11 TYPE LFB1-FDGRV,
        F12 TYPE LFM1-WAERS,
      END OF ITAB.

DATA IT_BDCDATA TYPE BDCDATA OCCURS 0 WITH HEADER LINE.

PARAMETERS P_FILE TYPE STRING.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

  CALL METHOD CL_RSAN_UT_FILES=>F4
    EXPORTING
      I_APPLSERV              = SPACE
      I_TITLE                 = 'Vendor File Upload.....'
      I_GUI_EXTENSION         = 'TXT'
      I_GUI_EXT_FILTER        = SPACE
*    I_GUI_INITIAL_DIRECTORY =
*    I_APPLSERV_LOGICAL      = 'X'
*    I_APPLSERV_AL11         = 'X'
*  IMPORTING
*    E_CANCELED              =
*    E_LOGICAL_FILE          =
*    E_AL11_CHOSEN           =
    CHANGING
      C_FILE_NAME             = P_FILE
*  EXCEPTIONS
*    FAILED                  = 1
*    OTHERS                  = 2
          .
  IF SY-SUBRC <> 0.
* Implement suitable error handling here
  ENDIF.

START-OF-SELECTION.

  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      FILENAME                      = P_FILE
*   FILETYPE                      = 'ASC'
     HAS_FIELD_SEPARATOR           = 'X'
*   HEADER_LENGTH                 = 0
*   READ_BY_LINE                  = 'X'
*   DAT_MODE                      = ' '
*   CODEPAGE                      = ' '
*   IGNORE_CERR                   = ABAP_TRUE
*   REPLACEMENT                   = '#'
*   CHECK_BOM                     = ' '
*   VIRUS_SCAN_PROFILE            =
*   NO_AUTH_CHECK                 = ' '
* IMPORTING
*   FILELENGTH                    =
*   HEADER                        =
    TABLES
      DATA_TAB                      = ITAB
   EXCEPTIONS
     FILE_OPEN_ERROR               = 1
     FILE_READ_ERROR               = 2
     NO_BATCH                      = 3
     GUI_REFUSE_FILETRANSFER       = 4
     INVALID_TYPE                  = 5
     NO_AUTHORITY                  = 6
     UNKNOWN_ERROR                 = 7
     BAD_DATA_FORMAT               = 8
     HEADER_NOT_ALLOWED            = 9
     SEPARATOR_NOT_ALLOWED         = 10
     HEADER_TOO_LONG               = 11
     UNKNOWN_DP_ERROR              = 12
     ACCESS_DENIED                 = 13
     DP_OUT_OF_MEMORY              = 14
     DISK_FULL                     = 15
     DP_TIMEOUT                    = 16
     OTHERS                        = 17
            .
  IF SY-SUBRC <> 0.

  ENDIF.

  LOOP AT ITAB.

*-----1

    PERFORM BDC_DATA USING 'SAPMF02K' '0100' 'X' ' ' ' ' ' ' ' '.
    PERFORM BDC_DATA USING ' ' ' ' ' ' 'RF02K-LIFNR' 'ITAB-F1' ' ' ' '.
    PERFORM BDC_DATA USING ' ' ' ' ' ' 'RF02K-BUKRS' 'ITAB-F2' ' ' ' '.
    PERFORM BDC_DATA USING ' ' ' ' ' ' 'RF02K-EKORG' 'ITAB-F3' ' ' ' '.
    PERFORM BDC_DATA USING ' ' ' ' ' ' 'RF02K-KTOKK' 'ITAB-F4' ' ' ' '.
    PERFORM BDC_DATA USING ' ' ' ' ' ' ' ' ' ' 'BDC_OKCODE' '/00'.

*-----2

    PERFORM BDC_DATA USING 'SAPMF02K' '0110' 'X' ' ' ' ' ' ' ' '.
    PERFORM BDC_DATA USING ' ' ' ' ' ' 'LFA1-ANRED' 'ITAB-F5' ' ' ' '.
    PERFORM BDC_DATA USING ' ' ' ' ' ' 'LFA1-NAME1' 'ITAB-F6' ' ' ' '.
    PERFORM BDC_DATA USING ' ' ' ' ' ' 'LFA1-SORTL' 'ITAB-F7' ' ' ' '.
    PERFORM BDC_DATA USING ' ' ' ' ' ' 'LFA1-STRAS' 'ITAB-F8' ' ' ' '.
    PERFORM BDC_DATA USING ' ' ' ' ' ' 'LFA1-LAND1' 'ITAB-F9' ' ' ' '.
    PERFORM BDC_DATA USING ' ' ' ' ' ' ' ' ' ' 'BDC_OKCODE' '/00'.

*-------3

    PERFORM BDC_DATA USING 'SAPMF02K' '0120' 'X' ' ' ' ' ' ' ' '.
    PERFORM BDC_DATA USING ' ' ' ' ' ' ' ' ' ' 'BDC_OKCODE' '/00'.

*-------4

    PERFORM BDC_DATA USING 'SAPMF02K' '0130' 'X' ' ' ' ' ' ' ' '.
    PERFORM BDC_DATA USING ' ' ' ' ' ' ' ' ' ' 'BDC_OKCODE' '=ENTR'.

*-------5

    PERFORM BDC_DATA USING 'SAPMF02K' '0380' 'X' ' ' ' ' ' ' ' '.
    PERFORM BDC_DATA USING ' ' ' ' ' ' ' ' ' ' 'BDC_OKCODE' '=ENTR'.

*-------6

    PERFORM BDC_DATA USING 'SAPMF02K' '0210' 'X' ' ' ' ' ' ' ' '.
    PERFORM BDC_DATA USING ' ' ' ' ' ' 'LFB1-AKONT' 'ITAB-F10' ' ' ' '.
    PERFORM BDC_DATA USING ' ' ' ' ' ' 'LFB1-FDGRV' 'ITAB-F11' ' ' ' '.
    PERFORM BDC_DATA USING ' ' ' ' ' ' ' ' ' ' 'BDC_OKCODE' '/00'.

*-----7

    PERFORM BDC_DATA USING 'SAPMF02K' '0215' 'X' ' ' ' ' ' ' ' '.
    PERFORM BDC_DATA USING ' ' ' ' ' ' ' ' ' ' 'BDC_OKCODE' '/00'.

*-----8

    PERFORM BDC_DATA USING 'SAPMF02K' '0220' 'X' ' ' ' ' ' ' ' '.
    PERFORM BDC_DATA USING ' ' ' ' ' ' ' ' ' ' 'BDC_OKCODE' '/00'.


*-----9

    PERFORM BDC_DATA USING 'SAPMF02K' '0310' 'X' ' ' ' ' ' ' ' '.
    PERFORM BDC_DATA USING ' ' ' ' ' ' 'LFM1-WAERS' 'ITAB-F12' ' ' ' '.
    PERFORM BDC_DATA USING ' ' ' ' ' ' ' ' ' ' 'BDC_OKCODE' '/00'.

*------10

    PERFORM BDC_DATA USING 'SAPMF02K' '0320' 'X' ' ' ' ' ' ' ' '.
    PERFORM BDC_DATA USING ' ' ' ' ' ' ' ' ' ' 'BDC_OKCODE' '=ENTR'.

*---
    CALL TRANSACTION 'XK01' USING IT_BDCDATA
                            MODE 'A'
                            UPDATE 'A'.

    REFRESH IT_BDCDATA[].

  ENDLOOP.

*&---------------------------------------------------------------------*
*&      Form  BDC_DATA
*&---------------------------------------------------------------------*

FORM BDC_DATA  USING    VALUE(P_0183)
                        VALUE(P_0184)
                        VALUE(P_0185)
                        VALUE(P_0186)
                        VALUE(P_0187)
                        VALUE(P_0188)
                        VALUE(P_0189).

  IT_BDCDATA-PROGRAM  = P_0183.
  IT_BDCDATA-DYNPRO   = P_0184.
  IT_BDCDATA-DYNBEGIN = P_0185.
  IT_BDCDATA-FNAM     = P_0186.
  IT_BDCDATA-FVAL     = P_0187.
  IT_BDCDATA-FNAM     = P_0188.
  IT_BDCDATA-FVAL     = P_0189.

  APPEND IT_BDCDATA.
  CLEAR  IT_BDCDATA.

ENDFORM.                    " BDC_DATA





REPORT  ZR_H107_ASSIGNMENT77.

DATA: BEGIN OF ITAB OCCURS 0,
        F1  TYPE RF02K-LIFNR,
        F2  TYPE RF02K-BUKRS,
        F3  TYPE RF02K-EKORG,
        F4  TYPE RF02K-KTOKK,
        F5  TYPE LFA1-ANRED,
        F6  TYPE LFA1-NAME1,
        F7  TYPE LFA1-SORTL,
        F8  TYPE LFA1-STRAS,
        F9  TYPE LFA1-LAND1,
        F10 TYPE LFB1-AKONT,
        F11 TYPE LFB1-FDGRV,
        F12 TYPE LFM1-WAERS,
      END OF ITAB.

DATA IT_BDCDATA TYPE BDCDATA OCCURS 0 WITH HEADER LINE.

PARAMETERS P_FILE TYPE STRING.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

  CALL METHOD CL_RSAN_UT_FILES=>F4
    EXPORTING
      I_APPLSERV              = SPACE
      I_TITLE                 = 'Vendor File Upload.....'
      I_GUI_EXTENSION         = 'TXT'
      I_GUI_EXT_FILTER        = SPACE
*    I_GUI_INITIAL_DIRECTORY =
*    I_APPLSERV_LOGICAL      = 'X'
*    I_APPLSERV_AL11         = 'X'
*  IMPORTING
*    E_CANCELED              =
*    E_LOGICAL_FILE          =
*    E_AL11_CHOSEN           =
    CHANGING
      C_FILE_NAME             = P_FILE
*  EXCEPTIONS
*    FAILED                  = 1
*    OTHERS                  = 2
          .
  IF SY-SUBRC <> 0.
* Implement suitable error handling here
  ENDIF.

START-OF-SELECTION.

  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      FILENAME                      = P_FILE
*   FILETYPE                      = 'ASC'
     HAS_FIELD_SEPARATOR           = 'X'
*   HEADER_LENGTH                 = 0
*   READ_BY_LINE                  = 'X'
*   DAT_MODE                      = ' '
*   CODEPAGE                      = ' '
*   IGNORE_CERR                   = ABAP_TRUE
*   REPLACEMENT                   = '#'
*   CHECK_BOM                     = ' '
*   VIRUS_SCAN_PROFILE            =
*   NO_AUTH_CHECK                 = ' '
* IMPORTING
*   FILELENGTH                    =
*   HEADER                        =
    TABLES
      DATA_TAB                      = ITAB
   EXCEPTIONS
     FILE_OPEN_ERROR               = 1
     FILE_READ_ERROR               = 2
     NO_BATCH                      = 3
     GUI_REFUSE_FILETRANSFER       = 4
     INVALID_TYPE                  = 5
     NO_AUTHORITY                  = 6
     UNKNOWN_ERROR                 = 7
     BAD_DATA_FORMAT               = 8
     HEADER_NOT_ALLOWED            = 9
     SEPARATOR_NOT_ALLOWED         = 10
     HEADER_TOO_LONG               = 11
     UNKNOWN_DP_ERROR              = 12
     ACCESS_DENIED                 = 13
     DP_OUT_OF_MEMORY              = 14
     DISK_FULL                     = 15
     DP_TIMEOUT                    = 16
     OTHERS                        = 17
            .
 IF SY-SUBRC =  3.
    MESSAGE 'Background processing can not be done' TYPE 'E'.
  ENDIF.

END-OF-SELECTION.

*------CREATE SESSION

  CALL FUNCTION 'BDC_OPEN_GROUP'
   EXPORTING
*     CLIENT                    = SY-MANDT
*     DEST                      = FILLER8
     GROUP                     = 'ZARUN'
*     HOLDDATE                  = FILLER8
     KEEP                      = 'X'
     USER                      = SY-UNAME
*     RECORD                    = FILLER1
*     PROG                      = SY-CPROG
*     DCPFM                     = '%'
*     DATFM                     = '%'
*   IMPORTING
*     QID                       =
*   EXCEPTIONS
*     CLIENT_INVALID            = 1
*     DESTINATION_INVALID       = 2
*     GROUP_INVALID             = 3
*     GROUP_IS_LOCKED           = 4
*     HOLDDATE_INVALID          = 5
*     INTERNAL_ERROR            = 6
*     QUEUE_ERROR               = 7
*     RUNNING                   = 8
*     SYSTEM_LOCK_ERROR         = 9
*     USER_INVALID              = 10
*     OTHERS                    = 11
            .
  IF SY-SUBRC <> 0.
* Implement suitable error handling here
  ENDIF.


  LOOP AT ITAB.

*-----1

    IT_BDCDATA-PROGRAM  = 'SAPMF02K'.
    IT_BDCDATA-DYNPRO   = '0100'.
    IT_BDCDATA-DYNBEGIN = 'X'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'RF02K-LIFNR'.
    IT_BDCDATA-FVAL = ITAB-F1.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'RF02K-BUKRS'.
    IT_BDCDATA-FVAL = ITAB-F2.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'RF02K-EKORG'.
    IT_BDCDATA-FVAL = ITAB-F3.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'RF02K-KTOKK'.
    IT_BDCDATA-FVAL = ITAB-F4.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'BDC_OKCODE'.
    IT_BDCDATA-FVAL = '/00'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

*-----2

    IT_BDCDATA-PROGRAM  = 'SAPMF02K'.
    IT_BDCDATA-DYNPRO   = '0110'.
    IT_BDCDATA-DYNBEGIN = 'X'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'LFA1-ANRED'.
    IT_BDCDATA-FVAL = ITAB-F5.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'LFA1-NAME1'.
    IT_BDCDATA-FVAL = ITAB-F6.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'LFA1-SORTL'.
    IT_BDCDATA-FVAL = ITAB-F7.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'LFA1-STRAS'.
    IT_BDCDATA-FVAL = ITAB-F8.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'LFA1-LAND1'.
    IT_BDCDATA-FVAL = ITAB-F9.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'BDC_OKCODE'.
    IT_BDCDATA-FVAL = '/00'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

*-------3

    IT_BDCDATA-PROGRAM  = 'SAPMF02K'.
    IT_BDCDATA-DYNPRO   = '0120'.
    IT_BDCDATA-DYNBEGIN = 'X'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'BDC_OKCODE'.
    IT_BDCDATA-FVAL = '/00'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

*-------4

    IT_BDCDATA-PROGRAM  = 'SAPMF02K'.
    IT_BDCDATA-DYNPRO   = '0130'.
    IT_BDCDATA-DYNBEGIN = 'X'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'BDC_OKCODE'.
    IT_BDCDATA-FVAL = '=ENTR'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

*-------5

    IT_BDCDATA-PROGRAM  = 'SAPMF02K'.
    IT_BDCDATA-DYNPRO   = '0380'.
    IT_BDCDATA-DYNBEGIN = 'X'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'BDC_OKCODE'.
    IT_BDCDATA-FVAL = '=ENTR'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

*-------6

    IT_BDCDATA-PROGRAM  = 'SAPMF02K'.
    IT_BDCDATA-DYNPRO   = '0210'.
    IT_BDCDATA-DYNBEGIN = 'X'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'LFB1-AKONT'.
    IT_BDCDATA-FVAL = ITAB-F10.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'LFB1-FDGRV'.
    IT_BDCDATA-FVAL = ITAB-F11.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'BDC_OKCODE'.
    IT_BDCDATA-FVAL = '/00'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

*-----7

    IT_BDCDATA-PROGRAM  = 'SAPMF02K'.
    IT_BDCDATA-DYNPRO   = '0215'.
    IT_BDCDATA-DYNBEGIN = 'X'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'BDC_OKCODE'.
    IT_BDCDATA-FVAL = '/00'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

*-----8

    IT_BDCDATA-PROGRAM  = 'SAPMF02K'.
    IT_BDCDATA-DYNPRO   = '0220'.
    IT_BDCDATA-DYNBEGIN = 'X'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'BDC_OKCODE'.
    IT_BDCDATA-FVAL = '/00'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

*-----9

    IT_BDCDATA-PROGRAM  = 'SAPMF02K'.
    IT_BDCDATA-DYNPRO   = '0310'.
    IT_BDCDATA-DYNBEGIN = 'X'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'LFM1-WAERS'.
    IT_BDCDATA-FVAL = ITAB-F12.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'BDC_OKCODE'.
    IT_BDCDATA-FVAL = '/00'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

*------10

    IT_BDCDATA-PROGRAM  = 'SAPMF02K'.
    IT_BDCDATA-DYNPRO   = '0320'.
    IT_BDCDATA-DYNBEGIN = 'X'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

    IT_BDCDATA-FNAM = 'BDC_OKCODE'.
    IT_BDCDATA-FVAL = '=ENTR'.

    APPEND IT_BDCDATA.
    CLEAR  IT_BDCDATA.

*-----INSERT TO SESSION

    CALL FUNCTION 'BDC_INSERT'
     EXPORTING
       TCODE                  = 'XK01'
*       POST_LOCAL             = NOVBLOCAL
*       PRINTING               = NOPRINT
*       SIMUBATCH              = ' '
*       CTUPARAMS              = ' '
      TABLES
        DYNPROTAB              = IT_BDCDATA
*     EXCEPTIONS
*       INTERNAL_ERROR         = 1
*       NOT_OPEN               = 2
*       QUEUE_ERROR            = 3
*       TCODE_INVALID          = 4
*       PRINTING_INVALID       = 5
*       POSTING_INVALID        = 6
*       OTHERS                 = 7
              .
    IF SY-SUBRC <> 0.
* Implement suitable error handling here
    ENDIF.

    REFRESH IT_BDCDATA[].

  ENDLOOP.

*-----CLOSE SESSION

  CALL FUNCTION 'BDC_CLOSE_GROUP'
*   EXCEPTIONS
*     NOT_OPEN          = 1
*     QUEUE_ERROR       = 2
*     OTHERS            = 3
            .
  IF SY-SUBRC = 0.

    WRITE:/ 'Session Created Successfully...'.

  ENDIF.

input:



   output:
































No comments:

Post a Comment