Skip to Content
0
Sep 03, 2007 at 06:53 AM

BAPI_PO_CREATE1

14 Views

Hii experts....help me..

when i create a purchase order using BAPI (BAPI_PO_CREATE1)... i am getting error message..(this is my first exp..with BAPI)

1.Check item number 0 in table POSCHEDULEX

FORM bapi_upload .

it_itab[] = itab[].

read table itab.

move-corresponding itab to G_BAPIMEPOHEADER.

G_BAPIMEPOHEADER-CREAT_DATE = sy-datum.

G_BAPIMEPOHEADER-CREATED_BY = sy-uname.

append G_BAPIMEPOHEADER.

g_poheaderx-comp_code = 'X'.

g_poheaderx-vendor = 'X'.

g_poheaderx-doc_type = 'X'.

g_poheaderx-purch_org = 'X'.

g_poheaderx-pur_group = 'X'.

g_poheaderx-suppl_plnt = 'X'.

loop at it_itab where material = itab-material.

move-corresponding it_itab to G_BAPIMEPOITEM.

append G_BAPIMEPOITEM.

move-corresponding it_itab to G_BAPIMEPOSCHEDULE.

append G_BAPIMEPOSCHEDULE.

g_poitemx-PO_ITEM = it_itab-PO_ITEM.

g_poitemx-PO_ITEMX = 'X'.

g_poitemx-item_cat = 'X'.

g_poitemx-stge_loc = 'X'.

g_poitemx-acctasscat = 'X'.

g_poitemx-short_text = 'X'.

g_poitemx-matl_group = 'X'.

g_poitemx-quantity = 'X'.

g_poitemx-po_unit = 'X'.

g_poitemx-orderpr_un = 'X'.

g_poitemx-trackingno = 'X'.

g_poitemx-delete_ind = 'X'.

append g_poitemx.

*G_BAPIMEPOSCHEDULE-PO_ITEM = it_itab-PO_ITEM.

*G_BAPIMEPOSCHEDULE-SCHED_LINE = 'X'.

*G_BAPIMEPOSCHEDULE-DEL_DATCAT_EXT = 'X'.

*G_BAPIMEPOSCHEDULE-DELIVERY_DATE = 'X'.

*G_BAPIMEPOSCHEDULE-QUANTITY = it_itab-quantity.

*G_BAPIMEPOSCHEDULE-DELIV_TIME = 'X'.

*G_BAPIMEPOSCHEDULE-STAT_DATE = 'X'.

*append G_BAPIMEPOSCHEDULE.

g_poschedulex-PO_ITEM = 'X'.

g_poschedulex-SCHED_LINE = 'X'.

g_poschedulex-PO_ITEMX = 'X'.

g_poschedulex-SCHED_LINEX = 'X'.

g_poschedulex-DEL_DATCAT_EXT = 'X'.

g_poschedulex-DELIVERY_DATE = 'X'.

g_poschedulex-QUANTITY = 'X'.

g_poschedulex-DELIV_TIME = 'X'.

g_poschedulex-STAT_DATE = 'X'.

g_poschedulex-PREQ_NO = 'X'.

g_poschedulex-PREQ_ITEM = 'X'.

g_poschedulex-PO_DATE = 'X'.

g_poschedulex-ROUTESCHED = 'X'.

g_poschedulex-MS_DATE = 'X'.

append g_poschedulex.

endloop.

CALL FUNCTION 'BAPI_PO_CREATE1'

EXPORTING

POHEADER = G_BAPIMEPOHEADER

POHEADERX = g_poheaderx

IMPORTING

EXPPURCHASEORDER = g_ebeln

TABLES

RETURN = G_BAPIRET2

POITEM = G_BAPIMEPOITEM

POITEMX = g_poitemx

POSCHEDULE = G_BAPIMEPOSCHEDULE

POSCHEDULEX = g_poschedulex

endform.