cancel
Showing results for 
Search instead for 
Did you mean: 

if statment in sap script

Former Member
0 Kudos

hi,

IF ( &STAX3& = '4.00' OR &STAX3& = '12.50' )

XXXXXX,, ,,&text3& &STAX1&% ,,,, &TOT_STAX1(C.0)&

XXXXXX,, ,,&text3& &STAX2&% ,,,, &TOT_STAX2(C.0)&

,,,,&text51&,,,,&tot_tcost&

,,,,,,,,&TOT_FINAL(C.0)&

ELSE

XXXXXX,, ,,&text3& &STAX&% ,,,, &TOT_STAX(C.0)&

,,,,&text51&,,,,&tot_tcost&

,,,,,,,,&TOT_FINAL(C.0)&

ENDIF

i am using this code.

i have one doubt in if statment we can use this syntax

IF ( &STAX3& = '4.00' OR &STAX3& = '12.50' )

this is correct or not.

if i use this code if statment is not excuting.

pls clarify my doubt.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Venkat,

Usually we'll write all the logical ABAP statements in Subroutine pool, instead of writing them in the script form directly.

Use PERFORM statement in the script form as shown below & write the code u want in that....

/: PERFORM GET_MERCANTIL IN PROGRAM cust_invoice

/: USING &RKWA-BUKRS&

/: USING &RKWA-LIFNR&

/: USING &BKPF-GJAHR&

/: CHANGING &V_MERCANTIL&

/: ENDPERFORM

GT Insc.Reg.Mercantil &V_MERCANTIL&

GT is the paragraph format.

Go to SE38 & create the program,cust_invoice ( called as Subroutine pool ) & write the FORMs in that....

U can use the normal ABAP coding in that....

Hope this will work.

Try this out & let me know if there are any issues.

Reward points, if useful.

Pavan.

Former Member
0 Kudos

hi,

The syntax is correct and it should work ... Please check what value you are getting in debug mode ..

Regards,

Santosh

Former Member
0 Kudos

Hi,

IF is a control command used in sap scripts.

the syntax is

/: IF (condition)

.....

/: ELSE

.....

/: ENDIF

This command will controll the the sapscript documents. These are used in sapscript text editors.

Reward.

Former Member
0 Kudos

/: IF ( &STAX3& EQ &STAX4& OR &STAX3& EQ &STAX5& )

I4 XXXXXX,, ,,&text3& &STAX1&% ,,,, &TOT_STAX1(C.0)&

I4 XXXXXX,, ,,&text3& &STAX2&% ,,,, &TOT_STAX2(C.0)&

/* ,,,,&text51&,,,,&tot_tcost&

I4 ,,,,,,,,&TOT_FINAL(C.0)&

/: ELSE

I4 XXXXXX,, ,,&text3& &STAX&% ,,,, &TOT_STAX(C.0)&

/* ,,,,&text51&,,,,&tot_tcost&

I4 ,,,,,,,,&TOT_FINAL(C.0)&

/: ENDIF