Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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

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.

...

Tags:
Former Member
replied

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 View this answer in context
Not what you were looking for? View more on this topic or Ask a question