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

Doubt in concatenating strings

Former Member
0 Likes
1,315

Hi all,

Am concatenating two strings and i want space of 10 characters.

If i use concatenate text1 text2 into text3 separated by space

it is dispalying as : text1 text2

But my requirement is to display text with gap of 10 characters

::::::text1 text2

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,289

Hi all,

Thanks for ur reply..Actually i have to display the text in alv(end of list)..Am using end of list event as footer in alv...In v_footer-info am passing that text..Its working fine in report but not in alv..

13 REPLIES 13
Read only

Former Member
0 Likes
1,289

DATA: field1(10) VALUE 'John',

field2(5) VALUE 'Martn',

seperatr(10) VALUE ' ', -->Give 10 spaces here

field3(35) .

CONCATENATE field1 field2 INTO field3 SEPARATED BY seperatr.

WRITE field3.

I hope it helps.

Best Regards,

Vibha

*Please mark all the helpful answers

Read only

Former Member
0 Likes
1,289

Hello,

U can do like this.

Data: blank(10) value ' ',

lv_string(255).

conactenate t1 t2 t3 into lv_string separeated by balnk.

If useful reward.

Vasanth

Read only

0 Likes
1,289
data : m(50) type c.
data : myspace(50) type c.
data : howmany type i.


howmany = 10.

concatenate 'kishan '  'negi' into m separated by myspace(howmany).
write : m.
Read only

Former Member
0 Likes
1,289

Hi,

rather than concatenate u can do this way...

suppose filed1 is of 10 characters length

write:/001 fieid1,

020 field2.

u have the display like this....

filed1 filed2

Madhavi

Read only

Former Member
0 Likes
1,289

Hi,

Check this

DATA: c1(10) TYPE c VALUE 'abcde',

c2(3) TYPE c VALUE 'xyz',

c5(23) type c ,

sep(10) TYPE c VALUE ' ' " 10 spaces

CONCATENATE c1 c2 INTO c5 SEPARATED BY sep.

Read only

Former Member
0 Likes
1,289

Hi,

data: str1 type string value 'str1',

str2 type string value 'str2',

str3 type string .

concatenate str1 str2 into str3.

write:/10 str3.

copy paste this code and execute.

regards,

keerthi.

Read only

Former Member
0 Likes
1,289

just execute this code ..

data : p1(10) type c value 'SAPABAP',
       P2(10) TYPE C ,
       P3(10) TYPE C VALUE 'WEBDYNPRO',
       P4(30) TYPE C.

       P2 = '          '.
       CONCATENATE P1  P3 INTO P4 SEPARATED BY P2.

       WRITE:/ P4.

regards,

vijay

Read only

Former Member
0 Likes
1,290

Hi all,

Thanks for ur reply..Actually i have to display the text in alv(end of list)..Am using end of list event as footer in alv...In v_footer-info am passing that text..Its working fine in report but not in alv..

Read only

0 Likes
1,289

Hello,

If u want to use it in ALV then u should do like this.

I have did the same thing for TOP_OF_PAGE do the same for end_OF list

GO therough this code..

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = IT_VARIANT-REPORT

<b> I_CALLBACK_HTML_TOP_OF_PAGE = 'TOP_OF_PAGE'</b> <b>Herechange to END_OF_LIST</b> IT_FIELDCAT = IT_FIELDCAT

I_SAVE = 'A'

IS_VARIANT = IT_VARIANT

IT_EVENTS = IT_EVENTS

TABLES

T_OUTTAB = G_T_OUTTAB

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

FORM TOP_OF_PAGE USING CL_DD TYPE REF TO CL_DD_DOCUMENT. "#EC *

DATA: L_F_INFO(255).

DATA: LV_COUNT TYPE SDYDO_TEXT_ELEMENT,

LV_PER TYPE SDYDO_TEXT_ELEMENT,

LV_NUMC(8) TYPE N.

CALL METHOD CL_DD->ADD_TEXT

EXPORTING

TEXT = TEXT-008

SAP_STYLE = CL_DD_DOCUMENT=>SMALL

SAP_COLOR = CL_DD_DOCUMENT=>LIST_HEADING_INT

SAP_FONTSIZE = CL_DD_DOCUMENT=>SMALL

SAP_EMPHASIS = CL_DD_DOCUMENT=>STRONG

STYLE_CLASS = SPACE.

CALL METHOD CL_DD->NEW_LINE

EXPORTING

REPEAT = 1.

CALL METHOD CL_DD->ADD_GAP

EXPORTING

WIDTH = 25.

CALL METHOD CL_DD->ADD_TEXT

EXPORTING

TEXT = TEXT-009

SAP_STYLE = CL_DD_DOCUMENT=>SMALL

SAP_COLOR = CL_DD_DOCUMENT=>LIST_HEADING_INT

SAP_FONTSIZE = CL_DD_DOCUMENT=>SMALL

SAP_EMPHASIS = CL_DD_DOCUMENT=>STRONG

STYLE_CLASS = SPACE.

CALL METHOD CL_DD->ADD_GAP

EXPORTING

WIDTH = 10.

CALL METHOD CL_DD->ADD_TEXT

EXPORTING

TEXT = TEXT-010

SAP_STYLE = CL_DD_DOCUMENT=>SMALL

SAP_COLOR = CL_DD_DOCUMENT=>LIST_HEADING_INT

SAP_FONTSIZE = CL_DD_DOCUMENT=>SMALL

SAP_EMPHASIS = CL_DD_DOCUMENT=>STRONG

STYLE_CLASS = SPACE.

CALL METHOD CL_DD->ADD_GAP

EXPORTING

WIDTH = 11.

CALL METHOD CL_DD->ADD_TEXT

EXPORTING

TEXT = TEXT-011

SAP_STYLE = CL_DD_DOCUMENT=>SMALL

SAP_COLOR = CL_DD_DOCUMENT=>LIST_HEADING_INT

SAP_FONTSIZE = CL_DD_DOCUMENT=>SMALL

SAP_EMPHASIS = CL_DD_DOCUMENT=>STRONG

STYLE_CLASS = SPACE.

CALL METHOD CL_DD->ADD_GAP

EXPORTING

WIDTH = 15.

Hope this will be help ful for u.

If useful reward.

Vasanth

Read only

Former Member
0 Likes
1,289

hi

Try this way

Concatenate ' ' text1 text 2 into text 3 seperated by ' '.

bye

murthy

Read only

Former Member
0 Likes
1,289

Hello,

Try this out.



DATA: str1 VALUE  '1',
           str2(5) VALUE '2',
           sep(10) VALUE  '**********', " asteriks denote spaces
           str3(25) .

CONCATENATE str1 str2 INTO str3 SEPARATED BY sep.

WRITE str3.

Regards,

Shehryar Dahar

Read only

Former Member
0 Likes
1,289

Hi Vasanth,

Thanks now my problem has been solved by using the classes that u mentioned.

Read only

Former Member
0 Likes
1,289

Hi all,

In ALV while downloading the file in excel , its downloading all the things (main area)except footer ..In footer am displaying remarks....for footer am using class cl_dd_document..is there any method to download end of list ...