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: 

function module behaving abnormally

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Please give 01 instead of just 1 in the STLAL field.I think the error is because of this.Just chek once.

Hope it works.

Thanks,

Sandeep.

5 REPLIES 5

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please use FM CONVERSION_EXIT_MATN1_INPUT to convert material from internal table ITAB_FINAL prior to call FM CS_BOM_EXPL_MAT_V2.


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.

...

Regards,

Ferry Lianto

Former Member
0 Kudos

Thanks Ferry for the reply. But I am still getting the same problem , sy-subrc is 1. only for that material .But it is executing in se37, there I am getting the results.

Thank you very much for ur reply.

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please check and ensure that you pass the same parameters for FM CS_BOM_EXPL_MAT_V2 as you did in SE37.

Is it only for a material or all material?

Regards,

Ferry Lianto

Former Member
0 Kudos

Hi,

Please give 01 instead of just 1 in the STLAL field.I think the error is because of this.Just chek once.

Hope it works.

Thanks,

Sandeep.

0 Kudos

Hi Sandeep , I am very much grateful to you . My Problem has been solved by your answer.

Thank you very much Sandeep