Error in BAPI BAPI_NETWORK_COMP_ADD
Hi all,
I'm trying to use the BAPI BAPI_NETWORK_COMP_ADD to create material components, soon after to create the network and activities.
I am filling the NUMBER with the value of temporary network created by bapi BAPI_BUS2002_CREATE.
When I run the bapi BAPI BAPI_NETWORK_COMP_ADD, I get the message 00 058 saying that this network does not exist in table AUFK.
Someone had this problem and know what is the solution?
Thank's very much,
Hi,
If you solve your problem, please let me know.
Here we have the same problem, we did like the expert said, executing the bapi after the commit but when we tried to execute the BAPI BAPI_NETWORK_COMP_ADD, is showing error Activity not exist...
Thanks
RP
Similar Messages
-
Bapi BAPI_NETWORK_COMP_ADD
Hi,
I am using bapi BAPI_NETWORK_COMP_ADD to post(Confirm) the network activity data. For the multiple records the very first record is being posted by the bapi and for the rest records error message is being shown as ' Order (network no.) is already being processed by USERNAME'.
To rectify the error 'wait up to sec seconds' in CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' is being used.
After this the result is getting absolutely fine.
but i dont want to use the WAIT statement as the data volume is large.
Kindly reply for the same.
I have already tried with the bapi CALL FUNCTION 'BAPI_PS_INITIALIZATION' and CO_ZF_DATA_RESET_COMPLETE writng in begining, But diidnt get the expected result.
Thanks in advance.Hi Prasanjeet,
Thanks for your prompt response.
In the starting phase of the developemenmt i was not using 'wait up to sec seconds'. I was calling 'BAPI_NETWORK_COMP_ADD' and after this 'BAPI_TRANSACTION_COMMIT'(In this commit bapi i was not passing any parameter). Everything was fine but the result i was getting was the error message from the second record onwards.
For the first record bapi is posting data successfully, but for the second record onwards it was showing error message
'' Order (network no.value) is already being processed by USERNAME'.
To rectify this error i am using 'wait up to sec seconds' afted calling bapi BAPI_TRANSACTION_COMMIT. Now the result is what i
wanted. But the SEC value is 1 sec. As my data volume is huge, i am bound to use some other alternative.
Kindly reply for the same with your valuable suggesion.
Thanks. -
Error during BAPI while uploading Material data through MM01
Hi all,
i am facing one problem when uploading Material data thorough BAPI in MM01.i am attaching the code below and the error given.
but in the debugger all the value is being stored.
REPORT ZFINISHED_MAT.
Data: Begin of legacy_data occurs 0,
MATNR LIKE MARA-MATNR,
MBRSH LIKE MARA-MBRSH, "Industry Sector
MTART LIKE MARA-MTART, "Matl Type
WERKS LIKE MARD-WERKS, "Plant
LGORT LIKE MARD-LGORT, "Storage location
VKORG LIKE MVKE-VKORG,
VTWEG LIKE MVKE-VTWEG,
MAKTX LIKE MAKT-MAKTX, "Matl Desc.
MEINS LIKE MARA-MEINS, "Base UOM
MATKL LIKE MARA-MATKL, "Matl.Grp
* BISMT LIKE MARA-BISMT,
SPART LIKE MARA-SPART, "Division
* BRGEW LIKE MARA-BRGEW, "Gross weight
GROES LIKE MARA-GROES,
FERTH LIKE MARA-FERTH,
ZEINR LIKE MARA-ZEINR,
TAXKM1 LIKE MLAN-TAXM1,
TAXKM2 LIKE MLAN-TAXM2,
TAXKM3 LIKE MLAN-TAXM3,
TAXKM4 LIKE MLAN-TAXM4,
KTGRM LIKE MVKE-KTGRM,
* GEWEI LIKE MARA-GEWEI, "Weight unit
* NTGEW LIKE MARA-NTGEW, "Net weight
* KLART LIKE RMCLF-KLART,
MTVFP LIKE MARC-MTVFP, "Availibility Check
* XGCHP LIKE MARA-XGCHP,
XCHPF LIKE MARA-XCHPF, "Batch Management
TRAGR LIKE MARA-TRAGR,
LADGR TYPE MARC-LADGR,
VPRSV LIKE MBEW-VPRSV, "Price Control
VERPR LIKE MBEW-VERPR,
* SPRAS LIKE MAKT-SPRAS,
END OF LEGACY_DATA.
DATA: BEGIN OF IT_MAKT OCCURS 0.
INCLUDE STRUCTURE BAPI_MAKT.
DATA: END OF IT_MAKT.
*--- BAPI structures
DATA: BAPI_HEAD LIKE BAPIMATHEAD, " Header Segment with Control Information
BAPI_MAKT LIKE BAPI_MAKT, " Material Description
BAPI_MARA1 LIKE BAPI_MARA, " Client Data
BAPI_MARAX LIKE BAPI_MARAX, " Checkbox Structure for BAPI_MARA
BAPI_MARD1 LIKE BAPI_MARD,
BAPI_MARDX1 LIKE BAPI_MARDX, " Checkbox Structure for BAPI_MARD
BAPI_MARC1 LIKE BAPI_MARC, " Plant View
BAPI_MARCX LIKE BAPI_MARCX, " Checkbox Structure for BAPI_MARC
BAPI_MVKE1 LIKE BAPI_MVKE,
BAPI_MVKEX1 LIKE BAPI_MVKEX, " Checkbox Structure for BAPI_MVKE
BAPI_MLAN1 LIKE BAPI_MLAN,
BAPI_MLANX1 LIKE bapi_mlan1, " Checkbox Structure for BAPI_MLAN
BAPI_MBEW1 LIKE BAPI_MBEW, " Accounting View
BAPI_MBEWX LIKE BAPI_MBEWX, " Checkbox Structure for BAPI_MBEW
BAPI_RETURN LIKE BAPIRET2. " Return Parameter
* $PARAMETERS DECLARATION$
SELECTION-SCREEN BEGIN OF BLOCK B11
WITH FRAME TITLE TEXT-001.
PARAMETERS: P_FILE LIKE RLGRAP-FILENAME. " DEFAULT 'C:\TEST1.XLS'.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN ULINE.
SELECTION-SCREEN END OF BLOCK B11 .
* $DATA DECLARATION$
*DATA : BDC_DATA LIKE STANDARD TABLE OF BDCDATA WITH HEADER LINE.
DATA : IT_EXCEL TYPE STANDARD TABLE OF ALSMEX_TABLINE INITIAL SIZE 0 WITH HEADER LINE,
IT_EXCEL_DUMMY TYPE ALSMEX_TABLINE.
DATA : MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA : L_MSTRING(480).
DATA :L_SUBRC LIKE SY-SUBRC.
DATA: V_FILE TYPE STRING.
* $AT-SELECTON SCREEN DECLARATION$
AT SELECTION-SCREEN ON P_FILE.
IF P_FILE IS INITIAL.
MESSAGE E398(00) WITH 'FILE NAME NEEDS TO BE SPECIFIED'.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
* DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'P_FILE'
IMPORTING
FILE_NAME = P_FILE
start-of-selection.
perform data_fetch_to_xls.
perform insertion.
*& Form data_fetch_to_xls
* text
* --> p1 text
* <-- p2 text
FORM data_fetch_to_xls .
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_FILE
I_BEGIN_COL = 1
I_BEGIN_ROW = 2
I_END_COL = 25
I_END_ROW = 2
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.
WRITE: /'ERROR UPLOADING XLS FILE FROM PRESENTATION SERVER !' ,
/'RETURN CODE : ', SY-SUBRC.
ELSE.
*************NOW FILL DATA FROM EXCEL INTO FINAL LEGACY DATA ITAB----LEGACY_DATA***************
IF NOT IT_EXCEL[] IS INITIAL.
CLEAR LEGACY_DATA.
REFRESH LEGACY_DATA[].
LOOP AT IT_EXCEL.
IT_EXCEL_DUMMY = IT_EXCEL.
AT NEW COL.
CASE IT_EXCEL_DUMMY-COL.
WHEN 1.
LEGACY_DATA-MATNR = IT_EXCEL_DUMMY-VALUE(18).
WHEN 2.
LEGACY_DATA-MBRSH = IT_EXCEL_DUMMY-VALUE(1).
WHEN 3.
LEGACY_DATA-MTART = IT_EXCEL_DUMMY-VALUE(4).
WHEN 4.
LEGACY_DATA-WERKS = IT_EXCEL_DUMMY-VALUE(4).
WHEN 5.
LEGACY_DATA-LGORT = IT_EXCEL_DUMMY-VALUE(4).
WHEN 6.
LEGACY_DATA-VKORG = IT_EXCEL_DUMMY-VALUE(4).
WHEN 7.
LEGACY_DATA-VTWEG = IT_EXCEL_DUMMY-VALUE(2).
WHEN 8.
LEGACY_DATA-MAKTX = IT_EXCEL_DUMMY-VALUE(40).
WHEN 9.
LEGACY_DATA-MEINS = IT_EXCEL_DUMMY-VALUE(3).
WHEN 10.
LEGACY_DATA-MATKL = IT_EXCEL_DUMMY-VALUE(9).
WHEN 11.
LEGACY_DATA-SPART = IT_EXCEL_DUMMY-VALUE(2).
WHEN 12.
LEGACY_DATA-GROES = IT_EXCEL_DUMMY-VALUE(32).
WHEN 13.
LEGACY_DATA-FERTH = IT_EXCEL_DUMMY-VALUE(18).
WHEN 14.
LEGACY_DATA-ZEINR = IT_EXCEL_DUMMY-VALUE(22).
WHEN 15.
LEGACY_DATA-TAXKM1 = IT_EXCEL_DUMMY-VALUE(1).
WHEN 16.
LEGACY_DATA-TAXKM2 = IT_EXCEL_DUMMY-VALUE(1).
WHEN 17.
LEGACY_DATA-TAXKM3 = IT_EXCEL_DUMMY-VALUE(1).
WHEN 18.
LEGACY_DATA-TAXKM4 = IT_EXCEL_DUMMY-VALUE(1).
WHEN 19.
LEGACY_DATA-KTGRM = IT_EXCEL_DUMMY-VALUE(2).
WHEN 20.
LEGACY_DATA-MTVFP = IT_EXCEL_DUMMY-VALUE(2).
WHEN 21.
LEGACY_DATA-XCHPF = IT_EXCEL_DUMMY-VALUE(1).
WHEN 22.
LEGACY_DATA-TRAGR = IT_EXCEL_DUMMY-VALUE(4).
WHEN 23.
LEGACY_DATA-LADGR = IT_EXCEL_DUMMY-VALUE(4).
WHEN 24.
LEGACY_DATA-VPRSV = IT_EXCEL_DUMMY-VALUE(1).
WHEN 25.
LEGACY_DATA-VERPR = IT_EXCEL_DUMMY-VALUE(14).
APPEND LEGACY_DATA.
CLEAR LEGACY_DATA.
ENDCASE.
ENDAT.
AT END OF ROW.
ENDAT.
ENDLOOP.
ENDIF.
ENDIF.
ENDFORM. " data_fetch_to_xls
*& Form insertion
* text
* --> p1 text
* <-- p2 text
FORM insertion .
LOOP AT legacy_data.
* Header
BAPI_HEAD-MATERIAL = legacy_data-MATNR.
BAPI_HEAD-IND_SECTOR = legacy_data-MBRSH.
BAPI_HEAD-MATL_TYPE = legacy_data-MTART.
BAPI_HEAD-BASIC_VIEW = 'X'.
BAPI_HEAD-SALES_VIEW = 'X'.
BAPI_HEAD-STORAGE_VIEW = 'X'.
*BAPI_HEAD-PURCHASE_VIEW = 'X'.
BAPI_HEAD-ACCOUNT_VIEW = 'X'.
* Material Description
REFRESH IT_MAKT.
*IT_MAKT-LANGU = legacy_data-SPRAS.
IT_MAKT-MATL_DESC = legacy_data-MAKTX.
APPEND IT_MAKT.
BAPI_MARD1-PLANT = legacy_data-WERKS.
BAPI_MARD1-STGE_LOC = legacy_data-LGORT.
BAPI_MARDX1-PLANT = legacy_data-WERKS.
BAPI_MARDX1-STGE_LOC = legacy_data-LGORT.
** Client Data - Basic
BAPI_MARA1-MATL_GROUP = legacy_data-MATKL.
*bapi_mara1-OLD_MAT_NO = legacy_data-bismt.
BAPI_MARA1-BASE_UOM = legacy_data-MEINS.
BAPI_MARA1-PROD_MEMO = LEGACY_DATA-FERTH.
BAPI_MARA1-SIZE_DIM = LEGACY_DATA-GROES.
BAPI_MARA1-DOCUMENT = LEGACY_DATA-ZEINR.
BAPI_MARA1-BATCH_MGMT = LEGACY_DATA-XCHPF.
*BAPI_MARA1-UNIT_OF_WT = legacy_data-GEWEI.
BAPI_MARA1-TRANS_GRP = legacy_data-TRAGR.
BAPI_MARA1-DIVISION = legacy_data-SPART.
BAPI_MARAX-MATL_GROUP = 'X'.
*BAPI_MARAX-OLD_MAT_NO = 'X'.
BAPI_MARAX-BASE_UOM = 'X'.
BAPI_MARAX-PROD_MEMO = 'X'.
BAPI_MARAX-SIZE_DIM = 'X'.
BAPI_MARAX-DOCUMENT = 'X'.
BAPI_MARAX-BATCH_MGMT = 'X'.
*BAPI_MARAX-UNIT_OF_WT = 'X'.
BAPI_MARAX-TRANS_GRP = 'X'.
BAPI_MARAX-DIVISION = 'X'.
*SALES
BAPI_MVKE1-SALES_ORG = legacy_data-VKORG.
BAPI_MVKE1-DISTR_CHAN = legacy_data-VTWEG.
*BAPI_MVKE1-DELYG_PLNT = legacy_data-DWERK.
BAPI_MVKE1-ACCT_ASSGT = legacy_data-KTGRM.
BAPI_MVKEX1-SALES_ORG = legacy_data-VKORG.
BAPI_MVKEX1-DISTR_CHAN = legacy_data-VTWEG.
*BAPI_MVKEX1-DELYG_PLNT = 'X'.
BAPI_MVKEX1-ACCT_ASSGT = 'X'.
** Plant - Purchasing
BAPI_MARC1-PLANT = legacy_data-WERKS.
BAPI_MARC1-LOADINGGRP = legacy_data-LADGR.
BAPI_MARC1-AVAILCHECK = legacy_data-MTVFP.
*BAPI_MARC1-MRP_GROUP = legacy_data-disgr.
BAPI_MARCX-PLANT = legacy_data-WERKS.
BAPI_MARCX-LOADINGGRP = 'X'.
BAPI_MARCX-AVAILCHECK = 'X'.
*BAPI_MARCX-MRP_GROUP = 'X'.
* Accounting
BAPI_MBEW1-VAL_AREA = legacy_data-WERKS.
BAPI_MBEW1-PRICE_CTRL = legacy_data-VPRSV.
BAPI_MBEW1-STD_PRICE = legacy_data-VERPR.
*BAPI_MBEW1-VAL_CLASS = legacy_data-BKLAS.
*BAPI_MBEW1-STD_PRICE = legacy_data-STPRS.
*BAPI_MBEW1-PRICE_UNIT = legacy_data-PEINH.
BAPI_MBEWX-VAL_AREA = legacy_data-WERKS.
BAPI_MBEWX-PRICE_CTRL = 'X'.
BAPI_MBEWX-STD_PRICE = 'X'.
*BAPI_MBEWX-VAL_CLASS = 'X'.
* TAX JURISDICTION CODE
BAPI_MLAN1-TAXCLASS_1 = LEGACY_DATA-TAXKM1.
BAPI_MLAN1-TAXCLASS_2 = LEGACY_DATA-TAXKM2.
BAPI_MLAN1-TAXCLASS_3 = LEGACY_DATA-TAXKM3.
BAPI_MLAN1-TAXCLASS_4 = LEGACY_DATA-TAXKM4.
BAPI_MLAN1-TAXCLASS_1 = 'X'.
BAPI_MLAN1-TAXCLASS_2 = 'X'.
BAPI_MLAN1-TAXCLASS_3 = 'X'.
BAPI_MLAN1-TAXCLASS_4 = 'X'.
*--- BAPI to create material
call function 'BAPI_MATERIAL_SAVEDATA'
exporting
HEADDATA = BAPI_HEAD
CLIENTDATA = BAPI_MARA1
CLIENTDATAX = BAPI_MARAX
*PLANTDATA = BAPI_MARC1
*PLANTDATAX = BAPI_MARCX
* FORECASTPARAMETERS =
* FORECASTPARAMETERSX =
* PLANNINGDATA =
* PLANNINGDATAX =
* STORAGELOCATIONDATA =
* STORAGELOCATIONDATAX =
VALUATIONDATA = BAPI_MBEW1
VALUATIONDATAX = BAPI_MBEWX
* WAREHOUSENUMBERDATA =
* WAREHOUSENUMBERDATAX =
* SALESDATA = BAPI_MVKE1
* SALESDATAX = BAPI_MVKEX
* STORAGETYPEDATA =
* STORAGETYPEDATAX =
IMPORTING
RETURN = BAPI_RETURN
TABLES
MATERIALDESCRIPTION = IT_MAKT
* UNITSOFMEASURE =
* UNITSOFMEASUREX =
* INTERNATIONALARTNOS =
* MATERIALLONGTEXT =
* TAXCLASSIFICATIONS =
* RETURNMESSAGES =
* PRTDATA =
* PRTDATAX =
* EXTENSIONIN =
* EXTENSIONINX =
IF BAPI_RETURN-TYPE = 'E'.
WRITE:/ 'Error:' ,BAPI_RETURN-MESSAGE ,'for material:' ,legacy_data-maTNR.
ELSEIF BAPI_RETURN-TYPE = 'S'.
WRITE: 'Successfully created material' ,legacy_data-maTNR.
ENDIF.
ENDLOOP.
ENDFORM. " insertion
The error: The field MARC-MTVFP/BAPI_MARC-AVAILCHECK is defined as a required field; it does not contain an entr
suggestion will be vry helpful,
Kind Regards,
Edited by: Prasenjit Sengupta on Nov 16, 2009 9:11 AMHi Prasenjit,
Did you get any solution for this as I am getting same error from BAPI to update MRP controller in MARC table.
Regards,
Suruchi -
How can we find error in BAPI Creation?
Can any one help out in How to findout Errors in BAPI Creation and Usage?
HI,
you can findout error by declaring BAPI RETURN type structure .
for ex:"
DATA : return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
EXPORTING
sales_header_in = header
sales_header_inx = headerx
IMPORTING
salesdocument_ex = v_vbeln
TABLES
return = return
sales_items_in = item
sales_items_inx = itemx
sales_partners = partner
sales_conditions_in = i_conditions.
LOOP AT return WHERE type = 'E' OR type = 'A'.
EXIT.
ENDLOOP.
if helpful reward points. -
Hi frnds i m unable to know the answer for the q?
How do u handle errors in BAPI.
i.e i m using standard BAPI po creation if some errors occurs then how to handle those errors
how can we know the errors.
plz reply me back frnds...
thnks...Hi Sanjay,
Call BAPI like this :
data: it_retrun typa table of bapireturn.
CALL FUNCTION 'BAPI_PO_CREATE'
EXPORTING
po_header =
PO_HEADER_ADD_DATA =
HEADER_ADD_DATA_RELEVANT =
PO_ADDRESS =
SKIP_ITEMS_WITH_ERROR = 'X'
ITEM_ADD_DATA_RELEVANT =
HEADER_TECH_FIELDS =
IMPORTING
PURCHASEORDER =
tables
po_items =
PO_ITEM_ADD_DATA =
po_item_schedules =
PO_ITEM_ACCOUNT_ASSIGNMENT =
PO_ITEM_TEXT =
RETURN = it_return
PO_LIMITS =
PO_CONTRACT_LIMITS =
PO_SERVICES =
PO_SRV_ACCASS_VALUES =
PO_SERVICES_TEXT =
PO_BUSINESS_PARTNER =
EXTENSIONIN =
POADDRDELIVERY =
IT_RETURN will contains all message returned from BAPI. For error message you can read IT_RETURN table where type = 'E'.
Thanks
Swagatika -
Hi experts,
I am new to BAPI.
Can anyone tell me " How to catch error in BAPI ".
Thanks,
ShipraHi,
In the BAPI return internal table you have to check for the Error or ABort message types..
Ex..
Check for error or abort messages
LOOP AT T_RETURN WHERE TYPE = 'E' OR TYPE = 'A'.
EXIT.
ENDLOOP.
IF SY-SUBRC = 0.
WRITE: / 'Exception occured'.
ELSE.
WRITE: / 'Update is successful'.
ENDIF.
Thanks
Naren -
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 while creating incoming invoice
Hi Experts,
Im creating incoming invoice by using the BAPI, 'BAPI_INCOMINGINVOICE_CREATE'.
when im going to posting my invoice it is showing the error like 'EDI: Error in customizing for differential invoicing'.it is a urgent requirement and need to solve this ASAP.Pls help me out with this error
Im passing following parameters to BAPI:
wa_header-invoice_ind = 'X'.
wa_header-doc_date = sy-datum. "Enter the document date
wa_header-pstng_date = sy-datum . "Enter the posting date
* wa_header-ref_doc_no = '5000008590'.
wa_header-comp_code = '1000'.
*wa_header-gross_amount = '50.11'. "Enter the gross amount(aft. tax) for the invoice
*wa_header-calc_tax_ind = 'X'.
wa_header-currency = 'INR'.
wa_header-INV_TRAN = 'X'.
wa_header-SIMULATION = 'X'.
wa_item-invoice_doc_item = '000001'.
wa_item-po_number = '3700000557'. "Enter the PO number
wa_item-po_item = '00010'. "Enter the PO item number
* wa_item-ref_doc = '5000008590'. "Enter the GR number
* wa_item-ref_doc_year = '2014'. "Enter the GR fiscal year
* wa_item-ref_doc_it = '0001'. "Enter the GR item number
* wa_item-tax_code = 'V0'. "Enter the tax code applicable
wa_item-item_amount = '50.60'. "Enter the item amount
* wa_item-quantity = '2380'. "Enter the invoice quantity
* wa_item-po_unit = 'EA'. "Enter the UoM
APPEND wa_item TO it_item.
CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE'
EXPORTING
headerdata = wa_header
* * ADDRESSDATA =
IMPORTING
invoicedocnumber = g_invno
fiscalyear = g_fyear
TABLES
itemdata = it_item
* * ACCOUNTINGDATA =
* * GLACCOUNTDATA =
* * MATERIALDATA =
* * TAXDATA =
* * WITHTAXDATA =
* * VENDORITEMSPLITDATA =
return = it_ret
* * EXTENSIONIN =
IF g_invno IS NOT INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
* * IMPORTING
* * RETURN =Thanks every one for your valuable solutions.
Issue is Solved by unchecking the flag.
wa_header-INV_TRAN = 'X'.
Thanks & Regards,
Ramjee. -
Error in BAPI RETURN for Service Contract
Hi,
I get an error in the BAPI Return for the Uploading the Service Contracts by LSMW. The Error Message is E BS No status object is available for &.Also want to know can we upload multiple line of header text for a Contract by this BAPI. If so then how would I do this , as the BAPI structure BAPISDTEXT has textline upto 132 characters. And I am take only one file in LSMW where the header & details come alongwith text. Or could also tell me the file structure of for the data upload. The legacy system sends multiple text in the header for a Contract.For Eg.
Header1 Detail1 Text1
HEader1 Detail2 Text2
Header1 Detail3 Text3
So I would need this text1TEXT2text3 in the Header Text of the Contracts. Or do I need the change the file structure. Many thanks for your time and help.Thanks Nablan, I could do that for multiple header coming in file. But I have a question for you on BAdI ALM_ME_006_GOODSMVT. I have implemented this BAdI , and this BAdI is called by a function Module ALM_MEREP_006_CREATE. When I test this FM giving the Material , Orderid and Movement type entries, this BAdI is triggered when giving a breakpoint. I've given this code for changing the movement type to 961. Cause the stanadrd scenario does not maintain Movement type 961 in Mobile Asset Management. The Movement type 961 for unplanned Materials comes to SAP and changes to 261 as maiantained by TCOKO table. To bypass this & retain the movement type 961 in SAP I'm using this BAdI. Currently this is what I'm doing and am stuck in the method interface how do I call the method.
method IF_EX_ALM_ME_006_GOODSMVT~CREATE .
break-point.
*DATA : i_ce_goodsmovement TYPE REFERENCE
ALM_ME_CUSTOMER_ENHANCEMENT.
DATA : lr_badi_goods_movement TYPE REF TO if_ex_alm_me_006_goodsmvt.
DATA : ls_user_data TYPE ALM_ME_USER_DATA-USERID.
*DATA : goods_movement TYPE ALM_ME_MATERIAL_MOVEMENT.
CALL METHOD lr_badi_goods_movement->create
EXPORTING
ce_goodsmovement = ce_goodsmovement
IMPORTING
user_data = ls_user_data
custom_user_data = ls_ce_user_data
goods_movement = goods_movement
changing
return = return[].
CALL FUNCTION 'ALM_ME_COMMIT_OR_ROLLBACK'
TABLES
return = return.
endmethod.
Please help me to get the data in this method. How do I call this. -
Error in bapi while changing and add items in transparant table
data : t_poitems type standard table of bapimepoitem,
t_poitemx type standard table of bapimepoitemx,
w_poitems type bapimepoitem,
w_poitemx type bapimepoitemx,
t_return type standard table of bapiret2,
w_return type bapiret2.
loop at t_modify_detail into w_modify_detail-ebeln. * populating changing data
*--&modifying fields
w_poitems-po_item = w_modify_detail-ebelp.
w_poitems-material = w_modify_detail-matnr.
append w_poitems to t_poitems.
w_poitemx-po_item = w_modify_detail-ebelp.
w_poitemx-po_itemx = 'X'.
w_poitems-material = 'X'.
append w_poitemx to t_poitemx.
endloop.
call function 'BAPI_PO_CHANGE'
exporting
purchaseorder = w_header-ebeln
POHEADER =
POHEADERX =
POADDRV
tables
return = t_return
poitem = t_poitems
poitemx = t_poitemx
POADDRDELIVERY =
call function 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT
ERROR IS:
giving error : cl_po_item_handle_mm.................cp
function in which error showing: mepo docitem_getCheck this sample code
http://www.sap-img.com/abap/sample-abap-code-on-bapi-po-change.htm
BAPI PO CHANGE with MENGE
Hope it helps to identify your requirement and fix accordingly.
ashish -
Error in BAPI call using webdynpro
hi ,
am new to this webdynpro abap..so i was trying out sample tutorials from sdn..when i trigger a button click event in order to call bapi function..the error has be raisen..so give me a solution for this..kindly chk out this link..i was trying for this application..i did exactly as mentioned in this tutorial..
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/00545e6d-0679-2910-acab-8073ce9a1659?rid=/webcontent/uuid/fed073e5-0901-0010-4eb4-c9882aac7b11 [original link is broken]
in this second tutorial..bapi usage
error :
The following error text was processed in the system NSP : RFC Exception COMMUNICATION_FAILURE with Message RFC destination bapi Fm does not exist. Occurred
The error occurred on the application server w2gzmbks01_NSP_00 and in the work process 0 .
The termination type was: RABAX_STATEHi Anuj,
I ve a similar kind of issue at my end. I am trying to call BAPI_DOCUMENT_CREATE2 from a Webdynpro application(A2C/000) and using commit work. A new doc_number is very much created, even commit work returns no error.
But surprisingly i dont see this new record in the same destination (A2C/000).
this BAPI is already remote enabled (SE37) -
Error in BAPI - 'BAPI_ACC_GL_POSTING_REV_POST'
Hi,
I am using the BAPI 'BAPI_ACC_GL_POSTING_REV_POST' to reverse a document.
I am getting the following error.What could be the possible reason?
E RW 609
Error in document: BKPFF 100016ZK012007 100
E RW 630
Reversal in component Financial Accounting not possible
E F5A 009
Reversal not possible, accounting document for the ref. does not exist
<b>Here is the code which I have written:</b>
Begin to populate document header.
*obj_key contains new document no.
CONCATENATE v_docno 'ZK01' sy-datlo(4) INTO doc_header-obj_key.
doc_header-obj_type = 'BKPFF'.
*obj_key_r contains document no. needed to reverse
CONCATENATE p_belnr 'ZK01' sy-datlo(4) INTO doc_header-obj_key_r.
doc_header-obj_sys = '100'.
doc_header-comp_code = 'ZK01'.
doc_header-reason_rev = '01'.
doc_header-pstng_date = '20061025'.
doc_header-fis_period = '07'.
CALL FUNCTION 'BAPI_ACC_GL_POSTING_REV_POST'
EXPORTING
reversal = doc_header
IMPORTING
obj_type = doc_header-obj_type
obj_key = doc_header-obj_key
obj_sys = doc_header-obj_sys
TABLES
return = return.
Regards,
SandyHi,
Please refer this.
http://ifr.sap.com/catalog/query.asp?namespace=urn:sap-com:ifr:FI:46C&type=bapi&name=AcctngGLPosting.Reverse¶m=Reversal
Cheers
Vinod -
Error in bapi sales order creation
hi..
I m creating sales order using bapi fm, It was working fine, but all of a sudden it is giving error 'NO OBJECT STATUS AVAILABLE FOR SDI 0.' and Sales order is not gettign created. Any idea why the problem occurs?Hi Cynthia,
This is probably caused by a COMMIT WORK in a user exit during sales order processing. This COMMIT WORK triggers FM BUFFER_STATUS_REFRESH which in turn causes this problem.
You can easily find out by putting a break-point in this FM and then take a look in the call-stack to find out where the commit work occurred.
Regards.
John. -
Error in Bapi : Change Purchase Requisition
Dear All,
We have requirement where we need to update the Purchase Requisition Quanity.
For this purpose, I am using Bapi '/AFS/CHANGE_AFS_PR_DATA'.
In this I want to change Sheduled Qty. (AFS Grid Qty.), but I m getting error like
"Line item 0010 : different quantities in item and schedule line". (Sy-subrc = 3)
Can any one help me out with this.
Thanks in advance.
Regards ,
Vishal.Hi,
Refer:
* BAPI to change the PR details
CALL FUNCTION 'BAPI_REQUISITION_CHANGE'
EXPORTING
number = v_banfn "<--PR Number
TABLES
requisition_items_old = it_old_detail "<--pass in old PR details
requisition_items_new = it_new_detail "<--pass in new PR details
return = it_return_change. "<--return table
* "read for error message while changing details for PR
READ TABLE it_return_change INTO wa_return_change WITH KEY type = 'E'.
IF sy-subrc = 0.
"check for ERROR
ENDIF.
Hope this helps you.
Regards,
Tarun -
Error in bapi BAPI_PR_CREATE while uploading
HI Gurus,
I have program for uploading PR with BAPI. BAPI_PR_CREATE.
while uploading without account assignment category it is working fine.
while enter account assignment category v need to enter sales order no and item no. that is mandatory field for account assignment category..
if using program its showing error.
No instance of object type Purchase Requisition has been created. External reference: # 1
Enter sales order
Sd document XXXXXXX is not in the database or has been archived.
but I tried to create manually it is working fine.
I tried to upload with bapi directly with out z program.
tht time also it showing error
No instance of object type Purchase Requisition has been created. External reference: # 1
Enter sales order
If any one give solution
it is very helpful for me.Hi
Thnaks for the Reply,
in normal scenario it ll upload base on header.
if header change it ll generate automatically requisition no. So in program v used AT END OF pr_type.
so if pr_type is diff it will work.
in my case only one header it will not change. v hav only one pr type.
it should generate based on Item.
If item 10 it should generate new requisition No.
my flat file is ,
pr type - material - pur org - plant - storage loc - qty - traking no - .... pr item
xxx abc pqr 1000 xyz 100 11111 10
xxx abc pqr 1000 xyz 200 11111 20
xxx abc pqr 1000 xyz 300 11111 30
xxx abc pqr 1000 xyz 400 11111 10
xxx abc pqr 1000 xyz 500 11111 20
here header is same.. if pr item 10 it should generate new requisition No, means it should commit before value 10.
so before commit v hav to give the logic if item 10 it should generate for before value.
hope u got my requirement.
Maybe you are looking for
-
I am having trouble with an external hard drive. One of the solutions i was told, was to repair permissions on my Macbook. I did this, and it found a couple permissions errors, and then said permissions repair complete. It had no effect on the extern
-
What's a good printer for Imac, Ipad, and iPhone?
I am looking into buying a printer, but I am not sure what the best printer that'll work well with Apple iMac, iPad, and iPone? Thanks
-
Switching subscription from Windows to Mac
I have a CC subscription and would like to switch it from my Windows computer to my Mac. I made a few searches but I'm having a brain-fart on good search terms and haven't found what I'm looking for. Is there a step-by-step for making this switch?
-
Is there disadvantages to keeping the project files on the same disk as the media? Keeping media on a separate disk means another whole folder structure. I have four disks and am trying to set them up not only for performance but the best organizing
-
Jobs Scheduled But Never Run or EM jobs remain in 'running' status
Hi All, Please I need help on this: I have job scheduled through Oracle Enterprise Manager (OEM) but each time our Windows server is shutdown for patches update the job I scheduled failed and in the status column it shows that the job is still runnin