‎2006 Nov 09 9:07 AM
Hi experts,
See the following code.
DATA STR(1000) TYPE C VALUE '1#02.11.2006#02.11.2006#1061#AUD##7#SA#Legacy data transfer1#Reference1'.
replace all occurrences of '#' in str with space.
if sy-subrc = 0.
write:/ str.
endif.
So the o/p is
102.11.200602.11.20061061AUD7SALegacy data transfer1Reference1
But the Actual o/p should be like this:
1 02.11.2006 02.11.2006 1061 AUD 7 SA Legacy data transfer Reference1
it should contain 10 fields in o/p...
Can anybody tell me what may be the problem in the code?
y it is not taking space?
Regrads
Ravi.
‎2006 Nov 09 9:14 AM
Pleae try using translate instead.
DATA: STR(1000) TYPE C VALUE '1#02.11.2006#02.11.2006#1061#AUD##7#SA#Legacy'
translate str using '# '.
IF SY-SUBRC = 0.
WRITE:/ STR.
ENDIF.
‎2006 Nov 09 9:24 AM
Hi,
Thanks..it is working...but see the below code.
TYPES: TY_D_ITABVALUE TYPE ALSMEX_TABLINE-VALUE,
TY_T_ITAB TYPE ALSMEX_TABLINE OCCURS 0,
BEGIN OF TY_S_SENDERLINE,
LINE(4096) TYPE C,
END OF TY_S_SENDERLINE,
TY_T_SENDER TYPE TY_S_SENDERLINE OCCURS 0 .
DATA: EXCEL_TAB1 TYPE TY_T_SENDER.
DATA : WA_EXCELTAB1 LIKE LINE OF EXCEL_TAB1.
data: str(2000) type c.
LOOP AT EXCEL_TAB1 INTO WA_EXCELTAB1.
str = WA_EXCELTAB1-line.
translate str using '#'.
MODIFY EXCEL_TAB1 FROM WA_EXCELTAB1.
CLEAR WA_EXCELTAB1.
ENDLOOP.
So here the same translate statement is not working..
WA_EXCELTAB1-line has value:1#02.11.2006#02.11.2006#1061#AUD##7#SA#Legacy data transfer1#Reference1
What may be the problem?
Regards
‎2006 Nov 09 9:33 AM
ur logic looking very clumsy..
try this way...ur modify EXCEL_TAB1 using WA_EXCELTAB1
but doing translate to str.
LOOP AT EXCEL_TAB1 INTO WA_EXCELTAB1.
*str = WA_EXCELTAB1-line.
translate WA_EXCELTAB1-line using '#'.
MODIFY EXCEL_TAB1 FROM WA_EXCELTAB1.
CLEAR WA_EXCELTAB1.
ENDLOOP.
‎2006 Nov 09 9:33 AM
‎2006 Nov 09 9:38 AM
Try with the following code:
data: l_separator TYPE c.
l_separator = cl_abap_char_utilities=>horizontal_tab.
REPLACE ALL OCCURRENCES OF l_separator IN wa_data WITH space.
‎2006 Nov 09 9:43 AM
Hi,
in ur code posted 2nd time
TYPES: TY_D_ITABVALUE TYPE ALSMEX_TABLINE-VALUE,
TY_T_ITAB TYPE ALSMEX_TABLINE OCCURS 0,
BEGIN OF TY_S_SENDERLINE,
LINE(4096) TYPE C,
END OF TY_S_SENDERLINE,
TY_T_SENDER TYPE TY_S_SENDERLINE OCCURS 0 .
DATA: EXCEL_TAB1 TYPE TY_T_SENDER.
DATA : WA_EXCELTAB1 LIKE LINE OF EXCEL_TAB1.
data: str(2000) type c.
LOOP AT EXCEL_TAB1 INTO WA_EXCELTAB1.
str = WA_EXCELTAB1-line.
<b>translate str using '# '.</b> <<make sure here u give 1 space after # inside the quotes,it will not work otherwise>>
MODIFY EXCEL_TAB1 FROM WA_EXCELTAB1.
CLEAR WA_EXCELTAB1.
ENDLOOP.
‎2006 Nov 09 9:51 AM