CSAP_MAT_BOM_MAINTAIN
Hi,
I am trying to change quantity of a existing Material BOM item using CSAP_MAT_BOM_MAINTAIN function module. I am passing Material, Plant, BOM Usage, Valid from (same as in exisiting BOM), FL_COMMIT_AND_WAIT = X, FL_DEFAULT_VALUES = X and populating the following field in T_STPO table ITEM_CATEG, ITEM_NO, COMPONENT, COMP_QTY, COMP_UNIT, BOM_NO, ITEM_NODE, ITEM_COUNT fields. SAP is not returning any errors instead it's creating a new line item but requirement is to change the line item.
Thanks in advance.
Regards,
Balaji Viswanath.
Hi,
try to use the Function Module :
CSAP_MAT_BOM_ITEM_SELECT
I hope it is helpful,
Regards,
Sandeep Kaushik
Similar Messages
-
Error while creating BOM with FM CSAP_MAT_BOM_MAINTAIN
Hi All,
While creating the bom with the FM "CSAP_MAT_BOM_MAINTAIN" using change number i am getting the below error message.
" Processing of this object is not supported with change number."
Please help me out.
Regards
Sureshcall function 'CSAP_MAT_BOM_MAINTAIN'
exporting
material = material
plant = plant
bom_usage = usage
alternative = alternat
valid_from = y_date
* CHANGE_NO = "<----Have u used this field for creating ?
* REVISION_LEVEL =
i_stko = l_stko
* FL_NO_CHANGE_DOC = ' '
fl_commit_and_wait = 'X'
fl_bom_create = 'X'
fl_new_item = ' '
fl_complete = ' '
* IMPORTING
* FL_WARNING =
* O_STKO =
CSAP_MAT_BOM_CREATE would be an ideal one for creation and CSAP_MAT_BOM_MAINTAIN for change
Regards,
Mithun Shetty. -
Error in Creating a BOM / CSAP_MAT_BOM_MAINTAIN
hi,
i need to create multiple bom alternatives in my development. i try using CSAP_MAT_BOM_MAINTAIN for this purpose.
even after i give all the inputs and flags necessary for creating a new bom, i am getting an error stating that bom already exist for....when i go and check MAST table, for the same material, plant and bom usage... no such alternative exist.
i am unable to proceed further. can anyone help me in this regard? thanks in advance.friend... you are right.
CSAP_MAT_BOM_MAINTAIN is used to create only one alternative bom. but this can be any number from 01 to 99. if any alternative bom exist for the same combination of material, plant and bom usage... then you cannot create any more alternative bom for the above mentioned combination. this is because... this function module checks MAST table before proceeding with creation. while checking MAST, it considers only material, plant and bom usage. alternative bom is left out here. but the real fact is... alternative bom should be also considered for uniqueness of bom while checking MAST. all these issues are only during bom creation, but the same function module works perfect during bom maintenance.
CSAP_MAT_BOM_CREATE is also used to create only one alternative bom. but this can be only one number - 01 (default). but, you cannot maintain a bom using this function module. you need to use CSAP_MAT_BOM_MAINTAIN for bom maintenance.
to create any number of alternative bom for a material, plant and bom usage combination... you need to use the function module BAPI_MATERIAL_BOM_GROUP_CREATE. but... you cannot maintain any bom or create object dependencies for line items using this function module.
summary:
to create a bom.. use BAPI_MATERIAL_BOM_GROUP_CREATE
to read a bom.. use CSAP_MAT_BOM_READ
to maintain a bom.. use CSAP_MAT_BOM_MAINTAIN.
to create object dependency.. use CSAP_MAT_BOM_OPEN , CSAP_BOM_ITEM_MAINTAIN , CSAP_MAT_BOM_CLOSE. -
hi:
i want to create a material first with "BAPI_MATERIAL_SAVEDATA",then i want to add this material as a component
to a existing BOM with "CSAP_MAT_BOM_MAINTAIN".
1 I create the material using "BAPI_MATERIAL_SAVEDATA" without "BAPI_TRANSACTION_COMMIT".
2 I use "CSAP_MAT_BOM_MAINTAIN" to add the material to a existing BOM.
Before this test,i think "CSAP_MAT_BOM_MAINTAIN" will raise an exception:
"The material XXX does not exist or is not activated"
But the result is:Material is created successfully and the BOM is added a component with a commit implicitly.
How can "CSAP_MAT_BOM_MAINTAIN" read the material which is not committed to the DB?
BTW:Even if "CSAP_MAT_BOM_MAINTAIN" raise a exception,i can use "BAPI_TRANSACTION_COMMIT" to rollback both the
created material and the changed BOM.
I am confused!!
Following is the sample code of this case:
*& Report Z_TESTYM23
REPORT z_testym23.
DATA mat LIKE bapimathead-material VALUE '000000000000002814'. "created material no
DATA bom LIKE csap_mbom-matnr VALUE '000000000000002794'.
DATA change_no LIKE aenrb-aennr.
create ECN in sap
PERFORM ecn_create.
create material without commit
PERFORM mat_create.
*-- maintain BOM
PERFORM maintain_bom.
*& Form MAT_CREATE
CREATE MATERIAL
FORM mat_create .
DATA headdata LIKE bapimathead.
DATA clientdata LIKE bapi_mara.
DATA clientdatax LIKE bapi_marax.
DATA itab_makt LIKE TABLE OF bapi_makt.
DATA wa_makt LIKE bapi_makt.
DATA return LIKE bapiret2.
headdata-material = mat.
headdata-ind_sector = 'A'.
headdata-matl_type = 'ROH'.
headdata-basic_view = 'X'.
clientdata-base_uom = '2X'.
clientdatax-base_uom = 'X'.
wa_makt-langu = sy-langu.
wa_makt-matl_desc = 'TEST'.
APPEND wa_makt TO itab_makt.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = headdata
clientdata = clientdata
clientdatax = clientdatax
IMPORTING
return = return
TABLES
materialdescription = itab_makt.
CHECK return-type <> 'S'.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
MESSAGE return-message TYPE 'E'.
ENDFORM. " MAT_CREATE
*& Form MAINTAIN_BOM
Maintain BOM
FORM maintain_bom .
DATA i_datum(10).
DATA i_stko TYPE stko_api01.
DATA t_stpo LIKE TABLE OF stpo_api03.
DATA w_stpo LIKE stpo_api03..
WRITE sy-datum TO i_datum.
w_stpo-item_categ = 'L'.
w_stpo-component = mat.
w_stpo-comp_qty = '2'.
APPEND w_stpo TO t_stpo.
CALL FUNCTION 'CSAP_MAT_BOM_MAINTAIN'
EXPORTING
material = bom
bom_usage = '1'
valid_from = i_datum
change_no = change_no "correct no:'500000000053';incorrect no:'500000000153'
i_stko = i_stko
fl_complete = 'X'
TABLES
t_stpo = t_stpo
EXCEPTIONS
error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'. "Rollback BOM and material
ELSE.
CALL FUNCTION 'BUFFER_REFRESH_ALL'. "Remained process of function:BAPI_TRANSACTION_COMMIT
WRITE: / 'Everything is OK',
/ 'CHANGE_NO: ',change_no,
/ 'MATERIAL NO: ',mat,
/ 'BOM: ', bom.
ENDIF.
ENDFORM. " MAINTAIN_BOM
*& Form ECN_CREATE
Create ECN
FORM ecn_create .
DATA change_header LIKE aenr_api01.
DATA object_bom LIKE aenv_api01.
change_header-status = '01'.
change_header-valid_from = '2007/06/01'.
change_header-descript = 'test'.
object_bom-active = 'X'.
CALL FUNCTION 'CCAP_ECN_CREATE'
EXPORTING
change_header = change_header
object_bom = object_bom
FL_COMMIT_AND_WAIT = 'X'
FL_NO_COMMIT_WORK = 'X'
IMPORTING
change_no = change_no
EXCEPTIONS
change_no_already_exists = 1
error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'E' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " ECN_CREATE
Regards
MingI did another test as following:
*& Report Z_TESTYM23
REPORT z_testym23.
DATA mat LIKE bapimathead-material VALUE '000000000000002816'. "created material no
create material without commit
PERFORM mat_create.
*& Form MAT_CREATE
CREATE MATERIAL
FORM mat_create .
DATA headdata LIKE bapimathead.
DATA clientdata LIKE bapi_mara.
DATA clientdatax LIKE bapi_marax.
DATA itab_makt LIKE TABLE OF bapi_makt.
DATA wa_makt LIKE bapi_makt.
DATA return LIKE bapiret2.
headdata-material = mat.
headdata-ind_sector = 'A'.
headdata-matl_type = 'ROH'.
headdata-basic_view = 'X'.
clientdata-base_uom = '2X'.
clientdatax-base_uom = 'X'.
wa_makt-langu = sy-langu.
wa_makt-matl_desc = 'TEST'.
APPEND wa_makt TO itab_makt.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = headdata
clientdata = clientdata
clientdatax = clientdatax
IMPORTING
return = return
TABLES
materialdescription = itab_makt.
CALL FUNCTION 'MARA_SINGLE_READ'
EXPORTING
KZRFB = ''
MAXTZ = 0
matnr = mat
SPERRMODUS = ' '
STD_SPERRMODUS = ' '
OUTPUT_NO_MESSAGE =
EXCEPTIONS
lock_on_material = 1
lock_system_error = 2
wrong_call = 3
not_found = 4
OTHERS = 5.
IF sy-subrc <> 0.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
SELECT COUNT(*) FROM MARA WHERE MATNR = MAT.
WRITE SY-DBCNT.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
WRITE return-message.
ENDFORM. " MAT_CREATE
SY-DBCNT = 1 and i can alse rollback the material -
BOM Update using a function module - 'CSAP_MAT_BOM_MAINTAIN'
Hi,
I have problem in updating the item status for a BOM using a function module - 'CSAP_MAT_BOM_MAINTAIN'.
My goal is reset the Checkbox for 'Indicator: item relevant to production'. When i pass the value ' '[Space] to the structure field 'T_STPO-REL_PROD' it doen't work.
Do let me know if you come across such problem & what needs to passed as input to reste the checkbox in the BOM.
Thanks & Regards,
BhargavaPLM wants to manipulate the Indicators u2013 u201CBulk Materialu201D & u201CCost Relevancyu201D in BOM.
Note: The 2 indicators [u201CBulk Materialu201D & u201CCost Relevancyu201D] are interlinked with each other for a business functionlity given by SAP. So, if we try to set both indicators we get the below SAP standard error.
E 29127 Bulk material not allowed for items relevant to costing
SAP Field Name RFC Tag SAP values PLM values Meaning for SAP field
Indicator: bulk material BULK_MAT Space ! No
Indicator: bulk material BULK_MAT X X Yes
Indicator: item relevant to costing REL_COST Space ! Not relevant to costing
Indicator: item relevant to costing REL_COST 1 1 Not relevant to costing
Indicator: item relevant to costing REL_COST 2 2 Packaging operation
Indicator: item relevant to costing REL_COST 3 3 Packaging material
Indicator: item relevant to costing REL_COST X X Relevant to costing
To achieve the clear/reset/set value for 2 indicators [u201CBulk Materialu201D & u201CCost Relevancyu201D] from PLM, only eitheir of indicators status needs to sent [i.e 1 indicator status @ a time]. -
Hi
In my current project I am facing the below issue.
In client MDM team is creating the master data. The BOM master data also creating through MDM only. The function module used is CSAP_MAT_BOM_MAINTAIN. When user trying to update the two extra BOM line items getting an error " Error while saving the BOM."
In SLG1 transaction we observed that the IDOC is trying to change the header level data. After analyzing I got some conclusion that
while BOM creation header level material and all components are created with change number reference. When the user trying to update two extra line items with new change number system giving error msg as idoc trying to change header level data. As my knowledge with FM:CSAP_MAT_BOM_MAINTAIN no changes possible for header. I came to conclusion as header is updated with a change number while creation and when we changing second time with new change number, system not able to replace the old change number with new change number.
To correct this IDOC what steps i can perform? Is it possible to reprocess this IDOC by changing any field values like MSGFN.
Please suggest what solution we can provide to reprocess this IDOC.
Regards
KesavaHi Rupesh
Thanks for the replay.
Here the user created the BOM with the same FM:CSAP_MAT_BOM_MAINTAIN but he created with change number refernce. This change number is updated in header. Later he wants to add some extra components to this BOM with the same FM:CSAP_MAT_BOM_MAINTAIN and he entered new change number second time to do the change. Then system giving an error status for this IDOC.Then if we check in SLG1 the error message is we are trying to change header fields which is not possible " The BOM header can only be displayed, Your entries were ingored". How can we reprocess this IDOC.
Regards
Kesava -
How to use CSAP_MAT_BOM_MAINTAIN for deleting / changing sub-items?
I'm trying to use CSAP_MAT_BOM_MAINTAIN for BOM create / change / delete.
Issue: This Function module is not working when I'm trying to delete / change sub-items of a BOM. I'm getting update termination (ABAP/4 processor: SAPSQL_ARRAY_INSERT_DUPREC) during BOM post.
Is there a way to fix this?
(1) BOM creation part is working fine
(2) BOM item (without any sub-item change) change / delete is also workinghi
The following parameter are important parameter and mandatory
Matnr ; Enter the material Number
BOM_USAGE : Ther many BOM available that is sales BOM and Production BOM etc here you need to mention usage of BOM that is for sales or production
I_STKO : Enter the BOM Header information . Note : Ask your Functional consultand
Apart form this parameter, all are optional so do worry
regards
anand kumar -
Dear Friends,
I am working on 3.0F Version.I have a requirement where when there is an update in the BOM from the 3rd party system, that changed field or quantity should be updated in the BOM.
I tried using CSAP_MAT_BOM_MAINTAIN and when I enter the material Number,Plant and BOM Usage...the FM goes to a Short Dump....
'' ABAP/4 runtime error CALL_FUNCTION_CONFLICT_LENG
The call to the function module "CSAP_MAT_BOM_MAINTAIN" is incorrect:
In the function module interface, you can specify only
fields of a specific type and length under "T_STPO".
Although the currently specified field
"%_OT_STPO[]" is the correct type, its length is incorrect.''
But I've tried to use the same Function Module in ECC 5.0 and it works perfectly fine and I am able to update the records.
Did anybody face a similar problem with 3.0 Version ??How to rectify this ??
Is there any other alternative or a solution for my problem ??
Please share your thoughts.
Warm Regards,
LakshmiHI,
I know it's a old subject but i just find the solution so to update long text feel the field
object_id in the table typed csltx_line for all the line you want to put in the header
with the below value:
* object_id = 0: Stücklistentext (STZU) (-> CS_DI_BOM_UPDATE)
* = 1: Alternativentext (STKO)
* = 2: Positionstext (STPO)
Regards -
It did not insert the materials in the BOM using 'CSAP_MAT_BOM_MAINTAIN'
Hi!
We developed a ABAP technical maintenance BOM.
In the program.
Before, we got current BOM and eliminated all related items.
Routine below.
LOOP AT INTO it_stpo wa_stpo.
MOVE-CORRESPONDING TO wa_stpo wa_stpo_i.
wa_stpo_i-id_itm_ctg = wa_stpo-item_categ.
wa_stpo_i-id_item_no = wa_stpo-item_no.
wa_stpo_i-id_comp = wa_stpo-component.
wa_stpo_i-fldelete = 'X'.
APPEND TO wa_stpo_i it_stpo_i.
ENDLOOP.
CALL FUNCTION 'CSAP_MAT_BOM_MAINTAIN'
EXPORTING
Stuff = pv_matnr
plant = p_werks
bom_usage = p_tplis
Alternative = p_altlis
VALID_FROM = v_valid_from
i_stko = pv_wa_stko
TABLES
t_stpo = it_stpo_i.
After , we inserted new materials in the BOM using the same function .
routine below
LOOP AT INTO it_tab_i wa_tab_i ins_up_del WHERE = '1 ' OR
ins_up_del = '2 ' .
wa_stpo_i - item_categ = ' L' .
wa_stpo_i -component = wa_tab_i - matnr_pri .
v_menge_i = wa_tab_i - menge ( 9 ) .
v_menge = v_menge_i / 1000 .
WRITE TO v_menge wa_stpo_i - comp_qty .
wa_stpo_i - comp_unit = " KG " .
wa_stpo_i - issue_loc = " COS " .
APPEND TO wa_stpo_i it_stpo_i .
ENDLOOP .
* Including new materials in the BOM .
CALL FUNCTION ' CSAP_MAT_BOM_MAINTAIN '
EXPORTING
Stuff = pv_matnr
plant = p_werks
bom_usage = p_tplis
Alternative = p_altlis
VALID_FROM = v_valid_from
i_stko = pv_wa_stko
IMPORTING
fl_warning = v_fl_warning
TABLES
t_stpo = it_stpo_i
EXCEPTIONS
error = 1
OTHERS = 2 .
But the new materials were not inserted.
Could you help me what is missing in the routine ?
Thanks.Hi!
We found the problem.
The problem was in the fields ID_ITM_CTG, ID_ITEM_NO and ID_COMP.
They were not cleaned when we were inserting the new materials in the BOM. -
Issues while processing the BOMs using fm ''CSAP_MAT_BOM_MAINTAIN'
Hi Group,
we are facing issues while processing the BOMs using the basic type(Z-idoc type) for standard type BOMMAT04.
thing is that the segment 'E1STPOM' is defined to contain 1 to 99999 records in it.
when an Idoc is run(say with 150/200 segments of 'E1STPOM'), there was a standard error with error message id PIC01(number : 004) when the Idoc is processed with the Standard function module 'CSAP_MAT_BOM_MAINTAIN'.
the error says 'Error reading material FING_005 . Exception: 0' and Check whether the material number is blocked. but when checked, the Material seems not blocked.
kindly advise how to overcome this error and proceed further.
Regards,
VishnuChecj the material status, while its transfer from one server to another server the status should be different
-
CSAP_MAT_BOM_CREATE\CSAP_MAT_BOM_MAINTAIN
SAPiens,
We are using the above mentioned RFMs to pass material bill of materials data in to SAP from an external system. These RFMs are not providing meaningful errors upon data failure. For example, if we pass a Change Order number which is not existing in SAP, these RFMs simply says, Error, thats all. In our scenario, we have choosen CSAP_MAT_BOM_MAINTAIN since we have to send delta BOM changes (only changes, not the complete BOM).
Please suggest is there any way to derive meaningful error log by using any other function module in conjunction with CSAP_MAT_BOM_MAINTAIN. OR is there any other RFM which carries only BOM changes and at the same time give some meaningful errors?
Thanks so much in Advance
AmanAman,
Try BAPI mentioned in attached link. There is a sample code too.
http://sap.ittoolbox.com/code/archives.asp?d=2270&a=s
ashish -
CSAP_MAT_BOM_MAINTAIN Alternative ?
Hi Friends ,
I would like to know if there is a BAPI i can use instead of CSAP_MAT_BOM_MAINTAIN. I want to try using a BAPI because this function module is causing change in the ECM number of the other vairant BOMS which were not intended to be changed .
Thank you ,
HariHi Hari,
check in SE37 by doing a F4 on BOMUPD* u will a couple of direct update FM's. But i think they will all update the ECM number.
Try ur luck.
Cheers
VJ -
CSAP_MAT_BOM_MAINTAIN - strange errors (+)
Hello,
In my program, I use CSAP_MAT_BOM_MAINTAIN function module to edit BOMs. In most cases, it works correctly, but sometimes, when large amount of data is processed, it returns error message, which says that "There're no active nametabs for CI_STPO". When I restart program (with the same data), it works correctly.
R/3 Release 4.7E.Hey,
Check the FM call you have made in the program. Import Parameter: FL_COMMIT_AND_WAIT = 'X'. check whether you've passed this flag.
Hope this helps you.
Regards, Murugesh AS -
FUNCTION 'CSAP_MAT_BOM_MAINTAIN'
I am trying to update a BOM. I am using
FUNCTION 'CSAP_MAT_BOM_OPEN'
FUNCTION 'CSAP_MAT_BOM_MAINTAIN'
The open returns a sy-subrc 0. so everything is ok
The maintain also completes successfully
However, the material # I am updating on the BOM does not get updated.
Any ideasHi ,
i am also facing same issue.its updating the quantity for the first time but it fails to update for the second item the same item id .
kindly help . -
CSAP_MAT_BOM_MAINTAIN change/create subitems
Hi,
I am 'trying' to write a program that can change / create subitems for components in existing bom's. I use CSAP_MAT_BOM_MAINTAIN but it just doesn't work.
Already searched the forum and tried all the tips ... no succes
Does anybody have experience with this or can provide me some example code ?
with regards
Erikhi
good
gt_stpo_api03-id_item_no = '0010'.
gt_stpo_api03-FLDELETE = 'X'.
gt_stpo_api03-component = 'Pass componet'.
APPEND gt_stpo_api03.
Try to use comitt work after FM.
Check the FM IDOC_INPUT_BOMMAT ,this fm use CSAP_MAT_BOM_MAINTAIN FM
thanks
mrutyun^
Maybe you are looking for
-
COnfiguration tab on ME21N screen at Item Overview level.
Hi All, In the Purchase order ME21N, screen at the Item Overview level, we have this tab called "Configuration" on the top right hand side of the item overview section. If i want to hide some of the fields from the user to view i think we can go and
-
JOptionPane...
im using JOptionPane.showMessageDialog... to ask the user something. the buttons are yes and no. now, how can i know if the user has clicked yes or the no button?
-
How to strip audio from DVD?
I want to get some audio off of a regular DVD - i want to import the audio (only) and use it on a new project. I have FCP, DVD SP. iDVD, Toast 7, iMovie but cannot figure out how to do it? Thanks
-
Oracle for large database + configuration
Hi I have some historical data for Stocks and Options that I want to save into an Oracle database. Currently I have about 190G of data and expect to grow about 5G per month. I have not completely thought about how to organize the tables. It is possib
-
Distroted sound with laptop expresscard soundcard
So I'm on a dell XPS 530m (about 2 years old) and I finally gave up on the internal sound (the buzz drove me crazy) and now I'm using a creative extreme audio notebook soundcard though my laptop's expresscard slot. Normally it runs just fine, sounds