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

String Comparision

Former Member
0 Likes
988

Hi Experts,

I need clarification regarding the following statement.

IF lv_temp EQ 's'.

lv_wbs_temp = prps-posid+0(12).

endif.

The above if condition while check whether that 12th character is 's' or not. If not,please provide your solutions.

Best Regards,

Bharat.

11 REPLIES 11
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
955

Hi,

IF lv_temp EQ 's'. "Will check for lower case value 's'

lv_wbs_temp = prps-posid+0(12). "Will move the first 12 characters from prps-posid to lv_wbs_temp.

endif.

Please make your question more clear

Read only

Former Member
0 Likes
955

The above if condition while check whether that 12th character is 's' or not.

IF lv_temp EQ 's'.

lv_wbs_temp = prps-posid+0(12).

endif.


IF lv_temp EQ 's'.
lv_wbs_temp = prps-posid+11(1) ."this will check if 12 character is 's' i.e small s .. 
endif.

br,

Vijay.

Read only

0 Likes
955

There is no check happening for the 12th character in the specified code.

It just moves the value based on Offset position.

Read only

0 Likes
955

yeah .keshav . i was about to alter my answer but system went for a reboot

the comparision she is looking for is a match to 's' but no where it was looking for 12 character ..

//IF lv_temp EQ 's'.

lv_wbs_temp = prps-posid+11(1) ."this will check if 12 character is 's' i.e small s ..

//endif.

instead it should be the first case like

if psps-posid+11(1) = 's' . makes sense that 12 character is 's' .. question was not clear ..

Br,

Vijay

Read only

0 Likes
955

Hi All,

After checking above condition. it has move in to the variable .

so in my report i have to declare as

lv_wbs_temp = prps-posid+0(11).

or

lv_wbs_temp = prps-posid+11(1).

Need ur suggestion to solve the problem.

Read only

0 Likes
955

 lv_wbs_temp = prps-posid+0(11). 

This will send first 11 characters of prps-posid to that variable.
 
 lv_wbs_temp = prps-posid+11(1).

This will send only 12th character of prps-posid to that variable.

Read only

0 Likes
955

Hello,

As mentioned above for

lv_wbs_temp = prps-posid+0(11). - copy first 11 characters from prps-posid into the variable

For

lv_wbs_temp = prps-posid+11(1) - it will copy 1 character on the 12th position.

Regards,

Sachin

Read only

Former Member
0 Likes
955

Hi Bharat,

The code checks whether lv_temp = 's' and not whether the 12th character of lv_temp is equal to s.

If you want to check the 12th Character of lv_temp, the code should be as follows:

if lv_temp+11(1) = 's'.

...

endif.

Secondly, the statement:

lv_wbs_temp = prps-posid+0(12).

will move the first twelve characters of prps-posid into lv_wbs_temp.

If you want only the twelfth character to be moved, use this statement:

lv_wbs_temp = prps-posid+11(1).

Hope this helps! Please revert if you need anything else!!

Cheers,

Shailesh.

Always provide feedback for helpful answers

Read only

Former Member
0 Likes
955

I think you're tyring to say....

if prps-posid+11(1) eq 's' .

lv_wbs_temp = prps-posid(12).

endif.

??

Read only

Former Member
0 Likes
955

Hi,

In your code,

you are first checking whether LV_TEMP EQ 's' or not? If it is 's'then you are passing first 12 characters of PRPS-POSID to

LV_WBS_TEMP.

If you want to check whether 12th character is 's' or not, use following code:

if LV_TEMP+11(1) = 's'.

endif.

Thanks,

Hemant

Read only

Former Member
0 Likes
955

Moderator message - Please do not ask or answer basic questions - thread locked Rob