2009 Jul 03 4:07 PM
Hi Gurus,
Before post this thread, i hav searched SDN but i could not find the exact solution.
I hav an internal table, i want to add the records of this internal table into single line (string variable), separated by tab operator.
can any one give me suggestions to solve this?
Thanks
Meher
Hi Gurus,
Before post this thread, i hav searched SDN but i could not find the exact solution.
I hav an internal table, i want to add the records of this internal table into single line (string variable), separated by tab operator.
can any one give me suggestions to solve this?
Thanks
Meher
2009 Jul 03 4:42 PM
use concatenate and cl_abap_char_utilities=>horizontal_tab
Roughly something like this:
do.
assign component sy-index of structure <table_line> to <fs>
if sy-subrc is not initial.
exit.
endif.
concatenate lv_string <fs> into lv_string separated by cl_abap_char_utilities=>horizontal_tab
enddo.
Edited by: Micky Oestreich on Jul 3, 2009 5:42 PM
2009 Jul 03 5:24 PM
Hi,
Program should be some thing like below:
-
REPORT ZTEST36.
*-- test program to concatenate internal table to string.
DATA:STRING TYPE STRING.
TYPES:BEGIN OF TY_ITAB,
WEEK(15),
END OF TY_ITAB.
DATA:GT_ITAB TYPE STANDARD TABLE OF TY_ITAB WITH HEADER LINE.
CLEAR GT_ITAB.
GT_ITAB-WEEK = 'SUNDAY'.
APPEND GT_ITAB.
CLEAR GT_ITAB.
GT_ITAB-WEEK = 'MONDAY'.
APPEND GT_ITAB.
CLEAR GT_ITAB.
GT_ITAB-WEEK = 'TUESDAY'.
APPEND GT_ITAB.
CLEAR GT_ITAB.
GT_ITAB-WEEK = 'WEDNESDAY'.
APPEND GT_ITAB.
CLEAR GT_ITAB.
GT_ITAB-WEEK = 'THURSDAY'.
APPEND GT_ITAB.
CLEAR GT_ITAB.
GT_ITAB-WEEK = 'FRIDAY'.
APPEND GT_ITAB.
CLEAR GT_ITAB.
GT_ITAB-WEEK = 'SATURDAY'.
APPEND GT_ITAB.
CLEAR:GT_ITAB, STRING.
LOOP AT GT_ITAB.
CONCATENATE STRING '/' GT_ITAB INTO STRING.
ENDLOOP.
WRITE: / STRING.
---------------------------------------------------------Regards
Ramesh.
Moderator message - Ramesh - please use code tags
Edited by: Rob Burbank on Jul 3, 2009 12:26 PM
2009 Jul 06 9:55 AM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |