‎2010 Aug 17 7:26 AM
Hi Folks,
I'm looping the standard messages of SAP into an internal table.
The standard messages were stored in SAP internal table as below format.
MSGTYP MSGID MSGNO MSGV1 MSGV2 MSGV3
W FB_ICRC 058 1 Company 008340
W FB_ICRC 058 2 Company 008340
W FB_ICRC 058 3 Company 008340
W FB_ICRC 058 4 Company 008340
W FB_ICRC 058 5 Company 008340
I am using the function module CALL FUNCTION 'FORMAT_MESSAGE' and pass the above parameters ,to get the original messages..
My Issue is that i am getting the duplicate entries in the internal table,
Line 5: Field Company: 008340 not valid according to restrictions
Line 4: Field Company: 008340 not valid according to restrictions
Line 3: Field Company: 008340 not valid according to restrictions
Line 2: Field Company: 008340 not valid according to restrictions
Line 1: Field Company: 008340 not valid according to restrictions
Line 4: Field Company: 008340 not valid according to restrictions
Line 3: Field Company: 008340 not valid according to restrictions
Line 2: Field Company: 008340 not valid according to restrictions
Line 1: Field Company: 008340 not valid according to restrictions
Line 3: Field Company: 008340 not valid according to restrictions
Line 2: Field Company: 008340 not valid according to restrictions
Line 1: Field Company: 008340 not valid according to restrictions
Line 2: Field Company: 008340 not valid according to restrictions
Line 1: Field Company: 008340 not valid according to restrictions
I'm getting the duplicate entries which is leading to SAP Dump because of Paging Memory ...while i'm trying to export the internal table...
How to eliminate the duplicate entries in the above internal table?
‎2010 Aug 17 7:29 AM
SORT the table based on MSGTYP MSGID MSGNO and delete the adjacent duplicates from the table by using DELETE ADJACENT DUPLICATES statement.
‎2010 Aug 17 7:29 AM
Can i use the function module BAL_LOG_MSG_ADD instead of 'FORMAT_MESSAGE' to eliminate the duplicate entries?
‎2010 Aug 17 7:32 AM
Hi naresh,
The MSG TYP, MSG ID were in SAP internal table (standard) i cant change the standard fuunctionality.
‎2010 Aug 17 7:38 AM
You said you are using 'FORMAT_MESSAGE' to display the message. So we understand there is a custom code written somewhere. This implies you've access to the internal table with the messages. The idea is to sort the table & delete the duplicate recs before calling 'FORMAT_MESSAGE'.
SORT IT_MSG.
DELETE ADJACENT DUPLICATES FROM IT_MSG COMPARING ALL FIELDS.Now i don't understand why you can't write the above logic in your code.
BR,
Suhas
PS: You can use MESSAGE ... INTO addition instead of FORMAT_MESSAGE to get the message text.
‎2010 Aug 17 7:57 AM
If your getting this dump in standard program then you have to contact SAP on this issue.
If you are using some standard FM return message internal table in custom program then you can delete adjacent duplicates no issues.
‎2010 Aug 17 7:54 AM
Try the below code
LOOP AT it_msg ASSIGNING <fs_msg>.
MESSAGE ID <fs_msg>-msgid TYPE <fs_msg>-msgty NUMBER <fs_msg>-msgno
INTO wa_msg
WITH <fs_msg>-msgv1 <fs_msg>-msgv2 <fs_msg>-msgv3.
APPEND wa_msg TO it_output.
ENDLOOP.
SORT it_output ASCENDING.
DELETE ADJACENT DUPLICATES FROM it_output COMPARING ALL FIELDS.