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

SAp Script

Former Member
0 Likes
755

Hi all

i need a help in sap script...

the reuierment is like::

char(35). and the ouput is coming in one line,like:::

Sap is big market in world.

but i have break the line in two parts::

it should display like::

sap is big

market in world.

i hope i am able to describe what i need..

plz help in this..

regards

parul

7 REPLIES 7
Read only

Former Member
0 Likes
708

You can do by using SPILT command. see the help on that

Read only

0 Likes
708

hi all

can anyone plz help me on this issue...i am not geeting any idea how to do that...

plz if possible someone help me out..

regards

parul

Read only

Former Member
0 Likes
708

Splitting Character Strings

To split a character string into two or more smaller strings, use the SPLIT statement as follows:

SPLIT <c> AT <del> INTO <c1> ... <cn>.

The system searches the field <c> for the separator <del>. The parts before and after the separator are placed in the target fields <c1> ... <cn>.

To place all fragments in different target fields, you must specify enough target fields. Otherwise, the last target field is filled with the rest of the field <c> and still contains delimiters.

If all target fields are long enough and no fragment has to be truncated, SY-SUBRC is set to 0. Otherwise it is set to 4.

DATA: STRING(60),

P1(20) VALUE '++++++++++++++++++++',

P2(20) VALUE '++++++++++++++++++++',

P3(20) VALUE '++++++++++++++++++++',

P4(20) VALUE '++++++++++++++++++++',

DEL(3) VALUE '***'.

STRING = ' Part 1 *** Part 2 *** Part 3 *** Part 4 *** Part 5'.

WRITE STRING.

SPLIT STRING AT DEL INTO P1 P2 P3 P4.

WRITE / P1.

WRITE / P2.

WRITE / P3.

WRITE / P4.

The output appears as follows:

Part 1 *** Part 2 *** Part 3 *** Part 4 *** Part 5

Part 1

Part 2

Part 3

Part 4 *** Part 5

Note that the contents of the fields P1 ...P4 are totally overwritten and that they are filled out with trailing blanks.

You can also split a string into the individual lines of an internal table as follows:

SPLIT <c> AT <del> INTO TABLE <itab>.

The system adds a new line to the internal table <itab> for each part of the string.

Read only

former_member186741
Active Contributor
0 Likes
708

Hi PArul,

you need to create a page-window which is smaller than the text you are trying to put in it and then SAPscript will automatically overflow and wrap the text round to fit. You have to do this in transaction SE71.

Regards

Neil

Read only

Former Member
0 Likes
708

Hi parul,

1. what does the variable contain ?

i mean, does it contain new line character?

2. What will be the criteria for the BREAK

eg.

Sap is big

market in world.

OR

Sap is big market in

world.

OR

Sap

is big market in world.

etc. etc.

Can u pls clarify.

Regards,

Amit Mittal.

Read only

0 Likes
708

hi

i have to break line say at position 15 ...and then from there in next line..

i hope i am clear...

regards

Read only

Former Member
0 Likes
708

Hi Parul,

Have two string variables and one to get total length of your string.

v_str = 'sap is a big market in world'.

now, V_len = strlen( v_str).

v_str1 = v_str+0(15).

v_len = v_len - 15.

v_str2 = v_str+15(v_len).

now, v_str1 and v_str2 has your string of data as required.

Regards,

Raj