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 editor...How to write code?

Former Member
0 Likes
3,451

In Script editor, How can I write code for the below calculation? Because I could not write code in driver program which is standard program .

<b>B1 &REGUP-BELNR&,,&REGUP-XBLNR&,,&REGUP-BLDAT&,,

&REGUP-WAERS&,,

= net</b>

I mean <b>net</b> = <b>&REGUP-WRBTR& - &REGUP-QBSHB& - &REGUP-WSKTO&</b>

Is it possible to take a variable to catch the value of &REGUP-WRBTR& - &REGUP-QBSHB& - &REGUP-WSKTO&

Please help me. It is urgent.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,407

Try to define a perform in your driver program like this:

/: PERFORM calculate_net 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 calculate_net TABLES IN_TAB STRUCTURE ITCSY

OUT_TAB STRUCTURE ITCSY.

*-Define your logic for Net

...

ENDFORM.

6 REPLIES 6
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,407

You can't do it like that, you will need to do a PERFORM in your sapscript passing the values to the FORM in a "Z" program and doing the calculation and passing the value back to the form.

Regards,

Rich Heilman

Read only

0 Likes
1,407

You cant operate text elements in SAP scripts..

the alternate way is copy the standard program into zprogram and add a subroutine for ur calculations and pass it to sap script.

Read only

Former Member
0 Likes
1,408

Try to define a perform in your driver program like this:

/: PERFORM calculate_net 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 calculate_net TABLES IN_TAB STRUCTURE ITCSY

OUT_TAB STRUCTURE ITCSY.

*-Define your logic for Net

...

ENDFORM.

Read only

0 Likes
1,407

Naresh has show you how to call a PERFORM in your script, since you are working with a standard print program, you can not put this FORM in your driver program, all you need to do is create a "Z" program and put this FORM in it, and then reference the "Z" program in the PERFORM statement in your sapscript.

REgards,

Rich Heilman

Read only

0 Likes
1,407

It is a Executable program. Not an Include Program

Read only

0 Likes
1,407

Hi Kumar,

I guess you dont need to do any caluculations, Netamount Which is Standard had a field, Please just use that field.

I guess it is Regud-swnes.

Let me know, if your problem is solved.

Thanks & Regards

Venkat