on 12-11-2014 11:20 AM
Good day,
In web dynpro, I'm trying to split string field into specific format as following:
Field value in DB table: 'user_id1 Date1 Time1 comment_text1 user_id2 Date2 Time2 comment_text2' as one field.
Field type is STRING.
After fetching this field from DB table, I need to split the string as following:
user_id1 Date1 Time1
comment_text1
********************************
user_id2 Date2 Time2
comment_text2
*******************************
Regards;
Habeeb
Hi,
Is your issue resolved?...if not please revert back
Thanks
KH
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Recently i got the same requirement and CR_LF does'nt works for me.Alternatively i used
CL_ABAP_CHAR_UTILITIES=>NEWLINE.
You can achieve this in various ways.
1) If your comments are fixed i,e as per shown above, use below code.
Data LV_STRING type STRING.
CONCATENATE USER_ID1 DATE1 TIME1 INTO LV_STRING SEPERATED BY SPACE.
CONCATENATE LV_STRING <COMMENT_TEXT1> INTO LV_STRING SEPERATED BY
CL_ABAP_CHAR_UTILITIES=>NEWLINE.
CONCATENATE LV_STRING '********************************' INTO LV_STRING SEPERATED BY
CL_ABAP_CHAR_UTILITIES=>NEWLINE.
CONCATENATE LV_STRING USER_ID2 DATE2 TIME2 INTO LV_STRING SEPERATED BY SPACE.
CONCATENATE LV_STRING <COMMENT_TEXT2> INTO LV_STRING SEPERATED BY
CL_ABAP_CHAR_UTILITIES=>NEWLINE.
CONCATENATE LV_STRING '********************************' INTO LV_STRING SEPERATED BY
CL_ABAP_CHAR_UTILITIES=>NEWLINE.
2) Else, you can achieve the same in LOOP statement as well.
Hope this helps you to resolve your issue.
Thanks
KH
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just use the concatenate Statement and CR_LF to get the new lines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.