Application Development 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: 

Changing WBS related routings using FM CP_BD_DIRECT_INPUT_PLMZ possible?

0 Kudos

Is it possible to change WBS related routings using this FM...

Unfortunytely it seems that this FM checks ferenced BOM by FMs for BOM Explosion.

When trying to execute BOM Explosion in FM CM_DI_MAT_PROV_BTCI (function module to change PLMZ using Batch Input) in coding only FMs for Material BOMs or Order BOMs are called depending on goven value for vbeln...

If it is not possible to change WBS related routings with this FM, is ther another FM (BAPI) to do this ?

1 ACCEPTED SOLUTION

vinoth_aruldass
Contributor
0 Kudos

hi ,

you can use this

sample code is

DATA:

      ls_plmz TYPE  PLMZ_DI,

      lt_plmz TYPE TABLE OF PLMZ_DI,

      lt_MFIELDRES TYPE TABLE OF  MFIELDRES,

      lt_ERROR_DI TYPE TABLE OF ERROR_DI,

      lt_CMFMSG TYPE TABLE OF CMFMSG,

      ls_ERROR_DI TYPE ERROR_DI,

      ls_SAVE_DI TYPE SAVE_DI,

      d_PLNNR TYPE PLNNR.

      "ls_ERROR_DI TYPE ERROR_DI,

      "lt_CMFMSG TYPE TABLE OF CMFMSG.

          .

  ls_plmz-MANDT = '100'.

  ls_plmz-PLNTY = 'N'.

  ls_plmz-PLNNR = '50000063'.

  ls_plmz-ZUONR = '1'.

  ls_plmz-ZAEHL = '1'.

  ls_plmz-PLNAL = '02'.

  ls_plmz-PLNFL = '000000'.

  ls_plmz-PLNKN = '00000002'.

  ls_plmz-STLTY = 'M'.

  ls_plmz-STLNR = '00000198'.

  ls_plmz-STLAL = '01'.

  ls_plmz-STLKN = '00000001'.

  ls_plmz-STLTY_W = 'M'.

  ls_plmz-STLNR_W = '00000198'.

  ls_plmz-STLAL_W = '01'.

  ls_plmz-MENGE = '1.000'.

  append ls_plmz to lt_plmz.

CALL FUNCTION 'CP_BD_DIRECT_INPUT_PLMZ' "

  IMPORTING

    error_di_exp = ls_ERROR_DI            

  TABLES

    plmz_di_tab = lt_plmz             

    null_field_tab =  lt_MFIELDRES         

    error_di_tab = lt_ERROR_DI            

    error_tab = lt_CMFMSG               

  EXCEPTIONS

    NO_INZ = 1. 

d_PLNNR = '50000063'.

CALL FUNCTION 'CP_BD_DIRECT_INPUT_SAVE' "

  EXPORTING

    save_di_imp = ls_SAVE_DI            

  IMPORTING

    plnnr_exp = d_PLNNR                

    error_di_exp = ls_ERROR_DI            

  TABLES

    error_tab = lt_CMFMSG               

  EXCEPTIONS

    NO_INZ = 1.

hope this will be helpful...

2 REPLIES 2

vinoth_aruldass
Contributor
0 Kudos

hi ,

you can use this

sample code is

DATA:

      ls_plmz TYPE  PLMZ_DI,

      lt_plmz TYPE TABLE OF PLMZ_DI,

      lt_MFIELDRES TYPE TABLE OF  MFIELDRES,

      lt_ERROR_DI TYPE TABLE OF ERROR_DI,

      lt_CMFMSG TYPE TABLE OF CMFMSG,

      ls_ERROR_DI TYPE ERROR_DI,

      ls_SAVE_DI TYPE SAVE_DI,

      d_PLNNR TYPE PLNNR.

      "ls_ERROR_DI TYPE ERROR_DI,

      "lt_CMFMSG TYPE TABLE OF CMFMSG.

          .

  ls_plmz-MANDT = '100'.

  ls_plmz-PLNTY = 'N'.

  ls_plmz-PLNNR = '50000063'.

  ls_plmz-ZUONR = '1'.

  ls_plmz-ZAEHL = '1'.

  ls_plmz-PLNAL = '02'.

  ls_plmz-PLNFL = '000000'.

  ls_plmz-PLNKN = '00000002'.

  ls_plmz-STLTY = 'M'.

  ls_plmz-STLNR = '00000198'.

  ls_plmz-STLAL = '01'.

  ls_plmz-STLKN = '00000001'.

  ls_plmz-STLTY_W = 'M'.

  ls_plmz-STLNR_W = '00000198'.

  ls_plmz-STLAL_W = '01'.

  ls_plmz-MENGE = '1.000'.

  append ls_plmz to lt_plmz.

CALL FUNCTION 'CP_BD_DIRECT_INPUT_PLMZ' "

  IMPORTING

    error_di_exp = ls_ERROR_DI            

  TABLES

    plmz_di_tab = lt_plmz             

    null_field_tab =  lt_MFIELDRES         

    error_di_tab = lt_ERROR_DI            

    error_tab = lt_CMFMSG               

  EXCEPTIONS

    NO_INZ = 1. 

d_PLNNR = '50000063'.

CALL FUNCTION 'CP_BD_DIRECT_INPUT_SAVE' "

  EXPORTING

    save_di_imp = ls_SAVE_DI            

  IMPORTING

    plnnr_exp = d_PLNNR                

    error_di_exp = ls_ERROR_DI            

  TABLES

    error_tab = lt_CMFMSG               

  EXCEPTIONS

    NO_INZ = 1.

hope this will be helpful...

0 Kudos

Thank you, but your code seems to be a Material BOM related routing...

Difference is field PSPNR for WBS Elements...

If I supply PSPNR FM tries to execute a BOM Explosion using this FM s in FM

FM CM_DI_MAT_PROV_BTCI

IF mat_tab-vbeln IS INITIAL.
 
*     Materialstückliste
       
CALL FUNCTION 'CM_DI_DET_BOMAT_BTCI'
            
EXPORTING
               i_bomat
= mat_tab-matnr
               i_werks
= mat_tab-werks
               i_boman
= stzu_tmp-stlan
               i_bomal
= plmzd-stlal_w
            
IMPORTING
               e_bomat
= e_bomat
               e_werks
= e_werks
               e_boman
= e_boman
               e_bomal
= e_bomal.
 

 
* Stückliste auflösen
 
*=======================================================================
         
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
              
EXPORTING
                    aufsw                
= const-flg_yes
                    ftrel                
= l_flg_ftrel
                    mdmps                
= const-flg_yes
                    mdnot                
= const-flg_yes
                    capid                
= '    '
                    datuv                
= sttag_imp
                    mehrs                
= const-flg_yes
                    mtnrv                
= e_bomat " MAT_TAB-MATNR
                    mmory                
= l_flg_mmory
                    stlal                
= e_bomal " PLMZD-STLAL_W
                    stlan                
= e_boman " STZU_TMP-STLAN
                    werks                
= e_werks " MAT_TAB-WERKS
              
IMPORTING
                    topmat               
= topmat
              
TABLES
                    stb                  
= stb_temp
              
EXCEPTIONS
                    missing_authorization
= 01
                    no_bom_found         
= 02
                    no_suitable_bom_found
= 03
                   
OTHERS                = 04.
 

     
ELSE.
 
*     Kundenauftragsstückliste
       
CALL FUNCTION 'CS_BOM_EXPL_KND_V1'
            
EXPORTING
                  aufsw                
= const-flg_yes
                  ftrel                
= const-flg_yes
                  mdmps                
= const-flg_yes
                  mdnot                
= const-flg_yes
                  capid                
= '    '
                  datuv                
= sttag_imp
                  mehrs                
= const-flg_yes
                  mtnrv                
= mat_tab-matnr
                  mmory                
= l_flg_mmory
                  stlal                
= plmzd-stlal_w
                  stlan                
= stzu_tmp-stlan
                  werks                
= mat_tab-werks
                  vbeln                
= mat_tab-vbeln
                  vbpos                
= mat_tab-posnr
            
IMPORTING
                  topmat               
= topmat
            
TABLES
                  stb                  
= stb_temp
            
EXCEPTIONS
                  missing_authorization
= 01
                  no_bom_found         
= 02
                  no_suitable_bom_found
= 03
                 
OTHERS                = 04.
 

     
ENDIF.                   " if mat_tab-vbeln .

For WBS related routings FM should check with FM CS_BOM_EXPL_PSP_V1

there's no branch that checks PSPNR not to be initial

therefore I guess direct input is 'not yet' ready for WBS related routings


MAT_TAB has structure rc272 and PSPNR is supplied reading in table mapl in FM CZ_DT_MAPL_CREATE

so unfortunately PSPNR is always and already filled when supplying STLNR