cancel
Showing results for 
Search instead for 
Did you mean: 

To do the calculation in SAPScript

Former Member
0 Kudos

Is it possible To do the calculation(addition of two fields) in SAPScript

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

you need to write the External perform statment, add the 2 fields in the program as Global fields, then write the perform statment as said by Tamás Nyisztor .

in the FORM routine you can get the 2 fields bu writing the seelct statment and do the caliculation then send the total value to the script using the OUTTAB

Regards

Sudheer

Former Member
0 Kudos

yes use the

/: to do the calculation in sapscript.

Former Member
0 Kudos

Can you sent me a sample code with /: for addition of two fields

Former Member
0 Kudos

Hi,

You can do calculations by calling a subroutine program in the Script using

Perform and Endperform. You can go with any calculations in the subroutine

program and pass the value to the script.

Reward points if it is useful.

Thanks,

Geeta

Former Member
0 Kudos

Hi!

Within SAPScript, you can PERFORM a FORM from an abap program. In your abap code, you can add the fields.

For example:

Definition in the SAPscript form:

/: PERFORM GET_BARCODE IN PROGRAM QCJPERFO

/: USING &PAGE&

/: USING &NEXTPAGE&

/: CHANGING &BARCODE&

/: ENDPERFORM

/

/ &BARCODE&

Coding of the calling ABAP program:

REPORT QCJPERFO.

FORM GET_BARCODE TABLES IN_PAR STUCTURE ITCSY

OUT_PAR STRUCTURE ITCSY.

DATA: PAGNUM LIKE SY-TABIX, "page number

NEXTPAGE LIKE SY-TABIX. "number of next page

READ TABLE IN_PAR WITH KEY ‘PAGE’.

CHECK SY-SUBRC = 0.

PAGNUM = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY ‘NEXTPAGE’.

CHECK SY-SUBRC = 0.

NEXTPAGE = IN_PAR-VALUE.

READ TABLE OUT_PAR WITH KEY ‘BARCODE’.

CHECK SY-SUBRC = 0.

IF PAGNUM = 1.

OUT_PAR-VALUE = ‘|’. "First page

ELSE.

OUT_PAR-VALUE = ‘||’. "Next page

ENDIF.

IF NEXTPAGE = 0.

OUT_PAR-VALUE+2 = ‘L’. "Flag: last page

ENDIF.

MODIFY OUT_PAR INDEX SY-TABIX.

ENDFORM.

Regards

Tamá