‎2005 Nov 29 4:00 AM
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
‎2005 Nov 29 4:07 AM
You can do by using SPILT command. see the help on that
‎2005 Nov 29 4:23 AM
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
‎2005 Nov 29 4:30 AM
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.
‎2005 Nov 29 4:42 AM
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
‎2005 Nov 29 4:48 AM
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.
‎2005 Nov 29 7:25 AM
hi
i have to break line say at position 15 ...and then from there in next line..
i hope i am clear...
regards
‎2005 Nov 29 9:03 AM
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