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

How does SAPscript 'WRITE_FORM' works ?

former_member425121
Participant
0 Likes
841

Hi

I have a Z program working fine, it is a SAPM07DR copy and i aggregated some fields to WASCHEIN form.

But i see when the program (standard or copy) calls the write form, the field values in program have other values (just the previous values) than the values wich appears in the printed form.

For example:

WASCHEIN KOPF Window has the WERKS value:

Plant: &*T001W-WERKS&

But when the write form is called

CALL FUNCTION 'WRITE_FORM'

EXPORTING ELEMENT = 'KOPF'

WINDOW = 'KOPF'.

In the program the *T001W-WERKS field has a different value that the value wich appears in the spool, debugging i see that the field has the prevoius value in the program:

Program

*T001W-WERKS

(when Write Form).............Spool

-


.................----


' '...................................Plant: 0900

'0900'.............................Plant: 0901

I had to do the same logic in my new aggregated fields, but i realy don't know why does the program works in this way.

Why the print program and sapscript function works in this way ?

How does WRITE-FORM works, that is where the function take from the values to print ?

Thanks

Frank

1 ACCEPTED SOLUTION
Read only

former_member425121
Participant
0 Likes
694

Does nobody can help me to solve my doubt, please ?

Thanks

Frank

3 REPLIES 3
Read only

former_member425121
Participant
0 Likes
695

Does nobody can help me to solve my doubt, please ?

Thanks

Frank

Read only

0 Likes
694

Hi

It generally depends on when the fm WRITE_FORM is called:

*T001W-WERS = '9000'.

CALL FUNCTION 'WRITE_FORM'

....

*T001W-WERS = '9001'.

CALL FUNCTION 'WRITE_FORM'

....

Here the sapscript should print 9000 and after 9001.

Max

Read only

0 Likes
694

Hi Max

I hope the program works like you said, but it works:

old_werks = ' '

T001W-WERKS = '0900'.

*T001W-WERKS = T001W-WERKS .

*T001W-WERKS = old_werks. <-- ' '

CALL FUNCTION 'WRITE_FORM'

(form KOPF with *T001W-WERKS)

....

old_werks = '0900'

T001W-WERKS = '0901'.

*T001W-WERKS = T001W-WERKS .

*T001W-WERKS = old_werks. <-- '0900'

CALL FUNCTION 'WRITE_FORM'

(form with *T001W-WERKS)

But the FM prints 0900 and after 0901, when the *T001W-WERKS values were ' ' and '0900' !!!

(and with the *T001W-NAME1 field occurs in the same way)

Why does the FM prints that values ??

Thanks

Frank