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

SAP Script - problem accessing a variable from the program

Former Member
0 Likes
968

Hello Friends,

I try to access a variable in SAP Script.

For ex.

IF &Y_VAR& EQ 'X'.

When the control goes here, during debuging, it simple omits the whole condition, including else part.

It's really a strange thing. Could any one suggest what is wrong here.

Senthil

7 REPLIES 7
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
872

Is this variable define in the global section of the print program? Can you please post the code from the sapscript for the IF statement along with the format.

Regards,

Rich Heilman

Read only

0 Likes
872

Hi,

The code is

IF &Y_FLAG& EQ 'X'.

INCLUDE '0510011256' OBJECT VBBK ID '0001'

ELSE.

INCLUDE ...

ENDIF.

This code is in the Address window, and when debugging Y_FLAG holds the value X, but it simple skips the process. Y_FLAG is declared globally in the program.

Thank for your time.

Senthil

Read only

0 Likes
872

Hi,

Make sure that y_flag is of Char 1 (or) .

Try it as

IF &Y_FLAG& = 'X'

.

<i>Hope This Info Helps YOU.</i>

Regards,

Lakshmi

Read only

Former Member
0 Likes
872

chk if u have declared Y_VAR within a subroutine..if yes, then declare it globally...

Read only

0 Likes
872

As Bikash suggested might be variable not declared globally in the print program.

You do check(syntax check) at text element level.

Hope this helps.

Thanks and regards,

vamshi tallada

Read only

Former Member
0 Likes
872

define the variable globally in the print program or

use CALL FUNCTION 'SET_TEXTSYMBOL'

EXPORTING

NAME = NAME

VALUE = VALUE.

if the variable is not globally defined.

For E.g

PERFORM SET_TEXTSYMBOL USING 'ITEM_FT' ITEM_FT

FORM SET_TEXTSYMBOL USING NAME VALUE.

CALL FUNCTION 'SET_TEXTSYMBOL'

EXPORTING

NAME = NAME

VALUE = VALUE.

ENDFORM. " SET_TEXTSYMBOL

and in the SAP Script use &ITEM_FT& variable.

Read only

Former Member
0 Likes
872

This looks more like an activation issue even though you are seeing the code in debugging, you may be executing the older version of it. Activate all and then start your test from the begining.