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

BDC For Tcode IB02

Former Member
0 Likes
1,783

Hi All,

I am trying to make bdc for tcode IB02( Bill of material change), as i am facing lot of problem in that like :

1. screen number gets change,

2. OK code is not working as recorded through SHDB

At the end i am not able to design bdc for IB02, so please suggest if there is any BAPI for IB02 tcode or provide me some solution in BDC :

i have wriiten the code as mentioned below :

PERFORM BDC_DYNPRO      USING 'SAPLCSDI'              '0200'.

PERFORM BDC_FIELD       USING 'BDC_CURSOR'            'RC29N-STLAN'.

PERFORM BDC_FIELD       USING 'BDC_OKCODE'            '/00'.

PERFORM BDC_FIELD       USING 'RC29N-EQUNR'           WA_TABLE-EQUNR.

PERFORM BDC_FIELD       USING 'RC29N-WERKS'           WA_TABLE-WERKS.

PERFORM BDC_FIELD       USING 'RC29N-STLAN'           WA_TABLE-STLAN.

PERFORM BDC_FIELD       USING 'RC29N-DATUV'           '26.06.2014'.

PERFORM BDC_DYNPRO      USING 'SAPLCSDI'              '0150'.

PERFORM BDC_FIELD       USING 'BDC_OKCODE'            '=ERFA'.

PERFORM BDC_FIELD       USING 'BDC_CURSOR'            'RC29P-POSNR(01)'.

PERFORM BDC_DYNPRO      USING 'SAPLCSDI'              '0150'.

PERFORM BDC_FIELD       USING 'BDC_OKCODE'            '/00'.

PERFORM BDC_FIELD       USING 'BDC_CURSOR'            'RC29P-POSTP'.

PERFORM BDC_FIELD       USING 'RC29P-POSTP'           WA_TABLE-POSTP.

PERFORM BDC_FIELD       USING 'RC29P-IDNRK'           WA_TABLE-IDNRK.

PERFORM BDC_FIELD       USING 'RC29P-MENGE'           WA_TABLE-MENGE.

PERFORM BDC_FIELD       USING 'RC29P-MEINS'           'EA'.

PERFORM BDC_DYNPRO      USING 'SAPLCSDI'              '0150'.

PERFORM BDC_FIELD       USING 'BDC_OKCODE'            '=FCBU'.

PERFORM BDC_FIELD       USING 'BDC_CURSOR'            'RC29P-POSTP'.

       ctu_param-updmode = 'N'.

       ctu_param-dismode = p_dismod.

       CALL TRANSACTION 'IB02'

                 USING it_bdcdata

                 OPTIONS FROM ctu_param

                 MESSAGES INTO git_msg_tab.

Endform.

Regards,

Deepak kansal.

1 ACCEPTED SOLUTION
Read only

jogeswararao_kavala
Active Contributor
0 Likes
1,480

Deepak,

I'm sharing the code I developed long ago for changing Equipment BOM (IB02). Used to Add more components to exiting Eq BOM. With this, it is possible that you got a ready solution OR you may have to do little changes. I believe that the hurdles you are facing will be addressed.

Jogeswara Rao K

8 REPLIES 8
Read only

Former Member
0 Likes
1,480

Hi Deepak,

Please check "CSAP_MAT_BOM_MAINTAIN" function module.

Regards,

Venkat.

Read only

0 Likes
1,480

Hi,

Thanks for your reply !!!

But i need to create a components against equipment, so i think this one BAPI is suitable according to the requirement.

Regards,

Deepak kansal

Read only

0 Likes
1,480

use below details in LSMW.

Object: 0030 Material BOM

Method: 0002 Change

Program Name: RCSBI020

Read only

jogeswararao_kavala
Active Contributor
0 Likes
1,481

Deepak,

I'm sharing the code I developed long ago for changing Equipment BOM (IB02). Used to Add more components to exiting Eq BOM. With this, it is possible that you got a ready solution OR you may have to do little changes. I believe that the hurdles you are facing will be addressed.

Jogeswara Rao K

Read only

0 Likes
1,480

Hi Jogeswara,

Please share code as mentioned by you in earlier reply.

Thanks in advance !!!

Regards,

Deepak Kansal.

Read only

0 Likes
1,480

Already shared. It is an attachment below the post. Confirm you've got it.

Read only

0 Likes
1,480

Hi jogeswara,

Yes i have received....looking into it.

Thanks,

Deepak kansal.

Read only

Former Member
0 Likes
1,480

Hi,


Whenever if you face screen sequence problem in BDC, it always preferred to go for Bapi...

For IB02.
1) Read Equipment BOM using BAPI CSAI_BOM_READ.

2) Add/Change line items using BAPI : CSAI_BOM_MAINTAIN.

I have tested the below program, it working fine. And the same will definately help you.

DATA: gs_csin TYPE csin,
       gs_stko TYPE stkob,
       gs_stzu TYPE stzub.

DATA: gt_stpo TYPE TABLE OF stpob,
      gt_stko TYPE TABLE OF stkob,
      gs_stpo TYPE stpob.

CONSTANTS: c_x      TYPE char01 VALUE 'X'.

START-OF-SELECTION.  gs_csin-stlty = 'E'.
  gs_csin-stlan = '4'.
  gs_csin-werks = 'GA01'.
  gs_csin-equnr = '000000000030000057'.
  gs_csin-DATUB = '20140702'.

  CALL FUNCTION 'CSAI_BOM_READ'
       EXPORTING
         ecsin              = gs_csin
* IMPORTING
*   FL_WARNING         =
      TABLES
        t_stpob            = gt_stpo
        t_stkob            = gt_stko
*   T_DEP_DATA         =
*   T_DEP_DESCR        =
*   T_DEP_ORDER        =
*   T_DEP_SOURCE       =
*   T_DEP_DOC          =
   EXCEPTIONS
     ERROR              = 1
     OTHERS             = 2
               .
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    exit.
  ENDIF.

  READ TABLE gt_stko INTO gs_stko INDEX 1.
  gs_csin-trtyp = 'B'. "Update
  gs_csin-stlnr = gs_stko-stlnr.
  gs_csin-aennr = gs_stko-aennr.
  gs_csin-datuv = gs_stko-datuv.


****New Item.
  gs_stpo-stlty = 'M'.
  gs_stpo-postp = 'L'.
  gs_stpo-idnrk = 'TEST001'.
  gs_stpo-menge = 7.
  gs_stpo-meins = 'EA'.
  gs_stpo-rvrel = c_x.
  APPEND gs_stpo TO gt_stpo.

  CALL FUNCTION 'CSAI_BOM_MAINTAIN'
    EXPORTING
*      FL_BOM_CREATE                = ' '
* fl_new_item      =    c_x
* fl_complete                  = c_x
      ecsin                        = gs_csin
      estkob                       = gs_stko
      estzub                       = gs_stzu
* FL_NO_CHANGE_DOC     =   ' '
* FL_COMMIT_AND_WAIT           = ' '
* FL_NO_COMMIT_WORK = ' '
* FL_ALE                       = ' '
* FL_DEFAULT_VALUES = 'X'
* FL_NEW_ROMEN                 = 'X'
* FL_RECURSIVE = ' '
*FL_IMPLICIT_SUBITEM_DELETION = *
*    IMPORTING
* FL_WARNING                   =
* ASTKOB                       =
* ASTZUB                       =
      TABLES
     t_stpob                      = gt_stpo
      et_stpob                     = gt_stpo
*T_STPUB =
*T_LTX_ITM                    =
*T_LTX_BOM                    =
EXCEPTIONS
ERROR                        = 1
OTHERS  =    2
.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

Also refer link:

regards,

Rajesh Sadula.