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

script variable printing

Former Member
0 Likes
1,407

Hi all,

i have problem in printing the variables in the Sapscript calculated in report.

i done this in the same report once by using,

PERFORM convert_to_scriptvar USING 'medi' medi.

here 'medi' is my variable. this worked.

but now im trying for another variable but its not working like above, i also tried by using element in sapscript like,

PERFORM write_form USING 'ELEMENT' 'APPEND' 'BODY' 'MAIN'.

but it still not working in both cases. plz help me out to solve this problem.

thanx...

11 REPLIES 11
Read only

Former Member
0 Likes
1,295

plzz reply back to solve this problem..

thanx a lot..

Read only

Former Member
0 Likes
1,295

why there is not a single reply????

plzz reply back...

plzzz.

thanx...

Read only

0 Likes
1,295

Hi Nelesh,

Please be more descriptive about the requirement.

Regards

Vijai

Read only

Former Member
0 Likes
1,295

Hi

what i understand,

You want to print values of variable in the sapscript.

Can you please confirm ur requirements or let me know ur requirements.

Read only

Former Member
0 Likes
1,295

i have a variable on which i have performed some operatiopn and now i want to disply the value (total amount) in the sap script for this i have tried various options mention in my question. it worked for 1 earlier with those thechniques but now it is not working.

why is it? or is there any other simple way to print report variable in sapscript.????

thax a lot for reply..

Read only

Former Member
0 Likes
1,295

Hi,

your question is not clear. but I am giving the syntax for calling the perform

Syntax in a form window:

/: PERFORM <form> IN PROGRAM <prog>
/: USING &INVAR1&
/: USING &INVAR2&
......
/: CHANGING &OUTVAR1&
/: CHANGING &OUTVAR2&
......
/: ENDPERFORM

INVAR1 and INVAR2 are variable symbols and may be of any of the four SAPscript symbol types.

OUTVAR1 and OUTVAR2 are local text symbols and must therefore be character strings.

The ABAP subroutine called via the command line stated above must be defined in the ABAP report prog as follows:

FORM <form> TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
*reading the invar1 value and multiplying with 20
read table in_tab with key name = 'invar1'.
in_tab-value = in_tab-value *20.

* asiging the calculated value into out var1.
out_tab-name = 'outvar1'.
out_tab-value  =  in_tab-value.
modify out_tab from out_tab.
 here for &invar1&
...
ENDFORM.

similary do calculations on all variables.

Thanks,

Suma

Read only

Former Member
0 Likes
1,295

You can do this via using the commant

Perform

endperform.

For example

write the following code in script

/: PERFORM get_amount PROGRAM ztest

/: USING &VAR1&

/: CHANGING &VAR2&

/: ENDPERFORM

write the following code in program ztest

FORM get_amount TABLES l_input_table STRUCTURE itcsy (table to hold the variables passed frm script)

l_output_table STRUCTURE itcsy. table to hold the variables passed to script)

READ TABLE l_input_table WITH KEY name = 'VAR1.

VAR2 = VAR1 * 100.

CLEAR l_output_table.

READ TABLE l_output_table WITH KEY name =' VAR2'.

IF sy-subrc = 0.

MOVE l_amount TO l_output_table-value.

MODIFY l_output_table INDEX sy-tabix.

ENDIF.

ENDFORM.

Read only

Former Member
0 Likes
1,295

will it not work with this?

PERFORM convert_to_scriptvar USING 'medi' medi.

bcoz i it worked before for this 'medi' variable.

thanx for ur reply..

Read only

Former Member
0 Likes
1,295

plz someone tel me ???

will it work..???

im not getting reply..??

sorry

& thanxxx a lot...

plzz relpyy....

Read only

Former Member
0 Likes
1,295

where are all the experts gone...?????

plz tel me can we pass the values to sapscript from report using

PERFORM convert_to_scriptvar USING 'medi' medi.

this statement????

plzzzzzz reply...

Read only

Former Member
0 Likes
1,295

ok