cancel
Showing results for 
Search instead for 
Did you mean: 

Execption handling in data feeder class

Former Member
0 Kudos

Hi All ,

I am calling some class methods inside the data class. So i am using the statement catch exe in lo_exe1.

After how can i display the execption , I  mean the message manger will be initial inside the data class, So how can i handle the exceptions from data feeder class.

Please share your ideas!

Thanks,

Pradeep.

Accepted Solutions (0)

Answers (2)

Answers (2)

jens_boeckenhauer
Active Participant
0 Kudos

Hi Pradeep,

if you do not need the connect the error to a GUIBB field you can easily send the exception as message to the FPM:

        mo_fpm->mo_message_manager->report_object_message(   "mo_fpm e.g. from fpm factory

          ir_message_object = lx_error       "<<<< exception, e.g. TYPE REF TO CX_ROOT

          io_component = me

          iv_severity = iv_severity ).

and if you want to include previous exceptions as well you can do something like:

*----- recusively walk up previous path

    DATA lx_root TYPE REF TP cx_root.

    DATA(lx_root) = lx_error.

    WHILE lx_root IS BOUND.

      IF lx_root->textid <> lx_root->cx_root.

        mo_fpm->mo_message_manager->report_object_message(

          ir_message_object = lx_root

          io_component = me

          iv_severity = iv_severity ).

      ENDIF.

      lx_root = lx_root->previous.

    ENDWHILE.

Regards, Jens

jitin_kharbanda
Participant
0 Kudos

Hi  Pradeep,

1) Populate table lt_messages with message on catch exe... and export lt_message to feeder class.

2) in your feeder class, move lt_message to et_messages.

Let me know if I've misunderstood your requirement....

Thanks

Jitin Kharbanda

Former Member
0 Kudos

Hi Jitin,

Thanks for your reply .

Yes , you got the point , Please give me the code , how to catch exe and how to export to lt_mesages,

And please tell me how can i read the lt_messages from my form feeder class.

jitin_kharbanda
Participant
0 Kudos

Hi Pradeep,

DATA CLASS

method catch_exception.

try.

...

...

...

catch.

prepare your lt_message table. (TYPE FPMGB_T_MESSAGES)

et_message = lt_message.

(you need to define et_message (TYPE FPMGB_T_MESSAGES) as export parameter of this method.

endtry.

endmethod.

FEEDER CLASS

data lt_message   TYPE   FPMGB_T_MESSAGES.

call method lo_data_class->catch_exception( importing et_message = lt_message ).

et_message = lt_message.

(ET_MESSAGE here is exporting parameter of your feeder class).

Thanks

Jitin Kharbanda

Former Member
0 Kudos

How can i populate the lt_messages .

For ex: i am catching the following ,

data : lo_err type ref to zex_comm_err.

try.

catch zex_comm_err into lo_err.

endtry.

Then how can i populate the messages from lo_err.

jitin_kharbanda
Participant
0 Kudos

Hello Pradeep,

For an exception caught, you can do some action (if required) and then add message to lt_message.

You need to maintain the message in a message class (based on the exception)

example - "Communication Error."

data :    ls_msg             TYPE fpmgb_s_t100_message.

try.

catch zex_comm_err into lo_err.

            ls_msg-msgid = message class.

             ls_msg-msgno =  message number.

             ls_msg-severity =  type of message (E, I, S etc..)

             APPEND ls_msg TO lt_message.


et_message = lt_message.


endtry.