Select options in usual ABAP class.

 

1. Goto SE24.

2. Give class name and click on create and give description.



3. Click on save.

4. Give method name, level, visibility, description.


5. Save, check and activate.

6. Click on parameters tab and give parameters.

         * Create structure in SE11 for select option.

            - Goto T-code -SE11.

            - Select data type and give name.

            - Click on create and select structure.

            - Give fields, check, activate.

            



    
 * Create Table type in SE11 for select option.

             - Goto T-code -SE11.

            - Select data type and give name.

            - Click on create and select table type.

            - Give description and line type (Structure).


        * Create structure in SE11 for internal table.

            - Goto T-code -SE11.

            - Select data type and give name.

            - Click on create and select structure.

            - Give fields, check, activate.

  


         * Create Table type in SE11 for internal table..

             - Goto T-code -SE11.

            - Select data type and give name.

            - Click on create and select table type.

            - Give description and line type (Structure).

                



    * In Class Give select option and internal table. 


7. Save and activate.

8. Click on source code and write logic.

method GET_DATA.
    TYPES: BEGIN OF ty_ekko,
                 ebeln TYPE ebeln,
                 bukrs TYPE bukrs,
                 bstyp TYPE bstyp,
                 bsart TYPE bsart,
               END OF ty_ekko.
        TYPES: BEGIN OF ty_ekpo,
                 ebeln TYPE ebeln,
                 ebelp TYPE ebelp,
                 txz01 TYPE txz01,
                 matnr TYPE matnr,
               END OF ty_ekpo.
        DATA: lt_final TYPE zab_tt_eeko_ekpo,
              lr_final TYPE zab_str_eeko_ekpo,
              lr_ekko  TYPE ty_ekko,
              lt_ekko  TYPE TABLE OF ty_ekko,
              lr_ekpo  TYPE ty_ekpo,
              lt_ekpo  TYPE TABLE OF ty_ekpo.

        SELECT ebeln
                bukrs
                bstyp
                bsart
                FROM ekko
                INTO TABLE lt_ekko
                WHERE ebeln in sebeln.
        IF lt_ekko IS NOT INITIAL.
          SELECT ebeln
                  ebelp
                  txz01
                  matnr
                  FROM ekpo
                  INTO TABLE lt_ekpo
                  FOR ALL ENTRIES IN
                  lt_ekko
                  WHERE ebeln = lt_ekko-ebeln.
        ENDIF.
        LOOP AT lt_ekko INTO lr_ekko.
          lr_final-ebeln = lr_ekko-ebeln.
          lr_final-bukrs = lr_ekko-bukrs.
          lr_final-bstyp = lr_ekko-bstyp.
          lr_final-bsart = lr_ekko-bsart.
          LOOP AT lt_ekpo INTO lr_ekpo WHERE ebeln = lr_ekko-ebeln.
            lr_final-ebelp = lr_ekpo-ebelp.
            lr_final-txz01 = lr_ekpo-txz01.
            lr_final-matnr = lr_ekpo-matnr.
            APPEND lr_final TO gt_ekko_ekpo.
            CLEAR: lr_final.
          ENDLOOP.

        ENDLOOP.

  endmethod.

9. Activate and execute.

Input



Output



**********************Thank You**********************


Comments

Popular posts from this blog

Custom entity/Action dialog in RAP using Unmanaged scenario

New syntax for append- VALUE (new syntax 7.4+) in ABAP

Read statement new syntax in ABAP. (7.4+).