Create Material Master Data with BAPI
Hi,
I don't know using of BAPI. I want using BAPI_MATERIAL_SAVEDATA bapi for creating material master data for Basic Data1, Basic Data2, Purchasing and MRP views. Does anybody can help me ?
Thank you
Good night
Hi,
Please refer to the documentation below:
BAPI_MATERIAL_SAVEDATA
Short Text
Create and Change Article Master Data
Functionality
You use this method to create new material master data or to change existing material master data. The data on a material can be transferred for each call.
When creating material master data, you must transfer the material number, the material type, and the industry sector to the method. You must also enter a material description and its language.
When changing material master data, you need enter only the material number.
In the header data, you must select at least one view for which data is to be created. Depending on the view selected, you must maintain other required parameters. If you do not enter values for all of the required parameters, the method is ended with an error message.
The corresponding fields in the tables (such as CLIENTDATA) must first be supplied with data by the calling program. An indicator must also be set for each of these fields so that the data is written to the database by the method. This requires the calling program to supply the corresponding field with the indicator in a checkbox table (for example, CLIENTDATAX). Checkbox tables exist for tables that do not contain any language-dependent texts (MAKT, MLTX), International Article Numbers (MEAN), or tax classifications (MLAN). Several data records for a material can be created in these tables.
If a structure contains fields for units of measurement (such as structure CLIENTDATA, field BASE_UOM), language indicators (such as structure MATERIALDESCRIPTION, field LANGU), or country indicators (such as structure TAXCLASSIFICATIONS, field DEPCOUNTRY), there is always a field of the same name with the ending _ISO. This makes it possible to transfer either the internally used SAP code or a standardized ISO code for the units of measurement, language indicators, or country indicators. ISO codes are converted to an SAP code internally for further processing. The ISO code is used only if the SAP code is not transferred. If you use ISO codes, there must be a unique assignment of the ISO code to the SAP code in the following activities in Customizing for Global Parameters:
Check Units of Measurement
Define Countries
If you want to maintain long texts (basic data texts, internal comments, purchase order texts, material memos, or sales texts) or customer-defined fields for a material, some special conditions have to be observed. They are described in the documentation for parameters MATERIALLONGTEXT and EXTENSIONIN.
Parameters
HEADDATA
CLIENTDATA
CLIENTDATAX
PLANTDATA
PLANTDATAX
FORECASTPARAMETERS
FORECASTPARAMETERSX
PLANNINGDATA
PLANNINGDATAX
STORAGELOCATIONDATA
STORAGELOCATIONDATAX
VALUATIONDATA
VALUATIONDATAX
WAREHOUSENUMBERDATA
WAREHOUSENUMBERDATAX
SALESDATA
SALESDATAX
STORAGETYPEDATA
STORAGETYPEDATAX
FLAG_ONLINE
FLAG_CAD_CALL
NO_DEQUEUE
NO_ROLLBACK_WORK
RETURN
MATERIALDESCRIPTION
UNITSOFMEASURE
UNITSOFMEASUREX
INTERNATIONALARTNOS
MATERIALLONGTEXT
TAXCLASSIFICATIONS
RETURNMESSAGES
PRTDATA
PRTDATAX
EXTENSIONIN
EXTENSIONINX
Exceptions
Function Group
1001UEB
Thanks,
Sandeep.
Similar Messages
-
Zprogram to create material master data using bapi
can anyone send me a zprogram which uses a
bapi to create\update material master data .
thanks ,
Amithi,
here below a code sample that will help you
FORM execution .
DATA: is_headdata TYPE bapimathead.
DATA: is_clientdata TYPE bapi_mara.
DATA: is_clientdatax TYPE bapi_marax.
DATA: is_plantdata TYPE bapi_marc.
DATA: is_plantdatax TYPE bapi_marcx.
DATA: is_valuationdata TYPE bapi_mbew.
DATA: is_valuationdatax TYPE bapi_mbewx.
DATA: it_materialdescription TYPE bapi_makt OCCURS 0 WITH HEADER LINE.
DATA : is_storagelocationdata TYPE bapi_mard,
is_storagelocationdatax TYPE bapi_mardx.
*... views
is_headdata-material = mara-matnr.
is_headdata-ind_sector = 'M'.
is_headdata-matl_type = 'ROH'.
is_headdata-basic_view = 'X'.
is_headdata-purchase_view = 'X'.
is_headdata-mrp_view = 'X'.
is_headdata-account_view = 'X'.
is_headdata-cost_view = 'X'.
is_headdata-storage_view = 'X'.
*... constants
is_clientdata-pur_valkey = '3'.
is_clientdatax-pur_valkey = 'X'.
*... Données article générales (de l'écran)
is_clientdata-base_uom = mara-meins.
is_clientdata-matl_group = mara-matkl.
is_clientdata-mfr_no = mara-mfrnr.
is_clientdata-manu_mat = mara-mfrpn.
is_clientdata-pur_status = mara-mstae.
is_clientdata-old_mat_no = mara-bismt.
is_clientdatax-base_uom = 'X'.
is_clientdatax-matl_group = 'X'.
is_clientdatax-mfr_no = 'X'.
is_clientdatax-manu_mat = 'X'.
is_clientdatax-pur_status = 'X'.
is_clientdatax-old_mat_no = 'X'.
*... Description
it_materialdescription-langu = sy-langu.
it_materialdescription-matl_desc = makt-maktx.
APPEND it_materialdescription.
is_plantdata-sm_key = '000'.
is_plantdata-dep_req_id = '2'.
is_plantdata-availcheck = '02'.
is_plantdata-auto_p_ord = 'X'.
is_plantdatax-sm_key = 'X'.
is_plantdatax-dep_req_id = 'X'.
is_plantdatax-availcheck = 'X'.
is_plantdatax-auto_p_ord = 'X'.
is_plantdata-pur_status = mara-mstae.
is_plantdatax-pur_status = 'X'.
is_plantdata-profit_ctr = '100012'.
is_plantdata-proc_type = 'F'.
is_plantdata-determ_grp = 'Z001'.
is_plantdata-deploy_horiz = '000'.
is_plantdatax-proc_type = 'X'.
is_plantdatax-determ_grp = 'X'.
is_plantdatax-deploy_horiz = 'X'.
*... Plant data
is_plantdata-plant = marc-werks.
is_plantdata-pur_group = marc-ekgrp.
is_plantdata-abc_id = marc-maabc.
is_plantdata-mrp_type = marc-dismm.
is_plantdata-plnd_delry = marc-plifz.
is_plantdata-lotsizekey = marc-disls.
is_plantdata-safety_stk = marc-eisbe.
is_plantdata-mrp_ctrler = marc-dispo.
is_plantdata-iss_st_loc = marc-lgpro.
is_plantdata-sloc_exprc = marc-lgfsb.
is_plantdata-round_prof = marc-rdprf.
is_plantdatax-plant = marc-werks.
is_plantdatax-pur_group = 'X'.
is_plantdatax-abc_id = 'X'.
is_plantdatax-mrp_type = 'X'.
is_plantdatax-plnd_delry = 'X'.
is_plantdatax-lotsizekey = 'X'.
is_plantdatax-safety_stk = 'X'.
is_plantdatax-mrp_ctrler = 'X'.
is_plantdatax-iss_st_loc = 'X'.
is_plantdatax-sloc_exprc = 'X'.
is_plantdatax-round_prof = 'X'.
*... Valuation
is_valuationdata-val_area = marc-werks.
is_valuationdatax-val_area = marc-werks.
is_valuationdata-price_ctrl = 'V'.
is_valuationdata-price_unit = '1'.
is_valuationdata-val_class = '3000'.
is_valuationdata-qty_struct = 'X'.
is_valuationdata-orig_mat = 'X'.
is_valuationdata-price_unit = mbew-peinh.
is_plantdata-lot_size = mbew-peinh.
is_valuationdatax-price_ctrl = 'X'.
is_valuationdatax-price_unit = 'X'.
is_valuationdatax-val_class = 'X'.
is_valuationdatax-qty_struct = 'X'.
is_valuationdatax-orig_mat = 'X'.
is_valuationdatax-price_unit = 'X'.
is_plantdatax-lot_size = 'X'.
Storage
IF NOT marc-lgpro IS INITIAL.
is_storagelocationdata-plant = marc-werks.
is_storagelocationdata-stge_loc = marc-lgpro.
is_storagelocationdata-stge_bin = mard-lgpbe.
is_storagelocationdatax-plant = is_storagelocationdata-plant.
is_storagelocationdatax-stge_loc = is_storagelocationdata-stge_loc.
is_storagelocationdatax-stge_bin = 'X'.
ENDIF.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = is_headdata
clientdata = is_clientdata
clientdatax = is_clientdatax
plantdata = is_plantdata
plantdatax = is_plantdatax
FORECASTPARAMETERS =
FORECASTPARAMETERSX =
PLANNINGDATA =
PLANNINGDATAX =
storagelocationdata = is_storagelocationdata
storagelocationdatax = is_storagelocationdatax
valuationdata = is_valuationdata
valuationdatax = is_valuationdatax
WAREHOUSENUMBERDATA =
WAREHOUSENUMBERDATAX =
SALESDATA =
SALESDATAX =
STORAGETYPEDATA =
STORAGETYPEDATAX =
FLAG_ONLINE = ' '
FLAG_CAD_CALL = ' '
IMPORTING
return = return
TABLES
materialdescription = it_materialdescription
UNITSOFMEASURE =
UNITSOFMEASUREX =
INTERNATIONALARTNOS =
MATERIALLONGTEXT =
TAXCLASSIFICATIONS =
returnmessages = it_returnmessages
PRTDATA =
PRTDATAX =
EXTENSIONIN =
EXTENSIONINX =
endform.
Regards.
David -
Create Material Master Record with Text
Hi, I am looking to create material Master Data via ABAP. I currently have some code that creates the Master Data Characteristic value I want, but I need the text as well. Can someone tell me what I need to do to add the text for the Master Data Characteristic value?
Here's what I have using CL_RSDMD_UPDATE_MASTER_DATA=>UPDATE_ATTRIBUTES_STATIC
TYPE-POOLS: RS, RSSM.
DATA: T_ZFREETEXT LIKE STANDARD TABLE OF ZFREETEXT.
DATA: T_INFO TYPE RSSM_S_MINFO.
DATA: RETURN_STATUS TYPE RSARR_T_IDOCSTATE.
DATA: RETURN_SUBRC LIKE SY-SUBRC.
DATA: MSG TYPE RS_T_MSG.
DATA: L_R_ACTIVATE_MASTER_DATA TYPE REF TO CL_RSDMD_ACTIVATE_MASTER_DATA.
INSERT ZFREETEXT INTO TABLE T_ZFREETEXT.
CALL METHOD CL_RSDMD_UPDATE_MASTER_DATA=>UPDATE_ATTRIBUTES_STATIC
EXPORTING
I_IOBJNM = '0MATERIAL' " Technical name of InfoObject
I_CHAVL_ENQUEUE = RS_C_FALSE
I_T_DATA = T_ZFREETEXT
I_S_MINFO = T_INFO
I_MONITORING = RS_C_FALSE
CHANGING
C_T_IDOCSTATE = RETURN_STATUS.
IF SY-SUBRC <> 0.
RETURN_SUBRC = 'Error happened'.
ELSE.
RETURN_MSG = 'Process Completed Successfully'.
CREATE OBJECT L_R_ACTIVATE_MASTER_DATA
EXPORTING
I_IOBJNM = '0MATERIAL'
I_P_Q_HAVE_TO_EXIST = RS_C_FALSE.
IF SY-SUBRC = 0.
L_R_ACTIVATE_MASTER_DATA->ACTIVATE(
IMPORTING
E_SUBRC = RETURN_SUBRC
CHANGING
C_T_MSG = MSG ).
ENDIF.
ENDIF.Dear Kenneth,
do you need to add master data during load of transaction data in planning scenario? If yes, you can do this with a planning function of type exit in the INIT function module.
I think you've to use the table ETO_CHAS (table for char. combinations) and all kind of char. combinations has to be transfered.
data:
l_s_chas type /1SEM/_YS_CHAS_"YOURCLIENT"YOURPLANNINGAREA",
l_r_co_area type range of /bi0/oico_area,
l_s_costcenter type /bi0/pcostcenter.
field-symbols:
<f_coar> type /bi0/oico_area,
<f_cctr> type /bi0/oicostcenter.
select * from /bi0/pcostcenter into l_s_costcenter
where co_area IN l_r_co_area
and objvers = 'A'.
<f_coar> = l_s_costcenter-co_area.
<f_cctr> = l_s_costcenter-costcenter.
INSERT l_s_chas INTO TABLE eto_chas.
endselect.
Regards, Clemens -
Runtime error while creating material master data
hello sir,
i am facing one prolem while creating MATERIAL MASTER DATA.
AFTER GIVING ALL REQUIRED INFORMATION WHEN I AM GOING TO SAVE THE DOCUMENT ITS SHOWING ABAP RUNTIME ERROR.
MESSAGE TYPE: - MDS_KEYMAP.
MESSAGE CLASS: 001.
PLEASE TELL ME WHAT TO DO?
REGARDS..SIR THANK YOU FOR YOUR REPLY.
I ALREADY DONE THAT DUMP ANALYSIS.
SO PLEASE KINDLY GIVE ME IN DETAILS ABOUT THAT SOLUTION... -
LSMW--Create Material master data
Hi,
When I use LSMW to create material master data, I set up all step, but when I go to last step "13 Run Batch Input Session", there is error message like "Select at least one view" in moudle SAPLMGMM, screen 0070, anybody can tell me what is problem, thanks a lot.Hi,
This is due to error while recording for MM01,
Please do a Repeat recording and ensure that once the material number, industry sector and material type is entered, on the next screen you need to select all or at least a single view to create the MMR.
Regards
Merwyn -
Set default value for price unit when creating material master data
HI: Every
could you tell me how to use user-exit or else ways to set default value(such as 1000) for field "Price unit" (MBEW-PEINH) when creating material master data(MM01)?
I have try to use Exit:EXIT_SAPLMGMU_001. However, this way cannot respones it.
thanks
HenryHi: Ihave find out a solution
Use BADI: BADI_MATERIAL_REF
SPROlogistics general enhancement supplement or change default data (industry)
And then creating a Implementation Name
Double click method: CREATE_MATERIAL
And then write code as below:
method IF_EX_MATERIAL_REFERENCE~CREATE_MATERIAL.
c_mbew-peinh = '1000' .
endmethod.
However, SAP still store '1000' in database evenif we change the default value such as 100 when we use TCode MM01.
in additional, we still use MM02 to change the default value such as '100'
can anybody tell me how to do?
thanks
Henry -
Transfer of material master data with Classification view
Dear Experts
I want to transfer material master data between R/3 using ALE. We are able to send master data using BD10 without classification view.
Please let me know in detail the configuration, steps invloved in sending materail master along with classification view.
Regards
SamalHAI FRIENDS,
CHANGING CLASSIFICATION VIEW FOR MATERIAL USING BAPI
->CREATE CHARACTERISTIC USING TCODE CT04
->CREATE CLASS USING TCODE CL01 .
-> RUN THIS PROGRAM TO CHANGE THE CLASSIFICATION VIEW
PARAMETERS: P_MATNR TYPE MARA-MATNR. "MATERIAL
DATA: OBJECTKEY TYPE BAPI1003_KEY-OBJECT,
OBJECTTABLE TYPE BAPI1003_KEY-OBJECTTABLE,
CLASSNUM TYPE BAPI1003_KEY-CLASSNUM,
CLASSTYPE TYPE BAPI1003_KEY-CLASSTYPE,
ALLOCVALUESNUMNEW TYPE TABLE OF BAPI1003_ALLOC_VALUES_NUM WITH HEADER LINE,
ALLOCVALUESCHARNEW TYPE TABLE OF BAPI1003_ALLOC_VALUES_CHAR WITH HEADER LINE,
ALLOCVALUESCURRNEW TYPE TABLE OF BAPI1003_ALLOC_VALUES_CURR WITH HEADER LINE,
RETURN TYPE TABLE OF BAPIRET2 WITH HEADER LINE.
OBJECTKEY = P_MATNR.
OBJECTTABLE = 'MARA'.
CLASSNUM = 'MTS_CABLE_BIN1'. "CLASS(CREATED USING CL01)
CLASSTYPE = '023'. "CLASS TYPE (023 FOR BATCH)
CALL FUNCTION 'BAPI_OBJCL_CHANGE'
EXPORTING
OBJECTKEY = OBJECTKEY
OBJECTTABLE = OBJECTTABLE
CLASSNUM = CLASSNUM
CLASSTYPE = CLASSTYPE
STATUS = '1'
STANDARDCLASS =
CHANGENUMBER =
KEYDATE = SY-DATUM
NO_DEFAULT_VALUES = ' '
IMPORTING
CLASSIF_STATUS =
TABLES
ALLOCVALUESNUMNEW = ALLOCVALUESNUMNEW
ALLOCVALUESCHARNEW = ALLOCVALUESCHARNEW
ALLOCVALUESCURRNEW = ALLOCVALUESCURRNEW
RETURN = RETURN
LOOP AT RETURN.
WRITE: / RETURN-TYPE ,RETURN-MESSAGE.
ENDLOOP.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
BY VENKATESWARAREDDY D
MYTEC SOFT LTD -
Problem when creating material master data
Hi,
I use MM01 to create a material master data and save it, the system appears the material created successfully. But when I use MM03 to display the material, the system appears no this material exists in the system. I use ST22 find some runtime error: "Insert into MARA values MARA" .
How can I solve this problem?
Fiona ZhangHi,
Have you executed the MARA table by material name.
Then try with MARA-ERNAM field. Enter ur user id and then execute. lets see whether it is really created or not in ur system.
If u dont find any material created by ur name then go to SO01 transaction and check ur inbox....U will find some mails like update terminated.
U can talk to ABAPer to get this resolved.
Thanks & Regards,
Shaik Hussain -
Not able to create customer master data with country code US
Hey All,
I am not able to create customer master data in the Transaction Code XD01/FD01 with the country code as US.
The error message for the same is NO JURISDICTION CODE COULD BE DETERMINED. I have checked the tax code settings but could not locate the problem.
Request you to provide me with a solution.
Thanks & Regards
VKHey all,
I have checked the field in the account group(OBD2) but its in optional status
and also checked the country settings for US in the transaction code OY17 still the same error message, but when i tried checking the settings for a differnt company code's customer data base i can see that there is a number mentioned in the address tab under tax jurisdiction feild (beside time zone) which is not populating for this company code.
so, do anyone know where exaclty we mention this number so that it populates in that field of address.
hope am clear
hope to receive a solution
thanks & regards
vinila -
Problem in extending material master data using BAPI?
Hi all,
I have created a program to upload material master using BAPI_MATERIAL_SAVEDATA WITH VIEWS
Basic view, purchase view, account view , storage view and MRP view. I am successful while uploading this data while not taking the valuation type field to account view(passing only valuation area,valuation class and moving price).
But when i am trying to pass valuation type field also then it is giving error as 'First create the valuation-type-independent data' .
So i have written another program to extend this material to enter valuation type , then it is giving the error as 'Valuation category does not allow split valuation'.
Please help me to solve this problem and while modifying what are the mandatory values to pass to BAPI?
Thanks,
Vamshi.Hi VAMSHI,
I have your same error but I don't know how to solve it. We have active "material split valuation" and valuation type is mandatory field if using ACCOUNTING and COSTING views.
Please, let me know.
Thanks in advance.
GB -
Error while updating AFS weights & measures material master data using BAPI
Hello ABAP experts,
Please help me in finding the right way in updating AFS weights & measures data (/AFS/MARM) data using BAPI /AFS/BAPI_MATERIAL_SAVE_DATA.
I'm populating the following table parameters of the BAPI,
1. SKUUNITSOFMEASURE with /AFS/MARM records
s_bapi_marm-ALT_UNIT = 'EA'.
s_bapi_marm-ALT_UNIT_ISO = 'EA'.
s_bapi_marm-grid_value = 'XXXXS'.
*s_bapi_marm-STOCK_CATEGORY = '01000'.
s_bapi_marm-volume = '10'.
s_bapi_marm-GROSS_WT = '10'.
s_bapi_marm-NET_WEIGHT = '10'.
append s_bapi_marm to t_bapi_marm.
2. UNITSOFMEASURE with MARM records
s_bapi_uom-ALT_UNIT = 'EA'.
s_bapi_uom-ALT_UNIT_ISO = 'EA'.
s_bapi_uom-NUMERATOR = '1'.
s_bapi_uom-DENOMINATR = '1'.
s_bapi_uom-UNIT_OF_WT = 'KG'.
s_bapi_uom-VOLUMEUNIT = 'CCM'.
append s_bapi_uom to t_bapi_uom.
But the BAPI returns me an error "Stock Category & is not valid in Category structure &"
Let me know if you have any inputs on this one.
Thanks,
Partha.Hi VAMSHI,
I have your same error but I don't know how to solve it. We have active "material split valuation" and valuation type is mandatory field if using ACCOUNTING and COSTING views.
Please, let me know.
Thanks in advance.
GB -
Dear sir,
how to create a material data using mm01.
explain step by step procdure..Hi
Transaction Recorder (SHDB)
How to Upload Presentation Server Flat file to SAP R/3 system???
How to upload application server file to R/3 system?
Definition
Example - Call Transaction Method
<b>Transaction Recorder (SHDB)</b>
Before you work with the Batch Input methods, you should know the purpose of the tool
Transaction Recorder.
Use:
You can use the transaction recorder to record a series of transactions and their screens.
Features:
You can use the recording to create
Data transfer programs that use batch input or CALL TRANSACTION
Batch input sessions
Test data
Function modules.
Note: It doesnt record F1, F4 and Scrollbar movements
<b>Upload Flat file from Presentation Server to SAP R/3</b>
CALL FUNCTION GUI_UPLOAD'
EXPORTING
CODEPAGE = IBM'
FILENAME = P_UFILE
FILETYPE = 'DAT'
TABLES
DATA_TAB = INT_TAB
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 NE 0.
MESSAGE E999(FR) WITH 'ERROR IN FILE UPLOAD'.
ENDIF.
<b>Upload file from application server to SAP R/3</b>
Open the the application server file
OPEN DATASET <dsn> FOR INPUT <mode>
Read the data from application server file
READ DATASET <dsn> INTO <wa>
And then close the application server file
CLOSE DATASET <dsn>
Definition- Declaring BDC Table
DATA: BDC_TAB LIKE STANDARD TABLE OF
BDCDATA INITIAL SIZE 6
WITH HEADER LINE .
The internal table used to collect the transactions information must be declared LIKE BDCDATA.
<b>Filling BDC Table Method #1</b>
FORM FILL_BDC_TAB.
REFRESH BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-PROGRAM = SAPMF02K.
BDC_TAB-DYNPRO = 01016.
BDC_TAB-DYNBEGIN = X.
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-FNAM = RF02K-LIFNR.
BDC_TAB-FVAL = TEST1.
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-FNAM = RF02K-D0010.
BDC_TAB-FVAL = X.
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-PROGRAM = SAPMF02K.
BDC_TAB-DYNPRO = 0110.
BDC_TAB-DYNBEGIN = X.
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-FNAM = LFA1-STRAS.
BDC_TAB-FVAL = 123 Main St..
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-FNAM = BDC_OKCODE.
BDC_TAB-FVAL = /11.
APPEND BDC_TAB.
ENDFORM.
<b>Filling BDC Table Method #2</b>
FORM FILL_BDC_TAB.
REFRESH BDC_TAB.
PERFORM POPULATE_BDC_TAB
USING:
1 SAPMF02K 0106,
RF02K-LIFNR TEST1,
RF02K-D0010 X,
1 SAPMF02K 0110,
LFA1-STRAS, 123 Main St.,
BDC_OKCODE, /11.
ENDFORM.
FORM POPULATE_BDC_TAB USING FLAG VAR1 VAR2.
CLEAR BDC_TAB.
IF FLAG = 1.
BDC_TAB-PROGRAM = VAR1.
BDC_TAB-DYNPRO = VAR2..
BDC_TAB-DYNBEGIN = X.
ELSE.
BDC_TAB-FNAM = VAR1.
BDC_TAB-FVAL = VAR2.
ENDIF.
APPEND BDC_TAB.
ENDFORM.
This two subroutine method to fill the BDC table is preferable because the POPULATE_BDC_TABLE subroutine is reusable throughout all batch input programs.
<b>Example #1 - Change Vendor (Call Transaction Method)</b>
<b>Example #1- Declaration Section</b>
REPORT Y180DM10.
DATA: BDC_TAB LIKE STANDARD TABLE OF
BDCDATA INITIAL SIZE 6 WITH HEADER LINE.
INFILE(20) VALUE /tmp/bc180_file4.
DATA: BEGIN OF INREC.
VENDNUM LIKE LFA1-LIFNR.
STREET LIKE LFA1-STRAS.
END OF INREC.
PARAMETERS: DISPMODE DEFAULT A,
UPDAMODE DEFAULT S.
START-OF-SELECTION.
OPEN DATASET INFILE
FOR INPUT IN TEXT MODE.
DO.
READ DATASET INFILE INTO INREC.
IF SY-SUBRC < > 0. EXIT. ENDIF.
PERFORM FILL_BDC_TAB.
CALL TRANSACTION FK02
USING BDC_TAB
MODE DISPMODE
UPDATE UPDAMODE.
IF SY-SUBRC < > 0.
WRITE: /ERROR.
ENDIF.
ENDDO.
CLOSE DATASET INFILE.
<b>synchronous updating</b>
DO.
PERFORM FILL_BDC_TAB.
CALL TRANSACTION FK02
USING BDC_TAB
MODE N
UPDATE S.
IF SY-SUBRC < > 0.
WRITE: /ERROR.
ENDIF.
ENDDO.
With synchronous updating, we can check SY-SUBRC to determine the success of the transaction and the actual update to the database.
<b>asynchronous updating</b>
DO.
PERFORM FILL_BDC_TAB.
CALL TRANSACTION FK02
USING BDC_TAB
MODE N
UPDATE A.
IF SY-SUBRC < > 0.
WRITE: /ERROR.
ENDIF.
ENDDO.
With asynchronous updating, we can check SY-SUBRC to determine the success of the transaction only, not the actual update to the database.
<b>Error Handling</b>
Write an error report.
Send the record(s) in error to an error file.
Create a batch input session with the record(s) in error.
To store error messages ( CALL TRANSACTION )
data: begin of Tab_Mess occurs 0.
include structure bdcmsgcoll.
data : end of Tab_Mess,
CALL TRANSACTION FK02 USING BDC_TAB MODE N UPDATE S
MESSAGES INTO TAB_MESS.
IF SY-SUBRC NE 0.
WRITE: / Tab_MESS-TCODE, Tab_MESS-DYNUMB, Tab_MESS-MSGTYP ,
Tab_MESS-MSGID.
ENDIF.
<b>i am giving you example for Change Vendor you practice for ur tcode</b>
For our example, we will use the Change Vendor transaction (FK02) to add a street address to an already existing vendor.
<b>Step #1</b>
Use SystemStatus menu path to determine online program name (SAPMF02K), screen number (0110)
<b>Step #2</b>
Use F1 key and Technical Info pushbutton in each screen field to be filled to determine the field name.
<b>Step #3</b>
Determine how to proceed in the transaction
(save the record by clicking on the Save pushbutton or pressing the F11 key).
<b>BDC Table Contents</b>
After researching the transaction we can determine the contents of the BDC table.
PROGRAM DYNPRO DYNBEGIN FNAM FVAL
SAMPF02K 0106 X
RF02K-LIFNR TEST1
RF02K-D0110 X
SAMPF02K 0110 X
LFA1-STRAS 123 Main St.
BDC_OKCODE /11
<b>Batch Input Methods</b>
CALL TRANSACTION USING
STATEMENT
Call transaction - for data transfer
Processing batch input data with CALL TRANSACTION USING is the faster of the two recommended data transfer methods. In this method, legacy data is processed inline in your data transfer program.
Syntax:
CALL TRANSACTION <tcode>
USING <bdc_tab>
MODE <mode>
UPDATE <update>
A Display all
E Display errors only
N No display
S Synchronous
A Asynchronous
L Local update
<b>The process flow of CALL TRANSACTION</b>
A program that uses CALL TRANSACTION USING to process legacy data should execute thefollowing steps:
Prepare a BDCDATA structure for the transaction that you wish to run.
Prepare a internal table to store error messages Tab_Mess like structure of BDCMSGCOLL.
With a CALL TRANSACTION USING statement, call the transaction and prepare the BDCDATA structure. For example:
CALL TRANSACTION MM01' USING BDCDATA MODE 'A' UPDATE 'S'. MESSAGES INTO TAB_MESS.
IF SY-SUBRC <> 0.
<Error_handling>.
ENDIF.
<b>Overview of Batch Input Session</b>
The first batch input method is to create a batch input session. It is the processing of this batch input session that updates the database, not the execution of the batch input program. i am giving you example for Change Vendor you practice for ur tcode
For our example, we will use the Change Vendor transaction (FK02) to add a street address to an already existing vendor.
<b>Step #1</b>
Use SystemStatus menu path to determine online program name (SAPMF02K), screen number (0110)
<b>Step #2</b>
Use F1 key and Technical Info pushbutton in each screen field to be filled to determine the field name.
<b>Step #3</b>
Determine how to proceed in the transaction
(save the record by clicking on the Save pushbutton or pressing the F11 key).
<b>BDC Table Contents</b>
After researching the transaction we can determine the contents of the BDC table.
PROGRAM DYNPRO DYNBEGIN FNAM FVAL
SAMPF02K 0106 X
RF02K-LIFNR TEST1
RF02K-D0110 X
SAMPF02K 0110 X
LFA1-STRAS 123 Main St.
BDC_OKCODE /11
<b>Batch Input Methods</b>
CALL TRANSACTION USING
STATEMENT
Call transaction - for data transfer
Processing batch input data with CALL TRANSACTION USING is the faster of the two recommended data transfer methods. In this method, legacy data is processed inline in your data transfer program.
Syntax:
CALL TRANSACTION <tcode>
USING <bdc_tab>
MODE <mode>
UPDATE <update>
A Display all
E Display errors only
N No display
S Synchronous
A Asynchronous
L Local update
<b>The process flow of CALL TRANSACTION</b>
A program that uses CALL TRANSACTION USING to process legacy data should execute thefollowing steps:
Prepare a BDCDATA structure for the transaction that you wish to run.
Prepare a internal table to store error messages Tab_Mess like structure of BDCMSGCOLL.
With a CALL TRANSACTION USING statement, call the transaction and prepare the BDCDATA structure. For example:
CALL TRANSACTION MM01' USING BDCDATA MODE 'A' UPDATE 'S'. MESSAGES INTO TAB_MESS.
IF SY-SUBRC <> 0.
<Error_handling>.
ENDIF.
<b>Overview of Batch Input Session</b>
The first batch input method is to create a batch input session. It is the processing of this batch input session that updates the database, not the execution of the batch input program.
<b>Reward if usefull</b> -
Problem in uploading material master data using BAPI?
Hi all,
I am using BAPI_MATERIAL_SAVEDATA to upload materail master data. Here i have to pass moving average price values in two currenices(using account_view and valuationdata in BAPI). But i found only one field for moving average price i.e moving_pr in valuationdata.
Please help me on how to upload the moving average price in two currencies?
Thanks,
Aravind.Hi
There is function module BAPI_MATERIAL_SAVEREPLICA where
VALUATIONDATA parameter is in the tables tab.
But I didn't test it. Try, may be it works as you need. -
How long does it take to create material master data from PO lines?
Hi ,
I was wondering if I could use an expert's opinion on the time and effort (FTEs) that goes into cleaning 50,000 PO lines that contain item descriptions to create a clean item master and a (basic) catalog.
The idea is:
To remove duplicates, invalid, non recurring/ redudant items
To create categories and sub categories (Standard - no coding)
Is there any defined tool and process-steps, not only for SAP but in general? Do consultants do this manually (with Excel spreadsheets) or some other means.
Any references will be very useful.
Thanks and regards.could be any time from a day to some months, just depends how big the mess is and how detailed the wishlist is and how well you want become.
Most consultants will do this probably with Excel as they are used to it.
Mixed tools can speed the process up if the people are used to those tools, or slow it down if they are not and need training before they can start.
Is it really only the description which will finally be different for some thousand materials that finally need to be created?
I would start with TAANA transaction, this would give me already an aggregated view on the items, as it can be used to group and count the items by description (and other parameters such as year) so it is down in seconds to the number of variations. Means the duplicates are eliminated.
Then you identify the one-time buys from previous years and remove them from the list (the output of TAANA can be worked on with Excel inplace)
Now starts the hard work to remove the garbage. This is usually a manual work, looking for typos which made this different from the same item with the correct description. And even identifying duplicates that are totally different written "Elbow - stainless steel" and "Stainless steel elbow" and far apart from each other in your list.
For this I use Excel with the Fuzzy Lookup Add-in
Watch some videos on youtube to see how it works, it's great.
And finally you load the materials with LSMW. If you are experienced with SAP material masters then you know which fields this materials need, they all could be defined as constants and your input file could only have the description, if that is really the only difference, which I actually don't believe. There might be differences in material group, in the unit of measure and usually in the purchasing group too (probably even more fields). And exact those differences in the other fields have to be considered in the cleanup too.
So, just technically eliminating duplicates and the worst garbage and all the one-time buys and finally load uniformed NLAG materials with just different descriptions could be done in a day. But the experience tells me that this can quickly evolve to a bigger long term project with harmonizing the way how the description will be written, harmonizing units and material groups. -
Uploading of material master data using bapi BAPI_MATERIAL_SAVEDATA
hi guys,
i am uploading data from a flatfile (say notepad file).
the value for the field BRGEW(gross_wt) is displayed as 0.0000 WHEN i run the transaction MM03 where as in the flat file its value is 0000000000003
the data type of BRGEW is P
what should i do to solve this issue.
my flat file looks like this
000000000000010760FERTRNY01test material KG 005 NY010KG 0000000000003
My structure is
DATA:
BEGIN OF MATERIAL_MASTER,
MATNR(018) TYPE C, "Material number
MTART(004) TYPE C, "Material type
MBRSH(001) TYPE C, "Industry sector
WERKS LIKE MARC-WERKS, "TYPE C Plant
MAKTX(040) TYPE C, "Material description
MEINS(3) TYPE C, "base unit of measure
MATKL(009) TYPE C, "Material group
SPART(002) TYPE C, "Division
WEBAZ(03) TYPE C, "GR processing time
GEWEI LIKE MARA-GEWEI, "Weight unit
BRGEW(13) type c, "Gross weight
end of MATERIAL_MASTER.
thanks
Edited by: nishant patel on Aug 7, 2008 11:16 AMHi,
try to fill the BAPI structure
WRITE ds_output1-brgew
TO <bapi_structure>
UNIT 'Pass the unit here'
NO-GROUPING.
Hope it will work.
Thanks,
Kamesh Bathla
Edited by: Kamesh Bathla on Aug 7, 2008 6:51 PM
Maybe you are looking for
-
I understand that both Mac OS 10.4.11 and Mac OS 10.6.8 have security holes, and that 10.4.11 is no longer supported. If neither 10.4.11 nor 10.6.8 are supported, and if unpatched vulnerabilities in 10.6.8 are worse than those in 10.4.11, then I pre
-
Why the html file doesn't change with applet ?
i am new to java , i get a problem when i am modifying a applet . i recompile it to .class file but did not change its name . and the .html file which use the applet doesn't change with it , it still shows the original style , even when i delete the
-
Hi Gurus, We have setup edi for one of our vendor and the problem is that when the PO is created i cannot see the particular item in the PO. Regards Dardo
-
Hi, i have lost my iphone and do not have the serial number and IMEI number with me.
I tried the edit > peference > mobile tab, but it only record my handphone number used. The support store does not reach Singapore.. What do i do?
-
How do i duplicate CD's or DVD's?
I need to duplicate a few music CD's as well as DVD's of music i composed myself but do not want to use iTunes. How do i duplicate those CD's using the internal super burner in my desktop iMac ( Maverick 10.9.5 )