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

About Sap Scripts

Former Member
0 Likes
512

Hi experts,

Is it possible to use IF condition in Script editor ?

If possible pls explain in detail .

Thanks,

kaladhar.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
488

Hi kaladhar,

Formatting

&SYMBOL& No formatting

&SYMBOL+4& Offset - Output begins here. Offset refers to formatted value

&SYMBOL(5)& Length - Output data in the specified length

&SYMBOL(I)& Suppress initial value - If the field has been initialized, nothing is output

&SYMBOL(Z)& Suppress leading zeros

&SYMBOL(C)& Compress blank spaces - Consecutice spaces are compressed into a single space. Leading spacesare suppressed.

&SYMBOL(R)& Right align output

&SYMBOL(S)& Operators are suppressed

&SYMBOL(*)& Dictionary length - The data length is defined by the ABAP dictionary

&SYMBOL(8.2)& Decimal format. Length 8 decimals 2

&'text1'SYMBOL'text2'& Text can be inserted before and after the symbol

Control commands

Control command are used to modify text output. Use format key /: in the format column.

/: INCLUDE

/: DEFINE

/: ADDRESS....ENDADDRESS

/: PROTECT.....ENDPROTECT

/: NEW-PAGE

/: IF....ENDIF

/: CASE...ENDCASE

Thankyou,

Regards.

3 REPLIES 3
Read only

Former Member
0 Likes
488

/: if <var1> eq <var2>

/: end if.........

reward if ,,,,

regards

Anbu

Read only

0 Likes
488

You can use the IF control command to specify that text lines should be output only when certain conditions are met. If the logical expression contained within the IF command evaluates to be true, then the text lines enclosed by the IF ... ENDIF command pair will be output. Otherwise they are ignored.

Syntax:

/: IF condition

:

:

/: ENDIF

The logical expression can use the following the comparison operators:

u2022 = EQ equal to

u2022 < LT less than

u2022 > GT greater than

u2022 <= LE less than or equal to

u2022 >= GE greater than or equal to

u2022 <> NE not equal to

The following logical connective operators can be used to combine conditions:

u2022 NOT

u2022 AND

u2022 OR

Evaluation of both the individual logical expressions and of the combinations of expressions is performed strictly from left to right. There are no precedence rules. Bracketed expressions are not supported.

The comparison is always performed on literal values, i.e. the symbols are formatted as character strings before being compared rather than using the internal form. This is particularly significant in the case of program symbols, because the formatting of these may depend on various parameters. For example, the formatted form of a currency field employs a variable number of decimal places and a variable 'decimal point' symbol (e.g. a period or a comma) depending on the applicable currency key.

The IF command may be extended with the ELSE command to allow text lines to be specified which are to be output in the case that the condition evaluates to be false. The text lines enclosed by the IF and ELSE commands are formatted if the condition is true; otherwise the text lines enclosed by the ELSE and ENDIF commands are formatted.

Syntax:

/: IF condition

:

/: ELSE

:

/: ENDIF

The ELSEIF command allows multiple cases to be specified.

Syntax:

/: IF condition

:

/: ELSEIF condition

:

/: ELSE

:

/: ENDIF

You can use arbitrarily many ELSEIF commands within one compound IF .. ENDIF control command. The use of an ELSE command is then optional.

Notes:

u2022 A condition may not occupy several lines. Both the IF or ELSEIF command and the attached condition must be completely contained within a single line.

u2022 IF commands may be nested.

u2022 An IF command must be terminated with an ENDIF command. If this is forgotten, then there will be no more output following the IF command if the condition evaluates to be false.

u2022 If a syntax error occurs in the interpretation of this command, then the command will not be executed. This may have an unexpected effect on the subsequent text output. For example if the IF statement is incorrect, then all following ELSEIF and ELSE commands will be ignored, since the opening IF command is 'missing'. This will cause all the text lines attached to the ELSEIF and ELSE commands to be output.

Please reward points if helpful

Read only

Former Member
0 Likes
489

Hi kaladhar,

Formatting

&SYMBOL& No formatting

&SYMBOL+4& Offset - Output begins here. Offset refers to formatted value

&SYMBOL(5)& Length - Output data in the specified length

&SYMBOL(I)& Suppress initial value - If the field has been initialized, nothing is output

&SYMBOL(Z)& Suppress leading zeros

&SYMBOL(C)& Compress blank spaces - Consecutice spaces are compressed into a single space. Leading spacesare suppressed.

&SYMBOL(R)& Right align output

&SYMBOL(S)& Operators are suppressed

&SYMBOL(*)& Dictionary length - The data length is defined by the ABAP dictionary

&SYMBOL(8.2)& Decimal format. Length 8 decimals 2

&'text1'SYMBOL'text2'& Text can be inserted before and after the symbol

Control commands

Control command are used to modify text output. Use format key /: in the format column.

/: INCLUDE

/: DEFINE

/: ADDRESS....ENDADDRESS

/: PROTECT.....ENDPROTECT

/: NEW-PAGE

/: IF....ENDIF

/: CASE...ENDCASE

Thankyou,

Regards.