08-01-2008 1:12 PM
Hi all,
I am using application log to collect all messages.
After collecting all messages, how to display all messages in one field.
FInally in the output display, i should display all messages.
is it possible, if so please help me.
Thanks in advance,
Swapana.
08-01-2008 1:21 PM
Swapna,
Example Routine for you to display error messages,
Data Defintiion for global variable / table
TYPES: begin of ty_msg,
msg type string,
end of ty_msg.
data: git_err TYPE STANDARD TABLE OF ty_msg,
&----
*& Form display_error_log
&----
text
----
form display_error_log.
data: lit_text type STANDARD TABLE OF tline.
data: ls_text type tline.
if not git_err[] is initial.
loop at git_err into gs_err.
move gs_err-msg to ls_text-tdline.
append ls_text to lit_text.
endloop.
CALL FUNCTION 'COPO_POPUP_TO_DISPLAY_TEXTLIST'
EXPORTING
TASK = 'DISPLAY'
TITEL = 'Error Log'
IMPORTING
FUNCTION =
TABLES
TEXT_TABLE = lit_text.
endif.
endform. "display_error_logSample rou
I hope this will help you.
Regards,
Maehsh
08-01-2008 1:16 PM
Hi,
maybe this can give you an idea:
CALL FUNCTION 'MESSAGES_INITIALIZE'.
LOOP AT it_return_bapi.
CALL FUNCTION 'MESSAGE_STORE'
EXPORTING
arbgb = it_return_bapi-id
exception_if_not_active = ' '
msgty = it_return_bapi-type
msgv1 = it_return_bapi-message_v1
msgv2 = it_return_bapi-message_v2
msgv3 = it_return_bapi-message_v3
msgv4 = it_return_bapi-message_v4
txtnr = it_return_bapi-number
zeile = ' '
EXCEPTIONS
message_type_not_valid = 1
not_active = 2
OTHERS = 3.
ENDLOOP.
CALL FUNCTION 'MESSAGES_STOP'
EXCEPTIONS
a_message = 04
e_message = 03
i_message = 02
w_message = 01.
IF NOT sy-subrc IS INITIAL.
CALL FUNCTION 'MESSAGES_SHOW'
EXPORTING
i_use_grid = 'X'
i_amodal_window = i_amod_window
EXCEPTIONS
inconsistent_range = 1
no_messages = 2
OTHERS = 3.
ENDIF.
Best regards.
08-01-2008 1:17 PM
Hi ,
Declare one field with length(255) char....in ur final internal table...Populate the value in the final internal table and display...
for example..
Loop at final_tab.
concatenate lv_msg appl-msg to lv_msg.
move : lv_msg to final_tab-msg.
endloop.
here appl-msg is the message which u get in ur application log table where u r collecting the messages..
now concatenate and send to ur field MSG which is having 255 characters..
Regards,
Nagaraj
08-01-2008 1:21 PM
Swapna,
Example Routine for you to display error messages,
Data Defintiion for global variable / table
TYPES: begin of ty_msg,
msg type string,
end of ty_msg.
data: git_err TYPE STANDARD TABLE OF ty_msg,
&----
*& Form display_error_log
&----
text
----
form display_error_log.
data: lit_text type STANDARD TABLE OF tline.
data: ls_text type tline.
if not git_err[] is initial.
loop at git_err into gs_err.
move gs_err-msg to ls_text-tdline.
append ls_text to lit_text.
endloop.
CALL FUNCTION 'COPO_POPUP_TO_DISPLAY_TEXTLIST'
EXPORTING
TASK = 'DISPLAY'
TITEL = 'Error Log'
IMPORTING
FUNCTION =
TABLES
TEXT_TABLE = lit_text.
endif.
endform. "display_error_logSample rou
I hope this will help you.
Regards,
Maehsh
08-01-2008 1:36 PM
Hi mahesh,
I am collectiong all messages using applciation log.
TAB is the final internal table for display.
In this text field should fill with all messages i collected step before.
all messages in one row of one perticular field.
Pelase help me.
Thanks
Swapna.
08-01-2008 1:43 PM
Swapna,
Yes, you collect all the message text into the internal table git_err in my example. if don't have actual text but have message id and message type, then you can build message text using function module.
You may use following routine to build message text to fill in git_err table. you may want to use standard FM 'FORMAT_MESSAGE' directly to format message.
&----
*& Form build_message
&----
text
----
form build_message
using in_msgid
in_msgno
in_msgv1
in_msgv2
in_msgv3
in_msgv4
changing
out_msg.
data: l_msgno type sy-msgno,
l_msgid type sy-msgid,
l_msgv1 type sy-msgv1,
l_msgv2 type sy-msgv2,
l_msgv3 type sy-msgv3,
l_msgv4 type sy-msgv4,
l_msg TYPE SY-LISEL.
move: in_msgid to l_msgid,
in_msgno to l_msgno,
in_msgv1 to l_msgv1,
in_msgv2 to l_msgv2,
in_msgv3 to l_msgv3,
in_msgv4 to l_msgv4.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = l_MSGID
LANG = SY-LANGU
NO = l_MSGNO
V1 = l_MSGV1
V2 = l_MSGV2
V3 = l_MSGV3
V4 = l_MSGV4
IMPORTING
MSG = l_msg
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
out_msg = 'System Error'(024).
else.
move l_msg to out_msg.
ENDIF.
ENDFORM. "build_message
I hope this helps, if you have any question please let me know.
Thanks & Regards,
Mahesh Apte
08-02-2008 12:17 PM
Hi mahesh,
Thanks a lot, BUt my problem is not solved.
Can i use this funciton module BAL_DSP_PROFILE_POPUP_GET to add applicaiton log in my output table as one field.
Please clarify and let me know how this function module works?
Thanks
Swapna
08-03-2008 7:29 AM
Hi,
maybe with fm APPL_LOG_DISPLAY ?
Best regards
Edited by: pablo casamayor on Aug 3, 2008 8:30 AM
08-03-2008 11:51 AM
Hi Swapna,
Can you be specific with the question.
u want the error messages to be displayed as part of your final output of the ALV with one field for messages. or else you want to display only error messages. clarify this. if you want to display only error messages follow the above replies. else i will tell u the method of displaying in ALV output.
Regards,
Santosh Kumar M.
08-03-2008 12:06 PM
I m sorry, i didnt see the subject. Do like this. if you want to display all the error messages.
declare one variable with type char of some 1000 chars.
data: begin of it_out occurs 0,
field1,
field2,
"
"
message(1000) type c,
end of it_out
in the loop where you are populating the it_out,
loop at messtab.
concatenate messtab-message into it_out-message.
endloop.
append it_out.
endloop.
in fieldcat log structure give seltext_m as 'MESSAGE LOG'.
Regards,
Santosh Kumar M.
Award points if it is useful.