Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI_PO_CREATE1 function module giving errors while creating PO?

Former Member
0 Likes
1,346

Hi,

when i am creating Purchase Order using BAPI_PO_CREATE1 function module it is giving the following errors.

1-> Currency key is unknown

2-> No instance of object type PurchaseOrder has been created. External reference:

Code written is

DATA : cc TYPE i,

l_lifnr LIKE lfa1-lifnr.

LOOP AT i_dbtab INTO wa_dbtab.

cc = cc + 1.

IF cc = 1.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = wa_dbtab-lifnr

IMPORTING

output = l_lifnr.

*POPULATE HEADER DATA FOR PO

header-comp_code = wa_dbtab-bukrs.

header-doc_type = wa_dbtab-bsart. "Standard Order

header-creat_date = sy-datum.

header-vendor = wa_dbtab-lifnr.

header-purch_org = wa_dbtab-ekorg.

header-pur_group = wa_dbtab-ekgrp.

header-currency = wa_dbtab-currency.

header-currency_iso = wa_dbtab-currency.

*POPULATE HEADER FLAG.

headerx-comp_code = c_x.

headerx-doc_type = c_x.

headerx-creat_date = c_x.

headerx-vendor = c_x.

headerx-purch_org = c_x.

headerx-pur_group = c_x.

header-currency = c_x.

header-currency_iso = c_x.

ENDIF.

*POPULATE ITEM DATA.

item-po_item = wa_dbtab-item.

item-material = wa_dbtab-matnr.

item-plant = wa_dbtab-werks.

item-matl_group = wa_dbtab-mat_grp.

item-quantity = wa_dbtab-menge.

item-net_price = wa_dbtab-netwr.

APPEND item.

CLEAR item.

*POPULATE ITEM FLAG TABLE

itemx-po_item = wa_dbtab-item.

itemx-po_itemx = c_x.

itemx-material = c_x.

itemx-plant = c_x .

itemx-matl_group = c_x.

itemx-quantity = c_x .

itemx-net_price = c_x.

APPEND itemx.

CLEAR itemx.

ENDLOOP.

CALL FUNCTION 'BAPI_PO_CREATE1'

EXPORTING

poheader = header

poheaderx = headerx

IMPORTING

exppurchaseorder = ponumber

TABLES

return = rettab

poitem = item

poitemx = itemx.

PERFORM f_bapi_errors.

*

IF bapi_err_count = 0.

PERFORM bapi_commit.

  • PERFORM f_bapi_errors.

WRITE: 'Created Po no:', ponumber COLOR 5.

else.

PERFORM bapi_commit.

ENDIF.

5 REPLIES 5
Read only

andrea_galluccio2
Contributor
0 Likes
1,006

Hi,

Try this.

Populate ONLY the field "currency" and not also the field "currency_iso".

Hope it helps

Bye

Andrea

Read only

Former Member
0 Likes
1,006

Check the Currency Key that exists in the table "TCURC".

If yes then Fetch the corresponding iso code from the "TCURC" then populate the ISO code.

Here ur populating Currency into Currency ISO, which is different. So first check for the appropriate ISO code then populate.

Read only

Former Member
0 Likes
1,006

1-> Currency key is unknown ----> only pass the currency. like EUR ...

2-> No instance of object type PurchaseOrder has been created. External reference: ---> this is warning message not worry about this...

Read only

0 Likes
1,007

Even i passed only currency then also i got the below errors.

1-> No instance of object type PurchaseOrder has been created. External reference:

2-> PO header data still faulty

3-> No master record exists for vendor 100017

4-> Vendor 100017 does not exist

5-> Can delivery date be met?

how to rectify these errors. Is it any functional problem or data passing problem

header-comp_code = wa_dbtab-bukrs.

header-doc_type = wa_dbtab-bsart. "Standard Order

header-creat_date = sy-datum.

header-vendor = wa_dbtab-lifnr.

header-purch_org = wa_dbtab-ekorg.

header-pur_group = wa_dbtab-ekgrp.

header-currency = wa_dbtab-currency.

*POPULATE HEADER FLAG.

headerx-comp_code = c_x.

headerx-doc_type = c_x.

headerx-creat_date = c_x.

headerx-vendor = c_x.

headerx-purch_org = c_x.

headerx-pur_group = c_x.

headerX-currency = c_x.

  • headerX-currency_iso = c_x.

ENDIF.

*POPULATE ITEM DATA.

item-po_item = wa_dbtab-item.

item-material = wa_dbtab-matnr.

item-plant = wa_dbtab-werks.

item-matl_group = wa_dbtab-mat_grp.

item-quantity = wa_dbtab-menge.

item-net_price = wa_dbtab-netwr.

APPEND item.

CLEAR item.

*POPULATE ITEM FLAG TABLE

itemx-po_item = wa_dbtab-item.

itemx-po_itemx = c_x.

itemx-material = c_x.

itemx-plant = c_x .

itemx-matl_group = c_x.

itemx-quantity = c_x .

itemx-net_price = c_x.

APPEND itemx.

CLEAR itemx.

Read only

Former Member
0 Likes
1,006

THANK U