Deleting material using BAPI
Hi Guys,
I'm trying to delete a material, using BAPI_MATERIAL_SAVEDATA. The inputs i gave are the material number(Under Headdata Structure) and the Deletion Flag field as "X" (under ClientData structure). I'm also commiting the transaction..
But my material in SAP doesn't show a deletion flag to be set.
The doubt i have is, am i missing someother important field to do this??
Pls help me on this guys
Thanks
Varun
The field MANUF_PROF was mandatory
Similar Messages
-
Create material using bapi ' bapi_material_savedata'
Hi Experts,
i was tring to create material using bapi ' bapi_material_savedata' but the material is not updating in the table.
please find the code and suggest me if any modification
data: la_headdata type BAPIMATHEAD,
la_clientdata type BAPI_MARA,
la_CLIENTDATAX type BAPI_MARAX,
la_return type BAPIRET2.
data: i_materialdescription type table of BAPI_MAKT,
wa_materialdescription like line of i_materialdescription.
*la_headdata-MATERIAL = int_matnum-MATERIAL.
*LOOP AT int_matnum.
la_headdata-MATERIAL = int_matnum-MATERIAL.
write : int_matnum-material.
*ENDLOOP.
la_headdata-MATERIAL = '100000518'."int_matnum-MATERIAL.
la_headdata-IND_SECTOR = p_indsr.
la_headdata-MATL_TYPE = p_matype.
la_clientdata-BASE_UOM = 'FT3'.
la_clientdata-pur_valkey = ' '.
la_CLIENTDATAX-BASE_UOM = 'X'.
la_clientdata-MATL_GROUP = '01'.
la_CLIENTDATAX-MATL_GROUP = 'X'.
wa_materialdescription = 'TEST'.
append wa_materialdescription to i_materialdescription.
clear: wa_materialdescription.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = la_headdata
CLIENTDATA = la_clientdata
CLIENTDATAX = la_CLIENTDATAX
PLANTDATA =
PLANTDATAX =
FORECASTPARAMETERS =
FORECASTPARAMETERSX =
PLANNINGDATA =
PLANNINGDATAX =
STORAGELOCATIONDATA =
STORAGELOCATIONDATAX =
VALUATIONDATA =
VALUATIONDATAX =
WAREHOUSENUMBERDATA =
WAREHOUSENUMBERDATAX =
SALESDATA =
SALESDATAX =
STORAGETYPEDATA =
STORAGETYPEDATAX =
FLAG_ONLINE = ' '
FLAG_CAD_CALL = ' '
IMPORTING
RETURN = la_return
TABLES
MATERIALDESCRIPTION = i_materialdescription
UNITSOFMEASURE =
UNITSOFMEASUREX =
INTERNATIONALARTNOS =
MATERIALLONGTEXT =
TAXCLASSIFICATIONS =
RETURNMESSAGES =
PRTDATA =
PRTDATAX =
EXTENSIONIN =
EXTENSIONINX =
Please Help me
Regards,
NareshHi all,
Now it is asking me for the other fields,
E ,
The field MARA-XCHPF/BAPI_MARA-BATCH_MGMT is defined as a required field; it does not contain an entry
i have passed this val as
la_clientdata-batch_mgmt = 'X'.
even though i am getting the same error.
can you help me to solve the issue.
Tthanks
Naresh
Edited by: naresh.k.dasari on Jan 4, 2011 10:36 AM -
Hi Friends,
I want to create a material using BAPI, can anyone give me some sample program or can any one give me links which earlier posted this problem.
Points for sure for sample program.
thanks and regards
Vijayahi
good
go through this REPORT z_bapi_salesorder_create.
Parameters
Sales document type
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text FOR FIELD p_auart.
PARAMETERS: p_auart TYPE auart OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Sales organization
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text1 FOR FIELD p_vkorg.
PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Distribution channel
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text2 FOR FIELD p_vtweg.
PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Division.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text3 FOR FIELD p_spart.
PARAMETERS: p_spart TYPE spart OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SKIP 1.
Sold-to
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text4 FOR FIELD p_sold.
PARAMETERS: p_sold TYPE kunnr OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Ship-to
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text5 FOR FIELD p_ship.
PARAMETERS: p_ship TYPE kunnr OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SKIP 1.
Material
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text6 FOR FIELD p_matnr.
PARAMETERS: p_matnr TYPE matnr OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Quantity.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text7 FOR FIELD p_menge.
PARAMETERS: p_menge TYPE kwmeng OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Plant
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text9 FOR FIELD p_plant.
PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
SELECTION-SCREEN END OF LINE.
Data declarations.
DATA: v_vbeln LIKE vbak-vbeln.
DATA: header LIKE bapisdhead1.
DATA: headerx LIKE bapisdhead1x.
DATA: item LIKE bapisditem OCCURS 0 WITH HEADER LINE.
DATA: itemx LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
DATA: partner LIKE bapipartnr OCCURS 0 WITH HEADER LINE.
DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: lt_schedules_inx TYPE STANDARD TABLE OF bapischdlx
WITH HEADER LINE.
DATA: lt_schedules_in TYPE STANDARD TABLE OF bapischdl
WITH HEADER LINE.
Initialization.
INITIALIZATION.
v_text = 'Order type'.
v_text1 = 'Sales Org'.
v_text2 = 'Distribution channel'.
v_text3 = 'Division'.
v_text4 = 'Sold-to'.
v_text5 = 'Ship-to'.
v_text6 = 'Material'.
v_text7 = 'Quantity'.
v_text9 = 'Plant'.
Start-of-selection.
START-OF-SELECTION.
Header data
Sales document type
header-doc_type = p_auart.
headerx-doc_type = 'X'.
Sales organization
header-sales_org = p_vkorg.
headerx-sales_org = 'X'.
Distribution channel
header-distr_chan = p_vtweg.
headerx-distr_chan = 'X'.
Division
header-division = p_spart.
headerx-division = 'X'.
headerx-updateflag = 'I'.
Partner data
Sold to
partner-partn_role = 'AG'.
partner-partn_numb = p_sold.
APPEND partner.
Ship to
partner-partn_role = 'WE'.
partner-partn_numb = p_ship.
APPEND partner.
ITEM DATA
itemx-updateflag = 'I'.
Line item number.
item-itm_number = '000010'.
itemx-itm_number = 'X'.
Material
item-material = p_matnr.
itemx-material = 'X'.
Plant
item-plant = p_plant.
itemx-plant = 'X'.
Quantity
item-target_qty = p_menge.
itemx-target_qty = 'X'.
APPEND item.
APPEND itemx.
Fill schedule lines
lt_schedules_in-itm_number = '000010'.
lt_schedules_in-sched_line = '0001'.
lt_schedules_in-req_qty = p_menge.
APPEND lt_schedules_in.
Fill schedule line flags
lt_schedules_inx-itm_number = '000010'.
lt_schedules_inx-sched_line = '0001'.
lt_schedules_inx-updateflag = 'X'.
lt_schedules_inx-req_qty = 'X'.
APPEND lt_schedules_inx.
Call the BAPI to create the sales order.
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_schedules_in = lt_schedules_in
sales_schedules_inx = lt_schedules_inx
sales_partners = partner.
Check the return table.
LOOP AT return WHERE type = 'E' OR type = 'A'.
EXIT.
ENDLOOP.
IF sy-subrc = 0.
WRITE: / 'Error in creating document'.
ELSE.
Commit the work.
COMMIT WORK AND WAIT.
WRITE: / 'Document ', v_vbeln, ' created'.
ENDIF.
thanks
mrutyun^ -
Creation of material using BAPI in LSMW without using material no.
Hi SAP Gurus,
I have a requirement of creating materials using the BAPI in LSMW.
I tried to create a material using the BAPI (Business Object - BUS1001006 , and method - SAVEDATA) which should be created internally, but it is asking the material number to be given externally and my configuration is setup to create the material number internally.
Even I looked into the material type which is associated with the number range and everything looks good.
Is there any solution to create the material by using BAPI in LSMW without passing the material no. externally ?
Appreciate your help.
Kalikonda.Hi,
it looks like it's not possible to call this BAPI wihtout material number. Here is a quote from BAPI documentation.
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.
Cheers -
Posting an accounting document with material using BAPI (ver 4.6c)
Hello!
Can anyone help me out with this one please?
I need to post an accounting document using BAPI. Since the customer's SAP is 4.6c, the BAPI I found closest is BAPI_ACC_GL_POSTING_POST.
The posting has 2 specific requirements:
1. For the Vendor item, the tax needs to be calculated; and
2. For the G/L items, the corresponding material/quantity needs to be entered
So, my questions are:
1. How do you enable the "Calculate Tax" option, which is the Calculate Tax checkbox in F-02?
2. How do you enter the material and quantity for the G/L items?
Thanks a lot!Hi,
Before posting your document please check first whether this is reversal or not.
please use BAPI_ACC_DOCUMENT_REV_CHECK to check reversal document
Have a Nice Day,
Regards,
Sujeet -
How to create material using BAPI Methods?
hi,
how to create material master dat using BAPI?
could u guide me
i will be waiting for reply.
REGARDS
ESWAR.Hi eswar,
Try this code to create gods mmovement...
DATA: GOODSMVT_HEADER LIKE BAPI2017_GM_HEAD_01,
" Material Document Header Data
GOODSMVT_CODE LIKE BAPI2017_GM_CODE,
" Assign code to transaction for BAPI goods movement
MATERIALDOCUMENT LIKE BAPI2017_GM_HEAD_RET-MAT_DOC,
" Number of Material Document
GOODSMVT_ITEM LIKE BAPI2017_GM_ITEM_CREATE OCCURS 0 WITH HEADER
LINE,
" Create Material Document Item
RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE
" Return table for messages
*Fill values in header
GOODSMVT_HEADER-PSTNG_DATE = '20030825'.
GOODSMVT_HEADER-DOC_DATE = '20030802'.
*Fill GOODSMVT_CODE
GOODSMVT_CODE-GM_CODE = '05' .
*Fill Item Table
GOODSMVT_ITEM-MATERIAL = '100-100'.
GOODSMVT_ITEM-PLANT = '1000'.
GOODSMVT_ITEM-STGE_LOC = '0001'.
GOODSMVT_ITEM-MOVE_TYPE = '501'.
GOODSMVT_ITEM-ENTRY_QNT = '50'.
GOODSMVT_ITEM-ITEM_TEXT = 'Test Sanket'.
*GOODSMVT_ITEM-COSTCENTER = '1000'.
APPEND GOODSMVT_ITEM.
*Create Good's movement
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
GOODSMVT_HEADER = GOODSMVT_HEADER
GOODSMVT_CODE = GOODSMVT_CODE
IMPORTING
MATERIALDOCUMENT = MATERIALDOCUMENT
TABLES
GOODSMVT_ITEM = GOODSMVT_ITEM
RETURN = RETURN.
*Commit BAPI
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
*Display Goods movement number
FORMAT COLOR 6 INVERSE ON.
READ TABLE RETURN WITH KEY TYPE = 'E'.
IF SY-SUBRC = 0.
WRITE: /,'ERROR! Goods movement not created'.
ELSE.
WRITE: /,'Goods movent number',MATERIALDOCUMENT COLOR 5,
'posted for material',GOODSMVT_ITEM-MATERIAL.
ENDIF.
FORMAT COLOR OFF INVERSE OFF.
try this on report program and create a goods movement.
Sanket. -
Sales order for variant material using BAPI "BAPI_SALESORDER_CREATEFROMDAT2
Hi,
I am using BAPI "BAPI_SALESORDER_CREATEFROMDAT2" for creating salesorder for variant configuration material. I am able to create a salesorder when have only one variant material, However when i have more than one variant material getting errors. Can some one tell me how to fill the material data in the config tables provided in the BAPI.
Thanks.Hai Vinit
Check the following Code & also Check the following Standard Programs
L2032U12
LCRMAU01
LCRMAU11
LZOC1U01
MWWMJF32
RBUS2032
Structures for order header
DATA: l_order_header_in LIKE bapisdhd1,
l_order_header_inx LIKE bapisdhd1x,
Tables for order items
li_order_items_in TYPE STANDARD TABLE OF bapisditm,
li_order_items_inx TYPE STANDARD TABLE OF bapisditmx,
Order partners
li_order_partners TYPE STANDARD TABLE OF bapiparnr,
*Schedule lines
li_ORDER_SCHEDULES_IN TYPE STANDARD TABLE OF BAPISCHDL,
li_ORDER_SCHEDULES_INX TYPE STANDARD TABLE OF BAPISCHDLX,
*-condition type
li_ORDER_CONDITIONS_IN TYPE STANDARD TABLE OF BAPICOND,
li_ORDER_CONDITIONS_INX TYPE STANDARD TABLE OF BAPICONDX,
Return table from bapi call
li_return TYPE STANDARD TABLE OF bapiret2,
Sales document number
l_vbeln LIKE bapivbeln-vbeln,
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
order_header_in = l_order_header_in
order_header_inx = l_order_header_inx
testrun = 'X'
IMPORTING
salesdocument = l_vbeln
TABLES
return = li_return
order_items_in = li_order_items_in
order_items_inx = li_order_items_inx
order_partners = li_order_partners
ORDER_SCHEDULES_IN = li_ORDER_SCHEDULES_IN
ORDER_SCHEDULES_INX = li_ORDER_SCHEDULES_INX
ORDER_CONDITIONS_IN = li_ORDER_CONDITIONS_IN
ORDER_CONDITIONS_INX = li_ORDER_CONDITIONS_INX.
Thanks & Regards
Sreenivasulu P -
Updating a child of a BOM material using bapi sales order change
Hi, Appreciate your thoughts on the following issue..
We have a batch program which uses a bapi sales order change and updates the plant at the line items of the sales order. when this plant is assigned.. if any of the line item is a BOM item, it explodes and the data from the parent ( like payment terms, fixed val date ) should get copied to the child items same as the parent. This is happening fine if manual mode using va01 and va02 but when plant is updated using bapi the childs are not getting the data from the parent ( which comes through config )...
Appreciate your inputs and any additional information to be passed to the bapi for the BOM materials to get the same config data as parent to the child when exploded...
Thanks and will reward helpful answers..Hi, Appreciate your thoughts on the following issue..
We have a batch program which uses a bapi sales order change and updates the plant at the line items of the sales order. when this plant is assigned.. if any of the line item is a BOM item, it explodes and the data from the parent ( like payment terms, fixed val date ) should get copied to the child items same as the parent. This is happening fine if manual mode using va01 and va02 but when plant is updated using bapi the childs are not getting the data from the parent ( which comes through config )...
Appreciate your inputs and any additional information to be passed to the bapi for the BOM materials to get the same config data as parent to the child when exploded...
Thanks and will reward helpful answers.. -
Fasing some problem in Material using BAPI..?
Hi... Guru's..
thanks in advance and will give full points...
I am creating material master using the BAPI and the data is in presentation server....
this is is the error message i am getting while control ebterinng into CALL BAPI(FM)....
Key fields for use data PLANTDATA and checkbox structure PLANTDATAX are different
please look into the program and and let me know if any chenges required...
i am able get the data from presentation layer and i am able to move field values from internal table to BAPI fields and values are populating properly....
while entering control into BAPI ..i am getting the above error..(error message ....i found in debugging mode...)
TYPE : E
ID : MM
NUMBER : 360
MESSAG :Key fields for use data PLANTDATA and checkbox structure PLANTDATAX are different
LOG_NO
LOG_MSG_NO : 000000
MESSAGE_V1 : PLANTDATA
MESSAGE_V2 : PLANTDATAX
MESSAGE_V3
MESSAGE_V4
PARAMETER
ROW 0
FIELD
SYSTEM
Program logic:
DATA:gs_bapimathead TYPE bapimathead,
gs_clientdata TYPE bapi_mara,
gs_clientdatax TYPE bapi_marax,
gs_plantdata TYPE bapi_marc,
gs_plantdatax TYPE bapi_marcx,
gs_forecastparameters TYPE bapi_mpop,
gs_forecastparametersx TYPE bapi_mpopx,
gs_valuationdata TYPE bapi_mbew,
gs_valuationdatax TYPE bapi_mbewx,
gs_salesdata TYPE bapi_mvke,
gs_salesdatax TYPE bapi_mvkex,
gs_storagelocationdata TYPE bapi_mard,
gs_storagelocationdatax TYPE bapi_mardx,
gt_materialdescription TYPE STANDARD TABLE OF bapi_makt,
gwa_materialdescription TYPE bapi_makt,
gt_taxclassifications TYPE STANDARD TABLE OF bapi_mlan,
gwa_taxclassifications TYPE bapi_mlan,
gt_prtdata TYPE STANDARD TABLE OF bapi_mfhm,
gwa_prtdata TYPE bapi_mfhm,
gt_prtdatax TYPE STANDARD TABLE OF bapi_mfhmx,
gwa_prtdatax TYPE bapi_mfhmx,
gt_unitsofmeasure TYPE STANDARD TABLE OF bapi_marm,
gwa_unitsofmeasure TYPE bapi_marm,
gt_unitsofmeasurex TYPE STANDARD TABLE OF bapi_marmx,
gwa_unitsofmeasurex TYPE bapi_marmx,
gs_return TYPE bapiret2.
TYPES:BEGIN OF gty_itab1,
matnr(18),
mbrsh(1),
mtart(4),
werks(4),
lgort(4),
vkorg(4),
vtweg(2),
maktx(40),
meins(3),
matkl(9),
spart(2),
brgew(13),
ntgew(13),
gewei(3),
dwerk(4),
taxkm(1),
kondm(2),
ktgrm(2),
mtpos(4),
tragr(4),
ladgr(4),
disgr(4),
dismm(2),
dispo(3),
beskz(1),
mtvfp(2),
prmod(1),
planv(3),
bklas(4),
vprsv(1),
peinh(5),
stprs(11),
END OF gty_itab1.
DATA:gt_itab1 TYPE STANDARD TABLE OF gty_itab1,
gwa_itab1 TYPE gty_itab1.
TYPES:BEGIN OF gty_itab2,
abc(1000),
END OF gty_itab2.
DATA:gt_itab2 TYPE STANDARD TABLE OF gty_itab2,
gwa_itab2 TYPE gty_itab2.
PARAMETERS:p_files TYPE string.
START-OF-SELECTION.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = p_files
filetype = 'ASC'
CHANGING
data_tab = gt_itab2
EXCEPTIONS
OTHERS = 8.
LOOP AT gt_itab2 INTO gwa_itab2.
gwa_itab1 = gwa_itab2-abc(1000).
APPEND gwa_itab1 TO gt_itab1.
ENDLOOP.
LOOP AT gt_itab1 INTO gwa_itab1.
gs_bapimathead-material = gwa_itab1-matnr.
gs_bapimathead-ind_sector = gwa_itab1-mbrsh.
gs_bapimathead-matl_type = gwa_itab1-mtart.
gs_plantdata-plant = gwa_itab1-werks.
gs_plantdatax-plant = 'X'.
gs_salesdata-sales_org = gwa_itab1-vkorg.
gs_salesdatax-sales_org = 'X'.
gs_salesdata-distr_chan = gwa_itab1-vtweg.
gs_salesdatax-distr_chan = 'X'.
gs_salesdata-mat_pr_grp = gwa_itab1-kondm.
gs_salesdatax-mat_pr_grp = 'X'.
gs_salesdata-acct_assgt = gwa_itab1-ktgrm.
gs_salesdatax-acct_assgt = 'X'.
gs_salesdata-delyg_plnt = gwa_itab1-dwerk.
gs_salesdatax-delyg_plnt = 'X'.
gs_clientdata-base_uom = gwa_itab1-meins.
gs_clientdatax-base_uom = 'X'.
gs_clientdata-trans_grp = gwa_itab1-tragr.
gs_clientdatax-trans_grp = 'X'.
gs_clientdata-matl_group = gwa_itab1-matkl.
gs_clientdatax-matl_group = 'X'.
gs_clientdata-division = gwa_itab1-spart.
gs_clientdatax-division = 'X'.
gs_clientdata-net_weight = gwa_itab1-ntgew.
gs_clientdatax-net_weight = 'X'.
gs_clientdata-unit_of_wt = gwa_itab1-gewei.
gs_clientdatax-unit_of_wt = 'X'.
gs_plantdata-loadinggrp = gwa_itab1-ladgr.
gs_plantdatax-loadinggrp = 'X'.
gs_plantdata-mrp_type = gwa_itab1-dismm.
gs_plantdatax-mrp_type = 'X'.
gs_plantdata-availcheck = gwa_itab1-mtvfp.
gs_plantdatax-availcheck = 'X'.
gs_plantdata-mrp_group = gwa_itab1-disgr.
gs_plantdatax-mrp_group = 'X'.
gs_plantdata-mrp_ctrler = gwa_itab1-dispo.
gs_plantdatax-mrp_ctrler = 'X'.
gs_plantdata-proc_type = gwa_itab1-beskz.
gs_plantdatax-proc_type = 'X'.
gs_forecastparameters-fore_model = gwa_itab1-prmod.
gs_forecastparametersx-fore_model = 'X'.
gs_valuationdata-val_class = gwa_itab1-bklas.
gs_valuationdatax-val_class = 'X'.
gs_valuationdata-std_price = gwa_itab1-stprs.
gs_valuationdatax-std_price = 'X'.
gs_valuationdata-price_ctrl = gwa_itab1-vprsv.
gs_valuationdatax-price_ctrl = 'X'.
gs_valuationdata-price_unit = gwa_itab1-peinh.
gs_valuationdatax-price_unit = 'X'.
gs_storagelocationdata-stge_loc = gwa_itab1-lgort.
gs_storagelocationdatax-stge_loc = 'X'.
gwa_materialdescription-langu = 'E'.
gwa_materialdescription-matl_desc = gwa_itab1-maktx.
gwa_taxclassifications-taxclass_1 = gwa_itab1-taxkm.
gwa_prtdata-prt_usage = gwa_itab1-planv.
gwa_prtdatax-prt_usage = 'X'.
gwa_unitsofmeasure-gross_wt = gwa_itab1-brgew.
gwa_unitsofmeasurex-gross_wt = 'X'.
APPEND gwa_materialdescription TO gt_materialdescription.
APPEND gwa_taxclassifications TO gt_taxclassifications.
APPEND gwa_prtdata TO gt_prtdata.
APPEND gwa_prtdatax TO gt_prtdatax.
APPEND gwa_unitsofmeasure TO gt_unitsofmeasure.
APPEND gwa_unitsofmeasurex TO gt_unitsofmeasurex.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = gs_bapimathead
clientdata = gs_clientdata
clientdatax = gs_clientdatax
plantdata = gs_plantdata
plantdatax = gs_plantdatax
forecastparameters = gs_forecastparameters
forecastparametersx = gs_forecastparametersx
valuationdata = gs_valuationdata
valuationdatax = gs_valuationdatax
salesdata = gs_salesdata
salesdatax = gs_salesdatax
IMPORTING
return = gs_return
TABLES
materialdescription = gt_materialdescription
unitsofmeasure = gt_unitsofmeasure
unitsofmeasurex = gt_unitsofmeasurex
taxclassifications = gt_taxclassifications
prtdata = gt_prtdata
prtdatax = gt_prtdatax.
Check the return table.
IF sy-subrc NE 0.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
WRITE: / 'Error occured while creating material'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
WRITE: / 'material',gwa_itab1-matnr,'created'.
ENDIF.
ENDLOOP.Hello,
Unfortunately SAP does not support any BAPI's to change customer/vendor master data.
The BAPI's were developed from different applications and were designed for their special needs.
You can see the existing BAPIs via tranx BAPI.
Please have a look at the SAP notes 390045 and 384462 which should
explain the proceeding. If you want to use Batch Input, please also have a look at SAP note 306275.
Another possibility is to use Trx XD99, object KNA1, Trx XK99, object LFA1.
Regards,
David -
To create a Material using BAPI with out passing the material number
Hello Experts,
I am using BAPI_MATERIAL_SAVEDATA to create a material of some Ztype. I am successfully creating a material if I am passing Material Number as input. I want the material number to generated internally.
When I am doing material creation with same input data with out material number using BDC, it is working fine. It is generating the material number.
But, not with the BAPI.
Do, I need to specify this some where in the BAPI to generate the Material number internally? Please let me know.
Please help me in this regard.
Thanks & Regards,
Naresh.Hi,
Read the BAPI documentation regarding Internal Number range for materials.
When you create material master data, the following fields must always
contain a value in the structure:
o MATERIAL
Only external number assignment is supported for the material number
(MATERIAL). If you want the material number to be assigned
internally, the method BAPI_MATERIAL_GETINTNUMBER must first be
called. This method determines an internal number for the material
to be created. You must enter this internal number in field
HEADDATA-MATERIAL.
Regards
Vinod -
Hi All,
We are using BAPI_MATERIAL_SAVEDATA to change a material. But end user is not having the authorization to modify using this bapi. because this BAPI is used for both creation and for changing so it is checking creation object Authorization and it is failing.
Kindly suggest me some other BAPI to Change the material to avoid the above problem.try these..
/SAPMP/BAPI_MATERIAL_SAVEDATA Mill Products: Create and Change Material Master
BAPI_MATERIAL_MAINTAINDATA_RT Create and change material master data (retail)
BAPI_MATERIAL_EDIT Change Material -
Probelm in creation of material using BAPI
Hi All,
Is it possible to create a material without passing a material number to the BAPI
(BAPIMATHEAD-MATERIAL)?
I am encountaring a problem that 'Enter the Material Number'.
I dont want to enter material number. The system should generate an internal material number.
How can i solve this issue...
will be rewarded with points....
Thanks in advance
KishoreHi,
first you need to check if your materialtype is customized for internal number
and then you can work with an btch-program
or MM17
regards
Nicole
Edited by: Nicole Lorenz on Mar 20, 2008 3:01 AM -
Create material master using BAPI .(Mat. internal number range)
I would like to create the material using BAPI. (Material is internal number range).
I am trying to create the material using BAPI BAPI_MATERIAL_SAVEDATA, but material number is required field as per BAPI documentation .
Can you please suggest me the function modules or BAPI to load materials which are in internal number range.
Regards
BadariHi ,
Use FM 'MATERIAL_NUMBER_GET_NEXT' to get next available material #.
You can use that material # in BAPI 'BAPI_MATERIAL_SAVEDATA'.
Cheers,
Vikram -
please get me the detailed procedure ( including code) of any data transfer program using BAPI's
check the sample code....it is used to transfer the data to MM01 tcode.
*TO CREATE MATERIAL USING BAPI.
STRUCTURE DECLARATIONS *
TABLES: BAPIMATHEAD, "Headerdata
BAPI_MARA, "Clientdata
BAPI_MARAX, "Clientdatax
BAPI_MARC, "Plantdata
BAPI_MARCX, "Plantdatax
BAPI_MAKT, "Material description
BAPI_MBEW, "VALUATION DATA
BAPI_MBEWX,
BAPI_MARM,
BAPI_MARMX,
bapi_mean,
BAPIRET2. "Return messages
DATA:V_FILE TYPE STRING. "input data file
DATA:
BEGIN OF LSMW_MATERIAL_MASTER,
MATNR(018) TYPE C, "Material number
MTART(004) TYPE C, "Material type
MBRSH(001) TYPE C, "Industry sector
WERKS(004) TYPE C, "Plant
MAKTX(040) TYPE C, "Material description
DISMM(002) TYPE C, "Extra Field Added In the Program as itsrequired
MEINS(003) TYPE C, "Base unit of measure
MATKL(009) TYPE C, "Material group
SPART(002) TYPE C, "Division
LABOR(003) TYPE C, "Lab/office
PRDHA(018) TYPE C, "Product hierarchy
MSTAE(002) TYPE C, "X-plant matl status
MTPOS_MARA(004) TYPE C, "Gen item cat group
BRGEW(017) TYPE C, "Gross weight
GEWEI(003) TYPE C, "Weight unit NTGEW(017) TYPE C, "Net weight
GROES(032) TYPE C, "Size/Dimensions
MAGRV(004) TYPE C, "Matl grp pack matls
BISMT(018) TYPE C, "Old material number
WRKST(048) TYPE C, "Basic material
PROFL(003) TYPE C, "DG indicator profile
KZUMW(001) TYPE C, "Environmentally rlvt
BSTME(003) TYPE C, "Order unit
VABME(001) TYPE C,
EKGRP(003) TYPE C, "Purchasing group
XCHPF(001) TYPE C, "Batch management
EKWSL(004) TYPE C, "Purchasing key value
WEBAZ(003) TYPE C, "GR processing time
MFRPN(040) TYPE C, "Manufacturer part number
MFRNR(010) TYPE C, "Manufacturer number
VPRSV(001) TYPE C, "Price control indicator
STPRS(015) TYPE C, "Standard price
BWPRH(014) TYPE C, "Commercial price1
BKLAS(004) TYPE C, "Valuation class
bwkey(004) type c,
END OF LSMW_MATERIAL_MASTER.
INTERNAL TABLE DECLARATIONS *
*to store the input data
DATA:
BEGIN OF it_matmaster OCCURS 0.
INCLUDE STRUCTURE LSMW_MATERIAL_MASTER.
DATA:
END OF it_matmaster.
*for material description
DATA:BEGIN OF IT_MATERIALDESC OCCURS 0.
INCLUDE STRUCTURE BAPI_MAKT .
DATA:END OF IT_MATERIALDESC.
*FOR gross wt
data: begin of it_uom occurs 0.
include structure BAPI_MARM.
data:end of it_uom.
DATA: BEGIN OF IT_UOMX OCCURS 0.
INCLUDE STRUCTURE BAPI_MARMX.
DATA:END OF IT_UOMX.
data:begin of it_mean occurs 0.
include structure bapi_mean.
data:end of it_mean.
DATA:BEGIN OF IT_MLTX OCCURS 0.
INCLUDE STRUCTURE BAPI_MLTX.
DATA:END OF IT_MLTX.
*to return messages
DATA:BEGIN OF IT_RETURN OCCURS 0.
INCLUDE STRUCTURE BAPIRET2.
DATA:END OF IT_RETURN.
SELECTION SCREEN *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-002.
PARAMETERS:P_FILE LIKE RLGRAP-FILENAME OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1 .
AT SELECTION SCREEN *
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.
TO UPLOAD THE DATA *
START-OF-SELECTION.
V_FILE = P_FILE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = V_FILE
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
IMPORTING
FILELENGTH =
HEADER =
tables
data_tab = IT_MATMASTER
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
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ELSE.
*DELETE IT_MATMASTER INDEX 1.
ENDIF.
DATA POPULATIONS *
LOOP AT IT_MATMASTER.
*HEADER DATA
BAPIMATHEAD-MATERIAL = IT_MATMASTER-MATNR.
BAPIMATHEAD-IND_SECTOR = IT_MATMASTER-Mbrsh.
BAPIMATHEAD-MATL_TYPE = IT_MATMASTER-Mtart.
BAPIMATHEAD-BASIC_VIEW = 'X'.
BAPIMATHEAD-PURCHASE_VIEW = 'X'.
BAPIMATHEAD-ACCOUNT_VIEW = 'X'.
*CLIENTDATA
BAPI_MARA-MATL_GROUP = IT_MATMASTER-MATKL.
BAPI_MARA-DIVISION = IT_MATMASTER-SPART.
BAPI_MARA-DSN_OFFICE = IT_MATMASTER-LABOR.
BAPI_MARA-PROD_HIER = IT_MATMASTER-PRDHA.
BAPI_MARA-PUR_STATUS = IT_MATMASTER-MSTAE.
BAPI_MARA-ITEM_CAT = IT_MATMASTER-MTPOS_MARA.
BAPI_MARA-NET_WEIGHT = IT_MATMASTER-NTGEW.
BAPI_MARA-PO_UNIT = 'KG'.
BAPI_MARA-UNIT_OF_WT_ISO = 'KG'.
BAPI_MARA-UNIT_OF_WT = 'KG'.
BAPI_MARA-PACK_VO_UN = 'KG'.
BAPI_MARA-BASE_UOM_ISO = 'KG'.
bapi_mara-size_dim = it_matmaster-groes.
BAPI_MARA-MAT_GRP_SM = IT_MATMASTER-MAGRV.
BAPI_MARA-OLD_MAT_NO = IT_MATMASTER-BISMT.
BAPI_MARA-BASE_UOM = IT_MATMASTER-MEINS.
BAPI_MARA-BASIC_MATL = IT_MATMASTER-WRKST.
BAPI_MARA-HAZMATPROF = IT_MATMASTER-PROFL.
BAPI_MARA-ENVT_RLVT = IT_MATMASTER-KZUMW.
BAPI_MARA-PO_UNIT = IT_MATMASTER-BSTME.
BAPI_MARA-VAR_ORD_UN = IT_MATMASTER-VABME.
BAPI_MARA-PUR_VALKEY = IT_MATMASTER-EKWSL.
BAPI_MARA-MANU_MAT = IT_MATMASTER-MFRPN.
BAPI_MARA-MFR_NO = IT_MATMASTER-MFRNR.
BAPI_MARAX-MATL_GROUP = 'X'.
BAPI_MARAX-DIVISION = 'X'.
BAPI_MARAX-DSN_OFFICE = 'X'.
BAPI_MARAX-PROD_HIER = 'X'.
BAPI_MARAX-PUR_STATUS = 'X'.
BAPI_MARAX-ITEM_CAT = 'X'.
BAPI_MARAX-NET_WEIGHT = 'X'.
BAPI_MARAX-UNIT_OF_WT = 'X'.
BAPI_MARAX-UNIT_OF_WT_ISO = 'X'.
bapi_maraX-size_dim = 'X'.
BAPI_MARAX-MAT_GRP_SM = 'X'.
BAPI_MARAX-OLD_MAT_NO = 'X'.
BAPI_MARAX-BASE_UOM = 'X'.
BAPI_MARAX-BASE_UOM_ISO = 'X'.
BAPI_MARAX-BASIC_MATL = 'X'.
BAPI_MARAX-MFR_NO = 'X'.
BAPI_MARAX-HAZMATPROF = 'X'.
BAPI_MARAX-ENVT_RLVT = 'X'.
BAPI_MARAX-PO_UNIT = 'X'.
BAPI_MARAX-PACK_VO_UN = 'X'.
BAPI_MARAX-VAR_ORD_UN = 'X'.
BAPI_MARAX-PUR_VALKEY = 'X'.
BAPI_MARAX-MANU_MAT = 'X'.
BAPI_MARAX-MFR_NO = 'X'.
*PLANT DATA
BAPI_MARC-PLANT = IT_MATMASTER-WERKS.
BAPI_MARC-PUR_GROUP = IT_MATMASTER-EKGRP.
BAPI_MARC-BATCH_MGMT = IT_MATMASTER-XCHPF.
BAPI_MARC-GR_PR_TIME = IT_MATMASTER-WEBAZ.
BAPI_MARCX-PLANT = IT_MATMASTER-WERKS.
BAPI_MARCX-PUR_GROUP = 'X'.
BAPI_MARCX-BATCH_MGMT = 'X'.
BAPI_MARCX-GR_PR_TIME = 'X'.
*VALUATION DATA
BAPI_MBEW-PRICE_CTRL = IT_MATMASTER-VPRSV.
BAPI_MBEW-STD_PRICE = IT_MATMASTER-STPRS.
BAPI_MBEW-COMMPRICE1 = IT_MATMASTER-BWPRH.
BAPI_MBEW-VAL_AREA = IT_MATMASTER-BWKEY.
BAPI_MBEW-VAL_CLASS = IT_MATMASTER-BKLAS.
BAPI_MBEWX-PRICE_CTRL = 'X'.
BAPI_MBEWX-STD_PRICE = 'X'.
BAPI_MBEWX-COMMPRICE1 = 'X'.
BAPI_MBEWX-VAL_AREA = IT_MATMASTER-BWKEY.
BAPI_MBEWX-VAL_CLASS = 'X'.
IT_MATERIALDESC-LANGU = 'EN'.
IT_MATERIALDESC-MATL_DESC = IT_MATMASTER-MAKTX.
append IT_materialdesc.
IT_UOM-GROSS_WT = IT_MATMASTER-BRGEW.
IT_UOM-ALT_UNIT = 'KG'.
IT_UOM-ALT_UNIT_ISO = 'KG'.
IT_UOM-UNIT_OF_WT = IT_MATMASTER-GEWEI.
APPEND IT_UOM.
IT_UOMX-GROSS_WT = 'X'.
IT_UOMX-ALT_UNIT = 'KG'.
IT_UOMX-ALT_UNIT_ISO = 'KG'.
IT_UOMX-UNIT_OF_WT = 'X'.
APPEND IT_UOMX.
it_mean-unit = 'KD3'.
append it_mean.
it_mltx-langu = 'E'.
it_mltx-text_name = it_matmaster-matnr.
APPEND IT_MLTX.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = BAPIMATHEAD
CLIENTDATA = BAPI_MARA
CLIENTDATAX = BAPI_MARAx
PLANTDATA = BAPI_MARc
PLANTDATAX = BAPI_MARcx
FORECASTPARAMETERS =
FORECASTPARAMETERSX =
PLANNINGDATA =
PLANNINGDATAX =
STORAGELOCATIONDATA =
STORAGELOCATIONDATAX =
VALUATIONDATA = BAPI_MBEW
VALUATIONDATAX = BAPI_MBEWX
WAREHOUSENUMBERDATA =
WAREHOUSENUMBERDATAX =
SALESDATA =
SALESDATAX =
STORAGETYPEDATA =
STORAGETYPEDATAX =
FLAG_ONLINE = ' '
FLAG_CAD_CALL = ' '
IMPORTING
RETURN = IT_RETURN
TABLES
MATERIALDESCRIPTION = IT_MATERIALDESC
UNITSOFMEASURE = IT_UOM
UNITSOFMEASUREX = IT_UOMX
INTERNATIONALARTNOS = it_mean
MATERIALLONGTEXT = IT_MLTX
TAXCLASSIFICATIONS =
RETURNMESSAGES =
PRTDATA =
PRTDATAX =
EXTENSIONIN =
EXTENSIONINX =
read table it_return with key TYPE = 'S'.
if sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
*else.
*CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
IMPORTING
RETURN =
endif.
WRITE:/ IT_RETURN-TYPE,
2 IT_RETURN-ID,
22 IT_RETURN-NUMBER,
25 IT_RETURN-MESSAGE.
IT_RETURN-LOG_NO,
IT_RETURN-LOG_MSG_NO,
IT_RETURN-MESSAGE_V1,
IT_RETURN-MESSAGE_V2,
IT_RETURN-MESSAGE_V3,
IT_RETURN-MESSAGE_V4,
IT_RETURN-PARAMETER,
IT_RETURN-ROW,
IT_RETURN-FIELD,
IT_RETURN-SYSTEM.
ENDLOOP.[/code]
Reward if useful.
Dara. -
Permeant delete material from systeam
hi gurus
plz help me how to delete materail from the systeam.i want delate a material permentaly also names& stock.Hi,
to delete material use t-code MM06.
and if you want that material should not be used for any transaction then go-to MM03 enter material no. select 'Basic Data View 'in that there is a field called 'X-plant matl status'
choose a valid value and just opposite to this field there is a field called 'Valid from' enter todays date in that field then from today your material will be blocked.
otherwise if you want to delete a view from the material use t-code MM50 and if you want to delete all the materials from your client use t-code MMDE and to archive the material use t-code MM71
below mention link will help you in understanding the archiving process.
http://help.sap.com/saphelp_erp2005/helpdata/en/8d/3e59bc462a11d189000000e8323d3a/content.htm
Regards,
Archit
Maybe you are looking for
-
Can someone please help me? I have a toshiba satelitte M45-s165 and for a couple of weeks I had been having trouble with it wanting to start up in bios screen so I created a boot disk which seemed to work but the other day while I was working it sudd
-
Getting following error when trying to run my application through eclipse
Hi i am getting following error when i am trying to execute my program from my eclipse id 3.2 .Plz help me .I have also increase jvm memory upto 256M but it doesnt work. [java] E:\tarun\java\workspace1\Nss_Gui\main\build.xml:62: java.io.IOException:
-
Hi, I am a beginner in Java and I am using JBuilder. How can I adding existing classes in my applet ? I got this error for each class I added: "MyClass.java": Package D:\applet_testing\jbuilder\browser2\MyApplet\src\MyApplet\MirageBrowser.java stated
-
Extending JDeveloper: Creating a new project within an extension
I am trying to use the JDeveloper extension to create a wizard, to create a new project. Creating the wizard was no problem at all. I am having difficulting creating a new project and adding it to the current workspace. Can somebody please tell me ho
-
Three TS people and a total of six hours with a phone pressed to my ear later and my iPhone won't activate. It says no service where I'm assuming there should be antenna bars. TS obviously has no clue, as two people said they would call me back yeste