06-17-2009 1:52 AM
<br>Hi Experts,</br>
I'm currently doing a code using BAPI_PO_CREATE1. The problem is, when inserting an existing PR in the POITEM table, i receive an error "Purchase Requisition XXXXX Item XXX does not exist", although when I checked the PR, it does exist.
But when I tried creating a PO without a reference PR it was able to create the PO successfully.
Below is the data that i pass to the FM BAPI_PO_CREATE1.
data:
wa_poheader type BAPIMEPOHEADER,
wa_poheaderx type BAPIMEPOHEADERX,
i_return type table of BAPIRET2,
i_poitem type table of BAPIMEPOITEM,
wa_poitem type BAPIMEPOITEM,
i_poitemx type table of BAPIMEPOITEMX,
wa_poitemx type BAPIMEPOITEMX,
i_poschedule type table of BAPIMEPOSCHEDULE,
wa_poschedule type BAPIMEPOSCHEDULE,
i_poschedulex type table of BAPIMEPOSCHEDULX,
wa_poschedulex type BAPIMEPOSCHEDULX.
wa_poheader-PO_NUMBER = 'MO10000201'.
wa_poheader-COMP_CODE = 'ES10'.
wa_poheader-DOC_TYPE = 'ZPM'.
wa_poheader-CREATED_BY = 'sample'.
wa_poheader-ITEM_INTVL = '00010'.
wa_poheader-VENDOR = '0000047173'.
wa_poheader-PURCH_ORG = '2050'.
wa_poheader-PUR_GROUP = 'ZPM'.
wa_poheader-CURRENCY = 'EUR'.
wa_poheader-DOC_DATE = '20090610'.
wa_poheader-REF_1 ='1'.
wa_poheader-SALES_PERS = 'sales.person'.
wa_poheaderx-PO_NUMBER = 'X'.
wa_poheaderx-COMP_CODE = 'X'.
wa_poheaderx-DOC_TYPE = 'X'.
wa_poheaderx-CREATED_BY = 'X'.
wa_poheaderx-ITEM_INTVL = 'X'.
wa_poheaderx-VENDOR = 'X'.
wa_poheaderx-PURCH_ORG = 'X'.
wa_poheaderx-PUR_GROUP = 'X'.
wa_poheaderx-CURRENCY = 'X'.
wa_poheaderx-DOC_DATE = 'X'.
wa_poheaderx-REF_1 ='X'.
wa_poheaderx-SALES_PERS = 'X'.
wa_poitem-PO_ITEM = '1'.
wa_poitem-SHORT_TEXT = 'Sample material'.
wa_poitem-MATERIAL = '000000001000006671'.
wa_poitem-PLANT = '1113'.
wa_poitem-QUANTITY = '6.000'.
wa_poitem-PO_UNIT = 'EA'.
wa_poitem-PO_UNIT_ISO = 'EA'.
wa_poitem-NET_PRICE = '10.78'.
wa_poitem-PREQ_NO = '53392605'.
wa_poitem-PREQ_ITEM = '10'.
wa_poitem-UNTIL_DATE = '20090616'.
append wa_poitem to i_poitem.
wa_poitemx-PO_ITEM = '1'.
wa_poitemx-SHORT_TEXT = 'X'.
wa_poitemx-MATERIAL = 'X'.
wa_poitemx-PLANT = 'X'.
wa_poitemx-QUANTITY = 'X'.
wa_poitemx-PO_UNIT = 'X'.
wa_poitemx-PO_UNIT_ISO = 'X'.
wa_poitemx-NET_PRICE = 'X'.
wa_poitemx-PREQ_NO = 'X'.
wa_poitemx-PREQ_ITEM = 'X'.
wa_poitem-UNTIL_DATE = 'X'.
append wa_poitemx to i_poitemx.
wa_poschedule-PO_ITEM = '1'.
wa_poschedule-DEL_DATCAT_EXT ='D'.
wa_poschedule-DELIVERY_DATE = '20090602'.
append wa_poschedule to i_poschedule.
wa_poschedulex-PO_ITEM = '1'.
wa_poschedulex-DEL_DATCAT_EXT = 'X'.
wa_poschedulex-DELIVERY_DATE = 'X'.
append wa_poschedulex to i_poschedulex.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = wa_poheader
POHEADERX = wa_poheaderx
TABLES
RETURN = i_return
POITEM = i_poitem
POITEMX = i_poitemx
POSCHEDULE = i_poschedule
POSCHEDULEX = i_poschedulex.
Thank you in advance for your help.
Edited by: AbeCayago on Jun 17, 2009 3:10 AM
Edited by: AbeCayago on Jun 17, 2009 3:12 AM
06-17-2009 2:16 AM
Hello ,
ur code looks okay , but make sure u need to pass full length field values to BAPI fields, this is the first thing u need to remember while using bapis.
wa_poitem-PREQ_NO = '0053392605'. wa_poitem-PREQ_ITEM = '000010'.
2. try to create PO with PR manually then check errrors , if not then probs with ur coding only.
regards
Prabhu
06-17-2009 2:16 AM
Hello ,
ur code looks okay , but make sure u need to pass full length field values to BAPI fields, this is the first thing u need to remember while using bapis.
wa_poitem-PREQ_NO = '0053392605'. wa_poitem-PREQ_ITEM = '000010'.
2. try to create PO with PR manually then check errrors , if not then probs with ur coding only.
regards
Prabhu