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_BOM_ITEM_MAINTAIN - Problems while clearing custom fields

Former Member
0 Likes
1,222

Hi, I try to modify some bom items, it works fine so far, but I get into trouble when trying to update previosly filled fields with empty ones.

First, I check my structure and insert a 'delete field character' into initial fields:

LOOP AT fieldcat INTO wa_fieldcat.
        IF wa_fieldcat-fieldname EQ 'FLDELETE'.
          CONTINUE.
        ENDIF.
        ASSIGN COMPONENT wa_fieldcat-fieldname OF STRUCTURE bomline TO <field>.
        IF sy-subrc IS INITIAL.
          IF <field> IS INITIAL OR <field> EQ space.
            <field> = '!'.
          ENDIF.
        ELSE.
          MESSAGE 'Error while looping thru bomline structure to update fields' TYPE 'E'.
        ENDIF.
     ENDLOOP.

Then, I use CSAP_BOM_ITEM_MAINTAIN to update bom

CALL FUNCTION 'CSAP_BOM_ITEM_MAINTAIN'
    EXPORTING
      i_stpo                   = bomline
*         FL_DEP_ALE_CONFORM       = ' '
    IMPORTING
      o_stpo                   = bomline_out
      fl_warning               = warning
*       TABLES
*         T_DEP_DATA               =
*         T_DEP_DESCR              =
*         T_DEP_ORDER              =
*         T_DEP_SOURCE             =
*         T_DEP_DOC                =
    EXCEPTIONS
      error                    = 1
      OTHERS                   = 2
      .

So, this works out fine, but not for my custom fields in the stpo_api02's .INCLUDE structure. While the standard fields are deleted when I fill them with '!', the custom ones just contain '!' afterwards.

When I dont put '!' into my custom fields and make them initial prior invoking CSAP_BOM_ITEM_MAINTAIN, their contents stay untouched.

However, real updates, where field contents are changed to some value but initial work flawlessly, on both, the stock and my custom fields.

Any Idea on this?

4 REPLIES 4
Read only

Former Member
0 Likes
859

Hi,

Can you try to read the BOM items before changes and use the same structure in change BAPI by modifying the structure with only the changes. I guess this will support the clearing of the custom fields.

With Regards,

Rajesh V.

Read only

0 Likes
859

In fact, I already read the bom before trying to change it.

I invoke CSAP_MAT_BOM_OPEN first, that opens and reads materials bom,

set alle values to be changed, then fire CSAP_BOM_ITEM_MAINTAIN followed by CSAP_MAT_BOM_CLOSE, which shoud commit all changes.

Read only

0 Likes
859

See Note 1229874.

Regards, Özgen.

Edited by: ASELSAN IT Dept. on Apr 18, 2011 3:36 PM

Read only

Former Member
0 Likes
859

This message was moderated.