cancel
Showing results for 
Search instead for 
Did you mean: 

Perform in sapscript

Former Member
0 Kudos

Hello,

i've been reading about this method to make simple programs in sap forms. I do the same things that you do, but i get no results. I explain:

I do this into the form:

/: DEFINE &ZGW01&

/: PERFORM CALCULATE IN PROGRAM Z_CALCULATE

/: USING &AFVGD-VGW01&

/: CHANGING &ZGW01&

/: ENDPERFORM

In the program i make this:

REPORT Z_CALCULATE.

FORM CALCULATE TABLES IN_TAB structure itcsy

OUT_TAB structure itcsy.

DATA: ZGW01 LIKE AFVGD-VGW01.

Read table IN_TAB index 1.

ZGW01 = IN_TAB-VALUE * 2.

Read table OUT_TAB index 1.

MOVE ZGW01 TO OUT_TAB-VALUE.

Modify OUT_TAB index 1.

ENDFORM.

But i don't get the out_tab-value into the form. Which is the problem?

Accepted Solutions (1)

Accepted Solutions (1)

valter_oliveira
Active Contributor
0 Kudos

Does AFVGD-VGW01 have values? Change your form to do this testing to make sure:


Read table IN_TAB index 1.
IF IN_TAB-VALUE IS INITIAL.
  ZGW01 = '123.123'.
ELSE.
  ZGW01 = IN_TAB-VALUE * 2.
ENDIF.

Also use script debug on your perform.

Regards,

Valter Oliveira.

Former Member
0 Kudos

I have made a debug in Z program.

I get the next (example):

IN_TAB-VALUE = 3.229

ZGW01 = 6.458

OUT_TAB-NAME = ZGW01

OUT_TAB-VALUE = empty field

Because of that i supose that the problem is on this part of program:

Read table OUT_TAB index 1.

MOVE ZGW01 TO OUT_TAB-VALUE.

Modify OUT_TAB index 1.

Perhaps in the MOVE commad.... i don't know.

JozsefSzikszai
Active Contributor
0 Kudos

hi,

after

MOVE ZGW01 TO OUT_TAB-VALUE.

insert the following line:

SHIFT out_tab-value LEFT DELETING LEADING space.

out_tab-value is a long character type field and probabyl the value is justified right by default.

You can also try to replace the MOVE ... with WRITE ... TO .... (in this case you probably don't need the SHIFT)

hope this helps

ec

valter_oliveira
Active Contributor
0 Kudos

Ok, and I think your deduction seems correct. Here I use code similar to this and it's working:


READ TABLE out_par WITH KEY name = 'ZGW01'.
CHECK sy-subrc = 0.
out_par-value = <new_value>.
MODIFY out_par INDEX sy-tabix.

Regards,

Valter Oliveira.

Former Member
0 Kudos

Thank you Eric. It works!. I give you points.

Answers (0)