cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP Logic in SAPscrip Layout

0 Kudos

Hello SAPscrip experts. I have a situation where two currency fields are carrying left over values from a previous A/R statement, if the account balance is zero. This is occuring in the footer window of my layout.

The logic looks like this:

IF &NEXTPAGE& EQ 0

(I want to do my conditional test here to initialize the fields before printing.)

&RF140-RAST1(13)& &RF140-RAST2(13) &RF140-SALDO(C)&

ENDIF

I need to clear out the first two fields with zeros, when the SALDO field is equal to zeros.

Edited by: Ernie Laboy on Feb 7, 2012 8:51 PM

Accepted Solutions (1)

Accepted Solutions (1)

tamas_hoznek
Product and Topic Expert
Product and Topic Expert
0 Kudos

As a quick-and-dirty solution (in case you don't want to touch the print program), you could use the following:

/: PERFORM RESET IN PROGRAM ZZRESET USING &RF140-SALDO(C)& CHANGING &RF140-RAST1(13)& &RF140-RAST2(13)&

Then in the RESET routine, you can evaluate the content of RF140-SALDO and CLEAR RF140-RAST1 and RF140-RAST2 if necessary.

Of course it would be cleaner to do this in the print program though, if you can modify that.

0 Kudos

Thanks Tamas. I've been testing the PERFORM logic, but I'm still having trouble understanding it. Question: Once the ABAP program is running, in order to access the data coming in USING parameter, must I read that table in order to access the data, or do I just reference the field in question? Thanks.

former_member205763
Active Contributor
0 Kudos

in the subroutine you need to fetch the values from the table of ITCSY type.

is that what you are asking??

0 Kudos

Yes, that's what I meant. I'm working with numeric values so I have to remove the commas before moving the char VALUE field into a numeric field, ACCT_BALANCE. Below is my logic so far. I guess my question was, do I have to READ both tables, IN_PAR and OUT_PAR in order to access the data in the NAME and VALUE fields? Then, do I have to do a MODIFY to save the data into the OUT_PAR table before sending it back to the SAPscript logic? Does that make any sense? Thanks.

FORM reset TABLES in_par STRUCTURE itcsy

out_par STRUCTURE itcsy.

CLEAR acct_balance.

READ TABLE in_par WITH KEY name = 'RF140-SALDO'.

REPLACE ALL OCCURRENCES OF ',' IN in_par-value WITH space.

CONDENSE in_par-value NO-GAPS.

MOVE in_par-value TO acct_balance.

IF acct_balance EQ 0.

MOVE '0.00' TO out_par-value.

ENDIF.

MODIFY out_par INDEX 1.

Former Member
0 Kudos

HI friend,

Yes you are correct you need to do as what you have specified.

Please see my code below for numeric calculation,

form CALCUUU TABLES IN_PAR STRUCTURE ITCSY

OUT_PAR STRUCTURE ITCSY.

DATA CALCW TYPE WRBTR.

READ TABLE OUT_PAR with key 'TOT'.

if sy-subrc eq 0.

CALCW = 2 * 10.

OUT_PAR-value = CALCW.

CONDENSE OUT_PAR-value.

endif.

MODIFY OUT_PAR INDEX 1.

ENDFORM.

So this will solve your issue. Just like a same you have to define the perform in the form.

If you face any issue sin this please revert back to me i will help you.

Thanks,

Sri Hari

Answers (1)

Answers (1)

0 Kudos

Thank you guys. I am working on the ABAP side of the layout. Seems to be working to some degree, I need to tweak it here and there but thanks for your help. This is definitely the way to go.