2008 Jun 16 5:51 PM
Hi All,
I am facing a problem with this function module for changing the BOM quantity.I am passing values to the parameters
ID_ITM_CTG,ID_ITEM_NO,ID_ITEM_NO in addition to this
I am passing the header details correctly.Always instead of changing the quantity it is adding new item always.
Please suggest somebody if anybody has done for the samerequirement.
Regards
Mahesh
Hi All,
I am facing a problem with this function module for changing the BOM quantity.I am passing values to the parameters
ID_ITM_CTG,ID_ITEM_NO,ID_ITEM_NO in addition to this
I am passing the header details correctly.Always instead of changing the quantity it is adding new item always.
Please suggest somebody if anybody has done for the samerequirement.
Regards
Mahesh
2008 Jun 18 12:01 PM
Hi Mahesh,
The following code works for updating the item in the BOM
&----
*& Report YBOM
*&
&----
*&
*&
&----
REPORT YBOM.
DATA: BEGIN OF TSTKO.
INCLUDE STRUCTURE STKO_API01.
DATA: END OF TSTKO.
*BOM header data structure
DATA: BEGIN OF TSTK2.
INCLUDE STRUCTURE STKO_API02.
DATA: END OF TSTK2.
*BOM items table
DATA: BEGIN OF TSTP3 OCCURS 0.
INCLUDE STRUCTURE STPO_API03.
DATA: END OF TSTP3.
DATA: FLG_WARNING LIKE CAPIFLAG-FLWARNING.
*Fill item data
*Exception: items that can be identified uniquely via their item
*number
*1. Item 0010: change quantity
CLEAR TSTP3.
TSTP3-ID_ITEM_NO = '0010'. "Item identification
TSTP3-COMP_QTY = '7.000'.
APPEND TSTP3.
*2. Item 0020: change quantity
CLEAR TSTP3.
TSTP3-ID_ITEM_NO = '0020'. "Item identification.
TSTP3-COMP_QTY = '7.000'.
APPEND TSTP3.
*3. item 0030 change quantity
CLEAR TSTP3.
TSTP3-ITEM_NO = '0030'.
TSTP3-COMP_QTY = '7.000'.
APPEND TSTP3.
*4. Item 0040: change quantity
CLEAR TSTP3.
TSTP3-ID_ITEM_NO = '0040'. "Item identification
TSTP3-COMP_QTY = '7.000'.
APPEND TSTP3.
*Change BOM
CALL FUNCTION 'CSAP_MAT_BOM_MAINTAIN'
EXPORTING
MATERIAL = 'CPF10104'
PLANT = '0001'
VALID_FROM = '07.08.2003'
BOM_USAGE = '1'
ALTERNATIVE = '01'
FL_BOM_CREATE = ' '
FL_NEW_ITEM = ' '
I_STKO = TSTKO
IMPORTING
FL_WARNING = FLG_WARNING
O_STKO = TSTK2
TABLES
T_STPO = TSTP3
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC EQ 1.
*Error
*Please see log
WRITE: 'error'.
ELSE.
WRITE 'updated'.
ENDIF.
IF FLG_WARNING EQ 'X'.
*Please see log for information, warning messages, and *success messages.
ENDIF.
Please give only the Item number and the quantity to be updated in the Item Internal table.
Hope it help,
Regards,
Janani
Edited by: janani chakrapani on Jun 18, 2008 4:31 PM
2008 Jun 18 12:30 PM
Hi,
I think you have to set a deletion flag (DELETE_IND) in the structure STKO_API01, that is there in the input parameters.
This would delete the old entries in the BOM, if any .
and new entries will be replaced then.
2016 Jul 07 10:52 AM
Hello,
You need to retrieve the GUIDX of the item number from the table STPO and then populate it in the T_STPO structure for the field ID_GUID of the module function.
For me it works. It updates the item line instead of creating a new one.
Plz try it.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |