2013 Nov 27 8:36 AM
Hi Expert,
i have problem with BAPI_GOODSMVT_CREATE, when i try on se37 with test data it's works and material document was created.
but when i called it from my abap program with same test data o se37,the bapi return with error.
the error is G/L account xxx does not exist in chart of accounts xxx.
i used GMCODE=03
movement type =261 and use orderid
Any idea about the problem?
data: begin of gmhead.
include structure bapi2017_gm_head_01.
data: end of gmhead.
data: begin of gmcode.
include structure bapi2017_gm_code.
data: end of gmcode.
data: begin of mthead.
include structure bapi2017_gm_head_ret.
data: end of mthead.
data: begin of itab occurs 100.
include structure bapi2017_gm_item_create.
data: end of itab.
data: begin of errmsg occurs 10.
include structure bapiret2.
data: end of errmsg.
data: wmenge like iseg-menge,
errflag.
data: begin of pcitab occurs 100,
ext_doc(10), "External Document Number
mvt_type(3), "Movement Type
doc_date(8), "Document Date
post_date(8), "Posting Date
plant(4), "Plant
material(18), "Material Number
qty(13), "Quantity
recv_loc(4), "Receiving Location
issue_loc(4), "Issuing Location
pur_doc(10), "Purchase Document No
po_item(3), "Purchase Document Item No
del_no(10), "Delivery Purchase Order Number
del_item(3), "Delivery Item
prod_doc(10), "Production Document No
scrap_reason(10), "Scrap Reason
upd_sta(1), "Update Status
end of pcitab.
gmhead-pstng_date = sy-datum.
gmhead-doc_date = sy-datum.
gmhead-pr_uname = sy-uname.
gmcode-gm_code = '06'. "01 - MB01 - Goods Receipts for Purchase Order
*loop at pcitab.
itab-move_type = '261'.
itab-mvt_ind = ''.
itab-plant = 'K001'.
itab-material = 'ORI3011110'.
itab-entry_qnt = '1'.
itab-entry_uom = 'PC'.
itab-move_stloc = '0020'.
itab-orderid ='7000000021'.
itab-gl_account ='5200104'.
itab-stge_loc = '0020'. "pcitab-issue_loc'.
* itab-po_number = pcitab-pur_doc.
* itab-po_item = pcitab-po_item.
* concatenate pcitab-del_no pcitab-del_item into itab-item_text.
* itab-move_reas = pcitab-scrap_reason.
append itab.
*endloop.
loop at itab.
write:/ itab-material, itab-plant, itab-stge_loc,
itab-move_type, itab-entry_qnt, itab-entry_uom,
itab-entry_uom_iso, itab-po_number, itab-po_item,
pcitab-ext_doc.
endloop.
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = gmhead
goodsmvt_code = gmcode
* TESTRUN = ' '
IMPORTING
goodsmvt_headret = mthead
* MATERIALDOCUMENT =
* MATDOCUMENTYEAR =
tables
goodsmvt_item = itab
* GOODSMVT_SERIALNUMBER =
return = errmsg
.
2013 Nov 27 8:43 AM
Hi,
Can you check the conversion exit for GL account.
CONVERSION_EXIT_ALPHA_INPUT
example: '5200104 ' --> '00005200104'
2013 Nov 27 8:43 AM
Hi,
Can you check the conversion exit for GL account.
CONVERSION_EXIT_ALPHA_INPUT
example: '5200104 ' --> '00005200104'
2013 Nov 27 8:50 AM
2013 Nov 27 8:51 AM
hi ,
when you create text file or excel file put initial 0 for gl account basically the length of field is 10 and if you not puting 0 in starting so it not takes value.