Application Development 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: 

doubt in printing variables in script

Former Member
0 Kudos
96

Hi Experts,

I am having small doubt.

1).I need to write one condition for sales org 'US11' and divisions '20' or '40'. So the below logic is correct or not.

if vbdkr-vkorg = 'US11' and and vbdkr-vtweg = '20' or vbdkr-vtweg = '40'.

select........

endif.

2). i need th print these variables in script. can i use the logic like this.

if &vbdkr-vkorg& = 'US11' and and &vbdkr-vtweg& = '20' or &vbdkr-vtweg& = '40'.

&zkbetr1/ zpery1&

else.

&zkbetr/ zpery& (This is for sales org other than US11)

endif.

Thanks & Regards,

Ramana.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
81

Hi,

I think your condition would be more apt if you code this way:


IF vbdkr-vkorg EQ 'US11' AND ( vbdkr-vtweg EQ '20' OR vbdkr-vtweg EQ '40' ).

ENDIF.

Also, look at putting the code into a subroutine called from your driver or subroutine program and then returning the value. The "logic" for determining the value to be printed can then be performed within the subroutine rather than the SAP script.

Cheers,

Aditya

2 REPLIES 2

Former Member
0 Kudos
82

Hi,

I think your condition would be more apt if you code this way:


IF vbdkr-vkorg EQ 'US11' AND ( vbdkr-vtweg EQ '20' OR vbdkr-vtweg EQ '40' ).

ENDIF.

Also, look at putting the code into a subroutine called from your driver or subroutine program and then returning the value. The "logic" for determining the value to be printed can then be performed within the subroutine rather than the SAP script.

Cheers,

Aditya

Former Member
0 Kudos
81

Hi Aditya,

Thanks for your reply. I have given the points.

Regards,

Ramana.