Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

hi friends hw to handle errors in bapi

Former Member
0 Kudos

wt are the function modules used in err handling in bapi

1 ACCEPTED SOLUTION

GauthamV
Active Contributor
0 Kudos

hi,

welcome to SDN.

check this fm.

BM_ERROR_CH.

generally every function module consists of a structure to handle errors.

ex: RETURN STRUCTURE BAPIRET2 OPTIONAL.

6 REPLIES 6

GauthamV
Active Contributor
0 Kudos

hi,

welcome to SDN.

check this fm.

BM_ERROR_CH.

generally every function module consists of a structure to handle errors.

ex: RETURN STRUCTURE BAPIRET2 OPTIONAL.

Former Member
0 Kudos

Hi ,

BAPI will store error Msgs in RETURN tables.

regards

P.

former_member265047
Active Participant
0 Kudos

Hi ,

There is no fixed format for error handling in bapi. We have to fill all the error messages in the internal table of type BAPIRET2 and pass it back to the user.

You can check the error handling logic in any existing BAPI in SE37.

Regards,

Naveen Veshala

Former Member
0 Kudos

Hi,

Plz take help of this example.

Generally the error messages for BAPI are stored in return importing parameter ie gt_bapiret2 .

LOOP AT gt_bapiret2 INTO gs_bapiret2.


    gs_report-rhkont = gs_accounts-zshkont.
    gs_report-posid = gs_prps-posid.
    gs_report-post1 = gs_prps-post1.
    gs_report-abgsl = gs_prps-abgsl.
    gs_report-pbukr = gs_prps-pbukr.
    gs_report-rtype = gs_bapiret2-type.
    gs_report-rmessage = gs_bapiret2-message.

    IF gs_report-rtype EQ 'E'.
      gs_report-ricon  = icon_led_red.

    ELSEIF gs_report-rtype EQ 'S'.
      gs_report-ricon  = icon_led_green.

    ELSEIF gs_report-rtype EQ 'W'.
      gs_report-ricon  = icon_led_yellow.
    ENDIF.

    gs_report2-rhkont = gs_accounts-zrhkont.
    gs_report2-shkont = gs_accounts-zshkont.
    gs_report2-posid = gs_prps-posid.
    gs_report2-post1 = gs_prps-post1.
    gs_report2-abgsl = gs_prps-abgsl.
    gs_report2-pbukr = gs_prps-pbukr.

  IF gs_report-rtype = 'S' .
      PERFORM commit_work.
    ENDIF.

Hope this helps you.

plz reward if useful.

thanks,

dhanashri.

Edited by: Dhanashri Pawar on Jun 26, 2008 7:35 AM

Former Member
0 Kudos

Hi,

Plz take help of this example.

LOOP AT gt_bapiret2 INTO gs_bapiret2.


    gs_report-rhkont = gs_accounts-zshkont.
    gs_report-posid = gs_prps-posid.
    gs_report-post1 = gs_prps-post1.
    gs_report-abgsl = gs_prps-abgsl.
    gs_report-pbukr = gs_prps-pbukr.
    gs_report-rtype = gs_bapiret2-type.
    gs_report-rmessage = gs_bapiret2-message.

    IF gs_report-rtype EQ 'E'.
      gs_report-ricon  = icon_led_red.

    ELSEIF gs_report-rtype EQ 'S'.
      gs_report-ricon  = icon_led_green.

    ELSEIF gs_report-rtype EQ 'W'.
      gs_report-ricon  = icon_led_yellow.
    ENDIF.

    gs_report2-rhkont = gs_accounts-zrhkont.
    gs_report2-shkont = gs_accounts-zshkont.
    gs_report2-posid = gs_prps-posid.
    gs_report2-post1 = gs_prps-post1.
    gs_report2-abgsl = gs_prps-abgsl.
    gs_report2-pbukr = gs_prps-pbukr.

  IF gs_report-rtype = 'S' .
      PERFORM commit_work.
    ENDIF.

Hope this helps you.

plz reward if useful.

thanks,

dhanashri.

Former Member
0 Kudos

thanks for all answers