2012 Jul 17 11:18 AM
Dear Experts,
I'm in the midst of customizing the sapscript form.
I've added the following lines in include (Z_RFFORI06) of print medium program Z_RFFOAVIS_FPAYM.
IF hlp_xhrfo EQ space.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
window = 'main_or'
element = '699'
function = 'APPEND'
EXCEPTIONS
window = 1
element = 2.
ENDIF.
I also added the following lines in the sapscript form
/E 699
/* -------------------- print invoice line item -------------------------------------------------
/: IF ®UH-LIFNR& EQ ' '
T2 &BSEG-REBZG&,,&VBRK-FKDAT&,,&VBRK-NETWR&,,&BSEG-NEBTR&
/: ENDIF
I used debugger to test print and the system did run the function module "write_form" but nothing came out on the printout.
I've even tried to use Write statement, and it printed out to the display, that means, there were values in the variables.
Does anyone has any idea?
regards,
Abraham
2012 Jul 17 11:28 AM
Another thing, comment out the IF check in the window 699 and put it back once the text is printing. This will make testing easier:
IF ®UH-LIFNR& EQ ' '
You may need to change the above to IF ®UH-LIFNR& EQ ' '.
But just comment it out for now.
2012 Jul 17 11:25 AM
Try changing the window = 'main_or' to uppercase window = 'MAIN_OR'
CALL FUNCTION 'WRITE_FORM'
EXPORTING
window = 'main_or'
element = '699'
function = 'APPEND'
EXCEPTIONS
window = 1
element = 2.
Assuming there is a window called MAIN_OR in the sap script and a text element 699.
2012 Jul 17 11:28 AM
Another thing, comment out the IF check in the window 699 and put it back once the text is printing. This will make testing easier:
IF ®UH-LIFNR& EQ ' '
You may need to change the above to IF ®UH-LIFNR& EQ ' '.
But just comment it out for now.
2012 Jul 18 3:23 AM
2012 Jul 18 4:28 AM
Hi Chaun,
Keep all in caps.SAP is not a case sensitive but space sensitive.Even though keep in caps.
Regards,
Madhu.
2012 Jul 18 5:14 AM
It's still the same after I made them to big cap.
Anyway, I added CLEAR statement immediately after the ENDLOOP, in order to clear the value in the above mentioned variables, and it printed out 4 lines of zero amount.
It seems like that the system pick up the last values that remained in the variables, and since it's reset after end of WRITE_FORM by the CLEAR statement, it has no values to print.
Does anyone know how exactly the system push the values to the print layout before sent for printing?
regards,
Abraham
2012 Jul 18 8:10 AM
Hi ,
Can i check with you window main is calling some condition if hlp_xhrfo EQ space .
Check for this condition may be for some record condition is getting truncate .
Check in Debugging .
Regards,
Yukti
2012 Jul 18 9:55 AM
Hi Yukti,
I've removed "if hlp_xhrfo EQ space" but still the same.
I've tried with Debugger and it showed there's correct values in the variables each loop before it move to the 'WRITE_FORM' function module, same as what was displayed by WRITE statement.
May I know where else other than WRITE_FORM function module, does the system process the print layout?
regards,
Abraham
2012 Jul 18 10:45 AM
2012 Jul 18 12:42 PM
Where have you declared BSEG? is it declared globally or locally? It must be declared globally for it to be visible in the sap script. The write statement maybe referring to a local declaration of BSEG.
Show us where you have declared BSEG and if possible give us more from Z_RFFORI06 and Z_RFFOAVIS_FPAYM.
Che
2012 Jul 19 7:32 AM
Hi Che,
I declared BSEG in Z_RFFORI00 as following.
tables:
bseg. "Accounting Document Segment
and internal table in Z_RFFORI06 as following.
FORM avis_schreiben.
DATA:
it_bseg TYPE TABLE OF bseg WITH HEADER LINE.
The way I look at the issue, it seems like the declaration has no problem as print medium program could print out except that it's print the last line repeatedly only.
I did use the Debugger, and it showed the values were carried in until just before WRITE_FORM, but once entered, it dissappeared, but will come back again once exit from WRITE_FORM.
Would that be caused by the declaration?
regards,
Abraham
2012 Jul 19 8:48 AM
Hi Abraham,
From what I have seen you cannot print table data in a non main window. You are printing the contents of table IT_BSEG in window MAIN_OR, is it a Main window or a Secondary window? The results you are getting are consistent with printing in a secondary window i.e. only the last line of data printed is shown.
Take a look at this thread:
//http://scn.sap.com/thread/1059966
Che
2012 Jul 19 10:14 AM
Hi Che,
At last my friend, you make my day.. It works now!.. just because of one little setting.. I moved the text element and the variables to the 'MAIN' window.
Thanks once again..
regards,
Abraham
2012 Jul 17 2:46 PM
I think
window = 'main_or'
should be written 'MAIN'_OR', too.
If this is not the problem check the window has exact the same name.
2012 Jul 18 5:14 AM
Hi Abraham,
Change your window name from lowercase to upper case then try
CALL FUNCTION 'WRITE_FORM'
EXPORTING
window = 'MAIN_OR'
i think now it should work.
Regards,
Ashish
2012 Jul 18 8:10 AM
Hi Ashish,
I already done that earlier and it worked but didn't print out exactly the values being passed to.
Now it's printing the last line's value only for 4 times repeatedly as there're 4 rows of data in the internal table.
Do you have any idea?
regards,
Abraham
2012 Jul 18 12:16 PM
Hi Abraham,
Clear the variables just before 'ENDLOOP', then check.
Regards,
Ashish