Skip to Content
0
Former Member
Feb 25, 2009 at 02:26 AM

Purchase order creation error

35 Views

Hi, please see below code to create PO. PO is creating perfectly alright but some how Goods Receipt Check is not there in Delivery tab for line item. Could you please tell me how do i get that GR filed checked? I don't know what mistake i am making.

Note : I am trying to create PO aganist Contract and trying to create Standard order (NB)

form map_input_data.

perform fill_bapiekkoc.

perform fill_bapiekkoa.

perform fill_bapiekpoc.

perform fill_bapiekpoa.

perform fill_bapieket.

perform fill_bapiekkn.

perform fill_bapiekpotx.

*----CALL THE FUNCTION TO CREATE THE PURCHASEORDER

perform call_create_purchaseorder.

endform. " MAP_INPUT_DATA

_________________________________________

form call_create_purchaseorder.

call function 'BAPI_PO_CREATE'

exporting

po_header = bapiekkoc

po_header_add_data = bapiekkoa

importing

purchaseorder = vbeln

tables

po_items = bapiekpoc

po_item_schedules = bapieket

return = bapireturn1

exceptions

others = 1.

if sy-subrc = 0.

clear bapireturn1.

read table bapireturn1 index 1.

if bapireturn1-type = ' ' or bapireturn1-type = 'S'.

clear itab_message.

move vbeln to itab_message-vbeln.

move ' : PURCHASEORDER CREATED SUCCESSFULLY' to itab_message-mess.

append itab_message.

else.

clear itab_error.

move bapireturn1 to itab_error.

append itab_error.

endif.

else.

write : / 'ERROR IN FUNCTION CALL'.

exit.

endif.

endform. " CALL_CREATE_PURCHASEORDER

-


form fill_bapiekkoc.

clear bapiekkoc.

bapiekkoc-doc_date = u201802/23/2009u2019.

bapiekkoc-doc_type = 'NB'.

move itab- to bapiekkoc-DOC_CAT.

move itab- to bapiekkoc-CO_CODE.

bapiekkoc-purch_org = '1000'.

bapiekkoc-pur_group = '001'.

move itab- to bapiekkoc-AGREEMENT.

bapiekkoc-vendor = 'SCM550-12'.

endform. " FILL_BAPIEKKOC

-


form fill_bapiekpoc.

clear bapiekpoc.

bapiekpoc-po_item = '00010'.

move itab- to bapiekpoc-AGREEMENT.

move itab- to bapiekpoc-AGMT_ITEM.

bapiekpoc-plant = '1000'.

bapiekpoc-unit = 'EA'.

bapiekpoc-net_price = '100000'.

bapiekpoc-price_unit = '5'.

bapiekpoc-orderpr_un = 'EA' .

append bapiekpoc.

endform. " FILL_BAPIEKPOC

-


form fill_bapieket.

clear bapieket.

bapieket-po_item = '000010'.

bapieket-deliv_date = sy-datum.

append bapieket.

endform. " FILL_BAPIEKET

-


form fill_bapiekkn.

clear bapiekkn.

bapiekkn-po_item = '000010'.

move itab- to bapiekkn-G_L_ACCT.

move itab- to bapiekkn-COST_CTR.

move itab- to bapiekkn-GR_RCPT.

move itab- to bapiekkn-UNLOAD_PT.

move itab- to bapiekkn-CO_AREA.

append bapiekkn.

endform. " FILL_BAPIEKKN