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

sapscript: PERFORM USAGE issue#2

Former Member
0 Likes
777

I dont get the expected value 5 from the PERFORM command. I tested explicitly putting value '123456' right on the OUT_PAR-VALUE and it showed on the report. but when I assign the VAR3 (which is the summation of VAR1 and VAR2) on OUT_PAR-VALUE, it wont realy appear. Where did i go wrong.

I tested the value of V3 on the debugger and it is giving me value 5. OUT_PAR-VALUE on the debugger is blank. I wonder why. <b>pls help. thanks. </b>

<b>screenshot of the sapscript code:</b>

http://i150.photobucket.com/albums/s116/painkiller2007/SAP/sapscript23.jpg

-


code of the called program

-


data: V1 type I,
      V2 type I,
      V3 type I.

form CALLSUB1 tables  IN_PAR structure ITCSY
                     OUT_PAR structure ITCSY.

      read table IN_PAR with key 'VAR1'.
      if SY-SUBRC = 0.
        V1 = IN_PAR-VALUE.
      endif.

      read table IN_PAR with key 'VAR2'.
      if SY-SUBRC = 0.
        V2 = IN_PAR-VALUE.
      endif.

      V3 = V1 + V2.

      read table OUT_PAR with key 'OUTPUT1'.
      CHECK SY-SUBRC = 0.
      OUT_PAR-VALUE = V3.
MODIFY OUT_PAR INDEX SY-TABIX.

endform. 

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
748

Hi,

Declare all the fields as TYPE C

data: V1(2) type C,

V2(2) type C,

V3(2) type C.

Regards

Sudheer

9 REPLIES 9
Read only

Former Member
0 Likes
748

Hi,

form CALLSUB1 tables  IN_PAR structure ITCSY
                     OUT_PAR structure ITCSY.
 
data: V1 type I,   " Inside the Form and Endform
      V2 type I,
      V3 type I.


      read table IN_PAR with key 'VAR1'.
      if SY-SUBRC = 0.
        V1 = IN_PAR-VALUE.
      endif.
 
      read table IN_PAR with key 'VAR2'.
      if SY-SUBRC = 0.
        V2 = IN_PAR-VALUE.
      endif.
 
      V3 = V1 + V2.
 
      read table OUT_PAR with key 'OUTPUT1'.
      CHECK SY-SUBRC = 0.
      OUT_PAR-VALUE = V3.
MODIFY OUT_PAR INDEX SY-TABIX.
 
endform.

Regards

Sudheer

Read only

Former Member
0 Likes
748

Try to use tranporting value in modify statement,,

also is the data local or global???

Hope solves your problem

Regards,

Jayant

Please award if helpful

Message was edited by:

JAYANT KUMAR

Read only

Former Member
0 Likes
748

Did you define the OUTPUT1 variable also in the script itself?

Regards,

Ravi

Read only

Former Member
0 Likes
748

<b>SUDHEER:</b> I put the variable declaration inside just like you said but still the same.

<b>RAVI: </b> I defined the OUTPUT1 too. the code is at the top. in fact, when you hardcode a value on OUT_PAR-VALUE, the value will be displayed on the sapscript report page.

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
748

Hi

Without touching the Print Program, we can change the sap script by using

Perform statements.

Using ITCSY structure.

Regards,

Sreeram

Read only

Former Member
0 Likes
748

Everything ooks ok to me.

is there enough space in the window to print?

Regards,

Ravi

Read only

Former Member
0 Likes
749

Hi,

Declare all the fields as TYPE C

data: V1(2) type C,

V2(2) type C,

V3(2) type C.

Regards

Sudheer

Read only

Former Member
0 Likes
748

Hi,

as u have written in u r form endperform as a command line, write like this :

/: perform callsub1 in program z_sub

= using &var1&

= using &var2&

= changing &output1&

= endperform

Reward points if useful..

Regards

Nilesh

Read only

Former Member
0 Likes
748

As advised by<b> SUDHEER,</b> I changed the variabled type from integer to character. I doubted it because as far as i know, I cant do math operations on character type but it did and it solved my issue. can someone explain this to me? that confuses me dramatically.

thanks to all of the contributors.