Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CSAP_MAT_BOM_MAINTAIN - change values to space

sven_1978
Explorer
10,899

Hi there,

I'm trying to clear some values of a bill of material (MBOM) with the function module CSAP_MAT_BOM_MAINTAIN. To achieve this I leave the fields empty - the fields are stko-alt_text, stko-bom_text and stpo-item_text1.

But as a result my values are completely ignored. They won't be updated.

If I try to fill the fields with not-empty-values, they are updated indeed and everything works fine.

My question: what do I have to do to clear the fields? Is there a special character to indicate that I want to change the value to emptiness? I'm very grateful for every advice.

Thanks

Here are some excerpts from my coding:

´ * clear header data     

CLEAR: ls_stko1-alt_text,            

ls_stko1-bom_text.

* clear position data     

LOOP AT lt_stpo INTO ls_stpo.       

CLEAR ls_stpo-item_text1.       

MODIFY lt_stpo FROM ls_stpo.     

ENDLOOP.

...     

CALL FUNCTION 'CSAP_MAT_BOM_MAINTAIN'       

EXPORTING         

     material    = ls_mast-matnr          

     plant       = ls_mast-werks          

     bom_usage   = ls_mast-stlan          

     alternative = ls_mast-stlal

     change_no   = ls_mast-aennr

     i_stko      = ls_stko1

TABLES          

     t_stpo      = lt_stpo

EXCEPTIONS          

     error       = 1.

1 ACCEPTED SOLUTION
Read only

sven_1978
Explorer
7,392

I found a solution to the problem myself. The FM that initializes the logging (CALO_INIT_API) has a parameter called "data reset sign". When you fill this with a special character (for example "!") you can use this as a delete indicator in the structures of CSAP_MAT_BOM_MAINTAIN.

It doesn't work in S4. Any other solutions in S4?

8 REPLIES 8
Read only

VenuAnumayam
Participant
0 Likes
7,392

As per the FM documentation,

Restrictions:

To date, changes to the BOM header are not yet supported.

Please note:

The item to be changed can be identified in two ways:

via the fields item category, item number, sort string, and object (depending on the item category, this can be material, document data, or class data).

The names of these identifying fields begin with 'ID_' and are contained in structure CSIDENT_02. Structure CSIDENT_02 is part of structure STPO_API03.

You can use any combination of these fields to identify the item, provided the fields identify the item uniquely. Otherwise you see the error message 'Item cannot be identified uniquely'.

via the BOM node and BOM item counter

These fields are only known to the system if you have read the BOM before. If you identify the item in this way, you should therefore use function modules CSAP_MAT_BOM_OPEN, CSAP_BOM_ITEM_MAINTAIN, or CSAP_MAT_BOM_CLOSE to change the BOM.

And it has provided a detailed example. Please follow that.

For e.g.,

*-- to change the quantity

  clear tstp3.

   tstp3-id_item_no = '0010'.                    "Item identification

   tstp3-comp_qty   = '5.000'.

   append tstp3.

Read only

0 Likes
7,392

Hi,

thanks for your reply... but like I wrote in my description, I am able to change existing values (header AND position by the way) to new values.

My problem only appears when I want to CLEAR the fields so that as a result my fields are EMPTY.

Maybe my description is not fully clear: I am trying to change existing BOM structures. Therefore I first read the existing BOM with the FM CSAP_MAT_BOM_READ. In the next step I only change my three fields and transfer the structures to CSAP_MAT_BOM_MAINTAIN.

Read only

0 Likes
7,392

Ok, got it. Instead of CLEAR, can you try pass an empty value and check? I'm not sure if it works though!!

For e.g, ls_stko1-alt_text = ' '.

Read only

0 Likes
7,392

Hi ravi,

yes I also tried passing an empty value. But it has the same effect.

Read only

sven_1978
Explorer
7,393

I found a solution to the problem myself. The FM that initializes the logging (CALO_INIT_API) has a parameter called "data reset sign". When you fill this with a special character (for example "!") you can use this as a delete indicator in the structures of CSAP_MAT_BOM_MAINTAIN.

Read only

Former Member
0 Likes
7,392

Hi Sven

Thank you very much for such as useful and helpful answer!!!

Read only

basis_hp3
Newcomer
0 Likes
7,392

Thanks so so so much! We came accross this problem several months ago. No alternative solution found In these month until today.Helps a lot.

Read only

0 Likes
4,818

It doesn't work in S4. Any other solutions in S4?