F Parallel Cursor program in SAP ABAP | CodeTheta

Parallel Cursor program in SAP ABAP

September 04, 2019

Code :
REPORT ZVP_PARALLEL_CURSOR.

TYPESBEGIN OF EMP,
         ID   TYPE I,
         NAME TYPE CHAR10,
       END OF EMP.

TYPES:  BEGIN OF SAL,
          ID     TYPE I,
          MONTH  TYPE CHAR10,
          SALARY TYPE I,
        END OF SAL.

DATAIT_EMP   TYPE STANDARD TABLE OF EMP,
      WA_EMP   TYPE EMP,
      IT_SAL   TYPE STANDARD TABLE OF SAL,
      WA_SAL   TYPE SAL,
      LV_INDEX TYPE I.

WA_EMP-ID '1'.
WA_EMP-NAME 'AAA'.
APPEND WA_EMP TO IT_EMP.

WA_EMP-ID '2'.
WA_EMP-NAME 'BBB'.
APPEND WA_EMP TO IT_EMP.

WA_EMP-ID '3'.
WA_EMP-NAME 'CCC'.
APPEND WA_EMP TO IT_EMP.

WA_SAL-ID '3'.
WA_SAL-MONTH 'MAY'.
WA_SAL-SALARY '3000'.
APPEND WA_SAL TO IT_SAL.

WA_SAL-ID '1'.
WA_SAL-MONTH 'JUNE'.
WA_SAL-SALARY '1000'.
APPEND WA_SAL TO IT_SAL.

WA_SAL-ID '2'.
WA_SAL-MONTH 'JULY'.
WA_SAL-SALARY '2000'.
APPEND WA_SAL TO IT_SAL.

SORTIT_EMPIT_SAL.

LOOP AT IT_EMP INTO WA_EMP.

  READ TABLE IT_SAL INTO WA_SAL WITH KEY ID WA_EMP-ID.
  IF SY-SUBRC 0.
    LV_INDEX SY-TABIX.

    LOOP AT IT_SAL INTO WA_SAL FROM LV_INDEX .
      IF WA_EMP-ID <> WA_SAL-ID.
        EXIT.
      ENDIF.

      WRITE:/ WA_EMP-ID,'|',
              WA_EMP-NAME,'|',
              WA_SAL-MONTH,'|',
              WA_SAL-SALARY,'|'.
    ENDLOOP.
  ENDIF.
ENDLOOP.


Output :

IDE Used To Test This Code : SAP Login 730.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Post a Comment