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: 

ITs time to prove who is the best of the best in ABAP function modules.

Former Member
0 Kudos

please help me in this issue. function module is not working.

Here i am passing a material to this function module , then it will return its subcomponents ie sub materials and their bom usage.

The fun module is working fine for all the materials except some materials for example say material 1000000001. But i went to se37 and executed the fun module with the same parameters as given here and passed the material 1000000001. Here the output is comming ie sub materials are comming. But in the program for this material it is not comming. the sy-subrc value after this function module is 1. please tell me why it is not comming in the program but working fine in se37.

my coding and parameters are like this.

LOOP AT itab_final .

CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'

EXPORTING

capid = 'PP01'

datuv = sy-datum

EMENG = 1

mktls = 'X'

mehrs = 'X'

mtnrv = itab_final-matnr

stlal = '1'

stlan = '1'

stpst = 0

svwvo = 'X'

werks = plant_werks

  • VERID = ' '

vrsvo = 'X'

  • IMPORTING

  • TOPMAT =

  • DSTST =

TABLES

stb = itab_return

  • MATCAT =

EXCEPTIONS

alt_not_found = 1

call_invalid = 2

material_not_found = 3

missing_authorization = 4

no_bom_found = 5

no_plant_data = 6

no_suitable_bom_found = 7

conversion_error = 8

OTHERS = 9.

IF sy-subrc EQ 0. //// here subrc value is 1 for the above material.

LOOP AT itab_return.

///// here i have some coding

ENDLOOP.

ENDIF.

ENDLOOP.

-


I also tried tbelow code also butits not working....

DATA: wa_matnr LIKE mara-matnr.

LOOP AT itab_final.

wa_matnr = itab_final -matnr.

CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'

EXPORTING

input = wa_matnr

IMPORTING

output = wa_matnr.

CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'

EXPORTING

capid = 'PP01'

datuv = sy-datum

EMENG = 1

mktls = 'X'

mehrs = 'X'

mtnrv = wa_matnr "Change here

stlal = '1'

stlan = '1'

stpst = 0

svwvo = 'X'

werks = plant_werks

  • VERID = ' '

vrsvo = 'X'

  • IMPORTING

  • TOPMAT =

  • DSTST =

TABLES

stb = itab_return

  • MATCAT =

EXCEPTIONS

alt_not_found = 1

call_invalid = 2

material_not_found = 3

missing_authorization = 4

no_bom_found = 5

no_plant_data = 6

no_suitable_bom_found = 7

conversion_error = 8

OTHERS = 9.

...

1 ACCEPTED SOLUTION

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please try this.


LOOP AT itab_final.
  wa_matnr = itab_final -matnr. 
 
  CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
    EXPORTING
      input  = wa_matnr 
    IMPORTING
      output = wa_matnr.
    
  CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
    EXPORTING
      capid = 'PP01'
      datuv = sy-datum
      EMENG = '1'                            "Change here
      mktls = 'X'
      mehrs = 'X'
      mtnrv = wa_matnr                
      stlal = '01'                           "Change here
      stlan = '01'                           "Change here
      stpst = '0'                            "Change here
      svwvo = 'X'
      werks = plant_werks
*     VERID = ' '
      vrsvo = 'X'
*   IMPORTING
*     TOPMAT =
*     DSTST  =
    TABLES
      stb = itab_return
*     MATCAT =
    EXCEPTIONS
      alt_not_found = 1
      call_invalid = 2
      material_not_found = 3
      missing_authorization = 4
      no_bom_found = 5
      no_plant_data = 6
      no_suitable_bom_found = 7
      conversion_error = 8
      OTHERS = 9.
 

Regards,

Ferry Lianto

3 REPLIES 3

Former Member
0 Kudos

Hi Kiran,

Please try passing the value of STLAL field as 01 instaed of 1 because the FM has a conversion routine to convert it automatically to 01 but when you are using the problem you have to pass 01 or call the conversion routine for the FM and pass whatever value you want to pass to the STLAL field first to the conversion FM and then use the return of this FM in the STLAL field of 'CS_BOM_EXPL_MAT_V2'.

Hope it works.

Thanks,

Sandeep.

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please try this.


LOOP AT itab_final.
  wa_matnr = itab_final -matnr. 
 
  CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
    EXPORTING
      input  = wa_matnr 
    IMPORTING
      output = wa_matnr.
    
  CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
    EXPORTING
      capid = 'PP01'
      datuv = sy-datum
      EMENG = '1'                            "Change here
      mktls = 'X'
      mehrs = 'X'
      mtnrv = wa_matnr                
      stlal = '01'                           "Change here
      stlan = '01'                           "Change here
      stpst = '0'                            "Change here
      svwvo = 'X'
      werks = plant_werks
*     VERID = ' '
      vrsvo = 'X'
*   IMPORTING
*     TOPMAT =
*     DSTST  =
    TABLES
      stb = itab_return
*     MATCAT =
    EXCEPTIONS
      alt_not_found = 1
      call_invalid = 2
      material_not_found = 3
      missing_authorization = 4
      no_bom_found = 5
      no_plant_data = 6
      no_suitable_bom_found = 7
      conversion_error = 8
      OTHERS = 9.
 

Regards,

Ferry Lianto

0 Kudos

Hi Ferry I am very much grateful to you.

My problem has been solved by placing 01 in stlal.

Thanks for Sandeep too for helping me to solve the issue.

Thank you very much Ferry Lianto