SAP Program to show multiple keyword's operation,

 PROGRAM: 


*&---------------------------------------------------------------------*
*& Report ZSM_1_5_25
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZSM_1_5_25.

TYPESBEGIN OF str,
  id type int4,
  name type char10,
  loct type char10,
  END OF str.

 datait type STANDARD TABLE OF str,
       wa type str.

 wa-id '1'.
 wa-name 'Suvadeep'.
 wa-loct 'Kolkata'.
 append wa to it.


 wa-id '2'.
 wa-name 'Soumyodeep'.
 wa-loct 'Bangalore'.
 append wa to it.


 wa-id '3'.
 wa-name 'NitaiPada'.
 wa-loct 'Chennai'.
 append wa to it.


 wa-id '4'.
 wa-name 'Chirashree'.
 wa-loct 'Hyderabad'.
 append wa to it.

**loop at it into wa.
*   write: / wa-id, wa-name, wa-loct.
*   ENDLOOP.

*read table it into wa index 1.
*if sy-subrc = 0.
*  write: wa-id, wa-name, wa-loct.
*  endif.

*SORT it ASCENDING.
*loop at it into wa.
*write: / wa-id, wa-name, wa-loct.
*endloop.

*LOOP AT it INTO wa.
*  IF wa-name = 'Chirashree'.
*    wa-name = 'Chiroshree'.
*    MODIFY it FROM wa.
*  ENDIF.
*ENDLOOP.

*loop at it into wa.
*  write: / wa-id, wa-name, wa-loct.
*  endloop.

*COLLECT wa INTO it.
*loop at it INTO wa.
*  WRITE: / wa-id, wa-name, wa-loct.
*  ENDLOOP.W

*refresh it.
*LOOP at it INTO wa.
*wRITE: / wa-id, wa-name, wa-loct.
*  ENDLOOP.
*data: lv_lines TYPE i.
*DESCRIBE TABLE it LINES lv_lines.
*WRITE: / 'Number of records in internal table:', lv_lines.

Post a Comment

0 Comments