‎2009 Jan 12 1:10 PM
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.
‎2009 Jan 12 1:19 PM
Hi,
Try this.
Populate ONLY the field "currency" and not also the field "currency_iso".
Hope it helps
Bye
Andrea
‎2009 Jan 12 1:25 PM
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.
‎2009 Jan 12 2:01 PM
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...
‎2009 Jan 13 3:10 AM
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.
‎2009 Jan 13 4:18 AM