Skip to Content
0
Former Member
Feb 21, 2011 at 03:23 PM

passing messages class to a variable declared as type Bapirets

72 Views

Hello again,

I have defined a in the dictionnany a class message for handling all messages and error messages.

When I call a FM a error occurs, this is catch with the defined class. I would like to store these (error)message in an export variable declared as type Bapirets

DATA: gv_ttype TYPE ztt_shipm_plan05,

gty_bapiret2 type bapiret2

PARAMETERS: pa_dte LIKE Zshipm_plan05-art_date MEMORY ID day

CALL FUNCTION 'Z_SHIPM_LIST05'

EXPORTING

iv_plandate = pa_dte IMPORTING

es_return = gty_bapiret2

et_shipments = gv_ttype.

FUNCTION z_shipm_list05.

*"----


""Local Interface:

*" IMPORTING

*" REFERENCE(IV_PLANDATE) TYPE S_DATE

*" EXPORTING

*" REFERENCE(ES_RETURN) TYPE BAPIRET2

*" REFERENCE(ET_SHIPMENTS) TYPE ZTT_SHIPM_PLAN05

*"----


DATA: lv_OREF TYPE REF TO ZCX_GROUP05,

lv_text type string.

SELECT * FROM art_tab INTO TABLE et_shipments

where art_DATE = IV_PLANDATE.

if sy-subrc <> 0.

TRY.

RAISE EXCEPTION TYPE zcx_group05

EXPORTING textid = zcx_group05=>NO_RECORDS_FOUNDS_FOR_DATE.

CATCH zcx_group05 INTO lv_oref.

lv_text = lv_oref->get_text( ).

ENDTRY.

'I have to retourn here the catched message in ES_RETURN (for later use of gty_bapiret2).

endif.

ENDFUNCTION.

Thank you for help.