11-12-2007 10:50 AM
I am getting dump error while executing message statement inside the MB_DOCUMENT_BADI.. please tell me how to handle this issue..
thanks in advance
jawahar
11-12-2007 11:04 AM
11-12-2007 11:17 AM
method IF_EX_MB_DOCUMENT_BADI~MB_DOCUMENT_BEFORE_UPDATE.
DATA : it_mseg TYPE ty_t_mseg,
wa_mseg TYPE mseg,
wa_ekko TYPE ekko,
wa_mcha TYPE mcha,
batch_create_flg TYPE c,
v_message TYPE string.
DATA : v_werks_send TYPE mseg-werks,
v_matnr_send TYPE mseg-matnr,
v_charg_send TYPE mseg-charg,
v_lgort_send TYPE mseg-lgort,
v_werks_rece TYPE mseg-werks,
v_matnr_rece TYPE mseg-matnr,
v_charg_rece TYPE mseg-charg,
v_lgort_rece TYPE mseg-lgort,
v_ummat_send TYPE mseg-ummat,
v_umwrk_send TYPE mseg-umwrk,
v_umcha_send TYPE mseg-umcha,
v_umlgo_send TYPE mseg-umlgo,
v_ummat_rece TYPE mseg-ummat,
v_umwrk_rece TYPE mseg-umwrk,
v_umcha_rece TYPE mseg-umcha,
v_umlgo_rece TYPE mseg-umlgo.
CONSTANTS : c_klart TYPE klah-klart VALUE '022',
c_class TYPE klah-class VALUE 'BATCH_CLASS'.
DATA: return TYPE STANDARD TABLE OF bapiret2,
wa_return TYPE bapiret2,
v_text1 TYPE sy-msgv1,
v_text2 TYPE sy-msgv1,
v_text3 TYPE sy-msgv1,
v_text4(50).
batch_create_flg = ' '. " Initialize the flag
it_mseg[] = xmseg[].
LOOP AT it_mseg INTO wa_mseg.
CASE wa_mseg-bwart.
WHEN '303'.
IF wa_mseg-shkzg = 'H'. " Check Debit/Credit Indicator is H, if so then pickup the details of sending
" plant, material, batch, storage location and receiving plant, material, batch
v_werks_send = wa_mseg-werks.
v_matnr_send = wa_mseg-matnr.
v_charg_send = wa_mseg-charg.
v_lgort_send = wa_mseg-lgort.
v_matnr_rece = wa_mseg-ummat.
v_werks_rece = wa_mseg-umwrk.
v_charg_rece = wa_mseg-charg.
batch_create_flg = 'X'.
ENDIF. " end the 303 movement type procedures
WHEN '301'.
IF wa_mseg-shkzg = 'H'. " Check Debit/Credit Indicator is H, if so then pickup the details of sending plant,
" material, batch, storage location and receiving plant, material, batch, storage location
v_matnr_send = wa_mseg-matnr.
v_werks_send = wa_mseg-werks.
v_charg_send = wa_mseg-charg.
v_lgort_send = wa_mseg-lgort.
v_matnr_rece = wa_mseg-ummat.
v_werks_rece = wa_mseg-umwrk.
v_charg_rece = wa_mseg-umcha.
v_lgort_rece = wa_mseg-umlgo.
batch_create_flg = 'X'.
ENDIF. " end the 301 movement type procedures
WHEN '101'. " For issuing movement type 351/641/643/647/645
IF wa_mseg-shkzg = 'S'. " Check Debit/Credit Indicator is S
Select record from table EKKO on the basis of MSEG plant *
SELECT SINGLE * FROM ekko INTO wa_ekko WHERE ebeln = wa_mseg-ebeln.
IF NOT wa_ekko-reswk IS INITIAL. " Check plant of EKKO is not initial, if so then pickup the details of sending plant,
" material, batch, and receiving plant, material, batch, storage location
v_werks_send = wa_ekko-reswk.
v_matnr_send = wa_mseg-matnr.
v_charg_send = wa_mseg-charg.
v_werks_rece = wa_mseg-werks.
v_matnr_rece = wa_mseg-matnr.
v_charg_rece = wa_mseg-charg.
v_lgort_rece = wa_mseg-lgort.
batch_create_flg = 'X'.
ENDIF. " end the EKKO plant check condition
ENDIF. " end the 101 movement type procedures
WHEN '305'.
IF wa_mseg-shkzg = 'S'. " Check Debit/Credit Indicator is S, if so then pickup the details of
" receiving plant, material, batch, storage location
v_werks_rece = wa_mseg-werks.
v_matnr_rece = wa_mseg-matnr.
v_charg_rece = wa_mseg-charg.
v_lgort_rece = wa_mseg-lgort.
batch_create_flg = ' '.
Select record from MCHA table on the basis of receiving material, plant and batch *
SELECT SINGLE * FROM mcha INTO wa_mcha WHERE
werks = v_werks_rece AND
matnr = v_matnr_rece AND
charg = v_charg_rece.
Check whether the selection is not success *
IF sy-subrc NE 0.
MESSAGE e357(zm) WITH wa_mseg-werks wa_mseg-charg.
EXIT.
ENDIF. " end the SY-SUBRC check condition
ENDIF. " end the 305 movement type procedures
WHEN OTHERS.
ENDCASE.
IF batch_create_flg = 'X'. " Check the local flag batch_create_flg is set, if so then call the
" function module Z_BATCH_CHAR_UPDATE
Call the function module Z_BATCH_CHAR_UPDATE to update the receiving material batch characteristics *
CALL FUNCTION 'Z_BATCH_CHAR_UPDATE'
EXPORTING
matnr_send = v_matnr_send
werks_send = v_werks_send
charg_send = v_charg_send
lgort_send = v_lgort_send
matnr_rece = v_matnr_rece
werks_rece = v_werks_rece
charg_rece = v_charg_rece
lgort_rece = v_lgort_rece
klart = c_klart
class = c_class
TABLES
rettab = return[].
ENDIF. " end the check condition of local flag batch_create_flg
batch_create_flg = ' '. " Clear the flag
Error or Warning message will be returned at return*
LOOP AT return INTO wa_return.
CONDENSE wa_return-message.
MOVE wa_return-message TO v_message.
CALL FUNCTION 'HR_ES_SPLIT_STRING_TO_4_CHAR50'
EXPORTING
in_string = v_message
str_len = 50
IMPORTING
char1 = v_text1
char2 = v_text2
char3 = v_text3
char4 = v_text4.
IF wa_return-type = 'E'. " Check the return-type is E-error
MESSAGE e358(zm) WITH v_text1
v_text2
v_text3
v_text4.
.
ELSEIF wa_return-type = 'W'. " Check the return-type is W-warning
MESSAGE w358(zm) WITH v_text1
v_text2
v_text3
v_text4.
ENDIF.
CLEAR : v_message,
v_text1,
v_text2,
v_text3,
v_text4.
ENDLOOP.
REFRESH : return[].
CLEAR return.
ENDLOOP.
endmethod.
11-12-2007 11:23 AM
Hi sathish,
in the above code im getting the dump error in all message statements execution..
11-12-2007 11:25 AM
11-12-2007 11:27 AM
Hi ,
Inside the method , please don't use the Command "MESSAGE"
Instead raise an exception .
Regards
Meikandan.