REDUCE Operator in ABAP- Use2

1 New REDUCE operator can be used in many ways.

 

 

 

DATAlt_sflight  TYPE TABLE OF sflight,
lv_occ_seat TYPE i.

START-OF-SELECTION.
  SELECT FROM sflight INTO TABLE lt_sflight WHERE carrid 'AA' OR
                                                    carrid 'DL'.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program sy-repid
      i_structure_name   'SFLIGHT'
    TABLES
      t_outtab           lt_sflight.

lv_occ_seat REDUCE iINIT FOR ls IN lt_sflight
                          WHERE carrid 'DL' )
                          NEXT + ls-seatsocc ).
  WRITE:'Total occupied seats for carrid = LH'lv_occ_seat COLOR 3.

OUTPUT

78


 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s