Application Development 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: 

scripts

Former Member
0 Kudos
406

Hi everybody,

i have copied the standard script F140_DOCU_EXC_01 into ZFI_F140_DOCU_EX. i need to make some changes in the main window.In the main window there is a text element 521

i have aded a new field &RF140-WRSHB& for Net Amount in the text elmt 521.i need to caluculate the Net amount, for that do i need to write the subrouitne, if that is so what is the subroutine.

Thanks in advance.

Srikanth

1 ACCEPTED SOLUTION

Former Member
0 Kudos
190

Hi,

You need to write a piece of code in a sub-routine to fill the value in this field. For this call:

PERFORM <subroutin_name> IN PROGRAM <prog_name>

USING <parms>

CHANGING <parms>

ENDFORM.

Declare the program <prog_name> of type sub-routine pool.

And in the FORM... ENDFORM of the subroutine, declare the local variables as follows.

FORM <form_name> TABLES in_var type ITCSY

out_var type ITCSY.

You get the table in_var do the modifications and send the final value to out_var.

This should solve the problem

Vamsi

6 REPLIES 6

Former Member
0 Kudos
190

Hi Shrikanth,

Take a look at these links:

http://www.idocs.de/www3/cookbooks/sapscript/sapscript_7/docu.htm

http://www.henrikfrank.dk/abapexamples/SapScript/calling_abap_subroutines.htm

So what these examples show is that you pass values to your subroutine from your sapscript and then retieve the value from subroutine back to your sapscript.

Hope it helps,

Ville

Former Member
0 Kudos
190

Hi,

If u need to calculate the net amount use the following statement before displaying the value:

PERFORM <routine_name> IN PROGRAM <program_name>

USING <parameters>

CHANGING <parameters>

ENDPERFORM.

u need to declare the <program_name> as type

sub-routine pool

this should solve your problem.

Vamsi

Former Member
0 Kudos
191

Hi,

You need to write a piece of code in a sub-routine to fill the value in this field. For this call:

PERFORM <subroutin_name> IN PROGRAM <prog_name>

USING <parms>

CHANGING <parms>

ENDFORM.

Declare the program <prog_name> of type sub-routine pool.

And in the FORM... ENDFORM of the subroutine, declare the local variables as follows.

FORM <form_name> TABLES in_var type ITCSY

out_var type ITCSY.

You get the table in_var do the modifications and send the final value to out_var.

This should solve the problem

Vamsi

0 Kudos
190

Hi vamsi..

i have gone thru the ITCSY stru, could u please tell me how write the code for caluculating the net amount, i mean have written the code as u said, i have seen the struc RF140(i need to caluculate the field WRSHB, i need the code in se38.

the standard sap script is F140_DOCU_EXC_01.

cheers

srikanth.

0 Kudos
190

Hi,

Yu just need to pass the field(eg: &W_WRSHB&) to the NAME and the value to VALUE of structure ITCSY. Just write your code of select statements to retreive the data in the subroutine pool and pass back the value to the structure OUT_VAR.

eg: PERFORM ..... USING &RF140-WRSHB&

ENDPERFORM.

FORM ..... IN_VAR STRUCTURE ITCSY

OUT_VAR STRUCTURE ITCSY.

select....

read out_var with key name = &RF140-WRSHB&

if sy-subrc = 0.

out_var-value = (value you retrieved).

and modify the table accordingly.

endif.

ENDFORM.

While form printing, the system will get the value from the out_var and displays it.

Vamsi