Hi experts, need an help for a (imho) quite interesting task. I have a little report that works on a single purchase order and , at the end of the execution, prints on screen a simple message using a WRITE statement. (something like "PO number X processed with/without errors", and eventually other lines showing a specific error).
Now, I'm just creating a "caller" report that gets po numbers from an input file, and process them one by one; a really simple task, but considering I'd like not to modify the original "called" program, I'm wondering about how to get messages in order to print them on screen at the end of the loop.
I tried something as follows (note: it_orders is an internal table containing my po numbers):
LOOP AT it_orders. CLEAR listobject. "TYPE TABLE OF ABAPLIST SUBMIT MY_CALLED_REPORT WITH num_ctr = it_orders-ebeln WITH flag = flag EXPORTING LIST TO MEMORY AND RETURN. * read from memory CALL FUNCTION 'LIST_FROM_MEMORY' TABLES LISTOBJECT = LISTOBJECT EXCEPTIONS NOT_FOUND = 1 OTHERS = 2. LOOP AT LISTOBJECT INTO wa_list. APPEND wa_list TO FINALLIST. ENDLOOP. ENDLOOP. FORMAT INTENSIFIED COLOR = 1. "heading WRITE: 'RESULTS'. SKIP. * write to output CALL FUNCTION 'WRITE_LIST' * EXPORTING * WRITE_ONLY = 'X' TABLES LISTOBJECT = FINALLIST EXCEPTIONS EMPTY_LIST = 1 OTHERS = 2.
But... it doesn't work. The above code only shows the message of the first order processed, but I can't understand why. Can somebody give a "clean" way to solve this issue? It would be helpful in many cases similar to the one I'm working on 😊
Thanks in advance