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

doubt in printing variables in script

Former Member
0 Likes
545

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
Read only

Former Member
0 Likes
530

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

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.

2 REPLIES 2
Read only

Former Member
0 Likes
531

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

Read only

Former Member
0 Likes
530

Hi Aditya,

Thanks for your reply. I have given the points.

Regards,

Ramana.