‎2008 Aug 13 10:30 AM
Hi Experts,
This is my internal table.
data: begin of i_final occurs 0,
value1 type char10,
value2 type char20,
value3 type char30,
end of i_final.
These fields have the following values in them.
value1 = abc.
value2 = defghijkl.
value3 = pqrstuv
Now I should insert '~' symbol as the separator. But I have to insert the symbol
at the last position of its total length i.e for
value1 --> I have to insert at 10th position.
value2 --> I have to insert at 20th position.
value3 --> I have to insert at 30th position.
Thanks in advance.
‎2008 Aug 13 10:33 AM
Hii,
use concatinate this symbol .but for placing this symbol give space like that ' '.
thanks,
jatin
‎2008 Aug 13 10:33 AM
Hii,
use concatinate this symbol .but for placing this symbol give space like that ' '.
thanks,
jatin
‎2008 Aug 13 10:34 AM
hii
calculate length first for every field .
give this in space.
length = strlen(value1)
do length-1.
use concatenate value1 ' ' into field1.
enddo.
concatenate field1 '~' into value.
thanks
Edited by: pardeep kumar on Aug 13, 2008 3:04 PM
Edited by: pardeep kumar on Aug 13, 2008 3:06 PM
‎2008 Aug 13 10:38 AM
Hi,
Try CONCATENATE value1 value2 value3 INTO finalfield SEPARATED BY '~' RESPECTING BLANKS.
Regards,
Mohaiyuddin
‎2008 Aug 13 10:38 AM
Hello mohd. Aslam,
Try string operation
i_final-value1+10 = '~'.
i_final-value2+20 = '~'.
i_final-value3+30 = '~'.
CONCATENATE does not take into account the trailing blanks.
Hope this helps.
BR,
SUhas
‎2008 Aug 13 10:38 AM
Hi Mohamed,
try something like this:
SHIFT var BY 1 PLACES RIGHT.
var(1) = '~'.
SHIFT var BY 1 PLACES LEFT CIRCULAR.
Regards,
Martin
‎2008 Aug 13 10:43 AM
Hi Aslam ,
First u have to find the length of th string .
then add the empty space for the string , at the end of the string concatenate the "~" operator .
Ex .. strlen( a ) .
concatenate a ' ~' into a .
‎2008 Aug 13 10:52 AM
data: len type i,
var1 and var2 and var3 of type value1.2.3.
define itab_final also of type itab.
loop at itab.
len = strlen( value1).
var1 = value1+9.
var2 = value+9(len).
concatenate var1 '~' var2 into var3.
itab_final-value1 = var3.
append itab_final.
clear : len, var1,var2, var3.
len = strlen( value2).
var1 = value2+9.
var2 = value2+9(len).
concatenate var1 '~' var2 into var3.
itab_final-value2 = var3.
append itab_final.
clear : len, var1,var2, var3.
len = strlen( value3).
var1 = value3+9.
var2 = value3+9(len).
concatenate var1 '~' var2 into var3.
itab_final-value3 = var3.
append itab_final.
clear : len, var1,var2, var3.
endloop.
hope this will help u .
‎2008 Aug 13 11:14 AM
Hi Mohamed,
I created this sample code, I think it works for you.
TYPE-POOLS: abap.
data: begin of i_final occurs 0,
value1 type char10,
value2 type char20,
value3 type char30,
end of i_final.
DATA:
ls_components TYPE abap_compdescr_tab,
lo_strucdescr TYPE REF TO cl_abap_structdescr,
lv_abap_comp TYPE abap_compdescr. "work area for the ls_components table, that provides the name of the field, as one of the components.
FIELD-SYMBOLS: <fs> TYPE ANY.
lo_strucdescr ?= cl_abap_typedescr=>describe_by_data( i_final ).
ls_components = lo_strucdescr->components.
i_final-value1 = 'abc'.
i_final-value2 = 'defghijkl'.
i_final-value3 = 'pqrstuv'.
LOOP AT ls_components INTO lv_abap_comp.
ASSIGN lv_abap_comp-name TO <fs>.
CONCATENATE 'i_final-' <fs> INTO <fs>.
ASSIGN (<fs>) TO <fs>.
CONCATENATE <fs> '~' INTO <fs>.
ENDLOOP.
WRITE:/ i_final-value1,
i_final-value2,
i_final-value3.