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 operation

Former Member
0 Likes
1,156

How to extract string seperately into different units .

i need CALL FUNCTION into one and then the remanining part into other.

The problem is the string may be not be of same size.But it will always hold 'CALL FUNCTION'.

Example

CALL FUNCTION 'UPLOAD'

CALL FUNCTION 'WS_UPLOAD'.

PLEASE HELP.

8 REPLIES 8
Read only

Former Member
0 Likes
1,116

HERE you will see in upload method set it.

HAS_FIELD_SEPARATOR = 'X'

Read only

Former Member
0 Likes
1,116

Hello,

Check this sample:

DATA: STR TYPE STRING,
      STR1 LIKE STR,
      STR2 LIKE STR.
STR = 'CALL FUNCTION `WS_UPLOAD'.

SPLIT STR AT '`' INTO STR1 STR2.
WRITE:/ STR1,
      /  STR2.

Cheers,

Vasanth

Read only

former_member203501
Active Contributor
0 Likes
1,116

hi look at this..

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/7f4fb0bd-0701-0010-6c80-b68c1767...

or use this..

HR_EFI_CONVERT_STRING_TO_TABLE

SWA_STRING_TO_TABLE

Read only

bpawanchand
Active Contributor
0 Likes
1,116

Hi

PARAMETERS :
   p_str(35) TYPE c.

DATA :
  w_cf TYPE string VALUE 'CALL FUNCTION',
  w_str TYPE string,
  w_str1 TYPE string,
  w_str2 TYPE string,
  w_len TYPE i,
  w_temp TYPE i.


CONCATENATE w_cf ' ''' p_str '''' INTO w_str.


w_len = STRLEN( w_str ).

w_temp = w_len - 13.

WRITE :
  / w_str.

w_str1  = w_str+0(13).
w_str2 = w_str+13.


WRITE /:
   w_str1 , w_str2.

Regards

Pavan

Read only

Former Member
0 Likes
1,116

get the string length

v_strlen = strlen ( field ).

v_strlen = v_strlen - 14.

v_val1 = field+0(13).

v_val2 = field+14(v_strlen).

Read only

Mohamed_Mukhtar
Active Contributor
0 Likes
1,116

Hi Susmitha,

PARAMETER p_str TYPE string.

DATA : abc TYPE i.

abc = STRLEN( p_str ).

abc = abc - 13.

WRITE :/ p_str+abc.
WRITE :/ p_str+0(13).

Thanks & Regards

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,116

just check this.

data:prefix type string value 'CALL FUNCTION'.

data:suffix type string.

data:split_string type tring 'CALL FUNCTION WS_UPLOAD'

data:length type i.

length = strlen( split_string ).

length = length - 1.

suffix = split_string+13(length).

write prefix

write suffix.

Read only

Former Member
0 Likes
1,116

Hi,

first find the length(say x) and then deduct 13 from that(y = x-13) and copy the remaining string to another string like this

data:c type string value 'CALL FUNCTION XYZ' ,

a type string ,

b type string,

x type i,

y type i.

x = STRLEN( c ) .

y = x - 13.

a = c+13(y).

Rhea.