‎2008 Jan 19 8:14 PM
Hy experts,
I've got the following problem with this form:
FORM make_out.
SORT tb_app BY rueck rmzhl.
LOOP AT tb_app ASSIGNING <fs_app>.
CALL FUNCTION 'BAPI_ALM_CONF_CANCEL'
EXPORTING
confirmation = <fs_app>-rueck
confirmationcounter = <fs_app>-rmzhl
IMPORTING
return = tb_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = ca_x
IMPORTING
return = tb_return.
UNASSIGN <fs_return>.
READ TABLE tb_return ASSIGNING <fs_return>
WITH KEY type = ca_e.
IF sy-subrc = 0.
wa_result-rueck = <fs_app>-rueck.
wa_result-rmzhl = <fs_app>-rmzhl.
wa_result-msg = <fs_return>-message.
wa_result-ex = icon_red_light . "'1'.
APPEND wa_result TO tb_result.
CLEAR wa_result.
ENDIF.
ENDLOOP.
ENDFORM. "make_out
I've to read the current row inserted in table tb_return and check the value of field 'message': if this value is 'E' i insert a row in table wa_result with the values described in the code shown. i wanted to know how to set the read table statement correctly, 'cause in the form you see i don't think it works.
Thanks to all
Ivan
‎2008 Jan 20 4:32 AM
Hi Ivano,
sy-index is the system field for current row position.
Read table <itab> into wa index sy-index.
cheers,
Hema.
‎2008 Jan 19 11:54 PM
hi,
i think that it's happend because u use the same table tb_return in 'BAPI_ALM_CONF_CANCEL' and in 'BAPI_TRANSACTION_COMMIT'. try to use different return or try this way.
>FORM make_out.
>SORT tb_app BY rueck rmzhl.
>
>LOOP AT tb_app ASSIGNING <fs_app>.
>
>CALL FUNCTION 'BAPI_ALM_CONF_CANCEL'
>EXPORTING
>confirmation = <fs_app>-rueck
>confirmationcounter = <fs_app>-rmzhl
>IMPORTING
>return = tb_return.
>UNASSIGN <fs_return>.
>READ TABLE tb_return ASSIGNING <fs_return>
>WITH KEY type = ca_e.
>IF sy-subrc NE 0.
>CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
>EXPORTING
>wait = ca_x
>IMPORTING
>return = tb_return.
>else.
>CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
> endif.
>UNASSIGN <fs_return>.
>
>READ TABLE tb_return ASSIGNING <fs_return>
>WITH KEY type = ca_e.
>IF sy-subrc = 0.
>wa_result-rueck = <fs_app>-rueck.
>wa_result-rmzhl = <fs_app>-rmzhl.
>wa_result-msg = <fs_return>-message.
>wa_result-ex = icon_red_light . "'1'.
>
>APPEND wa_result TO tb_result.
>CLEAR wa_result.
>ENDIF.
>ENDLOOP.
>ENDFORM. "make_out
Call the function 'BAPI_TRANSACTION_COMMIT' make sense if the BAPI which was called before it went well otherwise you should call the 'BAPI_TRANSACTION_ROLLBACK'
Regards
Marco
Edited by: nicolai marco on Jan 20, 2008 12:55 AM
‎2008 Jan 20 12:45 AM
No, my problem is that through the first bapi i insert one row in the table tb_return, and then i've got to examine the field 'type' of that row because i've to verify if its value is 'E': if the value of the filed eq 'E' then i make the insertio in wa_result. the problem is with the read statement,
read table tb_return assigning <fs_return> with key type = ca_e
this statement in my opinion doesn't read the row i've just inserted in tb_return, but simply read the first row in the table with type='e', and this isn't what my program must do, it has to examine the row inserted in tb_return, and if the field 'type' ofthat row = 'E' it must insert one row in tb_result. how do i can read the last row inserted into tb_return? could someone tell me how to modify the read statement?
Thanks to all
Ivan
‎2008 Jan 20 4:32 AM
Hi Ivano,
sy-index is the system field for current row position.
Read table <itab> into wa index sy-index.
cheers,
Hema.
‎2008 Jan 21 11:26 PM