Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

WRITE_FORM value not passed in

john_lee7
Participant
0 Likes
3,416

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.

35 REPLIES 35
Read only

Former Member
0 Likes
3,112

Is your variable referenced in element 610-T?

Rob

Read only

0 Likes
3,112

Yes.

One of the fields is reference as &T_REGUH-VBLNR& in 610-T

Read only

Former Member
0 Likes
3,112

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

Read only

0 Likes
3,112

I tried them as well, but no luck.

Read only

Former Member
0 Likes
3,112

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

Read only

0 Likes
3,112

I am not understanding when you say check itab value is calling correctly.

All the texts in the element prints except table values.

Read only

Former Member
0 Likes
3,112

Have you done a check on the form that includes a text element check (symbol check)?

Rob

Read only

0 Likes
3,112

I am sorry, but can you explan little more in detail what you are asking me to do?

Thanks.

Read only

0 Likes
3,112

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

Read only

0 Likes
3,112

First go to debug mode and check whether T_REGUH-VBLNR have value or not ?

a®

Read only

0 Likes
3,112

It has value right before calling write_form function, but I can't seem to debug actual sapscript form.

Read only

0 Likes
3,112

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®

Read only

0 Likes
3,112

Nope.

No value is printing.

Somehow value is not passing into write_form function module.

Read only

0 Likes
3,112

Have you done the check yet??

Rob

Read only

0 Likes
3,112

Yes, No error.

The text is syntactically correct message.

Read only

0 Likes
3,112

OK - are T_REGUH and the others declared globally?

Rob

Read only

0 Likes
3,112

That's is one of the questions I have...

Where do you have to declare to be global?

Thanks

Read only

0 Likes
3,112

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

Read only

0 Likes
3,112

I did that.

Read only

0 Likes
3,112

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

Read only

0 Likes
3,112

Correct.

And no logic at all...

I took everything out, so only one value from the table and a line of text can print.

Read only

0 Likes
3,112

How big is the program (number of lines)?

Rob

Read only

0 Likes
3,112

testing program is less than 100 lines.

Read only

0 Likes
3,112

OK - I wouldn't mind seeing it if you can post it - and the SAPScript element.

Rob

Read only

0 Likes
3,112

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.

Read only

0 Likes
3,112

Yes, i do see all the values before calling write_form function module.

Read only

0 Likes
3,112

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.

Read only

0 Likes
3,112

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&

Read only

0 Likes
3,112

Where is IT_OTFDATA declared?

Rob

Read only

0 Likes
3,112

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.

Read only

former_member194669
Active Contributor
0 Likes
3,112

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®

Read only

0 Likes
3,112

@ a®s

Impressive 😄

Read only

0 Likes
3,112

These are common mistake i usually do !!!

a®

Read only

0 Likes
3,112

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?

Read only

john_lee7
Participant
0 Likes
3,112

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