Application Development 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: 

BAPI_PO_CREATE1 create po without material master record

0 Kudos
1,625

Hello,

I try to create a purchase order foe several positions without material master records using the BAPI BAPI_PO_CREATE1. In the return table of the BAPI I get the error messages MEPO 049 (Purchase order item 00010 still contains faulty account assignments) and ME 083 (Enter G/L Account).

The G/L Account still is okay and can be used in M21N. Where is the problem?

Best regards

Armin

Position Table:

   *PO_ITEM  Positionsnummer des Einkaufsbelegs
    lv_pos = sy-tabix * 10.
    ls_poitem-po_item lv_pos.
    ls_poitemx-po_item = lv_pos.
    ls_poitemx-po_itemx = 'X'.
*SHORT_TEXT  Kurztext
    "Kurztext Preigruppe und Kostenstelle
    CONCATENATE ls_po->preisgrp ls_po->kostl INTO ls_poitem-short_text SEPARATED BY space.
    ls_poitemx-short_text = 'X'.
*MATERIAL Materialnummer
    ls_poitem-material = ''.
    ls_poitemx-material = 'X'.
*PLANT  Werk
    ls_poitem-plant = '1000'.
    ls_poitemx-plant = 'X'.
*STGE_LOC  Lagerort
    ls_poitem-stge_loc = iv_lgort.
    ls_poitemx-stge_loc = 'X'.
*TRACKINGNO  Bedarfsnummer
*MATL_GROUP  Warengruppe
    ls_poitem-matl_group = c_matl_group.
    ls_poitemx-matl_group = 'X'.
*QUANTITY  Bestellmenge
    ls_poitem-quantity = ls_po->anzahl.
    ls_poitemx-quantity = 'X'.
*PO_UNIT  Bestellmengeneinheit
    ls_poitem-po_unit = 'ST'.
    ls_poitemx-po_unit = 'X'.
*PO_UNIT_ISO  Bestellmengeneinheit im ISO-Code
    ls_poitem-po_unit_iso = 'ST'. "  Bestellmengeneinheit im ISO-Code
    ls_poitemx-po_unit_iso = 'X'.
*ORDERPR_UN  Bestellpreismengeneinheit
    ls_poitem-orderpr_un  = 'ST'. " Bestellpreismengeneinheit
    ls_poitemx-orderpr_un = 'X'.
*ORDERPR_UN_ISO  ISO-Code zur Bestellpreismengeneinheit
    ls_poitem-orderpr_un_iso = 'ST'. " ISO-Code zur Bestellpreismengeneinheit
    ls_poitemx-orderpr_un_iso = 'X'.
*CONV_NUM1  Zähler für die Umrechnung BPRME in BME
    ls_poitem-conv_num1 = '1'.
    ls_poitemx-conv_num1 = 'X'.
*CONV_DEN1  Nenner für die Umrechnung BPRME in BME
    ls_poitem-conv_den1 = '1'.
    ls_poitemx-conv_den1 = 'X'.
*NET_PRICE  Währungsbetrag für BAPIs (mit 9 Nachkommastellen)
    ls_poitem-net_price = ls_po->preis.
    ls_poitemx-net_price = 'X'.
*PRICE_UNIT  Preiseinheit
    ls_poitem-price_unit = 1.
    ls_poitemx-price_unit = 'X'.
*GR_PR_TIME  Bearbeitungszeit für Wareneingang in Tagen
    ls_poitem-gr_pr_time = '0'.
    ls_poitemx-gr_pr_time = 'X'.
*TAX_CODE  Umsatzsteuerkennzeichen
    ls_poitem-tax_code = '19'.
    ls_poitemx-tax_code = 'X'.
*PRNT_PRICE  Preisdruck
    ls_poitem-prnt_price = 'X'.
    ls_poitemx-prnt_price = 'X'.
*UNLIMITED_DLV  Kennzeichen: unbegrenzte Überlieferung erlaubt
    ls_poitem-unlimited_dlv = 'X'.
    ls_poitemx-unlimited_dlv = 'X'.
*ITEM_CAT Positionstyp im Einkaufsbeleg
    ls_poitem-item_cat = ' '.
    ls_poitemx-item_cat = 'X'.
*ACCTASSCAT Kontierungstyp
    ls_poitem-acctasscat = 'K'.
    ls_poitemx-acctasscat = 'X'.
*DISTRIB  Verteilungskennzeichen für Mehrfachkontierung
    ls_poitem-distrib = ''"Verteilungskennzeichen = Einfachkontierung
    ls_poitemx-distrib = 'X'.
*GR_IND Wareneingangskennzeichen
    ls_poitem-gr_ind = 'X' .
    ls_poitemx-gr_ind = 'X' .
*GR_NON_VAL Wareneingang unbewertet
*IR_IND Rechnungseingangskennzeichen
    ls_poitem-ir_ind = 'X' .
    ls_poitemx-ir_ind = 'X' .
*GR_BASEDIV Kennzeichen für WE-bezogene Rechnungsprüfung
    ls_poitem-gr_basediv = 'X'.
    ls_poitemx-gr_basediv = 'X'.
*PRICEDATE  Steuerung Preisfindungsdatum
    ls_poitem-pricedate = 'T'. "Tagesdatum
    ls_poitemx-pricedate = 'X'.
*PRICE_DATE Datum der Preisermittlung
    ls_poitem-price_date = sy-datum.
    ls_poitemx-price_date = 'X'.
*PO_PRICE Type  Preisübernahme: 1 = Brutto, 2 = Netto
    ls_poitem-po_price = 2.
    ls_poitemx-po_price = 'X'.

Accounting Table:

    lv_pos = sy-tabix * 10.
    ls_account-po_item = lv_pos.
    ls_accountx-po_item = lv_pos.
    ls_accountx-po_itemx = 'X'.

    " Einteilungsnummer
    lv_sl = sy-tabix * 10.
    ls_account-sched_line = lv_sl.
    ls_accountx-sched_line = 'X'.

    "laufende Nummer der Kontierung
    ls_account-serial_no = '01'.
    ls_accountx-serial_no = 'X'.

    " Datum
    ls_account-creat_date = sy-datum.
    ls_accountx-creat_date = 'X'.

    " Kostenstelle
    ls_account-costcenter = ls_po->kostl.
    ls_accountx-costcenter = 'X'.

    " Kostenrechnungskreis
    ls_account-co_area = '1000'.
    ls_accountx-co_area = 'X'.

    "Geschäftsbereich
    CONCATENATE '000' ls_po->kostl INTO lv_kostl.
    SELECT SINGLE gsber FROM csks INTO ls_account-bus_area
      WHERE kostl = lv_kostl AND
            kokrs = '1000' AND
            datbi GE sy-datum.
    ls_accountx-bus_area = 'X'.


    " Menge + Einheit
    ls_account-quantity = ls_po->anzahl.
    ls_accountx-quantity = 'X'.

    ls_account-net_value = ls_po->preis.
    ls_accountx-net_value = 'X' .

    " Kontierung
    ls_account-gl_account = c_gl_account.
    ls_accountx-gl_account = 'X'.

    ls_account-tax_code = '19'.
    ls_accountx-tax_code = 'X'.

    ls_account-gr_rcpt = '0'. "Warenempfänger, Unterkostenstellen
    ls_accountx-gr_rcpt = 'X'.

    "Bezugsdatum für Abrechnung
    ls_account-ref_date = sy-datum.
    ls_accountx-ref_date = 'X'.

1 ACCEPTED SOLUTION

0 Kudos
203

I found the mistake,

these lines are not correct.

" Einteilungsnummer

    lv_sl = sy-tabix * 10.

    ls_account-sched_line = lv_sl.

    ls_accountx-sched_line = 'X'.

after removing this lines of code the BAPI created a PO.

4 REPLIES 4

JL23
Active Contributor
0 Kudos
203

The message is talking about G/L account, are you certain you give the G/L account with leading zeros in case it is numeric only?

See  what approch others used to get to the root cause:

0 Kudos
203

Hello,

the field are filled with the correct g/l account including leading zeros. The interessting part is that the fields in account-structure are cleared after executing the bapi function.

Best Regards

Armin

0 Kudos
204

I found the mistake,

these lines are not correct.

" Einteilungsnummer

    lv_sl = sy-tabix * 10.

    ls_account-sched_line = lv_sl.

    ls_accountx-sched_line = 'X'.

after removing this lines of code the BAPI created a PO.

0 Kudos
203

Hi Armin,

Thanks for posting your solution. This helped me resolve the same issue I had after upgrading to 7.4.

Having the schedule line number worked before upgrade, so it would have taken a while to find the solution.

regards

Julian