‎2007 Jun 05 11:56 AM
For example, there is a string:
C-REVF-00003 0010 Development
how the program get the value '0010'?
‎2007 Jun 05 11:58 AM
hi,
substring = string+offset(no of chars).
string = 'C-REVF-00003 0010'.
substring = string+14(4).
check this.
‎2007 Jun 05 11:57 AM
‎2007 Jun 05 11:58 AM
hi,
substring = string+offset(no of chars).
string = 'C-REVF-00003 0010'.
substring = string+14(4).
check this.
‎2007 Jun 05 12:01 PM
if the string = 'C-REVF-00000003 0010'.
substring = string+14(4) doesn't work.
‎2007 Jun 05 12:04 PM
hi James,
try this
REPORT ychatest MESSAGE-ID zz..
DATA : v_str(25) VALUE 'C-REVF-00003 0010',
v_str1(4).
SEARCH v_str FOR '0010'.
IF sy-subrc EQ 0.
v_str1 = v_str+sy-fdpos(4).
ENDIF.
WRITE : v_str1
‎2007 Jun 05 11:58 AM
Hi,
Use SHIFT <string> BY <n> PLACES LEFT command.
Regards,
Padmam.
‎2007 Jun 05 11:58 AM
u can use offset lengths.
text = '10001000101'.
v_text = text+9(3) = 101.
Regards
Peram
‎2007 Jun 05 11:59 AM
data : text(30) value 'C-REVF-00003 0010 ',
text1(10),
text2(10).
split text at space into text1 text2.
write : / text2.
regards
shiba dutta
‎2007 Jun 05 12:00 PM
Hi,
Use Split command.
Syntax
SPLIT <c> AT <del> INTO <c1>... <cn> INTO TABLE <itab>.
Searches the field <c> for the character <del> and places the partial fields before and after <del>
into the target fields <c1> <cn>, or into a new line of the internal table <itab>.
Ex.
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
Regards,
Bhaskar