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

Twisting / Jumbling a Text

Former Member
0 Likes
1,282

I need to jumble the string. Ex: String has a valur like 'ANSWER'. I need to jumble the characters. something like 'RSNWRE'. some thing like that. The order of the jumbled string can be of any way.

I need to jumble the string. Ex: String has a valur like 'ANSWER'. I need to jumble the characters. something like 'RSNWRE'. some thing like that. The order of the jumbled string can be of any way.

8 REPLIES 8
Read only

Former Member
0 Likes
1,220

Hi,

Develop logic yourself using STRLEN and Loops.

regards,

Moon

Read only

0 Likes
1,220

Posted the thread thinking like SAP has any standard function module.

Read only

0 Likes
1,220

There is no standard FM available by SAP for jumbling text. Infact we can go with simple logic.

Read only

0 Likes
1,220

Check if the FM ISB_RANDOM_CHAR helps.

Read only

0 Likes
1,220

@ Vikranth : I tried this FM with passing pattern as ANSWER . The result comes out as WANEER

Read only

Former Member
0 Likes
1,220

hi,

check this code



data:
  w_char type STRING VALUE 'WELCOME',
  w_index type i,
  str1 type string,
  str2 type string,
  w_int type i,
  w_off type i.

  w_int = strlen( w_char ).
  w_off = 0.
  do w_int times.
  w_index = sy-index - 1.
  if w_off eq 0.
  concatenate str1 w_char+w_index(1) into str1.
  w_off = 1.
  else.
  concatenate str2 w_char+w_index(1) into str2.
  w_off = 0.
  endif.
  enddo.
  shift str1 left circular.
  shift str2 right circular.
  concatenate str2 str1 into w_char.
write:/ w_char.

Regards and Best wishes.

Read only

Former Member
0 Likes
1,220

I have written the custom Function Module.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,220

May be you can share the code for future reference.

Cheers,

Suhas