09-21-2008 4:10 PM
Hi,
In call transaction method a log sheet should be generated. For the successful line items, the corresponding line Document Number should be provided. For the Unsuccessful ones, the error details should be provided.
Line Item No. Success/ Failure Document Number Error Details
1 S doc 001
2 S Doc 002
3 F company code does not exist
4 F company code does not exist
Thus if an excel sheet contains 100 line items and there are 5 such line items which have some inconsistent data or no value is entered in a mandatory field, then a log sheet will be displayed.
As rectification, the end-user will go back to his excel sheet, and correct the inconsistent values, and upload the sheet again
thanks in advance
09-21-2008 4:29 PM
Hi,
Try this way,
Ex:-
CALL TRANSACTION 'XD01' USING i_bdcdata MODE 'N' UPDATE 'S' MESSAGES INTO i_bdcmsgcoll.
IF sy-subrc EQ 0
PERFORM get_success_messages.
WRITE 😕 i_upload-kunnr, v_msg.
ELSE.
PERFORM get_error_messages.
WRITE 😕 i_upload-kunnr, v_msg.
ENDIF.
FORM get_success_messages.
READ TABLE i_bdcmsgcoll WITH KEY msgtyp EQ 'S'.
IF sy-subrc EQ 0.
CALL FUNCTION 'FORMAT_MESSAGE'
Exporting
id = i_bdcmsgcoll-msgid
lang = sy-langu
no = i_bdcmsgcoll-msgnr
v1 = i_bdcmsgcoll-msgv1
v2 = i_bdcmsgcoll-msgv2
Importing
msg = v_msg.
ENDIF.
ENDFORM.
FORM get_error_messages.
READ TABLE i_bdcmsgcoll WITH KEY msgtyp EQ 'E'.
IF sy-subrc EQ 0.
CALL FUNCTION 'FORMAT_MESSAGE'
Exporting
id = i_bdcmsgcoll-msgid
lang = sy-langu
no = i_bdcmsgcoll-msgnr
v1 = i_bdcmsgcoll-msgv1
v2 = i_bdcmsgcoll-msgv2
Importing
msg = v_msg.
ENDIF.
ENDFORM.
or download all the records to an internal table and downlaod to excel sheet.
Regards
Bala Krishna
Edited by: Bala Krishna on Sep 21, 2008 8:59 PM