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

How to create extra space?

Former Member
0 Likes
1,325

Hi,

DATA v_tmp(18) TYPE c.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

EXPORTING

input = wa_sales-matnr

IMPORTING

output = v_tmp.

CONCATENATE v_tmp 'XXX' INTO PO_OBJ.

The answer that I get is this - "X7000114BLCKXXX" the spaces beteeen the MATNR and XXX is not there. How could I get like this - "X7000114BLCK XXX". The MATNR is made out of 18 characters. This 18 characters should be maintained in MATNR.

Please help me.

Thanks,

Kishan

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,283

hi ,

When you do the concatenation operation always the extra space after or before strings are automatically deleted.

Instead you can do

CONCATENATE v_tmp+16(3) 'XXX' INTO PO_OBJ.

this will solve your problem

hi ,

When you do the concatenation operation always the extra space after or before strings are automatically deleted.

Instead you can do

CONCATENATE v_tmp+16(3) 'XXX' INTO PO_OBJ.

this will solve your problem

11 REPLIES 11
Read only

Former Member
0 Likes
1,283

Hi,

Use CONCATENATE v_tmp 'XXX' INTO PO_OBJ separated by SPACE.

Best regards,

Prashant

Read only

0 Likes
1,283

Hi Patil,

It didnt work. This creates a single space. I need to make v_tmp 18 characters long.

Thanks,

Kishan

Read only

Former Member
0 Likes
1,283

Use this to get space in between.

CONCATENATE v_tmp 'XXX' INTO PO_OBJ SEPARATED BY SPACE.

Ps: Reward points if helpful.

Read only

Former Member
0 Likes
1,283

CONCATENATE v_tmp 'XXX' INTO PO_OBJ SEPERATED BY SPACE.

Read only

Former Member
0 Likes
1,283

You can also try,

unpack wa_sales-matnr into v_temp.

concatenate v_temp 'xxx' into po_obj separated by space.

Hope this helps.

The above logic will work fine if the matnr has all numeric values.

You can try this generic logic in all cases

1.Use shift statement and delete trailing spaces.

shift tmp right deleting trailing space.

2.fill the spaces with '0' using overlay statement

overlay tmp with '00000000000000000000000' only space.

3. Now you can use concatenate statement using space option.

This is working fine in my syatem.

Message was edited by: Imtiaz Ahmed

Read only

Former Member
0 Likes
1,283

To seperate two values by space, correct syntex for the command is:

CONCATENATE v_tmp 'XXX' INTO PO_OBJ SEPERATED BY SPACE.

and the other way to do the desired task is you can use the existing code in this way:

CONCATENATE v_tmp ' XXX' INTO PO_OBJ.

Hopefully this would serve the cause.

Read only

Former Member
0 Likes
1,284

hi ,

When you do the concatenation operation always the extra space after or before strings are automatically deleted.

Instead you can do

CONCATENATE v_tmp+16(3) 'XXX' INTO PO_OBJ.

this will solve your problem

Read only

Former Member
0 Likes
1,283

hi

try inserting some dummy characters append and then append XXX and replace the dummy characters. Any space in a report will be truncated.

P.S Reward ponits if useful

Read only

Former Member
0 Likes
1,283

hi,

Check out the following code.

You can get space before matnr as well you can maintain a length of 18 to it.

REPORT z_13317_sdn.

PARAMETERS : p_matnr(18) TYPE c.

DATA: f_matnr(18) TYPE c.

START-OF-SELECTION.

WRITE p_matnr TO f_matnr+0(13) RIGHT-JUSTIFIED .

CONCATENATE f_matnr 'XYZ' INTO f_matnr SEPARATED BY space.

WRITE 😕 f_matnr.

Regards,

Sailaja.

Read only

0 Likes
1,283

This will solve your problem. Try this.


DATA len TYPE i.
DESCRIBE FIELD v_tmp LENGTH len IN CHARACTER MODE.
po_obj+0(len) = v_tmp+0(len).
po_obj+len(3) = 'XXX'.
WRITE po_obj.

Ps: Reward points if helpful.

Read only

Former Member
0 Likes
1,283

Hi Kishan,

A simple solution is declaring a char array of size 18 and using it as

data: v_tmp_c(18) type c.

...

v_tmp_c = v_tmp.

CONCATENATE v_tmp_c 'XXX' INTO PO_OBJ.

This will solve your problem.

Regards,

Uma