Error in BAPI_TRANSACTION_COMMIT
Hi,
I am trying to commit after calling Sales order create BAPI twice and change BAPI once in my Inbound proxy and I am getting some runtime errors. The problem is the BAPI is not even coming back to the program with the errors, a table pops up with errors and it just hangs in there. The termination messages is Abort with the error 'Internal error when saving Itemization'. Does anyone have ne idea atleast I should capture these error messages and send it back, it should not be just hanging there. Any help would be greatly appreciated.
Thanks,
David.
hi,
Commit work is used when you code directly in ABAP and make changes in the database and
want to commit the database.
BAPI_TRANSACTION_COMMIT is used when you make changes to the SAP database by calling
a BAPI from outside SAP and want to commit the database. When you use a BAPI, you can not
directly use commit work, instead you are allowed to use only
BAPI_TRANSACTION_COMMIT.
for more information check the following link:
http://www.sap-img.com/bapi.htm
Regards,
Bhaskar
Similar Messages
-
We are getting below error while calling BAPI - Z_AW_READ_TEXT
(12.1) 04-22-10 06:04:47 (E) (4534318:6426) R3C-150412: |Dataflow DF_EXTRACT_STXL|Transform Query_Function8
R/3 CallReceive error <Function BAPI_TRANSACTION_COMMIT:User BOBAPI has no RFC authorization for function group BAPT.. User
BOBAPI has no RFC authorization for function group BAPT.>.
Any Ideas?
ThanksPlease ask the SAP basis team to set up a trace when you run this job.
I would probably expect there is some authorization group/role that needs to be added to your id.
Please let me know if that resolves the issue or has been already resolved -
We're having some issues regarding BAPI performance.
- BAPI_PO_CHANGE - Deleting all items
- BAPI_SALESORDER_CHANGE - Setting a single custom field
We're getting a runtime of between 5 and 30 minutes for doing a relatively minor change.
For example we have a PO were we're deleting all the items.
ls_poitem-po_item = 00010.
ls_poitem-delete_ind = 'L'.
append ls_poitem to lt_poitem.
ls_poitem-po_item = 00020.
append ls_poitem to lt_poitem.
ls_poitem-po_item = 00030.
append ls_poitem to lt_poitem.
ls_poitemx-po_item = 00010.
ls_poitemx-delete_ind = 'X'.
append ls_poitemx to lt_poitemx.
ls_poitemx-po_item = 00020.
append ls_poitemx to lt_poitemx.
ls_poitemx-po_item = 00030.
append ls_poitemx to lt_poitemx.
call function 'BAPI_PO_CHANGE'
exporting
purchaseorder = '1234567890'
tables
return = lt_return
poitem = lt_poitem
poitemx = lt_poitemx.
if lt_return has no errors.
bapi_transaction_commit.
endif.
In DEV, the bapi takes around 10 seconds to run, and the commit about 15 seconds. In PRD where there are lots of items, possibly BOMs it is taking between 5 and 30 minutes. The program is running in the day and during the night where hardly anything is going on in the system.
I've done a runtime analysis over the function and the majority of the time seems to be taken dealing with conditions and there are no user exits that are affecting the BAPI. 20% Database, 80% ABAP.
Can anyone explain why the bapis may be taking such a long time to run or whether there is something else I should be looking at?
I have noticed in st02 (buffers) there is a huge amount of swaps occurring, specifically with the import/export buffers. ~ 1 million per day! Would something like this affect anything?
Many Thanks@Diwakar - I've debugged the bapi (painful!) and there was no noticeable enhancements or exits being called out that appeared to be slow.
@Manu - One of the first things I checked. The program here is just a single PO with no loops.
@Yuri - It does look like it is condition related. The items I used in Dev were not BOMs, but I know in Prd they are used. Here are some results:
Sorted by "No."
No. Gross = Net Gross (%) Net (%) Call Program Name Type No. Filte
8.053 44.950 44.920 0,4 0,4 Perform XKOMV_AUFBAUEN_PRUEFEN SAPLV61A
6.441 17.595 = 17.595 0,1 0,1 Perform CONDITION_UPDATE_KAWRT SAPLV61A
6.441 17.335 = 17.335 0,1 0,1 Perform CONDITION_UPDATE_KWERT SAPLV61A
5.235 480.833 109.490 3,8 0,9 Perform XKOMV_KWERT_ERMITTELN SAPLV61A
5.208 164.660 34.644 1,3 0,3 Perform KONDITIONSBASIS_ERMITTELN SAPLV61A
5.077 22.825 = 22.825 0,2 0,2 Perform XKOMV_KKURS_ERMITTELN SAPLV61A
4.821 407.084 = 407.084 3,2 3,2 Perform XKOMV_KAWRT_ERMITTELN SAPLV61A
4.092 42.332 = 42.332 0,3 0,3 Perform XKOMV_KBETR_FROM_KWERT SAPLV61A
4.087 26.921 = 26.921 0,2 0,2 Perform XKOMV_KBETR_ERMITTELN SAPLV61A
4.079 211.423 147.126 1,7 1,2 Perform XKOMV_FUELLEN_OHNE_KONP SAPLV61A
4.079 6.374 = 6.374 0,0 0,0 Perform USEREXIT_XKOMV_FUELLEN_O_KONP SAPLV61A
4.074 12.628 12.598 0,1 0,1 Perform XKOMV_ERGAENZEN_MANUELLE SAPLV61A
2.387 30.438 = 30.438 0,2 0,2 Perform XKOMV_UEBERTRAGEN_VORBEREITEN SAPLV61A
2.385 11.630 = 11.630 0,1 0,1 Perform FIXIEREN_KOPFKOND_POSITION SAPLV61A
1.488 6.066 = 6.066 0,0 0,0 Perform(Ext) KOBED_002 SAPLV61A
1.188 3.394 = 3.394 0,0 0,0 Perform(Ext) FRM_KONDI_WERT_080 SAPLV61A
990 9.082 = 9.082 0,1 0,1 Call M. CL_BADI_CACHE_HANDLER=>GET_IMPLEMENTATION BADI_SD_SALES_ITEM============CP
968 5.325 = 5.325 0,0 0,0 Select Single TCK32 SAPL0K01 DB OpenS
594 1.633 = 1.633 0,0 0,0 Perform(Ext) FRM_KOND_BASIS_004 SAPLV61A
575 2.284 = 2.284 0,0 0,0 Perform STATUS_VERKNUEPFEN SAPLV45P
483 10.372 = 10.372 0,1 0,1 Perform EXECUTE_CHECK SAPLCKDI
462 7.632 = 7.632 0,1 0,1 Perform CONVERSION_IN2EX SAPLSDH4
367 2.957 = 2.957 0,0 0,0 Perform HIDE_INFO_FUELLEN SAPLSLS_LORD_DFLOW
340 205.332 8.647 1,6 0,1 Call M. CL_EXITHANDLER=>GET_CLASS_NAME_BY_INTERFACE CL_EXITHANDLER================CP
340 12.255 6.789 0,1 0,1 Call Func. SXV_ADD_PREFIX SAPLSEXV
340 15.421 3.166 0,1 0,0 Call Func. SXV_GET_CLIF_BY_NAME CL_EXITHANDLER================CP
340 5.466 = 5.466 0,0 0,0 Call Func. SX_NAME_SPACE_SPLIT SAPLSEXV
335 4.363 = 4.363 0,0 0,0 Select Single SXS_ATTR CL_EXITHANDLER================CP DB OpenS
318 12.836 2.092 0,1 0,0 Perform CULLX_EVAL_CND SAPLCULL -
Error while Creating a PO using BAPI_PO_CREATE1
Hi Friends,
The following issue that I have observed and as explained below is one of the weirdest scenarios that I have seen while working with SAP. Hence, kindly help me with possible errors from my end. I am working on ECC 6.0.
Requirement: To automatically create a PO.
Option used: I have used a BAPI: u2018BAPI_PO_CREATE1u2019
Scenario: When I execute the BAPI u2018BAPI_PO_CREATE1u2019 directly in sequence with u2018BAPI_TRANSACTION_COMMITu2019, the PO gets created successfully. The data entered as input is:
POHEADER-COMP_CODE
POHEADER-DOC_TYPE
POHEADER-PMNTTRMS
POITEM-PO_ITEM
POITEM-QUANTITY
POITEM-TAX_CODE
POITEM-TAXJURCODE
POITEM-RFQ_NO
POITEM-RFQ_ITEM
POITEM-PREQ_NO
POITEM-PREQ_ITEM
POITEM-PREQ_NAME
POSCHEDULE-PO_ITEM
POSCHEDULE-SCHED_LINE
POSCHEDULE-QUANTITY
POSCHEDULE-PREQ_NO
POSCHEDULE-PREQ_ITEM
Problem: I need to pass data to the BAPI through code, so I called the BAPI u2018BAPI_PO_CREATE1u2019 and u2018BAPI_TRANSACTION_COMMITu2019 in a test function module as well as report. I passed the same data as mentioned above i.e. while creating the PO by passing data to the BAPI directly.
But the BAPI returns an error BAPI header data still faulty, enter plant, Pur. Org., Pur. Grp., etc.
I tried by passing all the available data for the header and then for the items, but finally, I still get an error that the item is from a different order account and just cannot create a PO.
The Test FM code is as shown below:
DATA : PYMNT_TERMS TYPE YOAF_SEC_MASTER-TER_PYMNT.
DATA : ITEM_NO(4) .
DATA : CURRENCY TYPE LFM1-WAERS.
DATA : POHEAD TYPE BAPIMEPOHEADER.
DATA : POHEADX TYPE BAPIMEPOHEADERX.
DATA : EXP_HEAD TYPE BAPIMEPOHEADER.
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.
CONSTANTS : C_X VALUE 'X'.
POHEAD-COMP_CODE = 'P110'.
POHEAD-DOC_TYPE = DOC_TYPE.
POHEAD-PMNTTRMS = 'P10'.
POHEADX-COMP_CODE = C_X.
POHEADX-DOC_TYPE = C_X.
POHEADX-PMNTTRMS = C_X.
POITEM-PO_ITEM = '00001'.
POITEM-QUANTITY = '1.000'.
POITEM-TAX_CODE = 'D2'.
POITEM-TAXJURCODE = 'MH01'.
POITEM-RFQ_NO = '2300009491'.
POITEM-RFQ_ITEM = '00001'.
POITEM-PREQ_NO = '200003583'.
POITEM-PREQ_ITEM = '00001'.
POITEM-PREQ_NAME = 'SACHIN'.
APPEND POITEM.
POITEMX-PO_ITEM = '00001'.
POITEMX-PO_ITEMX = C_X.
POITEMX-QUANTITY = C_X .
POITEMX-TAX_CODE = C_X .
POITEMX-TAXJURCODE = C_X .
POITEM-RFQ_NO = C_X.
POITEM-RFQ_ITEM = C_X.
POITEM-PREQ_NO = C_X.
POITEM-PREQ_ITEM = C_X.
POITEMX-PREQ_NAME = C_X.
APPEND POITEMX.
POSCHED-PO_ITEM = '00001'.
POSCHED-SCHED_LINE = '0001'.
POSCHED-QUANTITY = '1.000'.
POSCHED-PREQ_NO = '1200003583'.
POSCHED-PREQ_ITEM = '00001'.
APPEND POSCHED.
POSCHEDX-PO_ITEM = '1'.
POSCHEDX-SCHED_LINE = '0001'.
POSCHEDX-PO_ITEMX = C_X.
POSCHEDX-SCHED_LINEX = C_X.
POSCHEDX-QUANTITY = C_X.
POSCHEDX-PREQ_NO = C_X.
POSCHEDX-PREQ_ITEM = C_X.
APPEND POSCHEDX.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
POHEADER = POHEAD
POHEADERX = POHEADX
IMPORTING
EXPPURCHASEORDER = EX_PO_NUMBER
EXPHEADER = EXP_HEAD
EXPPOEXPIMPHEADER =
TABLES
RETURN = RETURN_ERROR
POITEM = POITEM
POITEMX = POITEMX
POADDRDELIVERY =
POSCHEDULE = POSCHED
POSCHEDULEX = POSCHEDX
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = RETURN_ERROR.Hi,
As mentioned that this error was one of the wierdest SAP issues I have faced, it was due to the silliest copy paste errors on my behalf. I completely overlooked the POITEMX naming.
For 4 values of RFQ_NO, RFQ_ITEM, PREQ_NO, PREQ_ITEM, I didnt have the 'X' for POITEMX and kept on looking for errors for days.
BAPI_PO_CREATE1 works with min. possible inputs successfully.
Thanks to all! -
Error while creating a Service PO using BAPI_PO_CREATE1
Hi,
Im facing Error as "In case of account assignment, please enter acc. assignment data for item" while creating Service PO using BAPI_PO_CREATE1.
Header Data
w_poheader-comp_code = w_src-bukrs. "Company Code
w_poheader-doc_type = w_src-bsart. "Document type
w_poheader-delete_ind = w_src-vrtkz. "Deletion Indicator
CLEAR: lv_date.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = w_src-aedat
IMPORTING
date_internal = lv_date
EXCEPTIONS
date_external_is_invalid = 1
OTHERS = 2.
w_poheader-creat_date = lv_date. "Creation Date
w_poheader-created_by = sy-uname. "Creator Name
w_poheader-vendor = w_src-lifnr. "Vendor
w_poheader-pmnttrms = w_src-zterm. "Payment Terms
w_poheader-purch_org = w_src-ekorg. "Purchase Organization
w_poheader-pur_group = w_src-ekgrp. "Purchase Group
w_poheader-ref_1 = w_src-ihrez. "OLD PO
w_poheaderx-comp_code = 'X'. "Company Code
w_poheaderx-doc_type = 'X'. "Document type
w_poheaderx-delete_ind = 'X'. "Deletion Indicator
w_poheaderx-creat_date = 'X'. "Creation Date
w_poheaderx-created_by = 'X'.
w_poheaderx-vendor = 'X'.
w_poheaderx-pmnttrms = 'X'. "Payment Terms
w_poheaderx-purch_org = 'X'. "Purchase Organization
w_poheaderx-pur_group = 'X'. "Purchase Group
w_poheaderx-ref_1 = 'X'.
Item Data
w_poitem-po_item = w_src-ebelp.
IF NOT w_src-elikz IS INITIAL.
w_poitem-delete_ind = w_src-elikz.
ENDIF.
IF NOT w_src-txz01 IS INITIAL.
w_poitem-short_text = w_src-txz01.
ENDIF.
IF NOT w_src-werks IS INITIAL.
w_poitem-plant = w_src-werks.
ENDIF.
Material group
IF NOT w_src-matkl IS INITIAL.
w_poitem-matl_group = w_src-matkl.
ENDIF.
Open or Partial Qty
IF w_src-opqty IS NOT INITIAL.
w_poitem-quantity = w_src-opqty.
ELSEIF NOT w_src-paqty IS INITIAL.
w_poitem-quantity = w_src-paqty.
ENDIF.
IF NOT w_src-meins IS INITIAL.
w_poitem-po_unit = w_src-meins. "Base Unit of Measure
ENDIF.
IF NOT w_src-netpr IS INITIAL.
w_poitem-net_price = w_src-netpr. "Net Price
ENDIF.
IF NOT w_src-mwskz IS INITIAL.
w_poitem-tax_code = w_src-mwskz.
ENDIF.
IF NOT w_src-pstyp IS INITIAL.
w_poitem-item_cat = w_src-pstyp.
ENDIF.
IF NOT w_src-knttp IS INITIAL.
w_poitem-acctasscat = w_src-knttp.
ENDIF.
IF NOT w_src-vrtkz IS INITIAL.
w_poitem-distrib = w_src-vrtkz.
ENDIF.
Package No
IF NOT w_src-packno IS INITIAL.
w_poitem-pckg_no = w_src-packno. "Package no
ENDIF.
IF w_poitem-delete_ind IS INITIAL AND
w_poitem-short_text IS INITIAL AND
w_poitem-plant IS INITIAL AND
w_poitem-matl_group IS INITIAL AND
w_poitem-quantity IS INITIAL AND
w_poitem-po_unit IS INITIAL AND
w_poitem-net_price IS INITIAL AND
w_poitem-tax_code IS INITIAL.
CLEAR lv_item.
ELSE.
APPEND w_poitem TO i_poitem.
CLEAR: w_poitem.
lv_item = 'X'.
ENDIF.
w_poitemx-po_item = w_src-ebelp.
w_poitemx-delete_ind = 'X'.
w_poitemx-short_text = 'X'.
w_poitemx-plant = 'X'.
w_poitemx-matl_group = 'X'.
w_poitemx-quantity = 'X'.
w_poitemx-po_unit = 'X'.
w_poitemx-net_price = 'X'.
w_poitemx-tax_code = 'X'.
w_poitemx-item_cat = 'X'.
w_poitemx-acctasscat = 'X'.
w_poitemx-distrib = 'X'.
IF NOT w_src-packno IS INITIAL.
w_poitemx-pckg_no = 'X'.
ENDIF.
IF lv_item = 'X'.
APPEND w_poitemx TO i_poitemx.
CLEAR: w_poitemx,
lv_item.
ENDIF.
PO Deliery Address
w_poaddrdelivery-po_item = w_src-ebelp.
IF NOT w_src-adrn2 IS INITIAL.
w_poaddrdelivery-addr_no = w_src-adrn2.
APPEND w_poaddrdelivery TO i_poaddrdelivery.
CLEAR w_poaddrdelivery.
ENDIF.
POschedule
w_poschedule-po_item = w_src-ebelp.
CLEAR: lv_date.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = w_src-eindt
IMPORTING
date_internal = lv_date
EXCEPTIONS
date_external_is_invalid = 1
OTHERS = 2.
IF NOT lv_date IS INITIAL.
w_poschedule-del_datcat_ext = 'D'. "Delivery Date in Day Format
w_poschedule-delivery_date = lv_date.
w_poschedule-quantity = w_src-menge.
APPEND w_poschedule TO i_poschedule.
CLEAR w_poschedule.
lv_schd = 'X'.
ENDIF.
w_poschedulex-po_item = w_src-ebelp.
w_poschedulex-del_datcat_ext = 'X'.
w_poschedulex-delivery_date = 'X'.
w_poschedulex-quantity = 'X'.
IF lv_schd = 'X'.
APPEND w_poschedulex TO i_poschedulex.
CLEAR : w_poschedulex,
lv_schd.
ENDIF.
PO Account Assignment
w_poaccount-po_item = w_src-ebelp.
w_poaccount-serial_no = w_src-zekkn.
Distribution Indicator is 1
IF w_src-vrtkz EQ '1'.
w_poaccount-distr_perc = w_src-vproz.
IF NOT w_src-menge IS INITIAL.
CLEAR lv_menge.
lv_menge = w_src-menge.
ENDIF.
lv_acct_qty = lv_menge * w_src-vproz / 100.
Get Round value of Quanity
frac = FRAC( lv_acct_qty ).
IF frac EQ 0.
lv_acct_qty = FLOOR( lv_acct_qty ).
ELSE.
lv_acct_qty = CEIL( lv_acct_qty ).
ENDIF.
w_poaccount-quantity = lv_acct_qty.
ELSEIF w_src-vrtkz IS INITIAL.
w_poaccount-quantity = w_src-menge.
ENDIF.
w_poaccount-gl_account = w_src-saknr.
w_poaccount-costcenter = w_src-kostl.
w_poaccount-asset_no = w_src-anln1.
w_poaccount-wbs_element = w_src-wbs.
w_poaccount-network = w_src-nplnr.
w_poaccount-tax_code = w_src-mwskz.
w_poaccount-activity = w_src-vornr.
APPEND w_poaccount TO i_poaccount.
CLEAR w_poaccount.
w_poaccountx-po_item = w_src-ebelp.
w_poaccountx-serial_no = w_src-zekkn.
IF w_src-vrtkz EQ '1'.
w_poaccountx-distr_perc = 'X'.
ENDIF.
w_poaccountx-quantity = 'X'.
w_poaccountx-gl_account = 'X'.
w_poaccountx-costcenter = 'X'.
w_poaccountx-wbs_element = 'X'.
w_poaccountx-network = 'X'.
w_poaccountx-tax_code = 'X'.
w_poaccountx-activity = 'X'.
APPEND w_poaccountx TO i_poaccountx.
CLEAR w_poaccountx.
PO Services
w_poservices-pckg_no = w_src-packno. "Package no
w_poservices-line_no = w_src-srv_line_no. "Line item
w_poservices-ext_line = w_src-extrow. "External line
w_poservices-outl_level = 0.
w_poservices-outl_ind = 'X'.
w_poservices-subpckg_no = w_src-sub_packno. "Sub package no
w_poservices-quantity = w_src-srqty. "Service Quantity
w_poservices-base_uom = w_src-srmeins. "Service Basic unit of Measure
w_poservices-price_unit = '1'.
w_poservices-from_line = '1'.
w_poservices-gr_price = w_src-brtwr. "GR Price
w_poservices-short_text = w_src-sh_text1. "Service Short Text
w_poservices-matl_group = w_src-matkl. "Material Group
APPEND w_poservices TO i_poservices.
CLEAR w_poservices.
PO Service Access values
w_posrvacc-pckg_no = w_src-packno. "Package no
w_posrvacc-line_no = w_src-srv_line_no. "Line item
w_posrvacc-serno_line = w_src-zekkn. "'01'..
IF w_src-vproz IS INITIAL.
w_posrvacc-percentage = '100.0'.
ENDIF.
w_posrvacc-serial_no = w_src-zekkn. "'01'.
w_posrvacc-quantity = w_src-srqty. "Service Quantity
w_posrvacc-net_value = w_src-srqty. "Net value
APPEND w_posrvacc TO i_posrvacc.
CLEAR w_posrvacc.
ENDIF.
***Create a NEW PO
AT END OF ihrez.
Call BAPI
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = w_poheader
poheaderx = w_poheaderx
IMPORTING
exppurchaseorder = gv_ebeln
TABLES
return = i_return
poitem = i_poitem[]
poitemx = i_poitemx[]
poaddrdelivery = i_poaddrdelivery[]
poschedule = i_poschedule[]
poschedulex = i_poschedulex[]
poaccount = i_poaccount[]
poaccountx = i_poaccountx[]
poservices = i_poservices[]
posrvaccessvalues = i_posrvacc[]
extensionin = i_extensionin[].
Commit the Transaction
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
Regards,
Deepthi.1. If we get error as "In case of account assignment, please enter acc. assignment data for item" than First cehck whetaher u have authorization to Tcode ME23n or not. In my case, I din't had authorization to Me23n tcode.
2. If we get Error as "Please Mainatain Services or Limits". Please create a Service PO in the following Order.
*& Internal Table Declaration
DATA : i_intern TYPE STANDARD TABLE OF alsmex_tabline WITH HEADER LINE,
i_poitem TYPE STANDARD TABLE OF bapimepoitem,
i_poitemx TYPE STANDARD TABLE OF bapimepoitemx,
i_poaddrdelivery TYPE STANDARD TABLE OF bapimepoaddrdelivery,
i_poschedule TYPE STANDARD TABLE OF bapimeposchedule,
i_poschedulex TYPE STANDARD TABLE OF bapimeposchedulx,
i_poaccount TYPE STANDARD TABLE OF bapimepoaccount,
i_poaccountx TYPE STANDARD TABLE OF bapimepoaccountx,
i_poservices TYPE STANDARD TABLE OF bapiesllc,
i_posrvacc TYPE STANDARD TABLE OF bapiesklc,
i_extensionin TYPE STANDARD TABLE OF bapiparex,
i_return TYPE STANDARD TABLE OF bapiret2.
*& Work Area Declaration
DATA:
w_poheader TYPE bapimepoheader,
w_poheaderx TYPE bapimepoheaderx,
w_poitem TYPE bapimepoitem,
w_poitemx TYPE bapimepoitemx,
w_poaddrdelivery TYPE bapimepoaddrdelivery,
w_poschedule TYPE bapimeposchedule,
w_poschedulex TYPE bapimeposchedulx,
w_poaccount TYPE bapimepoaccount,
w_poaccountx TYPE bapimepoaccountx,
w_poservices TYPE bapiesllc,
w_posrvacc TYPE bapiesklc,
w_extensionin TYPE bapiparex,
w_return TYPE bapiret2.
START-OF-SELECTION.
Header Data
w_poheader-comp_code = '5791'. "Company Code
w_poheader-doc_type = 'Z0CM'. "Document type
w_poheader-creat_date = sy-datum. "lv_date. "Creation Date
w_poheader-created_by = sy-uname. "Creator Name
w_poheader-vendor = '0005012343'. "Vendor
w_poheader-pmnttrms = 'Z004'. "Payment Terms
w_poheader-purch_org = 'P000'. "Purchase Organization
w_poheader-pur_group = '001'. "Purchase Group
w_poheader-ref_1 = '004500007671'. "OLD PO
w_poheaderx-comp_code = 'X'. "Company Code
w_poheaderx-doc_type = 'X'. "Document type
w_poheaderx-creat_date = 'X'. "Creation Date
w_poheaderx-created_by = 'X'.
w_poheaderx-vendor = 'X'.
w_poheaderx-pmnttrms = 'X'. "Payment Terms
w_poheaderx-purch_org = 'X'. "Purchase Organization
w_poheaderx-pur_group = 'X'. "Purchase Group
w_poheaderx-ref_1 = 'X'.
Item Data
w_poitem-po_item = '000010'.
w_poitem-short_text = 'Z0CM - Default Appr. Test '.
w_poitem-plant = '5368'.
Trackign no
w_poitem-trackingno = ''.
Material group
w_poitem-matl_group = '119'.
w_poitem-po_unit = 'EA'. "Base Unit of Measure
w_poitem-net_price = '17500.00'. "Net Price
w_poitem-tax_code = 'I0'.
w_poitem-item_cat = '9'.
w_poitem-acctasscat = 'K'.
w_poitem-distrib = space.
Package must be given in item to create Service PO
w_poitem-pckg_no = 0000000001.
APPEND w_poitem TO i_poitem.
CLEAR: w_poitem.
w_poitemx-po_item = '000010'.
w_poitemx-delete_ind = 'X'.
w_poitemx-short_text = 'X'.
w_poitemx-plant = 'X'.
w_poitemx-trackingno = 'X'.
w_poitemx-matl_group = 'X'.
w_poitemx-quantity = 'X'.
w_poitemx-po_unit = 'X'.
w_poitemx-net_price = 'X'.
w_poitemx-tax_code = 'X'.
w_poitemx-item_cat = 'X'.
w_poitemx-acctasscat = 'X'.
w_poitemx-distrib = 'X'.
w_poitemx-pckg_no = 'X'.
APPEND w_poitemx TO i_poitemx.
CLEAR: w_poitemx.
PO Deliery Address
w_poaddrdelivery-po_item = '000010'.
w_poaddrdelivery-addr_no = '0000061208'.
APPEND w_poaddrdelivery TO i_poaddrdelivery.
CLEAR w_poaddrdelivery.
POschedule
w_poschedule-po_item = '000010'..
DATA : LV_DATE TYPE SY-DATUM,
lv_schd.
CLEAR: lv_date.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = '12/2/2009'
IMPORTING
date_internal = lv_date
EXCEPTIONS
date_external_is_invalid = 1
OTHERS = 2.
IF NOT lv_date IS INITIAL.
w_poschedule-del_datcat_ext = 'D'. "Delivery Date in Day Format
w_poschedule-delivery_date = lv_date.
w_poschedule-quantity = '1.000'.
APPEND w_poschedule TO i_poschedule.
CLEAR w_poschedule.
lv_schd = 'X'.
ENDIF.
w_poschedulex-po_item = '000010'.
w_poschedulex-del_datcat_ext = 'X'.
w_poschedulex-delivery_date = 'X'.
w_poschedulex-quantity = 'X'.
IF lv_schd = 'X'.
APPEND w_poschedulex TO i_poschedulex.
CLEAR : w_poschedulex,
lv_schd.
ENDIF.
PO Account Assignment
w_poaccount-po_item = '000010'.
w_poaccount-serial_no = '01'.
w_poaccount-distr_perc = ''.
w_poaccount-quantity = '1.000'.
w_poaccount-gl_account = '0000603064'.
w_poaccount-costcenter = '0053680100'.
w_poaccount-asset_no = ''.
w_poaccount-wbs_element = ''.
w_poaccount-network = ''.
w_poaccount-tax_code = 'I0'.
w_poaccount-activity = ''.
APPEND w_poaccount TO i_poaccount.
CLEAR w_poaccount.
w_poaccountx-po_item = '000010'.
w_poaccountx-serial_no = '01'.
w_poaccountx-distr_perc = 'X'.
w_poaccountx-quantity = 'X'.
w_poaccountx-gl_account = 'X'.
w_poaccountx-costcenter = 'X'.
w_poaccountx-wbs_element = 'X'.
w_poaccountx-network = 'X'.
w_poaccountx-tax_code = 'X'.
w_poaccountx-activity = 'X'.
w_poaccountx-cmmt_item = 'X'.
APPEND w_poaccountx TO i_poaccountx.
CLEAR w_poaccountx.
Extension for ZZSub
w_extensionin-structure = 'BAPI_TE_MEPOACCOUNTING'.
w_extensionin-valuepart1+0(5) = '00010'..
w_extensionin-valuepart1+5(2) = '01'.
w_extensionin-valuepart1+28(5) = ''.
APPEND w_extensionin TO i_extensionin.
CLEAR w_extensionin.
w_extensionin-structure = 'BAPI_TE_MEPOACCOUNTINGX'.
w_extensionin-valuepart1+0(5) = '00010'.
w_extensionin-valuepart1+5(2) = '01'.
w_extensionin-valuepart1+11(1) = 'X'.
APPEND w_extensionin TO i_extensionin.
CLEAR w_extensionin.
Extension to add Expense Type only
w_extensionin-structure = 'BAPI_TE_MEPOHEADER'.
w_extensionin-valuepart1+10(4) = '0131'.
APPEND w_extensionin TO i_extensionin.
CLEAR w_extensionin.
w_extensionin-structure = 'BAPI_TE_MEPOHEADERX'.
w_extensionin-valuepart1+10(4) = 'X'.
APPEND w_extensionin TO i_extensionin.
CLEAR w_extensionin.
EXPORT i_extensionin[] TO MEMORY ID 'SUB'.
PO Services
PO Services( One Line Iem)
Assign the dummy no as Pacakage no
w_poservices-pckg_no = 0000000001. "(assign package no as a dummy number)
w_poservices-line_no = 0000000001. "Line item
w_poservices-outl_ind = 'X'.
Assign Dummy no as sub package no
w_poservices-subpckg_no = 0000000003. "(Dummy No.) "Sub package no
w_poservices-from_line = '1'.
APPEND w_poservices TO i_poservices.
CLEAR w_poservices.
PO Services(Second Line Item )
Assign the same sub package dummy no which is mentioned above
w_poservices-pckg_no = 0000000003. "(Dummy No.) "Sub package no
w_poservices-line_no = 0000000002.
w_poservices-ext_line = '0000000010'. "External line
w_poservices-quantity = '17500.0'. "Service Quantity
w_poservices-base_uom = 'EA'. "Service Basic unit of Measure
w_poservices-price_unit = '1'.
w_poservices-gr_price = '1'. "GR Price
w_poservices-short_text = 'Z0CM - Default Appr. T'. "Service Short Text
w_poservices-matl_group = '119'. "w_src-matkl. "Material Group
APPEND w_poservices TO i_poservices.
CLEAR w_poservices.
PO Service Access values
w_posrvacc-pckg_no = 0000000003. "w_src-sub_packno. "Sub package no
w_posrvacc-line_no = 0000000002. "w_src-srv_line_no. "Line item
w_posrvacc-serno_line = '01'.
w_posrvacc-percentage = '100.0'.
w_posrvacc-serial_no = '01'.
w_posrvacc-quantity = '17500.0'. "w_src-srqty. "Service Quantity
APPEND w_posrvacc TO i_posrvacc.
CLEAR w_posrvacc.
DATA : gv_ebeln TYPE ebeln.
Call BAPI
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = w_poheader
poheaderx = w_poheaderx
IMPORTING
exppurchaseorder = gv_ebeln
TABLES
return = i_return
poitem = i_poitem[]
poitemx = i_poitemx[]
poaddrdelivery = i_poaddrdelivery[]
poschedule = i_poschedule[]
poschedulex = i_poschedulex[]
poaccount = i_poaccount[]
poaccountx = i_poaccountx[]
poservices = i_poservices[]
posrvaccessvalues = i_posrvacc[]
extensionin = i_extensionin[].
Commit the Transaction
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
WRITE:/5 gv_ebeln COLOR 5.
SKIP 2.
DATA : lv_msg TYPE string.
LOOP AT i_return INTO w_return WHERE type = 'E'.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = w_return-id
lang = 'EN'
no = w_return-number
v1 = w_return-message_v1
v2 = w_return-message_v2
v3 = w_return-message_v3
v4 = w_return-message_v4
IMPORTING
msg = lv_msg
EXCEPTIONS
not_found = 1
OTHERS = 2.
WRITE:/10 lv_msg.
ENDLOOP. -
Hello ,
While using the BAPI 'BAPI_MATERIAL_SAVEDATA', to extend material from one plant to another my code is throwing an error 'Currency initial v,current amount 6,000.0000 in MOVING_PR was transferred without a currency'
Enter a material number'
I have incorporated mbew-peinh, even then its throwing the same error.
I snd copy of my code.
report zmm_r018 .
*& Prog to copy n create the existing material using bapi .
tables: t001l, "Storage Locations
mara, "General Material Data
makt, "Material Descriptions
mbew, "Material Valuation
marc, "Plant Data for Material
mltx. "Purchase Order Descriptions
**parameters : new_mat like mara-matnr,
desc like makt-maktx,
*data: ref_mat like mara-matnr.
*data: xmara type mara.
**data: wamatnr like mara-matnr.
data: potext type string."Purchase Order Desc
data : ihead_data type bapimathead,
iclient_data type bapi_mara, "Client Data
iclient_datax type bapi_marax,
imakt like bapi_makt, "Mat Description
iplant_data like bapi_marc, "Plant View
iplant_datax like bapi_marcx,
iltxt type table of bapi_mltx with header line, "Pur Order Text
istoragelocationdata type bapi_mard, "Storage Location
istoragelocationdatax type bapi_mardx,
iaccounting_data like bapi_mbew, "Accounting View
iaccounting_datax like bapi_mbewx,
bapiret like bapiret2,
returnm type table of bapi_matreturn2 with header line.
**Internal Table to hold the records in the text file
types:begin of it,
matnr(18), " Material number
mbrsh(1), " Industry sector
mtart(4), " Material type
werks(4), " Plant
lgort_d(4), "Storage Location
maktx(40), " Material description
meins(3), " Base unit of measure
matkl(9) , " Material group
bismt(18), " Old Material number
spart(2), " Division
gewei(3), " Weight Unit
text1(30), " Purchasr Order Text
text2(30),
text3(30),
text4(30),
text5(30),
text6(30),
dzeinr(22), " Document
ekgrp(3), " Purchasing group
ekwsl(4), " Purchase Value Key
webaz(3), " Goods receipt processing time in days
dismm(2), " MRP Type
minbe(13), "Reorder point
dispo(3), " MRP Controller
disls(2), "Lot size (materials planning)
mabst(13), "Maximum stock level
plifz(3), " Planned delivery time in days
webaz1(3), " Goods receipt processing time in days
fhori(3), "Scheduling Margin Key for Floats
eisbe(13), "Safety stock
mtvfp(2), "Checking Group for Availability Check
lgpbe(10), "Storage Bin
qmatauth(6),"Material Authorization Group for Activities in QM
qmpur(1), " QM in Procurement is Active
qsspur(8), "Control Key for Quality Management in Procurement
bklas(4), " Valuation Class
bwtty_d(1), "Valuation Category
vprsv(1), " Price control indicator
verpr_bapi(23), "Moving average price/periodic unit price
peinh(5), "Price Unit
end of it.
data: it_data type table of it,
wa_data like line of it_data.
*Decalraing flag
data: v_flag value ''.
*DECLARING WORK AREAs TO BE PASSED TO THE FUNCTION MODULE.
data: bapi_head like bapimathead,
bapi_clientdata like bapi_mara,
bapi_clientdatax like bapi_marax,
bapi_plantdata like bapi_marc,
bapi_plantdatax like bapi_marcx,
bapi_storagelocationdata like bapi_mard,
bapi_storagelocationdatax like bapi_mardx,
bapi_salesdata like bapi_mvke,
bapi_salesdatax like bapi_mvkex,
bapi_makt like bapi_makt,
bapi_return like bapiret2.
*INTERNAL TABLE TO HOLD THE MATERIAL DESCRIPTION
data: begin of it_makt occurs 0.
include structure bapi_makt.
data end of it_makt.
data:begin of it_ret occurs 0.
include structure bapiret2.
data end of it_ret.
*INTERNAL TABLE TO HOLD HEADER DATA
data: it_excel type alsmex_tabline occurs 0 with header line.
*SELECTION-SCREEN ELEMENTS
selection-screen begin of block b1 with frame title text-001.
parameter: fname type rlgrap-filename default 'c:\supplies.xls'.
parameters: p_begcol type i default '1' no-display,
p_begrow type i default '2' no-display,
p_endcol type i default '200' no-display,
p_endrow type i default '2500' no-display.
*perform f_get_data.
selection-screen end of block b1.
*DECLARATION OF EXCELAL TABLE
at selection-screen on value-request for fname.
perform f_get_file using fname.
start-of-selection.
perform f_xls_itab using fname
changing it_excel.
perform f_move_data.
perform f_get_data.
perform f_call_bapi.
*& Form F_GET_FILE
text
-->P_FNAME text
<--P_SY_SUBRC text
form f_get_file using p_fname like fname.
call function 'KD_GET_FILENAME_ON_F4'
exporting
program_name = syst-repid
dynpro_number = syst-dynnr
FIELD_NAME = ' '
STATIC = ' '
MASK = ' '
changing
file_name = p_fname
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2
if sy-subrc <> 0.
message e006(zhnc).
endif.
endform. " F_GET_FILE
*& Form F_XLS_ITAB
text
-->P_FNAME text
<--P_IT_EXCEL text
form f_xls_itab using p_fname
changing p_it_excel.
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = 'c:\supplies.xls'
i_begin_col = p_begcol
i_begin_row = p_begrow
i_end_col = p_endcol
i_end_row = p_endrow
tables
intern = it_excel
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " F_XLS_ITAB
*& Form F_MOVE_DATA
text
--> p1 text
<-- p2 text
form f_move_data .
data : lv_index type i.
field-symbols <fs>.
*--- Sorting the internal table
sort it_excel by row col.
clear it_excel.
loop at it_excel.
move it_excel-col to lv_index.
*--- Assigning the each record to an internal table row
assign component lv_index of structure wa_data to <fs>.
*--- Asigning the field value to a field symbol
move it_excel-value to <fs>.
at end of row.
append wa_data to it_data.
clear wa_data.
endat.
endloop.
endform. " F_MOVE_DATA
form f_get_data .
loop at it_data into wa_data.
move-corresponding wa_data to ihead_data.
Header
ihead_data-material = wa_data-matnr.
ihead_data-ind_sector = wa_data-mbrsh.
ihead_data-matl_type = wa_data-mtart.
ihead_data-basic_view = 'X'.
ihead_data-purchase_view = 'X'.
ihead_data-mrp_view = 'X'.
ihead_data-storage_view = 'X'.
ihead_data-quality_view = 'X'.
ihead_data-account_view = 'X'.
move-corresponding wa_data to iclient_data.
Material Description
refresh it_makt.
it_makt-langu = 'EN'.
it_makt-matl_desc = wa_data-maktx.
append it_makt.
Purchase Order Description
clear:iltxt,iltxt[].
concatenate wa_data-text1 wa_data-text2 wa_data-text3 wa_data-text4
wa_data-text5 wa_data-text6 into potext
separated by space.
iltxt-applobject = 'MATERIAL'.
iltxt-text_name = wa_data-matnr.
iltxt-text_id = 'BEST'.
iltxt-langu = sy-langu.
iltxt-langu_iso = 'EN'.
iltxt-format_col = space.
iltxt-text_line = potext.
append iltxt.
Client Data - Basic
iclient_data-matl_group = wa_data-matkl.
iclient_data-old_mat_no = wa_data-bismt.
iclient_data-base_uom = wa_data-meins.
iclient_data-document = wa_data-dzeinr.
iclient_data-unit_of_wt = wa_data-gewei.
iclient_data-division = wa_data-spart.
iclient_data-qm_procmnt = wa_data-qmpur.
iclient_data-pur_valkey = wa_data-ekwsl.
iclient_datax-matl_group = 'X'.
iclient_datax-old_mat_no = 'X'.
iclient_datax-base_uom = 'X'.
iclient_datax-po_unit = 'X'.
iclient_datax-document = 'X'.
iclient_datax-unit_of_wt = 'X'.
iclient_datax-division = 'X'.
iclient_datax-var_ord_un = 'X'.
iclient_data-pur_valkey = 'X'.
move-corresponding wa_data to iplant_data.
Plant - Purchasing
iplant_data-plant = wa_data-werks.
iplant_data-pur_group = wa_data-ekgrp.
iplant_data-gr_pr_time = wa_data-webaz.
iplant_datax-plant = wa_data-werks.
iplant_data-pur_group = 'X'.
iplant_datax-gr_pr_time = 'X'.
*MRP1 View
iplant_data-mrp_type = wa_data-dismm.
iplant_data-reorder_pt = wa_data-minbe.
iplant_data-mrp_ctrler = wa_data-dispo.
iplant_data-lotsizekey = wa_data-disls.
iplant_data-max_stock = wa_data-mabst .
iplant_datax-mrp_type = 'X'.
iplant_datax-reorder_pt = 'X'.
iplant_datax-mrp_ctrler = 'X'.
iplant_datax-lotsizekey = 'X'.
iplant_datax-max_stock = 'X'.
*MRP2 View
iplant_data-plnd_delry = wa_data-plifz.
iplant_data-sm_key = wa_data-fhori.
iplant_data-ctrl_key = wa_data-qsspur.
iplant_data-availcheck = wa_data-mtvfp.
iplant_datax-plnd_delry = 'X'.
iplant_datax-sm_key = 'X'.
iplant_data-ctrl_key = 'X'.
iplant_datax-availcheck = 'X'.
*MRP3 View
iplant_data-safety_stk = wa_data-eisbe.
iplant_data-qm_authgrp = wa_data-qmatauth.
iplant_datax-safety_stk = 'X'.
iplant_data-qm_authgrp = 'X'.
move-corresponding wa_data to istoragelocationdata.
Storage View
istoragelocationdata-plant = wa_data-werks.
istoragelocationdata-stge_loc = wa_data-lgort_d.
istoragelocationdata-stge_bin = wa_data-lgpbe.
istoragelocationdatax-plant = wa_data-werks.
istoragelocationdatax-stge_loc = wa_data-lgort_d.
istoragelocationdatax-stge_bin = 'X'.
Accounting
iaccounting_data-val_area = wa_data-werks.
iaccounting_data-price_ctrl = wa_data-vprsv.
iaccounting_data-moving_pr = wa_data-verpr_bapi.
iaccounting_data-price_unit = wa_data-peinh.
iaccounting_data-val_class = wa_data-bklas.
iaccounting_data-val_cat = wa_data-bwtty_d.
iaccounting_datax-val_area = wa_data-werks.
iaccounting_datax-price_ctrl = 'X'.
iaccounting_datax-moving_pr = 'X'.
iaccounting_datax-price_unit = 'X'.
iaccounting_datax-val_class = 'X'.
iaccounting_datax-val_cat = 'X'.
clear it_ret.
refresh it_ret.
perform f_call_bapi.
read table it_ret with key type = 'S'.
if sy-subrc eq 0.
perform f_bapi_commit.
write:/ 'MATERIAL CREATED OR UPDATED SUCESSFULLY WITH MATERIAL NO',
wa_data-matnr.
else.
*message e000(zhnc) with 'ERROR IN CREATING THE MATERIAL'.
*WRITE: / 'ERROR IN CREATIN MATERIAL',IT_RET-MESSAGE.
*PERFORM F_DOWNLOAD.
endif.
*ENDIF.
endloop.
endform. " F_GET_DATA
*& Form F_CALL_BAPI
text
--> p1 text
<-- p2 text
form f_call_bapi .
call function 'BAPI_MATERIAL_SAVEDATA'
exporting
headdata = ihead_data
clientdata = iclient_data
clientdatax = iclient_datax
plantdata = iplant_data
plantdatax = iplant_datax
FORECASTPARAMETERS =
FORECASTPARAMETERSX =
PLANNINGDATA =
PLANNINGDATAX =
storagelocationdata = istoragelocationdata
storagelocationdatax = istoragelocationdatax
valuationdata = iaccounting_data
valuationdatax = iaccounting_datax
WAREHOUSENUMBERDATA =
WAREHOUSENUMBERDATAX =
SALESDATA =
SALESDATAX =
STORAGETYPEDATA = istoragelocationdata
STORAGETYPEDATAX = istoragelocationdatax
FLAG_ONLINE = ' '
FLAG_CAD_CALL = ' '
NO_DEQUEUE = ' '
NO_ROLLBACK_WORK = ' '
importing
return = it_ret
tables
materialdescription = it_makt
UNITSOFMEASURE = it_uom
UNITSOFMEASUREX = it_uomx
INTERNATIONALARTNOS =
materiallongtext = iltxt
TAXCLASSIFICATIONS =
returnmessages = returnm.
PRTDATA =
PRTDATAX =
EXTENSIONIN =
EXTENSIONINX =
append it_ret.
write: it_ret-message .
endform. " F_CALL_BAPI
*& Form F_BAPI_COMMIT
text
--> p1 text
<-- p2 text
form f_bapi_commit .
call function 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
endform. " F_BAPI_COMMIT
Plz suggest some solution.
Best Regards,
RaviHi,
Insert Material number in the MAKT(Material Description table).
Also, check if the material number is missing somewhere else...
Regards,
Kunjal -
Error in Bapi_GoodsMvt_Create using Purchase order
Hi Friends,
I am using Bapi_goodsmvt_create for Goods Receipts against Purchase order.
The below code i have given for Goods receipts
It shows the error like
ID : 8J
Err No.:182
Message : Entry 4500000344 00040 0000 not valid; correct entry
Please help me to correct this error.
Thanks
Shankar
===================================
Heading Structure
st_gm_code-gm_code = '01'.
st_gm_header-pstng_date = '20070930'.
st_gm_header-doc_date = '20070930'.
st_gm_header-gr_gi_slip_no = '970015'.
st_gm_header-bill_of_lading = '527213'.
st_gm_header-header_txt = 'AIR'.
st_gm_header-ref_doc_no = '4500000344'.
Tables - ITEM CREATE.
itab_afs_gm_itemx-plant = '2000'.
itab_afs_gm_itemx-deliv_numb = '80100121'.
itab_afs_gm_itemx-stge_loc = '2110'.
itab_afs_gm_itemx-move_stloc = '2110'.
itab_afs_gm_itemx-po_number = '4500000344'.
itab_afs_gm_itemx-po_item = '00040'.
itab_afs_gm_itemx-vendor = '0000650003'.
itab_afs_gm_itemx-vendrbatch = 'ABC123'.
itab_afs_gm_itemx-move_type = '101'.
itab_afs_gm_itemx-mvt_ind = 'B'.
itab_afs_gm_itemx-material = '000000000030000227'.
itab_afs_gm_itemx-entry_qnt = 10.
APPEND itab_afs_gm_itemx .
****&& Grid values
gr_afs-matdoc_itm = '0001'.
gr_afs-grid_value = '205'.
gr_afs-withdrawn_sku = 'X'. "Final issue at sku level
gr_afs-stock_cat = '0000000001000366'.
APPEND gr_afs.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = st_gm_header
goodsmvt_code = st_gm_code
TESTRUN = ' '
IMPORTING
goodsmvt_headret = st_gm_headret
materialdocument = mat_doc
matdocumentyear = doc_year
TABLES
goodsmvt_item = itab_afs_gm_itemx
afs_goodsmvt_sku = gr_afs
return = bapi_return.
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDIF.
CLEAR itab_afs_gm_itemx.
REFRESH itab_afs_gm_itemx.
CLEAR gr_afs.
REFRESH gr_afs.Hi,
Here is some sample code from one of my programs, which does a 551 movement type. This should get you started. Just check the RETURN table for messages, they should tell you what you are missing.
code
Structures for BAPI
data: gm_header type bapi2017_gm_head_01.
data: gm_code type bapi2017_gm_code.
data: gm_headret type bapi2017_gm_head_ret.
data: gm_item type table of
bapi2017_gm_item_create with header line.
data: gm_return type bapiret2 occurs 0.
data: gm_retmtd type bapi2017_gm_head_ret-mat_doc.
clear: gm_return, gm_retmtd. refresh gm_return.
Setup BAPI header data.
gm_header-pstng_date = sy-datum.
gm_header-doc_date = sy-datum.
gm_code-gm_code = '06'. " MB11
Write 551 movement to table
clear gm_item.
move '551' to gm_item-move_type .
move '000000000040001234' to gm_item-material.
move '1' to gm_item-entry_qnt.
move 'EA' to gm_item-entry_uom.
move '0004' to gm_item-plant.
move '4000' to gm_item-stge_loc.
move '201' to gm_item-move_reas.
Determine cost center per plant
case xresb-werks.
when '0004'.
move '0000041430' to gm_item-costcenter.
when '0006'.
move '0000041630' to gm_item-costcenter.
when '0007'.
move '0000041731' to gm_item-costcenter.
when '0008'.
move '0000041830' to gm_item-costcenter.
endcase.
append gm_item.
Call goods movement BAPI
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = gm_header
goodsmvt_code = gm_code
importing
goodsmvt_headret = gm_headret
materialdocument = gm_retmtd
tables
goodsmvt_item = gm_item
return = gm_return.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.
[/code]
Welcome to SDN! Please remember to award points for helpful answers and mark you post as solved when solved completely. Thanks.
REgards,
Raj. -
Error: 'BP category 1 does not fit the data in category 2'
Hi,
i have written a program to create a contact person and the code for it is pasted below...when i run this program i get nothing but this message in the status bar 'BP category 1 does not fit the data in category 2'...can someone tell me wht the error means and y it is coming.
thanks:)
pushpa
*table for storing the line by line records in the excel file
TYPES: BEGIN OF TTAB,
REC(1000) TYPE C,
END OF TTAB.
DATA ITAB TYPE TABLE OF TTAB WITH HEADER LINE.
*variable for storing the name of the excel file to be uploaded
DATA UP_FILE TYPE STRING.
*data to be uploaded
TYPES: BEGIN OF TDAT,
FLD1 TYPE BAPIBUS1006_CENTRAL_ORGAN-NAME1,
FLD2 TYPE BAPIBUS1006_ADDRESS-STREET,
FLD3 TYPE BAPIBUS1006_ADDRESS-CITY,
FLD4 TYPE BAPIBUS1006_ADDRESS-REGION,
FLD5 TYPE BAPIBUS1006_ADDRESS-POSTL_COD1,
FLD6 TYPE BAPIBUS1006_ADDRESS-COUNTRY,
FLD7 TYPE BAPIBUS1006_CENTRAL-PARTNEREXTERNAL,
END OF TDAT.
DATA IDAT TYPE TABLE OF TDAT WITH HEADER LINE.
DATA: BUSINESSPARTNER TYPE BAPIBUS1006_HEAD-BPARTNER,
CENTRALDATA TYPE BAPIBUS1006_CENTRAL,
ORGANIZATION TYPE BAPIBUS1006_CENTRAL_ORGAN,
ADDRESS TYPE BAPIBUS1006_ADDRESS,
BAPIRETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
PARAMETERS P_FILE TYPE LOCALFILE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
STATIC = 'X'
CHANGING
FILE_NAME = P_FILE.
START-OF-SELECTION.
UP_FILE = P_FILE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = UP_FILE
TABLES
DATA_TAB = ITAB
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17.
*writing out the contents of the internal table itab
LOOP AT ITAB.
WRITE:/ ITAB-REC.
CLEAR IDAT.
SPLIT ITAB-REC AT CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB
INTO IDAT-FLD1 IDAT-FLD2 IDAT-FLD3 IDAT-FLD4 IDAT-FLD5 IDAT-FLD6 IDAT-FLD7.
APPEND IDAT.
ENDLOOP.
LOOP AT IDAT.
MOVE: IDAT-FLD1 TO ORGANIZATION-NAME1,
IDAT-FLD2 TO ADDRESS-STREET,
IDAT-FLD3 TO ADDRESS-CITY,
IDAT-FLD4 TO ADDRESS-REGION,
IDAT-FLD5 TO ADDRESS-POSTL_COD1,
IDAT-FLD6 TO ADDRESS-COUNTRY,
IDAT-FLD7 TO CENTRALDATA-PARTNEREXTERNAL,
'0001' TO CENTRALDATA-PARTNERTYPE.
CALL FUNCTION 'BAPI_BUPA_CREATE_FROM_DATA'
EXPORTING
PARTNERCATEGORY = '1'
CENTRALDATA = CENTRALDATA
CENTRALDATAORGANIZATION = ORGANIZATION
ADDRESSDATA = ADDRESS
IMPORTING
BUSINESSPARTNER = BUSINESSPARTNER
TABLES
RETURN = BAPIRETURN.
IF BAPIRETURN IS NOT INITIAL.
READ TABLE BAPIRETURN INDEX 1.
MESSAGE
ID BAPIRETURN-ID
TYPE BAPIRETURN-TYPE
NUMBER BAPIRETURN-NUMBER
WITH BAPIRETURN-MESSAGE_V1
BAPIRETURN-MESSAGE_V2
BAPIRETURN-MESSAGE_V3
BAPIRETURN-MESSAGE_V4.
EXIT.
ENDIF.
REFRESH BAPIRETURN.
CLEAR BAPIRETURN.
CALL FUNCTION 'BAPI_BUPA_ROLE_ADD'
EXPORTING
BUSINESSPARTNER = BUSINESSPARTNER
BUSINESSPARTNERROLE = 'BUP001'
DIFFERENTIATIONTYPEVALUE =
TABLES
RETURN = BAPIRETURN.
IF BAPIRETURN IS NOT INITIAL.
READ TABLE BAPIRETURN INDEX 1.
MESSAGE
ID BAPIRETURN-ID
TYPE BAPIRETURN-TYPE
NUMBER BAPIRETURN-NUMBER
WITH BAPIRETURN-MESSAGE_V1
BAPIRETURN-MESSAGE_V2
BAPIRETURN-MESSAGE_V3
BAPIRETURN-MESSAGE_V4.
EXIT.
ENDIF.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
WRITE:/ 'Business Partner ID:', BUSINESSPARTNER.
ENDLOOP.Hi Pushpa,
you can use following code to create relationships using BAPI. In this Business partner is organisatin. contact persion paramenter is person. other information related to relationship details
CALL FUNCTION 'BAPI_BUPR_CONTP_CREATE'
EXPORTING
BUSINESSPARTNER = SEARCH_PARTNER
CONTACTPERSON = CONTACT_SAP
VALIDFROMDATE = '00010101'
VALIDUNTILDATE = '99991231'
DEFAULTRELATIONSHIP =
ADDRESSGUID =
CENTRALDATA = WA_CENTRAL_DATA
ADDRESSDATA = WA_ADDR_DATA
TABLES
BAPIADTEL = I_TEL_DATA
BAPIADFAX = I_FAX_DATA
BAPIADTTX =
BAPIADTLX =
BAPIADSMTP = I_EMAIL_DATA
BAPIADRML =
BAPIADX400 =
BAPIADRFC =
BAPIADPRT =
BAPIADSSF =
BAPIADURI =
BAPIADPAG =
BAPIAD_REM =
BAPICOMREM =
RETURN = I_RETURN
hope this will help you
Siva -
Short Dump on BAPI_TRANSACTION_COMMIT with destination NONE
Hi All
I am using SAP-PM with Compatible Unit(CU) functionality in ECC6 environment.
After we release the CU design to Generate order we get SHORT DUMP.
Any help will be of great help.
I am pasting the details from the dump file here.
Please let me know.
Appretaite your help.
Thanks
Meghana
Runtime Errors CALL_FUNCTION_REMOTE_ERROR
Date and Time 27.08.2007 18:01:10
Short text
"The current application triggered a termination with a short dump."
What happened?
Error in the ABAP Application Program
The current ABAP program "/***/SAPLCUORDER_N" had to be terminated because it
has
come across a statement that unfortunately cannot be executed.
The error occurred during an RFC call to another system.
In the target system, a short dump has been written as well.
More detailed information on the error cause can be found there.
What can you do?
Note down which actions and inputs caused the error.
To process the problem further, contact you SAP system
administrator.
Using Transaction ST22 for ABAP Dump Analysis, you can look
at and manage termination messages, and you can also
keep them for a long time.
Error analysis
An error occurred when executing a REMOTE FUNCTION CALL.
It was logged under the name "MESSAGE_TYPE_X"
on the called page.
How to correct the error
Please refer to the notes described in the
short dump.
System environment
SAP-Release 700
Application server... "MB1ES1005"
Network address...... "10.191.97.206"
Operating system..... "Windows NT"
Release.............. "5.2"
Hardware type........ "2x Intel 801586"
Character length.... 16 Bits
Pointer length....... 32 Bits
Work process number.. 3
Shortdump setting.... "full"
Database server... "MB1ES1005"
Database type..... "ORACLE"
Database name..... "EC6"
Database user ID.. "SAPSR3"
Char.set.... "C"
SAP kernel....... 700
created (date)... "Jul 25 2007 00:57:05"
create on........ "NT 5.0 2195 Service Pack 4 x86 MS VC++ 13.10"
Database version. "OCI_10201_SHARE (10.2.0.1.0) "
Patch level. 121
Patch text.. " "
Database............. "ORACLE 9.2.0.., ORACLE 10.1.0.., ORACLE 10.2.0.."
SAP database version. 700
Operating system..... "Windows NT 5.0, Windows NT 5.1, Windows NT 5.2, Windows
NT 6.0"
Memory consumption
Roll.... 8176
EM...... 14633136
Heap.... 0
Page.... 131072
MM Used. 5005432
MM Free. 1263944
User and Transaction
Client.............. 200
User................ 10086330
Language key........ "E"
Transaction......... "/***/DESIGN "
Transactions ID..... "409954DC5D77F1C58E2D0013725D3B3B"
Program............. "/***/SAPLCUORDER_N"
Screen.............. "/***/SAPLCUORDER_N 2000"
Screen line......... 34
Information on where terminated
Termination occurred in the ABAP program "/***/SAPLCUORDER_N" - in
"SAVE_DESIGN".
The main program was "/***/SAPLCUORDER_N ".
In the source code you have the termination point in line 594
of the (Include) program "/***/LCUORDER_NF07".
Source Code Extract
Line
SourceCde
564
ENDIF .
565
ENDLOOP .
566
IF l_ret-type = 'E' OR
567
l_ret-type = 'A' .
568
CLEAR: save_okcode .
569
570
Show Messages
571
CALL FUNCTION '/***/N_LOG_ADD_MSG'
572
EXPORTING
573
i_log_type = 'G'
574
TABLES
575
t_ret = t_ret.
576
PERFORM log_order_create_show .
577
Show first Message
578
MESSAGE ID l_ret-id TYPE l_ret-type NUMBER l_ret-number
579
WITH
580
l_ret-message_v1 l_ret-message_v2
581
l_ret-message_v3 l_ret-message_v4.
582
CALL FUNCTION '/***/N_DESIGN_INIT' .
583
ELSE .
584
IF g_design_mode = con_mode_crea.
585
Need to update DMS documents with real design number
586
PERFORM document_prepare_002 USING con_desnum_tmp_1
587
lv_desnum.
588
ENDIF.
589
Commit design BAPI's
590
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' .
591
592
IF save_okcode = con_order.
593
Commit order BAPI's
>>>>>
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
595
DESTINATION 'NONE'.
596
597
call of fct. RFC_CONNECTION_CLOSE is important to get a new
598
initial roll area with initial internal tables next time
599
CALL FUNCTION 'RFC_CONNECTION_CLOSE'
600
EXPORTING
601
destination = 'NONE'
602
EXCEPTIONS
603
destination_not_open = 1
604
OTHERS = 2.
605
ENDIF.
606
607
IF lv_desnum IS INITIAL .
608
lv_desnum = /***/cudesign-desnum .
609
ENDIF .
610
SET PARAMETER ID '/***/DESNUM' FIELD lv_desnum .
611
Changes saved
612
MESSAGE ID '/***/MSG' TYPE 'S' NUMBER '529' WITH lv_desnum .
613
ENDIF .
Contents of system fields
Name
Val.
SY-SUBRC
0
SY-INDEX
0
SY-TABIX
1
SY-DBCNT
1
SY-FDPOS
0
SY-LSIND
0
SY-PAGNO
0
SY-LINNO
1
SY-COLNO
1
SY-PFKEY
2000
SY-UCOMM
CU01
SY-TITLE
Change Design: 50000109
SY-MSGTY
X
SY-MSGID
00
SY-MSGNO
341
SY-MSGV1
MESSAGE_TYPE_X
SY-MSGV2
SY-MSGV3
SY-MSGV4
SY-MODNO
0
SY-DATUM
20070827
SY-UZEIT
180110
SY-XPROG
SAPMSSY1
SY-XFORM
XAB_READ
Active Calls/Events
No. Ty. Program Include Line
Name
4 FORM /***/SAPLCUORDER_N /***/LCUORDER_NF07 594
SAVE_DESIGN
3 FORM /***/SAPLCUORDER_N /***/LCUORDER_NF07 2616
CHECK_AND_SAVE_F07
2 FORM /***/SAPLCUORDER_N /***/LCUORDER_NF04 311
USER_COMMAND_D2000
1 MODULE (PAI) /***/SAPLCUORDER_N /***/LCUORDER_NI05 28
USER_COMMAND_2000
Chosen variables
Name
Val.
No. 4 Ty. FORM
Name SAVE_DESIGN
%_DUMMY$$
2222
0000
0000
0000
CL_GUI_RESOURCES=>COL_TEXTAREA
31
1000
F000
G_DESIGN_MODE
R
5
2
0
0
CON_MODE_CREA
I
4
9
0
0
GT_NODE_CUI
Table[initial]
SY-REPID
/***/SAPLCUORDER_N
2454254544545445542222222222222222222222
F35DF310C35F2452FE0000000000000000000000
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
CON_DESNUM_TMP_1
TM00000001CY
543333333345
4D0000000139
000000000000
000000000000
LV_DESNUM
222222222222
000000000000
000000000000
000000000000
SAVE_OKCODE
CU01
4533222222222222222222222222222222222222222222222222222222222222222222
3501000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000
CON_ORDER
CU01
4533222222222222222222222222222222222222222222222222222222222222222222
3501000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000
SY-XPROG
SAPMSSY1
5454555322222222222222222222222222222222
310D339100000000000000000000000000000000
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
CON_DELETE
LVMS
4545222222222222222222222222222222222222222222222222222222222222222222
C6D3000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000
No. 3 Ty. FORM
Name CHECK_AND_SAVE_F07
CL_GUI_ALV_GRID=>MC_MB_VIEW
&MB_VIEW
2445544522222222222222222222222222222222222222222222222222222222222222
6D2F695700000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000
GT_OP
Table IT_303[2x1320]
PROGRAM=/***/SAPLCUORDER_NDATA=GT_OP
Table reference: 118
TABH+ 0(20) = 7039FC3C5824DB3C00000000760000002F010000
TABH+ 20(20) = 0200000028050000FFFFFFFF0400000030140000
TABH+ 40( 8) = 08000000C1308001
store = 0x7039FC3C
ext1 = 0x5824DB3C
shmId = 0 (0x00000000)
id = 118 (0x76000000)
label = 303 (0x2F010000)
fill = 2 (0x02000000)
leng = 1320 (0x28050000)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000093
occu = 8 (0x08000000)
access = 1 (ItAccessStandard)
idxKind = 0 (ItIndexNone)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 8 (cmpManyEq)
occu0 = 1
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 0
sharedWithShmTab = 0
isShmLockId = 0
gcKind = 0
isUsed = 1
isCtfyAble = 1
>>>>> Shareable Table Header Data <<<<<
tabi = 0x2010FC3C
pgHook = 0x00000000
idxPtr = 0x00000000
shmTabhSet = 0x00000000
id = 234 (0xEA000000)
refCount = 0 (0x00000000)
tstRefCount = 0 (0x00000000)
lineAdmin = 8 (0x08000000)
lineAlloc = 8 (0x08000000)
shmVersId = 0 (0x00000000)
shmRefCount = 1 (0x01000000)
>>>>> 1st level extension part <<<<<
regHook = 0x60B7153D
collHook = 0x00000000
ext2 = 0x1024DB3C
>>>>> 2nd level extension part <<<<<
tabhBack = 0xE00FFC3C
delta_head = 0000000000000000000000000000000000000000000000000000000000000000000000000000000
pb_func = 0x00000000
pb_handle = 0x00000000
G_BADI_PROGRAM
2222222222222222222222222222222222222222
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
LOG_ERROR
2
0
0
0
CON_BUTT_DELETED
@11QDelete@
43355466676422222222222222222222222222222222
011C145C545000000000000000000000000000000000
00000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000
G_CU_EXIT_CU_EXPLODE
F0000000
F0000000
/***/CUDESIGN-OBJNR
CY00000000000000008835
4533333333333333333333
3900000000000000008835
0000000000000000000000
0000000000000000000000
CL_GUI_RESOURCES=>COL_TEXTAREA
31
1000
F000
G_SEC_COUNT
0
0000
0000
LV_UPD
X
5
8
0
0
%_SPACE
2
0
0
0
GS_ROW_NO
0.0.0.1.
0000
1000
0000
0000
SCREEN
/***/CUDESIGN-GLTRP
2454245445444244555222222222222222222222222222222222222222222222222222222222222222222222222222
F35DF3545397ED7C420000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
SY-MSGID
00
33222222222222222222
00000000000000000000
00000000000000000000
00000000000000000000
SWO_%CONTAINER
000000000
2222222222222222222222222222222233333333322222222222222222222222222222222222222222222222222222
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
SPACE
2
0
0
0
SY-MSGNO
341
333
341
000
000
/***/CVCUI-CUTYP
2
0
0
0
SY-MSGV1
MESSAGE_TYPE_X
44554445555455222222222222222222222222222222222222
D533175F4905F8000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
SY-MSGV2
22222222222222222222222222222222222222222222222222
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
SY-MSGV3
22222222222222222222222222222222222222222222222222
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
SY-MSGV4
22222222222222222222222222222222222222222222222222
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
No. 2 Ty. FORM
Name USER_COMMAND_D2000
/***/CVCUI
0.0.0.0.0.0.0.1. 000000
2220000000022222222222222222222222222222222222222222222222222222222222222222222222223333332222
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
SYST-REPID
/***/SAPLCUORDER_N
2454254544545445542222222222222222222222
F35DF310C35F2452FE0000000000000000000000
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
CON_MODE_COPY
C
4
3
0
0
LT_BAPI_RETURN
Table IT_1778[2x1088]
PROGRAM=/***/SAPLCUORDER_NFORM=USER_COMMAND_D2000DATA=LT_BAPI_RETURN
Table reference: 310
TABH+ 0(20) = 8837083D407E1C3D0000000036010000F2060000
TABH+ 20(20) = 0200000040040000FFFFFFFF04000000F0170000
TABH+ 40( 8) = 08000000C1308101
store = 0x8837083D
ext1 = 0x407E1C3D
shmId = 0 (0x00000000)
id = 310 (0x36010000)
label = 1778 (0xF2060000)
fill = 2 (0x02000000)
leng = 1088 (0x40040000)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000113
occu = 8 (0x08000000)
access = 1 (ItAccessStandard)
idxKind = 0 (ItIndexNone)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 8 (cmpManyEq)
occu0 = 1
groupCntl = 0
rfc = 1
unShareable = 0
mightBeShared = 0
sharedWithShmTab = 0
isShmLockId = 0
gcKind = 0
isUsed = 1
isCtfyAble = 1
>>>>> Shareable Table Header Data <<<<<
tabi = 0x50C6073D
pgHook = 0x00000000
idxPtr = 0x00000000
shmTabhSet = 0x00000000
id = 1534 (0xFE050000)
refCount = 0 (0x00000000)
tstRefCount = 0 (0x00000000)
lineAdmin = 8 (0x08000000)
lineAlloc = 8 (0x08000000)
shmVersId = 0 (0x00000000)
shmRefCount = 1 (0x01000000)
>>>>> 1st level extension part <<<<<
regHook = 0x00000000
collHook = 0x00000000
ext2 = 0x6067033D
>>>>> 2nd level extension part <<<<<
tabhBack = 0xE82F063D
delta_head = 0000000000000000CF000000000000000400000020180000000000004D00430055004F000000000
pb_func = 0x00000000
pb_handle = 0x00000000
CON_MODE_ORDE
O
4
F
0
0
TGSBT
22222222222222222222222222222222222222
00000000000000000000000000000000000000
00000000000000000000000000000000000000
00000000000000000000000000000000000000
CL_GUI_RESOURCES=>COL_TEXTAREA
31
1000
F000
LS_NUMBERS-AUFNR_NEW
000001000677
333333333333
000001000677
000000000000
000000000000
T024I
200UT10100PG for Term & Comp
33355333335426672567622246672222222222222222
20054101000706F20452D0603FD00000000000000000
00000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000
LS_T399X
200UT10UM01 X INST 30UT01UT01
3335533543322222222222222222252222445522335533553322222222222222222222222222222222222222222222
20054105D01000000000000000000800009E3400305401540100000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
CON_VBKZ_U
U
5
5
0
0
/***/CU_ORDER_IO-DISP_FACTOR
2097152
0
0
LS_DESIGN
200########000050000109DDCY00000000000000008835PROFILE1 0001UT10UM0100220100MWH001
333D5FC807333333333333344453333333333333333333355444443223333553354333333333345433322222222222
200CDB1E02B00005000010944390000000000000000883502F69C5100000154105D0100220100D7800100000000000
000599F215300000000000000000000000000000000000000000000000000000000000000000000000000000000000
0004C91D3DB00000000000000000000000000000000000000000000000000000000000000000000000000000000000
/***/CUDESIGN
200########000050000109DDCY00000000000000008835PROFILE1 0001UT10UM0100220100MWH001
333D5FC807333333333333344453333333333333333333355444443223333553354333333333345433322222222222
200CDB1E02B00005000010944390000000000000000883502F69C5100000154105D0100220100D7800100000000000
000599F215300000000000000000000000000000000000000000000000000000000000000000000000000000000000
0004C91D3DB00000000000000000000000000000000000000000000000000000000000000000000000000000000000
G_DROP_COUNT
0
0000
0000
LS_DESIGN-DESNUM
000050000109
333333333333
000050000109
000000000000
000000000000
No. 1 Ty. MODULE (PAI)
Name USER_COMMAND_2000
GT_SELTAB_INIT
Table[initial]
Internal notes
The termination was triggered in function "RfcExtendedReceive"
of the SAP kernel, in line 422 of the module
"//bas/700_REL/src/krn/rfc/abrfcrcv.c#4".
The internal operation just processed is "FUNC".
Internal mode was started at 20070827180011.
Status of connection:
RFC state: " "
RFC error text: "RFC_ERROR_SYSTEM_FAILURE"
CPI-C error text: "The current application triggered a termination with a short
dump."
Active Calls in SAP Kernel
Lines of C Stack in Kernel (Structure Differs on Each Platform)
SAP (R) - R/3(TM) Callstack, Version 1.0
Copyright (C) SAP AG. All rights reserved.
Callstack without Exception:
App : disp+work.EXE (pid=26488)
When : 8/27/2007 18:1:10.942
Threads : 2
Computer Name : MB1ES1005
User Name : ec6adm
Number of Processors: 2
Processor Type: x86 Family 15 Model 4 Stepping 10
Windows Version : 5.2 Current Build: 3790
State Dump for Thread Id 5e10
eax=000f93c0 ebx=0000042c ecx=00003118 edx=00000000 esi=0000042c edi=00000000
eip=7c82ed54 esp=056d71f0 ebp=056d7260 iopl=0 nv up ei ng nz ac po cy
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00200297
function : KiFastSystemCallRet
7c82ed54 c3 ret
7c82ed55 8da42400000000 lea esp,[esp] ss:056d71f0=7c822124
7c82ed5c 8d642400 lea esp,[esp] ss:62bd5803=00000000
FramePtr ReturnAd Param#1 Param#2 Param#3 Param#4 Function Name
056d7260 77e6ba42 0000042c 0001d4c0 00000000 056d7298 ntdll!KiFastSystemCallRet
056d7274 0109504d 0000042c 0001d4c0 00000001 7c38b5c8 kernel32!WaitForSingleObject
056d7298 00582118 00582151 7c38b5c8 7c38b5c8 7c38b5c8 disp+work!NTDebugProcess (ntstcdbg.c (501))
056d729c 00582151 7c38b5c8 7c38b5c8 7c38b5c8 01e9b1b8 disp+work!NTStack (dptstack.c (1367))
056d72b8 00582185 7c38b5c8 00000000 008b7ec8 7c38b5c8 disp+work!CTrcStack2 (dptstack.c (352))
056d72c4 008b7ec8 7c38b5c8 00000000 005f0059 00330030 disp+work!CTrcStack (dptstack.c (182))
056d72e8 008bb39f 00711076 056d8018 056d7be8 00200020 disp+work!rabax_CStackSave [abrabax.c (7063)
056d7b90 009eca8b 020b9e4c 020b9e14 000001a6 5d88acf0 disp+work!ab_rabax (abrabax.c (1243))
056d7bcc 009ed19e 00000003 00711076 00000020 00000000 disp+work!rcv_message (abrfcrcv.c (422))
056d8068 009ed29d 00000003 00000000 00710c47 056d80c0 disp+work!RfcExtendedReceive [abrfcrcv.c (14
056d808c 00714873 00000003 00710c47 056d80c0 00711076 disp+work!ab_rfcreceive (abrfcrcv.c (59))
056d80e4 0071886b 2694a7c8 2694a7cc 2694a7cc 2694a7cc disp+work!jfunc_get (abfunc.c (5103))
056d89f4 007191d0 00000003 000000b4 00000000 05e8b7c0 disp+work!jfunc_nonstandard [abfunc.c (1655)
056dcfb0 006e3e2d 00000003 3ced8f90 00000000 056dd018 disp+work!ab_jfunc (abfunc.c (554))
056dd018 0081cb5e 00000000 3ced8f90 056dd164 3cedb514 disp+work!ab_extri (abextri.c (552))
056dd02c 00897dbd 00000000 3cedae46 005bf4cd 3ceda13c disp+work!ab_xevent (abrunt1.c (281))
056dd038 005bf4cd 3ceda13c 000000ea 3cedae46 00000000 disp+work!ab_dstep (abdynpro.c (492))
056dd164 005c25be 3ced8f90 3ced8f90 056dfc78 00000000 disp+work!dynpmcal (dymainstp.c (2398))
056dd178 005c1def 00000001 3ced8f90 00000003 056dfc78 disp+work!dynppai0 (dymainstp.c (1004))
056dd194 00595e69 3ced8f90 00000001 00000001 00000001 disp+work!dynprctl (dymainstp.c (360))
056dfcec 00490e06 00000004 0049d15f 00000004 01dadd00 disp+work!dynpen00 (dymain.c (1628))
056dfcf4 0049d15f 00000004 01dadd00 00000003 00000002 disp+work!Thdynpen00 (thxxhead.c (4773))
056dfee0 0049d6d6 00000001 00000000 00000000 00430000 disp+work!TskhLoop (thxxhead.c (4455))
056dff00 00421c36 00000000 00000000 7ffde000 056dff60 disp+work!ThStart (thxxhead.c (1173))
056dff14 00401080 00000003 05876980 00000001 00000000 disp+work!DpMain (dpxxdisp.c (1121))
056dff60 01242970 00000003 05876980 05877a10 01cce000 disp+work!nlsui_main (thxxanf.c (82))
056dffc0 77e523e5 00000000 00000000 7ffde000 8967f020 disp+work!wmainCRTStartup (crtexe.c (395))
056dfff0 00000000 0124282d 00000000 00905a4d 00000003 kernel32!IsProcessorFeaturePresent
State Dump for Thread Id 61fc
eax=00000000 ebx=00000103 ecx=0587a700 edx=02714360 esi=00000000 edi=00000000
eip=7c82ed54 esp=0799fec0 ebp=0799ff04 iopl=0 nv up ei pl zr na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000246
function : KiFastSystemCallRet
7c82ed54 c3 ret
7c82ed55 8da42400000000 lea esp,[esp] ss:0799fec0=7c821514
7c82ed5c 8d642400 lea esp,[esp] ss:64e9e4d3=00000000
FramePtr ReturnAd Param#1 Param#2 Param#3 Param#4 Function Name
0799ff04 0119030a 000006e0 00000000 00000000 0587a798 ntdll!KiFastSystemCallRet
0799ff84 7c349565 00000000 00000000 00000000 0587a700 disp+work!SigIMsgFunc (signt.c (610))
0799ffb8 77e6608b 0587a700 00000000 00000000 0587a700 MSVCR71!endthreadex
0799ffec 00000000 7c3494f6 0587a700 00000000 00000000 kernel32!GetModuleFileNameA
List of ABAP programs affected
Index
Typ
Program
Group
Date
Time
Size
Lang.
0
Prg
/***/SAPLCUORDER_N
0
10.08.2007
10:12:44
541696
E
1
Typ
/***/CUDESIGN
0
10.08.2007
10:05:19
7168
2
Typ
/***/CU_ORDER_IO
0
10.08.2007
09:53:38
4096
3
Typ
/***/DESTYPE
0
10.08.2007
10:05:21
2048
4
Typ
/***/PRF_ORD
0
10.08.2007
10:05:21
4096
5
Prg
SAPMSSYD
0
04.04.2007
10:28:36
21504
E
6
Prg
SAPFSYSCALLS
0
09.09.2004
14:18:32
8192
E
7
Typ
/***/G_CUST
0
10.08.2007
09:53:39
3072
8
Prg
/***/SAPLTABLES
8
10.08.2007
10:13:00
19456
E
9
Typ
/***/G_CHAR
0
10.08.2007
10:05:21
3072
10
Prg
SAPLCTCE
10
09.09.2004
14:18:34
9216
E
11
Typ
CABN
0
18.09.2001
10:02:26
12288
12
Prg
SAPLICON
12
04.04.2007
10:10:28
27648
E
13
Prg
%_CICON
12
07.02.2006
10:40:00
104448
E
14
Typ
ICONT
0
04.04.2007
10:10:08
2048
15
Typ
NRIV
0
02.04.1998
08:14:54
3072
16
Prg
SAPLBSVA
16
04.04.2007
14:47:00
296960
E
17
Typ
/***/CU_ORDER_S_OP_N
0
10.08.2007
09:53:39
14336
18
Prg
CL_GUI_CONTROL================CP
18
28.02.2005
21:03:09
112640
E
19
Prg
%_CCNTL
18
18.02.2005
14:15:08
15360
E
20
Typ
OBJ_RECORD
0
14.02.1998
08:30:43
2048
21
Prg
CL_GUI_OBJECT=================CP
21
05.07.2005
13:10:15
375808
E
22
Prg
CL_GUI_CFW====================CP
22
28.02.2005
21:03:09
172032
E
23
Prg
CL_GUI_PROPS_CONSUMER=========CP
23
18.02.2005
14:15:08
30720
E
24
Prg
SAPLTHFB
24
04.04.2007
13:24:38
390144
E
25
Typ
EUDB
0
06.11.2003
20:28:08
8192
26
Prg
SAPLSFES
26
08.08.2007
16:46:17
259072
E
27
Prg
SAPLSPLUGIN
27
09.09.2004
14:18:36
8192
E
28
Prg
SAPLSTTMYes even i find it strange. But there is no syntax error and the fact is that it was working 2 days back. Suddenly it has started giving us this dump.
The code is as follows.
Commit design BAPI's
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' .
IF save_okcode = con_order.
Commit order BAPI's
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
DESTINATION 'NONE'.
Here con_order is CU01.
Please let me know if anybody has faced this problem earlier.
Thanks in Advance
Meghana -
Error when using functions BAPI_ACC_DOCUMENT_POST
Hello,
When I used BAPI_ACC_DOCUMENT_POST function, the message: Document posted successfully appears, but really not documens are created, and the FI number range are modified.
See the example code:
*& Report ZPBA_PC *
REPORT zpba_pc MESSAGE-ID m3.
DATA: obj_type LIKE bapiache09-obj_type,
obj_key LIKE bapiache09-obj_key,
obj_sys LIKE bapiache09-obj_sys.
DATA: it_hdr LIKE bapiache09,
it_gl LIKE bapiacgl09 OCCURS 0 WITH HEADER LINE,
it_curr LIKE bapiaccr09 OCCURS 0 WITH HEADER LINE,
t_result LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
Header Data
it_hdr-obj_type = 'BKPFF'.
it_hdr-obj_key = '$'.
it_hdr-obj_sys = 'LA122D'.
it_hdr-bus_act = 'RFBU'.
it_hdr-comp_code = 'VEZS'.
it_hdr-fisc_year = '2004'.
it_hdr-fis_period = '12'.
it_hdr-doc_date = '20041218'..
it_hdr-pstng_date = '20041218'.
it_hdr-doc_type = 'ZI'.
it_hdr-header_txt = 'TEXTO CAB'.
it_hdr-username = sy-uname.
it_hdr-compo_acc = 'GL'.
it_hdr-ref_doc_no_long = 'REFERENCIA'.
First Item
Account number
it_gl-itemno_acc = '1'.
it_gl-gl_account = '0014401001'.
it_gl-item_text = 'PRUEBA TEXTO 1'.
it_gl-profit_ctr = 'VE2020'.
APPEND it_gl.
Second Item
Account number
it_gl-itemno_acc = '2'.
it_gl-gl_account = '0014401001'.
it_gl-item_text = 'PRUEBA TEXTO 2'.
it_gl-profit_ctr = 'VE2020'.
APPEND it_gl.
Set amount
it_curr-itemno_acc = '1'.
it_curr-currency = 'VEB'.
it_curr-amt_doccur = '10'.
APPEND it_curr.
it_curr-itemno_acc = '2'.
it_curr-currency = 'VEB'.
it_curr-amt_doccur = '-10'.
APPEND it_curr.
check posting
CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
EXPORTING
documentheader = it_hdr
TABLES
accountgl = it_gl
currencyamount = it_curr
return = t_result.
LOOP AT t_result WHERE ( type = 'E' OR type = 'A' ).
EXIT.
ENDLOOP.
if sy-subrc ne 0.
REFRESH t_result.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = it_hdr
IMPORTING
obj_type = obj_type
obj_key = obj_key
obj_sys = obj_sys
TABLES
accountgl = it_gl
currencyamount = it_curr
return = t_result.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
COMMIT WORK.
WRITE: obj_key.
endif.
I appreciated your help to solve that error.
Regards,
Piero Cimule.
<b></b>Hi,
Please check the changes :
*& Report ZPBA_PC *
REPORT zpba_pc MESSAGE-ID m3.
DATA: obj_type LIKE bapiache09-obj_type,
obj_key LIKE bapiache09-obj_key,
obj_sys LIKE bapiache09-obj_sys,
<b>l_flag type c.</b>
DATA: it_hdr LIKE bapiache09,
it_gl LIKE bapiacgl09 OCCURS 0 WITH HEADER LINE,
it_curr LIKE bapiaccr09 OCCURS 0 WITH HEADER LINE,
t_result LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
Header Data
it_hdr-obj_type = 'BKPFF'.
it_hdr-obj_key = '$'.
it_hdr-obj_sys = 'LA122D'.
it_hdr-bus_act = 'RFBU'.
it_hdr-comp_code = 'VEZS'.
it_hdr-fisc_year = '2004'.
it_hdr-fis_period = '12'.
it_hdr-doc_date = '20041218'..
it_hdr-pstng_date = '20041218'.
it_hdr-doc_type = 'ZI'.
it_hdr-header_txt = 'TEXTO CAB'.
it_hdr-username = sy-uname.
it_hdr-compo_acc = 'GL'.
it_hdr-ref_doc_no_long = 'REFERENCIA'.
First Item
Account number
it_gl-itemno_acc = '1'.
it_gl-gl_account = '0014401001'.
it_gl-item_text = 'PRUEBA TEXTO 1'.
it_gl-profit_ctr = 'VE2020'.
APPEND it_gl.
Second Item
Account number
it_gl-itemno_acc = '2'.
it_gl-gl_account = '0014401001'.
it_gl-item_text = 'PRUEBA TEXTO 2'.
it_gl-profit_ctr = 'VE2020'.
APPEND it_gl.
Set amount
it_curr-itemno_acc = '1'.
it_curr-currency = 'VEB'.
it_curr-amt_doccur = '10'.
APPEND it_curr.
it_curr-itemno_acc = '2'.
it_curr-currency = 'VEB'.
it_curr-amt_doccur = '-10'.
APPEND it_curr.
check posting
CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
EXPORTING
documentheader = it_hdr
TABLES
accountgl = it_gl
currencyamount = it_curr
return = t_result.
LOOP AT t_result WHERE ( type = 'E' OR type = 'A' ).
<b>l_flag = 'X'.</b>
EXIT.
ENDLOOP.
<b>if l_flag is initial.</b>
REFRESH t_result.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = it_hdr
IMPORTING
obj_type = obj_type
obj_key = obj_key
obj_sys = obj_sys
TABLES
accountgl = it_gl
currencyamount = it_curr
return = t_result.
<b>Clear l_flag.
LOOP AT t_result WHERE ( type = 'E' OR type = 'A' ).
l_flag = 'X'.
EXIT.
ENDLOOP.</b><b>if l_flag is initial.</b>
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
<b>COMMIT WORK AND WAIT.</b>
<b>endif.</b>
WRITE: obj_key.
endif.
Best regards,
Prashant -
Please find herewith my below code. This program i have created for transferring goods with mvt type '657' to '555' using BAPI 'BAPI_GOODSMVT_CREATE' for TCODE MB1A.
*& Report Z_BAPI_FOR_MB1A
REPORT Z_BAPI_FOR_MB1A.
Tables : mkpf, mseg, WB2_V_MKPF_MSEG2.
DATA:
it_mb1a LIKE BAPI2017_GM_ITEM_CREATE OCCURS 0 WITH HEADER LINE,
it_return LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE,
it_ex_headret LIKE BAPI2017_GM_HEAD_RET OCCURS 0 WITH HEADER LINE,
it_im_header LIKE BAPI2017_GM_HEAD_01, " OCCURS 0, " WITH HEADER LINE,
it_im_gmcode LIKE BAPI2017_GM_CODE, " OCCURS 0, "WITH HEADER LINE,
mat_doc type bapi2017_gm_head_ret-mat_doc,
mat_docyear type bapi2017_gm_head_ret-doc_year.
*data : lv_intense(01).
data : it_mseg like WB2_V_MKPF_MSEG2 occurs 0 with header line,
it_cost like csks occurs 0 with header line.
selection-screen begin of block a with frame title text-001.
parameters: p_date type sy-datum default sy-datum.
select-options: so_budat for WB2_V_MKPF_MSEG2-budat,
so_werks for WB2_V_MKPF_MSEG2-werks_i,
so_matnr for WB2_V_MKPF_MSEG2-matnr_i,
so_lgort for WB2_V_MKPF_MSEG2-lgort_i.
selection-screen end of block a.
select * from WB2_V_MKPF_MSEG2 into
table it_mseg where
budat in so_budat and
werks_i in so_werks and
matnr_i in so_matnr and
lgort_i in so_lgort and
bwart_i = '657'.
select * from csks into table it_cost
for all entries in it_mseg where
gsber = it_mseg-werks_i.
*Filling BAPI Header Tables
it_im_header-pstng_date = sy-datum.
it_im_header-doc_date = sy-datum.
it_im_gmcode-gm_code = '03'.
*Filling BAPI Item Tables
loop at it_mseg.
read table it_cost with key gsber = it_mseg-werks_i.
it_mb1a-material = it_mseg-matnr_i.
it_mb1a-plant = it_mseg-werks_i.
it_mb1a-stge_loc = it_mseg-lgort_i.
it_mb1a-batch = it_mseg-charg_i.
it_mb1a-move_type = 555. " '103'.
it_mb1a-entry_qnt = it_mseg-menge_i.
it_mb1a-costcenter = it_cost-KOSTL.
it_mb1a-gl_account = '530089'.
append it_mb1a.
clear it_mb1a.
clear it_cost.
endloop.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = it_im_header
goodsmvt_code = it_im_gmcode
* TESTRUN = ' '
* GOODSMVT_REF_EWM =
IMPORTING
GOODSMVT_HEADRET = it_ex_headret
MATERIALDOCUMENT = mat_doc
MATDOCUMENTYEAR = mat_docyear
tables
goodsmvt_item = it_mseg
* GOODSMVT_SERIALNUMBER =
return = it_return
* GOODSMVT_SERV_PART_DATA =
* EXTENSIONIN =
if sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
* IMPORTING
* RETURN =
endif.
But when i execute the above i am getting the following error.
Runtime Errors CALL_FUNCTION_UC_STRUCT
Except. CX_SY_DYN_CALL_ILLEGAL_TYPE
Date and Time 27.01.2009 14:43:06
Short text
Type conflict during structure parameter transfer at CALL FUNCTION.
What happened?
Error in the ABAP Application Program
The current ABAP program "Z_BAPI_FOR_MB1A" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE', was
not caught and
therefore caused a runtime error.
The reason for the exception is:
In the function "BAPI_GOODSMVT_CREATE", the STRUCTURE parameter "GOODSMVT_ITEM"
is typed in such a way
that only actual parameters are allowed, which are compatible in Unicode
with respect to the fragment view. However, the specified actual
parameter "IT_MSEG" has an incompatible fragment view.
Missing Handling of System Exception
Program Z_BAPI_FOR_MB1A
Trigger Location of Exception
Program Z_BAPI_FOR_MB1A
Include Z_BAPI_FOR_MB1A
Row 72
Module Name START-OF-SELECTION
Source Code Extract
Line SourceCde
42 lgort_i in so_lgort and
43 bwart_i = '657'.
44
45 select * from csks into table it_cost
46 for all entries in it_mseg where
47 gsber = it_mseg-werks_i.
48 *Filling BAPI Header Tables
49 it_im_header-pstng_date = sy-datum.
50 it_im_header-doc_date = sy-datum.
51 it_im_gmcode-gm_code = '03'.
52
53 *Filling BAPI Item Tables
54 loop at it_mseg.
55
56 read table it_cost with key gsber = it_mseg-werks_i.
57
58 it_mb1a-material = it_mseg-matnr_i.
59 it_mb1a-plant = it_mseg-werks_i.
60 it_mb1a-stge_loc = it_mseg-lgort_i.
61 it_mb1a-batch = it_mseg-charg_i.
62 it_mb1a-move_type = 555. " '103'.
64 it_mb1a-costcenter = it_cost-KOSTL.
65 it_mb1a-gl_account = '530089'.
66
67 append it_mb1a.
68 clear it_mb1a.
69 clear it_cost.
70 endloop.
71
72*>>>> CALL FUNCTION 'BAPI_GOODSMVT_CREATE'* 73 EXPORTING
74 goodsmvt_header = it_im_header
75 goodsmvt_code = it_im_gmcode
76 * TESTRUN = ' '
77 * GOODSMVT_REF_EWM =
78 IMPORTING
79 GOODSMVT_HEADRET = it_ex_headret
80 MATERIALDOCUMENT = mat_doc
81 MATDOCUMENTYEAR = mat_docyear
82 tables
83 goodsmvt_item = it_mseg
84 * GOODSMVT_SERIALNUMBER =
85 return = it_return
86 * GOODSMVT_SERV_PART_DATA =
87 * EXTENSIONIN =
88 .
89 if sy-subrc = 0.
90 CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
91 EXPORTING
Can u explain why this is coming. Your valuable suggestions are required.
Thanks,
Jitesh M NairHi,
Try this Code.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
GOODSMVT_HEADER = WF_HEADER
GOODSMVT_CODE = WF_CODE
TESTRUN = WL_space
IMPORTING
MATERIALDOCUMENT = FS_MATERIAL_DOC
TABLES
GOODSMVT_ITEM = INT_ITEM
GOODSMVT_SERIALNUMBER = INT_SERIALNO
RETURN = INT_RETURN1.
*VARIABLES for goods movement creation bapi
DATA : WF_HEADER TYPE BAPI2017_GM_HEAD_01,
WF_CODE TYPE BAPI2017_GM_CODE.
DATA : FS_MATERIAL_DOC TYPE BAPI2017_GM_HEAD_RET-MAT_DOC,
FS_SERIALNO TYPE BAPI2017_GM_SERIALNUMBER,
FS_ITEM TYPE BAPI2017_GM_ITEM_CREATE,
FS_RETURN1 TYPE BAPIRET2,
data declaration for goods movement creation bapi
DATA : INT_ITEM TYPE TABLE OF BAPI2017_GM_ITEM_CREATE,
INT_SERIALNO TYPE TABLE OF BAPI2017_GM_SERIALNUMBER,
INT_RETURN1 TYPE TABLE OF BAPIRET2.
Hope this will help.
Regards,
Rohan. -
Error when using BAPI_ACC_DOCUMENT_POST...
[code]
Hello Experts,
Iam using the said BAPI for the first time and I am not sure if I filled up the
fields correctly. What I want to do is to post multiple debit entries(40) and a
special G/L entry for vendor(posting key 39). I also need to generate the tax and
withholding tax. So my entries will be like:
40 -->amount = 1,120(This value has a VAT included which is 12% or 120)
39 -->amount = 1,120(Special G/L for vendor)
For these 2 entries below, they must be generated automatically.
40 -->amount = 120(Tax)
50 -->amount = 20(This is the EWT or withholding tax)
Below is my code:
wa_documentheader-obj_type = 'BKPFF'.
CONCATENATE sy-sysid sy-mandt INTO wa_documentheader-obj_sys.
wa_documentheader-obj_key = '$'.
wa_documentheader-username = sy-uname.
wa_documentheader-comp_code = '1000'.
wa_documentheader-bus_act = 'RFBU'.
wa_documentheader-header_txt = 'AVH Testing...'.
wa_documentheader-fisc_year = '2007'.
wa_documentheader-doc_date = sy-datum.
wa_documentheader-pstng_date = sy-datum.
wa_documentheader-fis_period = '11'.
wa_documentheader-doc_type = 'S3'.
CLEAR wa_accountpayable.
wa_accountpayable-itemno_acc = 1.
wa_accountpayable-vendor_no = '2000000058'.
wa_accountpayable-sp_gl_ind = 'V'.
wa_accountpayable-tax_code = 'DI'.
APPEND wa_accountpayable TO it_accountpayable.
CLEAR: wa_accountgl.
wa_accountgl-itemno_acc = 2.
wa_accountgl-gl_account = '0060000061'.
wa_accountgl-item_text = 'Aris' .
wa_accountgl-DE_CRE_IND = 'S'.
wa_accountgl-tax_code = 'DI'.
wa_accountgl-comp_code = '1000'.
wa_accountgl-fisc_year = '2007'.
wa_accountgl-fis_period = '11'.
wa_accountgl-pstng_date = sy-datum.
wa_accountgl-doc_type = 'S3'.
INSERT wa_accountgl INTO TABLE it_accountgl.
CLEAR wa_accounttax.
wa_accounttax-itemno_acc = 3.
wa_accounttax-tax_code = 'DI'.
wa_accounttax-gl_account = '0010018291'.
wa_accounttax-acct_key = 'VST'.
APPEND wa_accounttax TO it_accounttax.
CLEAR: wa_currency.
wa_currency-itemno_acc = 1.
wa_currency-currency = 'PHP'.
wa_currency-curr_type = '00'.
wa_currency-amt_doccur = 1120.
wa_currency-amt_base = 1000.
wa_currency-exch_rate = 1.
APPEND wa_currency TO it_currency.
CLEAR: wa_currency.
wa_currency-itemno_acc = 2.
wa_currency-currency = 'PHP'.
wa_currency-curr_type = '00'.
wa_currency-amt_doccur = 1120.
wa_currency-amt_base = 1000.
wa_currency-exch_rate = 1.
APPEND wa_currency TO it_currency.
CLEAR: wa_currency.
wa_currency-itemno_acc = 3.
wa_currency-currency = 'PHP'.
wa_currency-curr_type = '00'.
wa_currency-amt_doccur = 120.
wa_currency-amt_base = 120.
wa_currency-exch_rate = 1.
APPEND wa_currency TO it_currency.
Post
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = wa_documentheader
IMPORTING
obj_type = obj_type
obj_key = obj_key
obj_sys = obj_sys
TABLES
accountgl = it_accountgl
currencyamount = it_currency
return = it_return.
LOOP AT it_return INTO wa_return.
WRITE : /1 wa_return-message.
ENDLOOP.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = wa_return3.
When I checked the return table there are 2 problems that says:
1. Error in document: BKPFF $ ED1CLNT140
2. Balance in transaction currency
Hope you can help me guys. Simple examples will be appreciated. Thank you and take care!
[/code]<u>you can check the code.</u>
IF NOT wa_data-lifnr IS INITIAL.
ADD 1 TO g_lino.
x_vendoritem-itemno_acc = g_lino.
x_vendoritem-vendor_no = wa_data-lifnr.
IF wa_data-newbk IS INITIAL.
x_vendoritem-comp_code = wa_data-bukrs.
ELSE.
x_vendoritem-comp_code = wa_data-newbk.
ENDIF.
x_vendoritem-comp_code = t001-bukrs.
x_vendoritem-item_text = wa_data-csgtxt.
x_vendoritem-pmnttrms = wa_data-pyterm.
x_vendoritem-bline_date = wa_data-bldate.
x_vendoritem-pymt_meth = wa_data-zlsch.
x_vendoritem-alloc_nmbr = wa_data-zuonr.
x_vendoritem-tax_code = wa_data-mwskz.
x_vendoritem-taxjurcode = wa_data-txjcd.
APPEND x_vendoritem TO it_vendoritem.
x_currencyamount-itemno_acc = g_lino.
x_currencyamount-curr_type = c_ct1.
x_currencyamount-currency = t001-waers.
x_currencyamount-amt_doccur = wa_data-cwrbtr.
APPEND x_currencyamount TO it_currencyamount.
x_currencyamount-curr_type = c_ct2.
APPEND x_currencyamount TO it_currencyamount.
IF t001-land1 = c_lnd.
x_currencyamount-curr_type = c_ct3.
APPEND x_currencyamount TO it_currencyamount.
ENDIF.
ENDIF.
IF NOT wa_data-dsaknr IS INITIAL.
CLEAR:
x_accountgl,
x_currencyamount,
x_vendoritem.
ADD 1 TO g_lino.
x_accountgl-itemno_acc = g_lino.
x_accountgl-doc_type = x_doc_hdr-doc_type.
IF wa_data-newbk IS INITIAL.
x_accountgl-comp_code = wa_data-bukrs.
ELSE.
x_accountgl-comp_code = wa_data-newbk.
ENDIF.
x_accountgl-gl_account = wa_data-dsaknr.
x_accountgl-costcenter = wa_data-dkostl.
x_accountgl-item_text = wa_data-dsgtxt.
x_accountgl-orderid = wa_data-daufnr.
x_accountgl-wbs_element = wa_data-dwbs.
x_accountgl-pstng_date = p_pdate.
x_accountgl-vendor_no = wa_data-lifnr .
x_accountgl-alloc_nmbr = wa_data-zuonr.
x_accountgl-tax_code = wa_data-mwskz.
x_accountgl-taxjurcode = wa_data-txjcd.
APPEND x_accountgl TO it_accountgl.
x_currencyamount-itemno_acc = g_lino.
x_currencyamount-curr_type = c_ct1.
x_currencyamount-currency = t001-waers.
x_currencyamount-amt_doccur = - wa_data-dwrbtr.
APPEND x_currencyamount TO it_currencyamount.
x_currencyamount-curr_type = c_ct2.
APPEND x_currencyamount TO it_currencyamount.
IF t001-land1 = c_lnd.
x_currencyamount-curr_type = c_ct3.
APPEND x_currencyamount TO it_currencyamount.
ENDIF.
ENDIF.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = x_doc_hdr
TABLES
accountgl = it_accountgl
accountpayable = it_vendoritem
currencyamount = it_currencyamount
return = it_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
Reward if helpful. -
Hi all,
i am creating a BOM with item & sub item .
i am getting the error like BOM is not valid.
i am giving my coding below.plz suggest where i am doing mistake.
it's urgent.
can u plz give some sample coding where sub-item will be there in that BOM.
any idea will be highly appreaciated.
correct answers will be rewarded.
regards
pabitra
report z_bom_create
line-size 132
line-count 65.
no standard page heading.
*-- DATA DECLARATION--
include <icon> .
*---Tables
tables : s076, t100, marc .
*---Types
types : begin of t_upload, " Upload file data
col1(18),
col2(10),
col3(30),
col4(12),
col5(50),
end of t_upload,
begin of t_split,
location like stpu-ebort,
end of t_split.
*data:begin of i_return occurs 10.
*include structure bapiret2.
*data:end of i_return.
data:i_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
types:begin of t_item."occurs 10.
include structure BAPI1080_ITM_C.
types:end of t_item.
types:begin of t_subitem." occurs 10.
include structure BAPI1080_SUI_C.
types:end of t_subitem.
types:begin of t_header." occurs 10.
include structure BAPI1080_MBM_C.
types:end of t_header.
types:begin of t_bomgroup." occurs 10.
include structure BAPI1080_BGR_C.
types:end of t_bomgroup.
types:begin of t_variant." occurs 10.
include structure BAPI1080_BOM_C.
types:end of t_variant.
data:it_itemas LIKE bapi1080_rel_itm_bom_c OCCURS 0 WITH HEADER LINE,
it_subitemas LIKE BAPI1080_REL_SUI_ITM_C OCCURS 0 WITH HEADER LINE.
*--- Tables
data: i_upload type standard table of t_upload, " to hold data
i_upload1 type standard table of t_upload,
i_upload2 type standard table of t_upload,
i_split type standard table of t_split,
i_item type standard table of t_item,
i_subitem type standard table of t_subitem,
i_header type standard table of t_header,
i_bomgroup type standard table of t_bomgroup,
i_variant type standard table of t_variant.
data: wa_upload type t_upload, " to hold file data,
wa_upload1 type t_upload, " to hold plan data,
wa_upload2 type t_upload,
wa_split type t_split,
wa_item type t_item,
wa_subitem type t_subitem,
wa_header type t_header,
wa_bomgroup type t_bomgroup,
wa_variant type t_variant.
data:v_matnr like mara-matnr,
v_start like sy-index,
v_count(3) type c,
v_num(4) type c value '0000'.
*--Constants
data: c_dot type c value '.',
c_x type c value 'X',
c_comma type c value ','.
-------Selection Screen Design -
*Selection screen for input of upload file address
selection-screen skip 2.
selection-screen begin of block blk1 with frame.
parameters : p_file like rlgrap-filename obligatory .
parameters : p_matnr like mara-matnr obligatory,
p_werks like marc-werks obligatory memory id wrk,
p_stlan like afko-stlan obligatory default '1' .
selection-screen end of block blk1.
---AT SELECTION SCREEN -
*at selection-screen on value-request for p_file.
**--For popup to select file.
perform f_give_help.
*at selection-screen on p_matnr.
perform f_check_matnr.
-----START OF SELECTION -
*--Data upload using WS_Upload.
perform f_get_data.
perform f_get_bom_data.
perform f_get_bom_data1.
perform f_call_bapi.
perform f_error_display.
*& Form f_give_help
text
--> p1 text
<-- p2 text
*FORM f_give_help.
*call function 'WS_FILENAME_GET'
exporting
mask = ',.,..'
mode = 'O'
importing
filename = p_file
exceptions
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
others = 5.
if sy-subrc <> 0 and not sy-msgty is initial.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
*ENDFORM. " f_give_help
*& Form f_check_matnr
text
--> p1 text
<-- p2 text
*FORM f_check_matnr.
*CALL FUNCTION 'BAPI_MAT_BOM_EXISTENCE_CHECK'
EXPORTING
MATERIAL = p_matnr
PLANT = p_werks
BOMUSAGE = '1'
VALID_FROM_DATE =
VALID_TO_DATE =
TABLES
RETURN = i_return.
*ENDFORM. " f_check_matnr
*& Form f_get_data
text
--> p1 text
<-- p2 text
FORM f_get_data.
call function 'WS_UPLOAD'
exporting
CODEPAGE = ' '
filename = p_file
filetype = 'DAT'
tables
data_tab = i_upload
exceptions
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
others = 10
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
ENDFORM. " f_get_data
*& Form f_get_bom_data
text
--> p1 text
<-- p2 text
FORM f_get_bom_data.
delete i_upload where col1 is initial.
delete i_upload where col1 cs 'ITEM'.
i_upload2[] = i_upload[].
delete i_upload2 where col1 cs 'FINISHED GOOD'.
read table i_upload into wa_upload with key col1 = 'FINISHED GOOD:'.
if sy-subrc = 0.
v_matnr = wa_upload-col2.
if v_matnr <> p_matnr.
message e001(zl) with p_matnr.
endif.
else.
message e000(zl).
endif.
ENDFORM. " f_get_bom_data
*& Form f_get_bom_data1
text
--> p1 text
<-- p2 text
FORM f_get_bom_data1.
loop at i_upload into wa_upload where col1 CS 'FINISHED GOOD'.
v_start = sy-tabix + 1.
loop at i_upload into wa_upload1 from v_start .
if wa_upload1-col1 cs 'FINISHED GOOD'.
exit.
else.
perform f_split_upload_data.
endif.
endloop.
endloop.
ENDFORM. " f_get_bom_data1
*& Form f_split_upload_data
text
--> p1 text
<-- p2 text
FORM f_split_upload_data.
if not wa_upload1-col5 is initial.
if wa_upload1-col5 cs c_comma.
split wa_upload1-col5 at c_comma into table i_split.
loop at i_split into wa_split.
v_count = v_count + 1.
endloop.
if wa_upload1-col4 <> v_count.
wa_upload1-col4 = v_count.
endif.
clear wa_upload1-col5.
clear wa_split.
clear v_count.
loop at i_split into wa_split.
wa_upload1-col5 = wa_split-location.
append wa_upload1 to i_upload1.
endloop.
else.
append wa_upload1 to i_upload1.
endif.
else.
append wa_upload1 to i_upload1.
endif.
clear wa_upload1.
ENDFORM. " f_split_upload_data
*& Form f_call_bapi
text
--> p1 text
<-- p2 text
FORM f_call_bapi.
clear wa_upload1.
wa_header-material = p_matnr.
*wa_header-plant = p_werks.
wa_header-bom_group_identification = 'BAPI_SMP_COL1'.
wa_header-bom_usage = p_stlan.
wa_header-alternative_bom = '1'.
append wa_header to i_header.
wa_bomgroup-bom_usage = p_stlan.
*wa_bomgroup-created_in_plant = p_werks.
*wa_bomgroup-bom_group = ''.
wa_bomgroup-object_id = 'SIMPLE1'.
wa_bomgroup-bom_group_identification = 'BAPI_SMP_COL1'.
wa_bomgroup-object_type = 'BGR'.
append wa_bomgroup to i_bomgroup.
wa_variant-alternative_bom = '1'.
wa_variant-base_qty = '1.000'.
wa_variant-valid_from_date = sy-datum.
wa_variant-bom_group_identification = 'BAPI_SMP_COL1'.
wa_variant-object_type = 'BOM'.
wa_variant-object_id = 'VAR'.
wa_variant-bom_status = '1'.
wa_variant-valid_from_date = sy-datum.
wa_variant-function = 'NEW'.
append wa_variant to i_variant.
it_itemas-bom_group_identification = 'BAPI_SMP_COL1'.
it_itemas-sub_object_type = 'ITM'.
it_itemas-sub_object_id = 'SIM'.
it_itemas-super_object_type = 'BOM'.
it_itemas-super_object_id = 'VAR'.
it_itemas-valid_from_date = sy-datum.
it_itemas-function = 'NEW'.
append it_itemas.
it_subitemas-bom_group_identification = 'BAPI_SMP_COL1'.
it_subitemas-sub_object_type = 'SUI'.
it_subitemas-sub_object_id = 'SIMP'.
it_subitemas-super_object_type = 'ITM'.
it_subitemas-super_object_id = 'SIM'.
append it_subitemas.
loop at i_upload2 into wa_upload2.
*wa_item-item_id = v_num.
*v_num = v_num + 1.
wa_item-bom_group_identification = 'BAPI_SMP_COL1'.
wa_item-object_type = 'ITM'.
wa_item-object_id = 'SIM'.
wa_item-item_no = wa_upload2-col1.
wa_item-item_cat = wa_upload2-col2.
wa_item-component = wa_upload2-col3.
wa_item-comp_qty = wa_upload2-col4.
wa_item-valid_from_date = sy-datum.
append wa_item to i_item.
endloop.
loop at i_item into wa_item.
loop at i_upload1 into wa_upload1 where col1 = wa_item-item_no.
wa_subitem-bom_group_identification = 'BAPI_SMP_COL1'.
wa_subitem-object_type = 'SUI'.
wa_subitem-object_id = 'SIMP'.
IF not wa_upload1-col5 is initial.
on change of wa_upload1-col5.
v_num = v_num + 1.
wa_subitem-subitem_no = v_num.
wa_subitem-subitem_qty = '1'.
wa_subitem-installation_point = wa_upload1-col5.
append wa_subitem to i_subitem.
clear wa_subitem.
endon.
endif.
clear wa_upload1.
endloop.
clear v_num.
clear wa_upload.
endloop.
CALL FUNCTION 'BAPI_MATERIAL_BOM_GROUP_CREATE'
EXPORTING
TESTRUN = ' '
ALL_ERROR = ' '
TABLES
BOMGROUP = i_bomgroup
VARIANTS = i_variant
ITEMS = i_item
SUBITEMS = i_subitem
MATERIALRELATIONS = i_header
ITEMASSIGNMENTS = it_itemas
SUBITEMASSIGNMENTS = it_subitemas
TEXTS =
RETURN = i_return.
*if i_return[] is initial.
*CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
*write: /'BOM created:', stpo-stlnr.
*else.
*if not i_return[] is initial.
*loop at i_return.
WRITE:/ i_return-type, i_return-id, i_return-number,
i_return-message.
*ENDLOOP.
IF i_return-TYPE = 'E'.
errmsg-type = i_return-type.
errmsg-line = i_return-message.
append errmsg.
ULINE /1(108).
write:/ icon_led_RED as icon, i_return-MESSAGE.
ULINE /1(108).
ENDIF.
IF i_return-TYPE = 'W'.
errmsg-type = i_return-type.
errmsg-line = i_return-message.
append errmsg.
ULINE /1(108).
write:/ icon_led_YELLOW as icon, i_return-MESSAGE.
ULINE /1(108).
ENDIF.
ENDLOOP.
**write: / i_return-id, i_return-number, i_return-message(80).
**endloop.
**write: /'Error'.
**endif.
ENDFORM. " f_call_bapi
*& Form f_error_display
text
--> p1 text
<-- p2 text
FORM f_error_display.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
loop at i_return.
WRITE:/ i_return-type, i_return-id, i_return-number,
i_return-message.
ENDLOOP.
ENDFORM. " f_error_displayAre u sure That BAPI is the right one to use to create BOM , I think this Error is coming from BAPI itself So try to Debug the BAPI from where its throwing the error.
Regards
prabhu -
Error field is not getting populated into corresponding str. in Zrfc
hi,
In case of error in PO creation i am not getting all the data i nto correponding structure..
*data it_head type standard table of bapimepoheader.
DATA ls_head TYPE bapimepoheader.
DATA it_headx TYPE STANDARD TABLE OF bapimepoheaderx.
DATA ls_headx TYPE bapimepoheaderx.
data : it_temp_ekpo type zpo_item_60 occurs 0 with header line.
DATA it_item TYPE STANDARD TABLE OF bapimepoitem.
DATA ls_item TYPE bapimepoitem.
DATA it_itemx TYPE STANDARD TABLE OF bapimepoitemx.
DATA ls_itemx TYPE bapimepoitemx.
DATA it_sch TYPE STANDARD TABLE OF bapimeposchedule .
DATA ls_sch TYPE bapimeposchedule.
DATA it_schx TYPE STANDARD TABLE OF bapimeposchedulx.
DATA ls_schx TYPE bapimeposchedulx.
DATA it_poact TYPE STANDARD TABLE OF bapimepoaccount.
DATA ls_poact TYPE bapimepoaccount.
DATA it_poactx TYPE STANDARD TABLE OF bapimepoaccountx.
DATA ls_poactx TYPE bapimepoaccountx.
DATA it_cond TYPE STANDARD TABLE OF bapimepocond.
DATA ls_cond TYPE bapimepocond.
DATA it_adrc TYPE STANDARD TABLE OF bapimepoaddrdelivery.
DATA st_adrc TYPE bapimepoaddrdelivery.
DATA it_condx TYPE STANDARD TABLE OF bapimepocondx.
DATA ls_condx TYPE bapimepocondx.
DATA it_popart TYPE STANDARD TABLE OF bapiekkop.
DATA ls_popart TYPE bapiekkop.
data : ret2 type bapiret2 occurs 0 with header line.
DATA ls_ekko TYPE zpo_data_60.
DATA st_ekko TYPE zpo_data_60.
DATA ls_ekpo TYPE zpo_item_60.
DATA st_ekpo TYPE zpo_item_60.
DATA: ls_adrc TYPE zpo_adrc_60,
ls_ekkn TYPE zpo_ekkn_60,
ls_eket TYPE zpo_eket_60,
ls_ekbe TYPE zpo_ekbe_60,
w_purchaseorder type BAPIMEPOHEADER-PO_NUMBER.
LOOP AT lt_ekpo INTO st_ekpo.
ls_ekpo = st_ekpo.
AT NEW ebeln.
READ TABLE lt_ekko WITH KEY ebeln = ls_ekpo-ebeln.
IF sy-subrc = 0.
ls_head-comp_code = lt_ekko-bukrs.
ls_head-doc_type = lt_ekko-bsart.
ls_head-vendor = lt_ekko-lifnr.
ls_head-purch_org = lt_ekko-ekorg.
ls_head-pur_group = lt_ekko-ekgrp.
ls_head-pmnttrms = lt_ekko-zterm.
ls_head-exch_rate = lt_ekko-wkurs.
ls_head-incoterms1 = lt_ekko-inco1.
ls_head-incoterms2 = lt_ekko-inco2.
ls_head-currency = lt_ekko-waers.
ls_head-PO_NUMBER = lt_ekko-ebeln.
*append ls_head to it_head.
*Parameter: POHEADERX
ls_headx-comp_code = 'X' .
ls_headx-doc_type = 'X' .
ls_headx-vendor = 'X' .
ls_headx-purch_org = 'X'.
ls_headx-pur_group = 'X' .
ls_headx-pmnttrms = 'X'.
ls_headx-currency = 'X'.
ls_headx-exch_rate = 'X'.
ls_headx-incoterms1 = 'X'.
ls_headx-incoterms2 = 'X'.
ls_headx-currency = 'X'.
ls_headx-PO_NUMBER = 'X'.
*append ls_headx to it_headx.
ENDIF.
ENDAT.
ls_item-po_unit = ls_ekpo-meins.
ls_item-po_item = ls_ekpo-ebelp.
ls_item-material = ls_ekpo-matnr.
ls_item-price_unit = ls_ekpo-peinh.
ls_item-orderpr_un = ls_ekpo-bprme.
ls_item-net_price = ls_ekpo-netpr.
ls_item-matl_group = ls_ekpo-matkl.
ls_item-short_text = ls_ekpo-txz01.
ls_item-plant = ls_ekpo-werks.
ls_item-stge_loc = ls_ekpo-lgort.
ls_item-quantity = ls_ekpo-menge.
ls_item-acctasscat = ls_ekpo-knttp.
ls_item-gr_basediv = ls_ekpo-webre.
ls_item-vend_mat = ls_ekpo-idnlf.
ls_item-no_more_gr = ls_ekpo-elikz.
ls_item-final_inv = ls_ekpo-erekz.
ls_item-gr_ind = ls_ekpo-wepos.
ls_item-gr_non_val = ls_ekpo-weunb.
ls_item-conv_num1 = ls_ekpo-bpumz.
ls_item-conv_den1 = ls_ekpo-bpumn.
ls_item-ir_ind = ls_ekpo-repos.
ls_item-unlimited_dlv = ls_ekpo-uebtk.
ls_item-reminder1 = ls_ekpo-mahn1.
ls_item-reminder2 = ls_ekpo-mahn2.
ls_item-reminder3 = ls_ekpo-mahn3.
ls_item-vend_mat = ls_ekpo-idnlf.
ls_item-no_more_gr = ls_ekpo-elikz.
ls_item-final_inv = ls_ekpo-erekz.
ls_item-gr_ind = ls_ekpo-wepos.
append ls_ekpo to it_temp_ekpo.
*Parameter: POITEMX
ls_itemx-po_unit = 'X'.
ls_itemx-po_item = ls_ekpo-ebelp.
ls_itemx-material = 'X'.
ls_itemx-price_unit = 'X'.
ls_itemx-orderpr_un = 'X'.
ls_itemx-net_price = 'X'.
ls_itemx-matl_group = 'X'.
ls_itemx-short_text = 'X'.
ls_itemx-plant = 'X'.
ls_itemx-stge_loc = 'X'.
ls_itemx-quantity = 'X'.
ls_itemx-acctasscat = 'X'.
ls_itemx-gr_basediv = 'X'.
ls_itemx-vend_mat = 'X'.
ls_itemx-no_more_gr = 'X'.
ls_itemx-final_inv = 'X'.
ls_itemx-gr_ind = 'X'.
ls_itemx-gr_non_val = 'X'.
ls_itemx-conv_num1 = 'X'.
ls_itemx-conv_den1 = 'X'.
ls_itemx-ir_ind = 'X'.
ls_itemx-unlimited_dlv = 'X'.
ls_itemx-reminder1 = 'X'.
ls_itemx-reminder2 = 'X'.
ls_itemx-reminder3 = 'X'.
ls_itemx-vend_mat = 'X'.
ls_itemx-no_more_gr = 'X'.
ls_itemx-final_inv = 'X'.
ls_itemx-gr_ind = 'X'.
APPEND ls_itemx TO it_itemx.
APPEND ls_item TO it_item.
READ TABLE lt_eket INTO ls_eket WITH KEY ebeln = ls_ekpo-ebeln
ebelp = ls_ekpo-ebelp.
IF sy-subrc = 0.
*Parameter: POSCHEDULE
ls_sch-po_item = ls_ekpo-ebelp.
ls_sch-sched_line = LS_EKET-ETENR.
ls_sch-delivery_date = ls_eket-eindt.
ls_sch-quantity = ls_ekpo-menge .
APPEND ls_sch TO it_sch.
ENDIF.
*Parameter: POSCHEDULEX
ls_schx-po_item = ls_ekpo-ebelp.
ls_schx-sched_line = LS_EKET-ETENR.
ls_schx-po_itemx = 'X' .
ls_schx-sched_linex = 'X'.
ls_schx-delivery_date = 'X'.
ls_schx-quantity = 'X' .
APPEND ls_schx TO it_schx.
read table lt_ekkn into ls_ekkn with key ebeln = ls_ekpo-ebeln
ebelp = ls_ekpo-ebelp.
*Parameter: POACCOUNT
IF SY-SUBRC = 0.
ls_poact-po_item = ls_ekpo-ebelp.
ls_poact-serial_no = sy-tabix.
ls_poact-quantity = ls_ekpo-menge.
ls_poact-gl_account = ls_ekkn-sakto.
ls_poact-costcenter = ls_ekkn-KOSTL.
ls_poact-co_area = '1000'.
ls_poact-tax_code = ls_ekkn-mwskz.
APPEND ls_poact TO it_poact.
ENDIF.
*Parameter: POACCOUNTX
ls_poactx-po_item = 'X' .
ls_poactx-serial_no = sy-tabix .
ls_poactx-quantity = 'X' .
ls_poactx-gl_account = 'X' .
ls_poactx-costcenter = 'X' .
ls_poactx-co_area = 'X' .
ls_poactx-tax_code = 'X' .
APPEND ls_poactx TO it_poactx.
*Parameter: POCOND
ls_cond-itm_number = ls_ekpo-ebelp.
ls_cond-cond_st_no = '001' .
ls_cond-cond_type = 'PB00' .
ls_cond-cond_value = '79.900000000' .
ls_cond-currency = ls_ekko-waers.
ls_cond-currency_iso = 'USD'.
ls_cond-cond_unit = 'KG' .
ls_cond-cond_p_unt = '1' .
ls_cond-change_id = 'U' .
APPEND ls_cond TO it_cond.
*Parameter: POCONDX
ls_condx-itm_number = ls_ekpo-ebelp.
ls_condx-cond_st_no = '000' .
ls_condx-itm_numberx = 'X' .
ls_condx-cond_type = 'X' .
ls_condx-cond_value = 'X' .
ls_condx-currency = 'X' .
ls_condx-change_id = 'X' .
APPEND ls_condx TO it_condx.
*Parameter: POPARTNER,
ls_popart-partnerdesc = 'OA' .
ls_popart-langu = 'EN' .
ls_popart-buspartno = '0000001100' .
ls_popart-partnerdesc = 'GS' .
ls_popart-langu = 'EN' .
ls_popart-buspartno = '0000001200' .
ls_popart-partnerdesc = 'IP' .
ls_popart-langu = 'EN' .
ls_popart-buspartno = '0000001000'.
APPEND ls_popart TO it_popart.
Address data
READ TABLE lt_adrc INTO ls_adrc WITH KEY addrnumber = ls_ekko-adrnr.
IF sy-subrc = 0.
st_adrc-addr_no = ls_adrc-addrnumber.
st_adrc-name = ls_adrc-name1.
st_adrc-street = ls_adrc-street.
st_adrc-district = ls_adrc-city2.
st_adrc-postl_cod1 = ls_adrc-post_code1.
st_adrc-city = ls_adrc-city1.
st_adrc-country = ls_adrc-country.
st_adrc-region = ls_adrc-region.
APPEND st_adrc TO it_adrc.
ENDIF.
AT END OF ebeln.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = ls_head
poheaderx = ls_headx
POADDRVENDOR =
TESTRUN =
MEMORY_UNCOMPLETE =
MEMORY_COMPLETE =
POEXPIMPHEADER =
POEXPIMPHEADERX =
VERSIONS =
NO_MESSAGING =
NO_MESSAGE_REQ =
NO_AUTHORITY =
NO_PRICE_FROM_PO =
IMPORTING
EXPPURCHASEORDER = w_purchaseorder
EXPHEADER =
EXPPOEXPIMPHEADER =
TABLES
return = ret2
poitem = it_item
poitemx = it_itemx
poaddrdelivery = it_adrc
poschedule = it_sch
poschedulex = it_schx
poaccount = it_poact
POACCOUNTPROFITSEGMENT =
poaccountx = it_poactx
POCONDHEADER =
POCONDHEADERX =
pocond = it_cond
pocondx = it_condx
POLIMITS =
POCONTRACTLIMITS =
POSERVICES =
POSRVACCESSVALUES =
POSERVICESTEXT =
EXTENSIONIN =
EXTENSIONOUT =
POEXPIMPITEM =
POEXPIMPITEMX =
POTEXTHEADER =
POTEXTITEM =
ALLVERSIONS =
popartner = it_popart
POCOMPONENTS =
POCOMPONENTSX =
POSHIPPING =
POSHIPPINGX =
POSHIPPINGEXP =
if w_purchaseorder is not initial.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
LOOP AT ret2 WHERE type = 'S'.
lt_success_po-ebeln = ret2-message_v2.
lt_success_po-type = ret2-type.
lt_success_po-message = ret2-message.
append lt_success_po.
clear : lt_success_po.
ENDLOOP.
else.
append lt_ekko to lt_ekko_error.
append it_temp_ekpo to lt_ekpo_error.
append ls_eket to lt_eket_error.
append ls_adrc to lt_adrc_error.
append ls_ekkn to lt_ekkn_error.
*loop at ret2 where type = 'E'.
**move-corresponding lt_ekko to lt_error_po.
**move-corresponding ls_ekpo to lt_error_po.
**move ret2-type to lt_error_po-type.
**move ret2-message to lt_error_po-message.
*append
**lt_error_po.
**clear :
**lt_error_po.
endloop.
endif.
CLEAR : ls_ekko,
st_ekko,
ls_ekpo,
st_ekpo,
ls_ekkn,
ls_ekbe,
ls_eket.
ENDAT.
ENDLOOP.
ENDFUNCTION.
Message was edited by:
ruban RYou must get all the messages into
RET2
table.
You need to fill your ZRFC's RETURN table with the data from RET2 after the FM 'BAPI_PO_CREATE1' call. Because your BAPI is calling mulitple times and henceforth your RET2 is being refreshed and contains the last executed BAPI's return message.
So,
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
EXCEPITON
LOOP AT RET2.
MOVE-CORRESPONDING RET2 TO IT_RETRUN. " << This is the table which you need to pass back to ZRFC
APPEND IT_RETURN.
ENDLOOP.
Regards,
Naimesh Patel -
Doubt in BAPI - BAPI_TRANSACTION_COMMIT
Hi Gurus,
I am posting material from customer storage palce to activate storage location through the follwo\ing BAPI-
BAPI_TRANSACTION_COMMIT.
in that i got error as follow
Material 30000004 not maintained in plant SUND
Material 30000005 not maintained in plant SUND
Material 30000006 not maintained in plant SUND
Material 30000007not maintained in plant SUND
Material 30000008 not maintained in plant SUND
BUt if i post through MIGO trasaction directly means, no errors occur.
only through BAPI the above error occurs.
Help me to Solve this problem.
Thank in Advance.
Regards,
Bhuvana.Hi,
Sit with your functional consultant .May be the plant parameters have been maintained for your plant
under Inventory management and Physical inventory If not pl maintain the same in SPRO.
Regards
Kiran Sure
Maybe you are looking for
-
Hi experts please help me here back order calculation is 10 4000-36 = 3964 10 3964-276= 3688 10 3688-700= 2988
-
Where is the network memory object?
Hello, I have a performance problem. I wrote a logical network in the spatial database with around 120.000 links and 100.000 nodes. I can read the network through SDO_NET_MEM PL/SQL but I cant read it through the Java API. I get an OutofMemory error.
-
I have OS Lion and Angry Birds on my MacBook Pro. Everything is up to date. But everything I open Angry Birds it pops up a window that says "The Application quit" Then it asked restore windows or not to restore windows. Either option I choose doe
-
Lightroom Issues! An error occurred when attempting to change modules.
Hello, I am having issues with Opening Lightroom and everytime it opens this is the error I get. I downloaded PS and other photo software and they work. I have installed all versions 4.2 4.3 4.4 and even tried the new LR5 beta. All get the same error
-
Use BEx query results from a FM in a Transformation to Infocube
I am trying to use the Function Module RRW3_GET_QUERY_VIEW_DATA to execute a query and read the results from E_CELL_DATA. The issue i am having is that i get the keyfigure values but not the characteristics values. Is their a new FM that i could use