Display purchasing document details (EKKO + EKPO) 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.
- 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.
- Goto T-code -SE11.
- Select data type and give name.
- Click on create and select table type.
- Give description and line type (Structure).
* Create internal table with type table type.
7. Save and activate.
8. Click on source code and write logic.
METHOD display.
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 = pebeln.
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
Post a Comment