SAMPLE PROGRAM FOR GETTING PURCHASE ORDER DETAILS USING BAPI BAPI_PO_GETITEMS
*&---------------------------------------------------------------------*
*& Report ZRP_BAPI_USING_FM_
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZRP_BAPI_USING_FM_.
types: BEGIN OF TY_PO,
EBELN TYPE EKPO-EBELN,
EBELP TYPE EKPO-EBELP,
MATNR TYPE EKPO-MATNR,
BUKRS TYPE EKPO-BUKRS,
WERKS TYPE EKPO-WERKS,
MATKL TYPE EKPO-MATKL,
MEINS TYPE EKPO-MEINS,
NETPR TYPE EKPO-NETPR,
END OF TY_PO.
data : it_po type standard table of ty_po,
wa_po like line of it_po.
start-of-selection.
perform get_data.
perform process_data.
end-of-selection.
perform display_data.
*&---------------------------------------------------------------------*
*& Form get_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM get_data .
select EBELN
EBELP
MATNR
BUKRS
WERKS
MATKL
MEINS
NETPR from ekpo into table it_po up to 50 rows.
if sy-subrc ne 0.
message : ' No data FOUND' type 'E'.
endif.
ENDFORM. " get_data
*&---------------------------------------------------------------------*
*& Form display_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM display_data .
DATA : OBJ TYPE REF TO CL_SALV_TABLE.
TRY.
CALL METHOD CL_SALV_TABLE=>FACTORY
IMPORTING
R_SALV_TABLE = OBJ
CHANGING
T_TABLE = it_po.
CATCH CX_SALV_MSG .
ENDTRY.
OBJ->DISPLAY( ).
ENDFORM. " display_data
*&---------------------------------------------------------------------*
*& Form process_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM process_data .
data : lv_po type BAPIEKKO-PO_NUMBER .
data : lt_item type standard table of BAPIEKPOC,
ls_item type BAPIEKPOC.
LOOP AT it_po into wa_po.
CALL FUNCTION 'BAPI_PO_GETITEMS'
EXPORTING
PURCHASEORDER = lv_po
* DOC_TYPE =
* DOC_DATE =
* PUR_GROUP =
* PURCH_ORG =
* VENDOR =
* SUPPL_PLANT =
* MATERIAL =
* MAT_GRP =
* ITEM_CAT =
* ACCTASSCAT =
* PLANT =
* TRACKINGNO =
* SHORT_TEXT =
* CREATED_BY =
* PREQ_NAME = ' '
* WITH_PO_HEADERS = ' '
* DELETED_ITEMS = ' '
* ITEMS_OPEN_FOR_RECEIPT = ' '
* PUR_MAT = ' '
* MATERIAL_EVG =
* PUR_MAT_EVG =
TABLES
* PO_HEADERS =
PO_ITEMS = lt_item
* RETURN =
.
* move-corresponding : wa_po to
ENDLOOP.
ENDFORM. " process_data
No comments:
Post a Comment