09-30-2008 1:31 PM
pls help me how to maintain the errors in below format, as i'm not getting the 1st and 2nd column properly like for the 2nd column i'm getting errors,warning,sucess like tht.
Line Item No. Success/ Failure Document Number Error Details
1 S Doc 1
2 S Doc 3
3 F Doc 6 notexist
4 F Doc 9 GL Account does not exist
-
below is my code.
&----
*& Form BDC_DYNPRO
&----
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR W_BDCDATA.
W_BDCDATA-PROGRAM = PROGRAM.
W_BDCDATA-DYNPRO = DYNPRO.
W_BDCDATA-DYNBEGIN = 'X'.
APPEND W_BDCDATA TO lT_BDCDATA.
ENDFORM. "BDC_DYNPRO
----
Insert field *
----
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> SPACE.
CLEAR W_BDCDATA.
W_BDCDATA-FNAM = FNAM.
W_BDCDATA-FVAL = FVAL.
APPEND W_BDCDATA TO lT_BDCDATA.
ENDIF.
ENDFORM. "BDC_FIELD
&----
*& Form fr_format_message_text
&----
FORM FR_FORMAT_MESSAGE_TEXT .
DATA: LF_MSG TYPE STRING.
WRITE:/10 'Message Id',
35 'Megno',
45 'Msg.Type',
55 'Message Info'.
LOOP AT lT_BDCMSGCOLL INTO W_BDCMSGCOLL.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = W_BDCMSGCOLL-msgid
LANG = SY-LANGU
NO = W_BDCMSGCOLL-MSGNR
V1 = W_BDCMSGCOLL-MSGV1
V2 = W_BDCMSGCOLL-MSGV2
V3 = W_BDCMSGCOLL-MSGV3
V4 = W_BDCMSGCOLL-MSGV4
IMPORTING
MSG = LF_MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC EQ 0.
CONDENSE lf_msg.
WRITE:/25 W_BDCMSGCOLL-msgid,
30 W_BDCMSGCOLL-MSGtyp,
45 W_BDCMSGCOLL-MSGnr,
60 LF_MSG.
ENDIF.
ENDLOOP.
ENDFORM. "fr_format_message_text
Thanks in advance.
Edited by: neelima neelima on Sep 30, 2008 2:44 PM
09-30-2008 3:41 PM
If you want the line number from the message itab, WRITE SY-TABIX as your first column. It is a loop counter variable.
Hope this helps