Skip to Content
0
Nov 05, 2012 at 11:17 AM

Error after calling function module

219 Views

Dear Experts,

I am calling function module CS_BOM_EXPL_MAT_V2 to get bom details.

CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
aumgb = c_x
capid = c_pp01
datuv = sy-datum
ehndl = c_1
mbwls = c_x
mehrs = c_x
mtnrv = p_matnr
stpst = c_0
werks = p_werks
rndkz = c_1
TABLES
stb = t_stb
matcat = t_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 <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

but when i execute this on production and if sy-subrc is non zero then some problem occurs.

if i took a material(say xyz) and execute it and if sy-subrc is non zero program gets terminated. giving error: message type unknown.

when i debugged it i found that sy-msgid, sy-msgno , sy-msgty all are initial, thats why it shows error.

but if i execute report again with same material (xyz) it wont get terminated and all

sy-msgid, sy-msgno , sy-msgty are populated.

it is happening for all cases, on 1st execution it is giving dump and on 2nd execution it is working fine.

please suggest possible reasons and solution for case.

Note: This works perfectly on development and quality server.

Problem in production server only.

Thanks,

Amar