Application Development 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: 

concatenate with multiple space.

Former Member
0 Kudos

Hi,

i have a requirement like

material ( VEPO-MATNR) 18 char

batch (VEPO-CHARG) 10 char

if we get the value of material like W3497 and charg TESTRETURN so to be require output is like

w_string = W3497 TESTRETURN.

means need to be concatenate both field but require is that lenght of material should be filled when material no. is not fully 18 char so we added space till 18 char then concatenate charg.

So please suggest me how to do?

Thanks .

Puneet.

1 ACCEPTED SOLUTION

Former Member

Hi try this,

data : material(18) type c value 'W3497 ',

batch(10) type c.

concatenate material batch into w_string RESPECTING BLANKS.

6 REPLIES 6

Former Member
0 Kudos

Use the command RESPECTING SPACES with the CONCAT

Former Member

Hi try this,

data : material(18) type c value 'W3497 ',

batch(10) type c.

concatenate material batch into w_string RESPECTING BLANKS.

Former Member
0 Kudos

try with SHIFT.

see example

IF v_mat CA sy-abcde.

v_str = STRLEN( v_mat ).

v_count = 18 - v_str.

CONCATENATE wa_vbrk-vkorg wa_vbrk-vtweg INTO V_SPACE.

SHIFT V_SPACE RIGHT BY V_COUNT PLACES.

CONCATENATE V_MAT V_SPACE INTO V_MATEXN.

ENDIF.

Former Member
0 Kudos

Well a bit confusing requirement

CONDENSE VEPO-MATNR.

CONDENSE VEPO-CHARG.

Now

CONCATENATE MATNR CHARG INTO w_string SEPARATED BY SPACE.

after this find length of w_string.

pad the rest of the length with SPACE.

Hope this helps!

Former Member

Hi Puneet,

You can use any of this

CONCATENATE w_mat w_batch INTO w_result SEPARATED BY space. 

CONCATENATE w_mat w_batch INTO w_result RESPECTING BLANKS.

Best regards,

raam

Former Member
0 Kudos

hii

do like follows

data:

v_text1(18) type c,
v_text2(10) type c,
v_text(28) type c.

v_text1 = 'W3497'.

v_text2 = 'TESTRETURN'.

CONCATENATE v_text1 v_text2 INTO v_text RESPECTING BLANKS.

write : v_text.

regards

twinkal