‎2012 Jun 09 6:39 PM
Hi Guys,
I am creating a Z reporting program, where at point A in the program, I am creating a report with 'WRITE' statement. And later certain point B, I want to clear the list created at point A, and want to print new report created at point B with 'WRITE' statement.
Is this possible?
I will appreciate if somebody can help me.
Thanks a lot.
‎2012 Jun 09 7:30 PM
Hi,
I think there is no direct function module or statement to clear the list buffer.
But you have several workarounds:
Regards,
Sandra
‎2012 Jun 10 5:04 AM
Hi Manoj,
Are you talking about Secondary lists?
When you use WRITE statement, it prints the contents to the screen.
The only way you can print some other content, say Point B, it will be executed when you do some other action, Button click, HOTSPOT etc. If this is the case, you don't have to do anything to handle the list output.
Can you explain what is the exact requirement?
Thanks,
Shambu
‎2012 Jun 10 4:15 PM
Hi Guys,
Let me explain the requirement.
I am creating a Z reporting program with selection screen. At point A, I am using WRITE statement to create a report (report A) . At point B, I am creating another report (report b) with WRITE. And due to logic, I don't want to print the report created by point A. I want to display only the report created at point B. Right now both Report A and Report B are displayed on screen.
Thanks a lot for your time.
‎2012 Jun 10 4:34 PM
Hi,
Again, the requirement is not clear.
How does the control go to point B?
END-OF-SELECTION.
WRITE: 'Report A'. " Basic list
AT LINE SELECTION.
WRITE : 'Report B'. " Secondary list
Is this what you are doing?
If you dont want to print the Report A, why are you writing this?
This doesn't make any sense. I am missing something.
Please explain.
Thanks,
Shambu
‎2012 Jun 11 2:59 AM
Hi Shambu,
Thanks for your time.
Program : ZABC1
perform WRITE_REPORT_A (Write report and create ITAB1) (I have to run this. Mandetory)
export ITAB1 to memoy id 'ZITAB1'
if new_logic = 'X'
submit ZABC2 and return.
endif.
if new_logic = 'X'
import ITAB2 from memory id 'ZITAB2'
(clear previous report Report A)
Write report using ITAB2.
endif.
-------------------------------------
Program: ZABC2
Import ITAB1 from memory id 'ZABC1
Process ITAB1 and create ITAB2.
export ITAB2 to memory id 'ZITAB2'.
--------------------------------------------
I hope this helps you.
Thanks for your help again.
‎2012 Jun 11 4:56 AM
Hi Manoj,
There is a way to clear the List content even after writing to the screen.
MODIFY LINE.
Check a sample program I have used.
DATA : lt_mara TYPE TABLE OF mara WITH HEADER LINE,
ls_mara LIKE LINE OF lt_mara,
test TYPE string,
start TYPE i,
lin TYPE i.
START-OF-SELECTION.
SELECT * FROM mara INTO TABLE lt_mara UP TO 10 ROWS.
END-OF-SELECTION.
LOOP AT lt_mara.
WRITE:/ lt_mara-matnr, lt_mara-mtart, lt_mara-laeda, lt_mara-ernam.
ENDLOOP.
DESCRIBE LIST PAGE 1 INDEX 0 LINES lin.
start = 1.
DO lin TIMES.
MODIFY LINE start OF CURRENT PAGE LINE VALUE FROM test.
start = start + 1.
ENDDO.
You can try commenting the MODIFY LINE statement and see what changes this brings.
Thanks,
Shambu
‎2012 Jun 11 2:21 PM
Hi,
To have the minimum amount of modifications, you could create ZABC0 program :
SUBMIT zabc1 ... EXPORTING LIST TO MEMORY... and return
CALL FUNCTION 'LIST_FROM_MEMORY'... -> itab1
if new_logic = 'X'
FREE itab1
submit ZABC2 and return.
import ITAB2 from memory id 'ZITAB2'
Write report using ITAB2.
else
CALL FUNCTION 'WRITE_LIST' of itab1
FREE itab1
endif
Regards,
Sandra
‎2012 Jun 11 4:23 PM
Hi,
A possible workaround for this, if your tables ITAB1 and ITAB2 has the same structure (or at least the same output field length), is to overwrite your first list with the second one by using the statement BACK before outputting ITAB2... If ITAB2 contains less records than ITAB1, you will also have to overwrite the extra entries from ITAB1 with blank lines... Not really nice however
Question: Why not simply output the first list based on a condition as well??
E.g:
if new_logic = ' '
perform WRITE_REPORT_A
else.
submit ZABC2 and return.
import ITAB2 from memory id 'ZITAB2'
Write report using ITAB2.
endif.
Kr,
Manu.
‎2012 Jun 11 9:31 AM
‎2013 Dec 06 12:49 PM