2008 Mar 18 4:13 PM
Hi out there,
im trying to find out, how to use the BAPI_PO_CREATE1 with the limits table
to create a Service PO with NO_LIMIT.
- Without Limit its working fine, but when I specify a limit line to the package number of the PO its telling me "SE 518 theres no accounting to position 00000000".
- I built several examples with SE37 test functionality
I googled, and some have the same problem, but theres no solution up to now.
Release is 46c and there are some OSS, but I checked them all and there all built in.
Szenario: Service PO, with 1 position, 1 service line, Accounting to purchcase requisition and order (accounting type F).
Who had the same problem (and solved it) ? If useful, i post the complete coding, but maybe someone has a running coding part himself ?
Please no trivial answers panting for points.
Thanks in advance.
Norbert
2008 Mar 18 5:33 PM
2008 Mar 18 5:33 PM
2008 Mar 18 5:40 PM
2024 Feb 28 10:36 AM
Hi G@urav
I couldn't find the solution. can you share it here?
Best regards
Mehmet
2024 Feb 28 3:59 PM - edited 2024 Feb 28 4:24 PM
Use the search tool (two discussions with almot the same title 😂)
(Also, a former member is unlikely to respond...)
2008 Mar 18 7:41 PM
Hello Norbert,
you should have a look at OSS note 420332. There's an example, which describes, how to fill the tables for BAPI_PO_CREATE. I think it's nearly the same for BAPI_PO_CREATE1.
Btw - BAPI_PO_CREATE1 isn't officially released by SAP for release 4.6C. See OSS note 372976. So if it's not working, it could also be a problem with the version (see OSS note 197958 for missing functionality)
Depending on your Hot package level (if < 30), also OSS note 494446 could be relevant ->
Limits and services were not transferred in the new BAPI - limits of neither item category B nor item category D. Also the error messages that are returned in parameter 'Return' indicate that account assignment records are missing although these were not transferred in the BAPI.
Hope that helps.
Best regards
Stephan
2008 Mar 20 9:41 AM
Thanks to you all.
I think my problem was, that I mixed up the line numbers of the services.
To check this, I created a report, that first reads an existing PO and then creates a PO with the same parameters. So one can debug the whole process.
So maybee one can use it.
REPORT zre_create_po LINE-SIZE 180.
TABLES: bapimepoheader,
bapimepoheaderx,
bapimepoaddrvendor,
bapiflag,
bapiret2,
bapimepoitem,
bapimepoitemx,
bapimepoaddrdelivery,
bapimeposchedule,
bapimeposchedulx,
bapimepoaccount,
bapimepoaccountprofitsegment,
bapimepoaccountx,
bapimepocondheader,
bapimepocondheaderx,
bapimepocond,
bapimepocondx,
bapiesuhc,
bapiesucc,
bapiesllc,
bapiesklc,
bapieslltx,
bapiparex,
bapimepotextheader,
bapimepotext,
bapiekkop,
ekko.
DATA: gv_ebeln TYPE bapimepoheader-po_number,
gv_testrun TYPE bapiflag-bapiflag,
gv_no_authority TYPE bapiflag-bapiflag,
gv_memory_uncomplete TYPE bapiflag-bapiflag,
qv_memory_complete TYPE bapiflag-bapiflag.
DATA: wa_bapimepoheader_input TYPE bapimepoheader,
wa_bapimepoheader_output TYPE bapimepoheader,
wa_bapimepoheaderx TYPE bapimepoheaderx,
wa_bapimepoaddrvendor TYPE bapimepoaddrvendor.
DATA: it_return TYPE TABLE OF bapiret2 WITH HEADER LINE,
it_poitem TYPE TABLE OF bapimepoitem WITH HEADER LINE,
it_poitemx TYPE TABLE OF bapimepoitemx WITH HEADER LINE,
it_poaddrdelivery TYPE TABLE OF bapimepoaddrdelivery
WITH HEADER LINE,
it_poschedule TYPE TABLE OF bapimeposchedule WITH HEADER LINE,
it_poschedulex TYPE TABLE OF bapimeposchedulx WITH HEADER LINE,
it_poaccount TYPE TABLE OF bapimepoaccount WITH HEADER LINE,
it_poaccountprofitsegment TYPE TABLE OF
bapimepoaccountprofitsegment
WITH HEADER LINE,
it_poaccountx TYPE TABLE OF bapimepoaccountx WITH HEADER LINE,
it_pocondheader TYPE TABLE OF bapimepocondheader WITH HEADER LINE,
it_pocondheaderx TYPE TABLE OF bapimepocondheaderx
WITH HEADER LINE,
it_pocond TYPE TABLE OF bapimepocond WITH HEADER LINE,
it_pocondx TYPE TABLE OF bapimepocondx WITH HEADER LINE,
it_polimits TYPE TABLE OF bapiesuhc WITH HEADER LINE,
it_pocontractlimits TYPE TABLE OF bapiesucc WITH HEADER LINE,
it_poservices TYPE TABLE OF bapiesllc WITH HEADER LINE,
it_posrvaccessvalues TYPE TABLE OF bapiesklc WITH HEADER LINE,
it_poservicestext TYPE TABLE OF bapieslltx WITH HEADER LINE,
it_extensionin TYPE TABLE OF bapiparex WITH HEADER LINE,
it_extensionout TYPE TABLE OF bapiparex WITH HEADER LINE,
it_potextheader TYPE TABLE OF bapimepotextheader WITH HEADER LINE,
it_potextitem TYPE TABLE OF bapimepotext WITH HEADER LINE,
it_popartner TYPE TABLE OF bapiekkop WITH HEADER LINE.
DATA: gv_typ.
FIELD-SYMBOLS: <wert>.
PARAMETERS: pa_ebeln TYPE ekko-ebeln DEFAULT '4500000019',
p_brk AS CHECKBOX,
p_test AS CHECKBOX DEFAULT 'X'.
TOP-OF-PAGE.
FORMAT COLOR COL_HEADING.
WRITE:/ 'Type', 6 'Id',
16 'Number',
24 'Message',
90 'Message1',
105 'Parameter',
115 'Row',
120 'Field'.
FORMAT COLOR OFF.
START-OF-SELECTION.
CLEAR: wa_bapimepoheader_output,
wa_bapimepoheader_input,
gv_ebeln,
gv_testrun,
gv_no_authority,
gv_memory_uncomplete,
qv_memory_complete,
gv_typ.
CLEAR: it_return,
it_poitem,
it_poitemx,
it_poaddrdelivery,
it_poschedule,
it_poschedulex,
it_poaccount,
it_poaccountprofitsegment,
it_poaccountx,
it_pocondheader,
it_pocondheaderx,
it_pocond,
it_pocondx,
it_polimits,
it_pocontractlimits,
it_poservices,
it_posrvaccessvalues,
it_poservicestext,
it_extensionin,
it_extensionout,
it_potextheader,
it_potextitem,
it_popartner.
REFRESH: it_return,
it_poitem,
it_poitemx,
it_poaddrdelivery,
it_poschedule,
it_poschedulex,
it_poaccount,
it_poaccountprofitsegment,
it_poaccountx,
it_pocondheader,
it_pocondheaderx,
it_pocond,
it_pocondx,
it_polimits,
it_pocontractlimits,
it_poservices,
it_posrvaccessvalues,
it_poservicestext,
it_extensionin,
it_extensionout,
it_potextheader,
it_potextitem,
it_popartner.
gv_ebeln = pa_ebeln.
gv_testrun = p_test.
gv_no_authority = 'X'.
gv_memory_uncomplete = 'X'.
qv_memory_complete = 'X'.
* Bestelldaten auslesen
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = gv_ebeln
* poheader = wa_bapimepoheader_input
* poheaderx =
* poaddrvendor =
testrun = gv_testrun
memory_uncomplete = gv_memory_uncomplete
memory_complete = qv_memory_complete
* no_messaging =
* no_message_req =
no_authority = gv_no_authority
* no_price_from_po =
IMPORTING
expheader = wa_bapimepoheader_output
TABLES
return = it_return
poitem = it_poitem
poitemx = it_poitemx
poaddrdelivery = it_poaddrdelivery
poschedule = it_poschedule
poschedulex = it_poschedulex
poaccount = it_poaccount
poaccountprofitsegment = it_poaccountprofitsegment
poaccountx = it_poaccountx
pocondheader = it_pocondheader
pocondheaderx = it_pocondheaderx
pocond = it_pocond
pocondx = it_pocondx
polimits = it_polimits
pocontractlimits = it_pocontractlimits
poservices = it_poservices
posrvaccessvalues = it_posrvaccessvalues
poservicestext = it_poservicestext
extensionin = it_extensionin
extensionout = it_extensionout
potextheader = it_potextheader
potextitem = it_potextitem
popartner = it_popartner.
IF NOT it_return[] IS INITIAL.
LOOP AT it_return.
WRITE:/ it_return.
ENDLOOP.
ENDIF.
* Kopf
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE wa_bapimepoheaderx
TO <wert>.
IF sy-subrc <> 0.
EXIT.
ELSE.
<wert> = 'X'.
ENDIF.
ENDDO.
* Items
CLEAR: it_poitemx,
it_poitemx[].
LOOP AT it_poitem.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE it_poitemx
TO <wert>.
IF sy-subrc <> 0.
EXIT.
ELSE.
CLEAR: gv_typ.
DESCRIBE FIELD <wert> TYPE gv_typ.
IF gv_typ = 'N'. "'I','P','F'
<wert> = it_poitem-po_item.
ELSE.
<wert> = 'X'.
ENDIF.
ENDIF.
ENDDO.
APPEND it_poitemx.
CLEAR: it_poitem,
it_poitemx,
gv_typ.
ENDLOOP.
* Schedule
CLEAR: it_poschedulex,
it_poschedulex[].
LOOP AT it_poschedule.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE it_poschedulex
TO <wert>.
IF sy-subrc <> 0.
EXIT.
ELSE.
CLEAR: gv_typ.
DESCRIBE FIELD <wert> TYPE gv_typ.
IF gv_typ = 'N'. "'I','P','F'
IF sy-index = 1.
<wert> = it_poschedule-po_item.
ELSEIF sy-index = 2.
<wert> = it_poschedule-sched_line.
ENDIF.
ELSE.
<wert> = 'X'.
ENDIF.
ENDIF.
ENDDO.
APPEND it_poschedulex.
CLEAR: it_poschedule,
it_poschedulex,
gv_typ.
ENDLOOP.
* Kontierung
CLEAR: it_poaccountx,
it_poaccountx[].
LOOP AT it_poaccount.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE it_poaccountx
TO <wert>.
IF sy-subrc <> 0.
EXIT.
ELSE.
CLEAR: gv_typ.
DESCRIBE FIELD <wert> TYPE gv_typ.
IF gv_typ = 'N'. "'I','P','F'
IF sy-index = 1.
<wert> = it_poaccount-po_item.
ELSEIF sy-index = 2.
<wert> = it_poaccount-serial_no.
ENDIF.
ELSE.
<wert> = 'X'.
ENDIF.
ENDIF.
ENDDO.
APPEND it_poaccountx.
CLEAR: it_poaccount,
it_poaccountx,
gv_typ.
ENDLOOP.
* Kopfkonditionen
CLEAR: it_pocondheaderx,
it_pocondheaderx[].
LOOP AT it_pocondheader.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE it_pocondheaderx
TO <wert>.
IF sy-subrc <> 0.
EXIT.
ELSE.
IF sy-index = 1.
<wert> = it_pocondheader-condition_no.
ELSEIF sy-index = 2.
<wert> = it_pocondheader-itm_number.
ELSEIF sy-index = 3.
<wert> = it_pocondheader-cond_st_no.
ELSE.
<wert> = 'X'.
ENDIF.
ENDIF.
ENDDO.
APPEND it_pocondheaderx.
CLEAR: it_pocondheader,
it_pocondheaderx.
ENDLOOP.
* Positionskonditionen
CLEAR: it_pocondx,
it_pocondx[].
LOOP AT it_pocond.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE it_pocondx
TO <wert>.
IF sy-subrc <> 0.
EXIT.
ELSE.
IF sy-index = 1.
<wert> = it_pocond-condition_no.
ELSEIF sy-index = 2.
<wert> = it_pocond-itm_number.
ELSEIF sy-index = 3.
<wert> = it_pocond-cond_st_no.
ELSE.
<wert> = 'X'.
ENDIF.
ENDIF.
ENDDO.
APPEND it_pocondx.
CLEAR: it_pocond,
it_pocondx.
ENDLOOP.
* Bestellung anlegen
IF NOT wa_bapimepoheader_output-po_number IS INITIAL.
wa_bapimepoheader_input = wa_bapimepoheader_output.
CLEAR: wa_bapimepoheader_input-po_number,
wa_bapimepoheader_output,
gv_ebeln,
it_return,
it_return[].
wa_bapimepoheader_input-creat_date = sy-datum.
wa_bapimepoheader_input-doc_date = sy-datum.
IF p_brk = 'X'.
BREAK-POINT.
ENDIF.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = wa_bapimepoheader_input
poheaderx = wa_bapimepoheaderx
* poaddrvendor =
testrun = p_test
* memory_uncomplete = space "gv_memory_uncomplete
memory_complete = space "qv_memory_complete
* no_messaging =
* no_message_req =
* no_authority = gv_no_authority
* no_price_from_po =
IMPORTING
exppurchaseorder = gv_ebeln
expheader = wa_bapimepoheader_output
TABLES
return = it_return
poitem = it_poitem
poitemx = it_poitemx
poaddrdelivery = it_poaddrdelivery
poschedule = it_poschedule
poschedulex = it_poschedulex
poaccount = it_poaccount
poaccountprofitsegment = it_poaccountprofitsegment
poaccountx = it_poaccountx
pocondheader = it_pocondheader
pocondheaderx = it_pocondheaderx
pocond = it_pocond
pocondx = it_pocondx
polimits = it_polimits
pocontractlimits = it_pocontractlimits
poservices = it_poservices
posrvaccessvalues = it_posrvaccessvalues
poservicestext = it_poservicestext
extensionin = it_extensionin
extensionout = it_extensionout
potextheader = it_potextheader
potextitem = it_potextitem
popartner = it_popartner.
WRITE:/ 'Einkaufsbeleg:', 20 gv_ebeln.
LOOP AT it_return.
WRITE:/ it_return-type UNDER 'Type',
it_return-id UNDER 'Id',
it_return-number UNDER 'Number',
it_return-message UNDER 'Message',
it_return-message_v1 UNDER 'Message1',
it_return-parameter UNDER 'Parameter',
it_return-row UNDER 'Row' LEFT-JUSTIFIED,
it_return-field UNDER 'Field'.
CLEAR: it_return.
ENDLOOP.
ENDIF. "if not wa_bapimepoheader_output-po_number is initial.
IF p_test = space.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.