Skip to Content

issue with warning message used inside a loop


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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Jan 25, 2018 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)

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 24, 2018 at 01:37 PM

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

    Add comment
    10|10000 characters needed characters exceeded

    • 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.

  • Jan 24, 2018 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.

    Add comment
    10|10000 characters needed characters exceeded