‎2009 Aug 14 6:15 PM
Hi I am writing a function module that will retrieve value in a table and trying to print using sapscript form, but table value is not passing to sapscript form.
I see the value before WRITE_FORM, but when the form is printed, it is not display value.
It prints text information, but not values from the table.
Thanks for any help you can give.
John
My code looks like this...
data: t_reguh like table of reguh with header line.
get data to t_reguh
call function 'OPEN_FORM'
exporting
device = 'PRINTER'
form = 'ZFORM1'
language = sy-langu
options = zoption
importing
language = sy-langu
exceptions
others = 1.
loop at t_reguh.
call function 'WRITE_FORM'
exporting
element = '610-T'
" FUNCTION = 'APPEND'
" TYPE = 'BODY'
window = 'MAIN'
exceptions
element = 1.
endloop.
call function 'CLOSE_FORM'
exceptions
unopened = 1
others = 2.
‎2009 Aug 14 6:21 PM
‎2009 Aug 14 6:29 PM
Yes.
One of the fields is reference as &T_REGUH-VBLNR& in 610-T
‎2009 Aug 14 6:22 PM
Hi,
De comment parameter FUNCTION and set value equal to Set or Append.
you can also use function Module WRITE_FORM_LINES also for main Window
‎2009 Aug 14 6:29 PM
‎2009 Aug 14 6:30 PM
Hi,
Your code looks fine. Seems there is a problem in the script where you are calling the text-element 610-T . Check if you are correctly calling the itab value for this element in the script
‎2009 Aug 14 6:33 PM
I am not understanding when you say check itab value is calling correctly.
All the texts in the element prints except table values.
‎2009 Aug 14 6:33 PM
Have you done a check on the form that includes a text element check (symbol check)?
Rob
‎2009 Aug 14 6:38 PM
I am sorry, but can you explan little more in detail what you are asking me to do?
Thanks.
‎2009 Aug 14 6:44 PM
Open your form and take the menu path:
Form -> Check -> Texts
Make sure "Symbol check" is selected
Press enter.
If a popup asking for a program comes up, select your program
See if any errors are reported.
Rob
‎2009 Aug 14 6:55 PM
First go to debug mode and check whether T_REGUH-VBLNR have value or not ?
a®
‎2009 Aug 14 6:57 PM
It has value right before calling write_form function, but I can't seem to debug actual sapscript form.
‎2009 Aug 14 7:00 PM
Just for testing
declare a variable like
data : v_text(30) type c.
then move T_REGUH- to v_text.
then declare v_text in the form and check whether its printing or not
a®
‎2009 Aug 14 7:06 PM
Nope.
No value is printing.
Somehow value is not passing into write_form function module.
‎2009 Aug 14 7:07 PM
‎2009 Aug 14 7:10 PM
‎2009 Aug 14 7:15 PM
‎2009 Aug 14 7:33 PM
That's is one of the questions I have...
Where do you have to declare to be global?
Thanks
‎2009 Aug 14 7:37 PM
If you have a top include, declare them there. If you just have the main program, declare them at the top (before the forms).
Rob
‎2009 Aug 14 7:38 PM
‎2009 Aug 14 7:42 PM
OK - the element 610-T has something like:
Blah blah blah &T_REGUH-VBLNR& blah blah blah.
Correct? IE, there is no logic there (IF)?
Rob
‎2009 Aug 14 7:44 PM
Correct.
And no logic at all...
I took everything out, so only one value from the table and a line of text can print.
‎2009 Aug 14 7:50 PM
‎2009 Aug 14 7:51 PM
‎2009 Aug 14 7:52 PM
OK - I wouldn't mind seeing it if you can post it - and the SAPScript element.
Rob
‎2009 Aug 14 7:53 PM
Hi,
You seem to have used an internal table with header line.
Just a suggestion.
Please check if your body of the internal table is populated or its just the header.
Try to print the value of your field in the program and see if its populated with data.
‎2009 Aug 14 7:55 PM
Yes, i do see all the values before calling write_form function module.
‎2009 Aug 14 7:57 PM
Hi,
Because you have populated your data in the internal table, did you do this?
LOOP AT itab.
CALL FUNCTION 'WRITE_FORM'.
ENDLOOP.
As Rob suggests, try pasting your code here.
‎2009 Aug 14 8:07 PM
This is basically what I used.
Before calling WRITE_FORM, I can see all the values in T_REGUH table.
TABLES : USR01, REGUH, REGUP.
DATA : BEGIN OF ZOPTION.
INCLUDE STRUCTURE ITCPO.
DATA : END OF ZOPTION.
data: wa_reguh type reguh.
data: t_reguh like table of reguh with header line.
CLEAR USR01.
SELECT SINGLE * FROM USR01 WHERE BNAME = SY-UNAME.
ZOPTION-TDDEST = USR01-SPLD. "Output device (printer)
ZOPTION-TDIMMED = 'X'. "Print immediately
ZOPTION-TDDELETE = 'X'. "Delete after printing
ZOPTION-TDPROGRAM = 'ZPQRPRNT'. "Program Name
ZOPTION-TDGETOTF = 'X'.
select * from reguh into wa_reguh
where laufi = 'JL128'
append wa_reguh to t_reguh.
endselect.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
DEVICE = 'PRINTER'
DIALOG = ' '
FORM = 'ZFORM1'
LANGUAGE = SY-LANGU
OPTIONS = ZOPTION
IMPORTING
LANGUAGE = SY-LANGU
EXCEPTIONS
OTHERS = 1.
loop at T_REGUH.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = '610-T'
FUNCTION = 'APPEND'
" TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
ELEMENT = 1.
endloop.
CALL FUNCTION 'CLOSE_FORM'
TABLES
OTFDATA = IT_OTFDATA
EXCEPTIONS
UNOPENED = 1
OTHERS = 2.
SAPSCRIPT FORM
ELEMENT 601-T
/E 601-T
AS PRINT DOC NO &T_REGUH-VBLNR&
‎2009 Aug 14 8:14 PM
‎2009 Aug 14 8:18 PM
Sorry... that was relate to creating pdf file, so I took it out.
It is declare at top.
data: it_otfdata type standard table of itcoo,
it_tline type standard table of tline.
‎2009 Aug 14 8:35 PM
In the write_from you are calling element 610-T but in SAPSCRIPT its 601-T
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = '610-T' "<<<<<<<<<<<<<<<
FUNCTION = 'APPEND'
" TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
ELEMENT = 1.
SAPSCRIPT FORM
ELEMENT 601-T
/E 601-T "<<<<<<<<<<<<<<<<<<<
AS PRINT DOC NO &T_REGUH-VBLNR&
a®
‎2009 Aug 14 8:49 PM
‎2009 Aug 14 8:55 PM
‎2009 Aug 15 3:42 PM
Sorry, but it is 610-T in Sapscript form, meaning both progam and sapscript have 610-T
I just typed wrong when I wriote here....
Any other suggestion?
‎2009 Aug 18 12:15 PM
I probably am missing something very simple... but just can't figure it out.
ANY OTHER SUGGESTIONS???
I REALLY NEED TO GET THIS FIX QUICKLY.
Thanks.
John