Skip to Content
author's profile photo Former Member
Former Member

How to use SPLIT statements in SAP

I have a Variable which stores two field values like Purchase Order No and Date now I want to display this Value correctly from that Variable

e.g VAR1 = PONO/Date

How to print PONO on one line and Date on the other line from the VARIABLE VAR1.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Feb 01, 2005 at 09:21 AM

    split var1 at '/' into l_pno l_date.

    Christian

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 01, 2005 at 09:28 AM

    Hi Nandan,

    There are different ways to do this.

    Suppose your variable contains always a fixed length of two other values like PO number an Date.

    DATA: v_pono TYPE ebeln,

    v_date TYPE sydatum,

    v_variable(18) TYPE C.

    v_variable = '000001234520050201'.

    You can then read the parts like this:

    v_pono = v_variable+000(010).

    v_date = v_variable+010(008).

    Suppose your variable contains always a variable length of two other values like PO number an Date.

    DATA: v_pono TYPE ebeln,

    v_date TYPE sydatum,

    v_variable(20) TYPE C,

    v_table LIKE v_variable OCCURS 0.

    v_variable = '12345/20050201'.

    You can then read the parts like this:

    SPLIT v_variable AT '/' INTO TABLE v_table.

    READ TABLE v_table INTO v_pono INDEX 1.

    READ TABLE v_table INTO v_date INDEX 2.

    Or you can use it like this:

    SPLIT v_variable AT '/' INTO v_pono v_date.

    Hope this gives you some clues.

    Regards,

    Rob.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.