2005 Aug 04 4:34 PM
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
2005 Aug 04 7:57 PM
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
2005 Aug 04 4:43 PM
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
2005 Aug 04 5:03 PM
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
2005 Aug 04 5:06 PM
Hi Srikanth,
below links might help you.
http://help.sap.com/saphelp_45b/helpdata/en/65/897415dc4ad111950d0060b03c6b76/content.htm
http://www.henrikfrank.dk/abapexamples/SapScript/sapscript.htm
regards,
venu.
2005 Aug 04 7:57 PM
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
2005 Aug 05 3:37 PM
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.
2005 Aug 05 9:54 PM
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