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: 

Bapiret2 Return Type

0 Kudos
1,433

I have 3 forms and I return lt return in these forms.

  DATA: lt_return TYPE TABLE OF  bapiret2,
        ls_return TYPE bapiret2.

What I need to do is to check these forms and send an e-mail if their type is 'E', 'A' and 'I'.

I created my mail form and these 3 forms that I mentioned, and there is no problem with them. Now, I need to check the types of these 3 forms I created with lt_return and if it is wrong, I need to call my send_mail form and send an error mail.

7 REPLIES 7

raymond_giuseppi
Active Contributor
698

How far have you been able to advance, have you already

Where exactly are you stuck?

0 Kudos
698

I created my mail form and these 3 forms that I mentioned, and there is no problem with them. Now, I need to check the types of these 3 forms I created with lt_return and if it is wrong, I need to call my send_mail form and send an error mail.

FORM x_x .
DATA: lt_return TYPE TABLE OF bapiret2,
ls_return TYPE bapiret2.
LOOP AT lt_return INTO DATA(ls_error).
IF ls_error-type EQ 'E'.
PERFORM send_mail.
ENDIF.
ENDLOOP.
ENDFORM.

0 Kudos
698

You must pass the internal table RETURN of type BAPIRET2 to the form (or a method) as a parameter.

0 Kudos
698

How can ı do it?

698

Something like this:

DATA: it_bapiret2 TYPE bapiret2_t.

PERFORM x_x USING it_bapiret2.

FORM x_x  USING    p_bapiret2 TYPE bapiret2_t.

  LOOP AT p_bapiret2 ASSIGNING FIELD-SYMBOL(<fs_bapiret2>).
    IF <fs_bapiret2>-type EQ 'E'.
      PERFORM send_mail.
    ENDIF.
  ENDLOOP.

ENDFORM.

Sandra_Rossi
Active Contributor
0 Kudos
698
  TYPES: ty_bapiret2_tab TYPE TABLE OF bapiret2.
  DATA: lt_return TYPE ty_bapiret2_tab,
        ls_return TYPE bapiret2.
  PERFORM x USING lt_return.
  FORM x USING it_return TYPE ty_bapiret2_tab.
  ENDFORM.

ThorstenHoefer
Active Contributor
0 Kudos
698

Hi sahbaz,

you can splitt it_return into three different tables:


DATA: lt_return TYPE bapiret2_t, ls_return TYPE bapiret2. data(lt_return_i) = value bapiret2_t( for l_line in lt_return where ( type = 'I') ( l_line ) ). data(lt_return_a) = value bapiret2_t( for l_line in lt_return where ( type = 'A') ( l_line ) ). data(lt_return_e) = value bapiret2_t( for l_line in lt_return where ( type = 'E') ( l_line ) ).