2008 Feb 08 12:39 AM
Hi Experts,
CALL TRANSACTION 'XD02'.
IF successfully saved.
further processing..................
ENDIF.
Can anybody advice how to check if record is successfully saved after statement 'call transaction'. Return code is 0 even if I exit from the tcode without saving the code. Thanks in advance.
Regards,
Seema
Hi Experts,
CALL TRANSACTION 'XD02'.
IF successfully saved.
further processing..................
ENDIF.
Can anybody advice how to check if record is successfully saved after statement 'call transaction'. Return code is 0 even if I exit from the tcode without saving the code. Thanks in advance.
Regards,
Seema
2008 Feb 08 1:03 AM
Try this
CALL TRANSACTION 'XD02' USING bdcdata MESSAGES INTO messtab.
READ TABLE messtab WITH KEY msgtyp = 'E'
IF sy-subrc NE 0.
further processing......
ENDIF.
You get all the messages in the message table.
If you find any reecord with msgtyp as E then it has an error
else you can continue with the other processing.
Regards,
Sudhir Atluru.
2008 Feb 08 1:17 AM
Hi
Extention MESSAGES INTO messtab is not allowed if I am not using 'USING bdcdata'.
Regards,
Seema
2008 Feb 08 2:11 AM
Hi,
Please see my code below. Hope it solves your problem.
DATA: lv_mode TYPE c LENGTH 1,
lv_message TYPE string.
CASE 'X'.
WHEN p_all.
MOVE 'A' TO lv_mode.
WHEN p_err.
MOVE 'E' TO lv_mode.
WHEN p_nos.
MOVE 'N' TO lv_mode.
ENDCASE.
CALL TRANSACTION 'VD02' USING gt_bdcdata
MODE lv_mode
UPDATE 'S'
MESSAGES INTO gt_bdc_msg.
IF p_test = 'X'.
COMMIT WORK AND WAIT.
ENDIF.
LOOP AT gt_bdc_msg INTO wa_bdc_msg.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = wa_bdc_msg-msgid
lang = sy-langu
no = wa_bdc_msg-msgnr
v1 = wa_bdc_msg-msgv1
v2 = wa_bdc_msg-msgv2
v3 = wa_bdc_msg-msgv3
v4 = wa_bdc_msg-msgv4
IMPORTING
msg = lv_message
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
IF wa_bdc_msg-msgtyp = 'S'.
wa_output-icon = icon_okay.
ADD 1 TO ex_success.
ELSE.
wa_output-icon = icon_cancel.
ADD 1 TO ex_fail.
ENDIF.
wa_output-status = wa_bdc_msg-msgtyp.
wa_output-rec_num = im_line.
wa_output-message = lv_message.
APPEND wa_output TO gt_output.
CLEAR wa_output.
ENDLOOP.
REFRESH: gt_bdcdata, gt_bdc_msg.
CLEAR: wa_bdcdata, wa_bdc_msg.