‎2006 Jun 23 8:24 AM
hai
i am trying to create po using bapi
the following code explains
constants : c_x value 'X'.
data: del_date type sy-datum.
data: pohead type bapimepoheader.
data: poheadx type bapimepoheaderx.
data: exp_head type bapimepoheader.
data: t_return_out type table of bapiret2 with header line,
wa_return_out TYPE bapiret2.
data: poitem type table of bapimepoitem with header line.
data: poitemx type table of bapimepoitemx with header line.
data: posched type table of bapimeposchedule with header line.
data: poschedx type table of bapimeposchedulx with header line.
data: ex_po_number type bapimepoheader-po_number.
Header Level Data
pohead-comp_code = '1011'.
pohead-doc_type = 'NB' .
pohead-creat_date = sy-datum .
pohead-vendor = 'A1138'.
pohead-purch_org = 'DOMS'.
pohead-pur_group = 'MFR'.
pohead-langu = sy-langu .
pohead-doc_date = sy-datum.
poheadx-comp_code = c_x.
poheadx-doc_type = c_x.
poheadx-creat_date = c_x.
poheadx-vendor = c_x.
poheadx-langu = c_x.
poheadx-purch_org = c_x.
poheadx-pur_group = c_x.
poheadx-doc_date = c_x.
Item Level Data
poitem-po_item = 1.
poitem-material = '000000000100001079'.
poitem-plant = 'HO01'.
poitem-stge_loc = ''.
poitem-quantity = 1.
append poitem.
poitemx-po_item = 1.
poitemx-po_itemx = c_x.
poitemx-material = c_x.
poitemx-plant = c_x .
poitemx-stge_loc = c_x .
poitemx-quantity = c_x .
poitemx-tax_code = c_x .
poitemx-item_cat = c_x .
poitemx-acctasscat = c_x .
append poitemx.
Schedule Line Level Data
posched-po_item = 1.
posched-sched_line = 1.
posched-del_datcat_ext = 'D'.
del_date = sy-datum + 1.
write del_date to posched-delivery_date.
posched-deliv_time = '000001'.
posched-quantity = 1.
append posched.
*
poschedx-po_item = 1.
poschedx-sched_line = 1.
poschedx-po_itemx = c_x.
poschedx-sched_linex = c_x.
poschedx-del_datcat_ext = c_x.
poschedx-delivery_date = c_x.
poschedx-quantity = c_x.
append poschedx.
call function 'BAPI_PO_CREATE1'
EXPORTING
poheader = pohead
poheaderx = poheadx
testrun = ' '
IMPORTING
exppurchaseorder = ex_po_number
expheader = exp_head
TABLES
return = t_return_out
poitem = poitem
poitemx = poitemx.
poschedule = posched
poschedulex = poschedx.
call function 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
*
if not ex_po_number is initial.
call function 'DEQUEUE_ALL'.
else.
call function 'DEQUEUE_ALL'.
message i036.
endif.
**endform. " create_po
IF ex_po_number IS NOT INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
PERFORM show_result.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
PERFORM show_result.
ENDIF.
&----
*& Form show_result
&----
text
----
--> p1 text
<-- p2 text
----
FORM show_result .
LOOP AT t_return_out INTO wa_return_out.
write : ex_po_number.
WRITE : / wa_return_out-type,
/ wa_return_out-id,
/ wa_return_out-number,
/ wa_return_out-message,
/ wa_return_out-log_no,
/ wa_return_out-log_msg_no,
/ wa_return_out-message_v1,
/ wa_return_out-message_v2,
/ wa_return_out-message_v3,
/ wa_return_out-message_v4,
/ wa_return_out-parameter,
/ wa_return_out-row,
/ wa_return_out-field,
/ wa_return_out-system.
ENDLOOP.
iam geting the error such that
E
BAPI
001
No instance of object type PurchaseOrder has been created. External reference:
000000
PurchaseOrder
POHEADER
1
E
ME
062
Account assignment mandatory for material 100001079 (enter acc. ass. cat.)
000000
100001079
POITEM
how to correct this error
regards
vijay
‎2006 Jun 23 8:39 AM
its due to problem with the MATNR , So check Account Assignment in SPRO.
best Method to rearch in SPRO is Ctrl+F
Regards
Prabhu
‎2006 Jun 23 8:54 AM
hai prabhu
Actually i had check with different items , repeatedly iam getting the same error.
is accountinfo mandatory for bapi_po_create1
do you have any bdc program or any bapi program with you
for me21n
please advice me
regards
vijay
‎2006 Jun 29 5:29 AM
Hi ,
yeah u have to pass the Account Info like G/L code , CostCenter , Controling Area .
more info please check the Documentation , and where-used list.
Regards
Prabhu
‎2006 Jun 23 8:52 AM
I think its the issue with data. try soem other material which is under the the same company code. or Go an check an existing PO and get the material and BUKRS data from there.
rgds,
TM.
‎2006 Jun 23 10:01 AM
‎2006 Jun 23 10:16 AM
Hi,
U can do the Procurement for Stock and Procurement for Direct Consumption.
For direct consumption u have to do the account assignment. For your case account assignment may not require.
Regards,
Sudhakar.
‎2006 Jun 29 2:15 AM
Vijay,
The issue is specific with the data of the material and account assignment in your system. Pull out a existing a PO for the material that you are trying to use and see the data in there and try to use the same data. That should work.
Regards,
Ravi
‎2006 Jun 29 1:58 AM
Hi Vijay,
Have you solved this problem? I'm having the same one.
Regards,
Cristiano Soares
‎2006 Jun 29 3:31 AM
Only the following error appears to me in RZ20:
"Shopping cart 1000002572 (PO 4100000492): BAPI 001 No instance of object type PurchaseOrder has been created. External reference"
Do you know what can it be?
Regards,
Cristiano Soares
‎2006 Jun 29 4:29 AM
hai cristiano
could you give me some more clarity regarding your bug
regards
vijay
‎2006 Jun 29 1:58 PM
The error was that the tax field was obligatory in PO, but the interface was not filling that.
Thanks for the help,
Cristiano Soares