Skip to Content

issue with warning message used inside a loop

Jan 24 at 01:32 PM


avatar image


I have an issue with one of the custom report where I am checking the sched agreemnt item dates with the header dates and if the item date is less than the header date throw an warning message. I had used as

LOOP at internal table.

check if the item date is less than header date if yes

message s(000) -- warning messsage here

endloop .

for example if the first two records are not satisfying the date condition and the remaining all records are satisfying the date condition than once the loop is completed there is no warning message. please suggest how to handle this as far as I know we can collect all the messages into an internal table and throw a warning message after the loop will it work? please suggest

thanks balu

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Sagar Kotyada Jan 25 at 09:49 AM

Hello Balu,

Other way is, 1) you can add an additional field(Status) at last in the output display and there you can fill the status as success/failure for each and every record

2)You can collect the all the error records into an internal table and you can display in the same screen or if you want to display in the next screen(By adding a push button(Logs) at the top of the report)

10 |10000 characters needed characters left characters exceeded
Sathya Gunasekaran Jan 24 at 01:37 PM

You have to collect the messages in an internal table and display them after the loop.

Show 2 Share
10 |10000 characters needed characters left characters exceeded

ok thanks for your reply.. But I am using REUSE_ALV_GRID_DISPLAY .. Can we display warning messages at the bottom of the output for alv grid display.


Can you just add another column to the output table and populate it while checking the data in the loop (using field-symbol probably ). This way, the warning message will be displayed against the record it got populated by.

Sandra Rossi Jan 24 at 02:53 PM

If you want to display several messages at a time, you can't use MESSAGE because it displays either one message at a time, or only the last message.

If you want to stay on REUSE_ALV_GRID_DISPLAY, you may use the parameter I_CALLBACK_HTML_END_OF_LIST to write the messages at the bottom of the ALV.

You could also use the function modules BAL_LOG_CREATE, BAL_LOG_MSG_ADD and BAL_DSP_LOG_DISPLAY (SAP Library: Application Log (BC-SRV-BAL)), to display the messages in a popup.

You could also display both the ALV and the messages from the BAL, in the same screen, by using a "splitter container" (CL_GUI_EASY_SPLITTER_CONTAINER), but you need to display the ALV in the top container via CL_GUI_ALV_GRID --or CL_SALV_TABLE in a container--, and function modules BAL_CNT_* to display the log in the bottom container instead of BAL_DSP_LOG_DISPLAY.

10 |10000 characters needed characters left characters exceeded