Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Numc

Former Member
0 Likes
507

Hi

I am getting Short dum at this statement.

v_var1 = v_var1 + v_var2.

v_var value is 120

v_var 2 = "abcdefghijk'.

basically trying to add 120 + abcdefghi....

i can do concatenate if it only one record or not adding

but if i have 10 records,9 records has number and 20th has like this char

Thread Locked , Postings are not allowed

Edited by: Vijay Babu Dudla on Feb 3, 2009 10:34 PM

2 REPLIES 2
Read only

former_member156446
Active Contributor
0 Likes
474

hmm you need to check with the describe statment which type of data is in the variable and need to use suitable logic some thing near to this :

DATA: v_var1 TYPE i,v_var2(10) TYPE c.
DATA: lv_type TYPE c, lv_temp(20) TYPE c.

*v_var2 = 'abcdefghijk'.

v_var2 = '1212'.

DESCRIBE FIELD v_var2 TYPE lv_type.

CASE lv_type.
  WHEN 'C'.
    lv_temp = v_var1.
    CONCATENATE lv_temp v_var2 INTO v_var2.
  WHEN OTHERS.
    v_var1 = v_var1 + v_var2.
ENDCASE.

WRITE:/ v_var1.

or

PARAMETER: p_grid TYPE c RADIOBUTTON GROUP g1,
           p_list TYPE c RADIOBUTTON GROUP g1.

DATA: v_var1 TYPE n,v_var2(10) TYPE c.
DATA: lv_type TYPE c, lv_temp(20) TYPE c.
IF p_grid = 'X'.
  v_var2 = 'asldhals'.
ELSE.
  v_var2 = '2535'.
ENDIF.

TRANSLATE v_var2 TO UPPER CASE.

IF v_var2 CA sy-abcde.
  lv_temp = v_var1.
  CONCATENATE lv_temp v_var2 INTO v_var2.
ELSE.
  v_var2 = v_var1 + v_var2.
ENDIF.

WRITE:/ v_var2.

Read only

Former Member
0 Likes
474

try this

data: v_var type TABLE OF string .

data: v_var2 type string.

data: x type string.

v_var2 = 120 .

append v_var2 to v_var.

v_var2 = 'abcdefghijk'.

append v_var2 to v_var.

clear v_var2.

loop at v_var into v_var2.

if sy-tabix = 1.

x = v_var2.

else.

CONCATENATE v_var2 x INTO v_var2.

write: v_var2.

endif.

endloop.

Edited by: abap on Feb 4, 2009 3:38 AM