Skip to Content
avatar image
Former Member

string operation

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

8 Answers

  • avatar image
    Former Member
    Sep 25, 2008 at 10:22 AM

    HERE you will see in upload method set it.

    HAS_FIELD_SEPARATOR = 'X'

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 25, 2008 at 10:26 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 25, 2008 at 10:27 AM

    hi look at this..

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

    or use this..

    HR_EFI_CONVERT_STRING_TO_TABLE

    SWA_STRING_TO_TABLE

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 25, 2008 at 10:27 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 25, 2008 at 10:27 AM

    get the string length

    v_strlen = strlen ( field ).

    v_strlen = v_strlen - 14.

    v_val1 = field+0(13).

    v_val2 = field+14(v_strlen).

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 25, 2008 at 10:36 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 25, 2008 at 10:46 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 25, 2008 at 10:55 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded