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: 

problem with string concatenation

Former Member
0 Kudos

Hi all,

I have defined an internal table with line type as char65.

I have populated 10 lines of data in internal table.

when I concatenated all lines of itab into a string field some data is missing.

In debugging mode, if I check the value of the string field, there are different options.

(In New Debugger)

For Fast display: Some text is missing

For Tabular : Full text is coming.

If I print the string field with the write statement Full text is displayed.

But if I send this text to a smartform there the full text is not passed, only Fast display text is passed.

What could be the reason for this deviation.

17 REPLIES 17

Former Member
0 Kudos

can you give your code?

0 Kudos

I am using an editor to get text into the internal table.

then I am concatenating the lines.

DATA : it_duties TYPE TABLE OF char65,

wa_edit type char65.

DATA: text TYPE string,

text2 TYPE string.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(20) text-001.

SELECTION-SCREEN PUSHBUTTON 25(15) but1

USER-COMMAND push1

MODIF ID mod.

SELECTION-SCREEN END OF LINE.

AT SELECTION-SCREEN.

IF sscrfields-ucomm = 'PUSH1' or

sscrfields-ucomm = 'PUSH2'.

CALL SCREEN 100.

ENDIF.

end-of-selection.

************************************************************************

  • FORMS

************************************************************************

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'ZTEST_FORM'

IMPORTING

FM_NAME = g_fm_name

EXCEPTIONS

NO_FORM = 1

NO_FUNCTION_MODULE = 2

OTHERS = 3.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CONCATENATE LINES OF it_duties INTO text2 SEPARATED BY space.

loop at it_duties INTO wa_edit.

CONCATENATE text

wa_edit

INTO text

SEPARATED BY space.

endloop.

write : text2.

call function g_fm_name

EXPORTING

text = text2.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE status_0100 OUTPUT.

SET PF-STATUS 'MENU_TEST'.

CASE sscrfields-UCOMM.

WHEN 'PUSH1'.

CALL FUNCTION 'RH_EDITOR_SET'

EXPORTING

REPID = sy-repid

DYNNR = sy-dynnr

CONTROLNAME = 'CONT'

MAX_COLS = 65

TABLES

LINES = it_duties

EXCEPTIONS

CREATE_ERROR = 1

INTERNAL_ERROR = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDCASE.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE user_command_0100 INPUT.

CASE SY-UCOMM.

WHEN 'BACK'.

LEAVE TO SCREEN 0. " 100.

WHEN 'EXIT' OR 'CANCEL'.

LEAVE PROGRAM.

WHEN 'SAVE'.

CASE sscrfields-UCOMM.

WHEN 'PUSH1'.

CALL FUNCTION 'RH_EDITOR_GET'

EXPORTING

CONTROLNAME = 'CONT'

COL_WIDTH = 72

  • IMPORTING

  • CHANGED =

TABLES

LINES = it_duties

EXCEPTIONS

INTERNAL_ERROR = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

LEAVE to SCREEN 0.

ENDCASE.

ENDCASE.

ENDMODULE. "USER_COMMAND_0100 INPUT

0 Kudos

Hi Charan,

Please do this way... This procedure has worked for me.....

Pass the internal table to smart-form with out doing any concatenation and in the Initialization of the smart-form ...

Declare one string variable in smart-form and in initialization loop the internal table and concatenate the

value to the string variable declared in the Smart-form. After the Endloop you would get the complete 10

lines of your internal table into that string variable..

Display it as per your necessary where ever you want..

So finally that string variable declared in SMART-FORM holds the 10 lines of text in Internal table..

This would solve your issue.

Good luck

Narin

0 Kudos

Hi Narin,

Thanks for ur time.

But still I am not getting entire text in to the string.

I am passing the internal table to smartform, there I have concatenated into a string field.

I defined string field in global data of Global Definitions.

I checked by writing the code in initialization and in program lines.

On both occassions it is giving the same output as in the previous case. Text is limited to particular no. of chars only.

Did u check that the different views of string field in Debugging Mode.

Can we specify some thing for tabular view.

Former Member
0 Kudos

Hi ,

The Reason could be , There is Fixed length..Maybe it is Extending that Length after concatenation of group of lines into a Single string.

It would be clear for us, if you can provide us your code.

Regards,

Deepthi Dandibhotla.

Former Member
0 Kudos

Try changing the data element like char255 or char 1000....

Regards,

Kunjal

0 Kudos

I tried with char2000 also

but string field is taking up to 255 char only.

Beyond that it is not accomodating...

Can we set field length to string field also.....

If not how it is limited to 255 char only.

0 Kudos

Hi,

If you are using, type string, then its max length is 255........ thts y it is taking max of 255.....

Can you give the concatenation code written by you.....

Regards,

Kunjal

0 Kudos

Kunjal,

The code I used for this is:

CONCATENATE LINES OF it_duties INTO text2 SEPARATED BY space.

text2 is of type string.

if it can take only up to 255 then what would be solution to my prob.

here the data is not restricted to 10 or 20 rows, it can be even more.

I need to get the data into one string field.

So suggest the best possible solution.

0 Kudos

Hi,

Try doing it this way just for testing purpose....implement it if its working fine.....

LOOP AT it_duties into work_area.

CONCATENATE text2 work_area-field_name INTO text2 SEPARATED BY space.

ENDLOOP.

Regards,

Kunjal

Former Member
0 Kudos

Hi Charan,

There is once class which is used to concatenate all the values into one string.

Correct me if i am wrong

Thanks & Regards,

M.Ramana Murthy

0 Kudos

Hi everybody,

Is there no solution for this...

Seems to be simple but not working..

Ramana,

you told one class is there for concatenate, can u give details of that, Will it solve the prob.

Former Member
0 Kudos

Hi charan,

The maximum length that is allowed will be 255.

Make all the 10 lines of internal table data according to that and use 'concatenate with no gaps' statement and also check whether the length of the field you are choosing for displaying this in the smart form having sufficient length.

I think this will help you.

Former Member
0 Kudos

Hi charan,

you put the text upto 255 char in one line of internal table by concatenating if the lenght is more than 255 put that line into second line of internal table and do subsequently.

I think this will be helpful to you.

0 Kudos

Hi Surya,

Taking the data again in internal table, would create more probs when it is handled in a smartform.

Why because I need to insert this text in between a static text which has boxes around it. So I can't insert a table inside a text field.

If it is a string field I can simply include in b/w the static text which is in smartform.

Former Member
0 Kudos

Concatenation is possible but while displaying split the spring into 255 char.

0 Kudos

Hello,

What do u exactly mean? I didnt got you...

Can you please explain it in detail.....??

Please grant points if the question is answered satisfactorily.....

Regards,

Kunjal