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

String declaration in my program does not take more than 255 chars

Former Member
0 Likes
4,996

Hi!

I created a transportation schedule program which finally prints the output onto a smartform. There is a text editor box in the output from where the text eneterd is read onto the form. I decalred a variable as buffer where I concatenate all the text read line by line form the internal table having text and pass that onto the form which prints it. My problem is that even though I have several linesin the text box , it just collects only first few lines and after that it cuts of the lines. In debugging mode I saw a message when I tried increasing teh text in debugging mode , it siad only 255 chars are allowed, dont know why or wheer I am going wrong. PLease help.

Thanks

FORM print_sched .
  DATA:    ltp_func TYPE rs38l_fnam.   " Name of Function Module.
     LOOP AT TA_TLINE.
     CONCATENATE LTP_BUFFER TA_TLINE-TDLINE INTO LTP_BUFFER RESPECTING BLANKS .<<<<<<<<Here
    ENDLOOP.
CONDENSE LTP_BUFFER.
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname           = 'ZSD_TRANS_SCHED'
    IMPORTING
      fm_name            = ltp_func
    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.
  CALL FUNCTION ltp_func
    EXPORTING
      tp_vttk          = vttk
      tp_sname         = tp_sname
      tp_date          = oia05-schddt
      buffer           = ltp_buffer

    TABLES
      ita_transch      = ta_transch
    EXCEPTIONS
      formatting_error = 1
      internal_error   = 2
      send_error       = 3
      user_canceled    = 4
      OTHERS           = 5.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
ENDFORM.                    " PRINT_SCHED

Hi!

I created a transportation schedule program which finally prints the output onto a smartform. There is a text editor box in the output from where the text eneterd is read onto the form. I decalred a variable as buffer where I concatenate all the text read line by line form the internal table having text and pass that onto the form which prints it. My problem is that even though I have several linesin the text box , it just collects only first few lines and after that it cuts of the lines. In debugging mode I saw a message when I tried increasing teh text in debugging mode , it siad only 255 chars are allowed, dont know why or wheer I am going wrong. PLease help.

Thanks

FORM print_sched .
  DATA:    ltp_func TYPE rs38l_fnam.   " Name of Function Module.
     LOOP AT TA_TLINE.
     CONCATENATE LTP_BUFFER TA_TLINE-TDLINE INTO LTP_BUFFER RESPECTING BLANKS .<<<<<<<<Here
    ENDLOOP.
CONDENSE LTP_BUFFER.
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname           = 'ZSD_TRANS_SCHED'
    IMPORTING
      fm_name            = ltp_func
    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.
  CALL FUNCTION ltp_func
    EXPORTING
      tp_vttk          = vttk
      tp_sname         = tp_sname
      tp_date          = oia05-schddt
      buffer           = ltp_buffer

    TABLES
      ita_transch      = ta_transch
    EXCEPTIONS
      formatting_error = 1
      internal_error   = 2
      send_error       = 3
      user_canceled    = 4
      OTHERS           = 5.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
ENDFORM.                    " PRINT_SCHED

29 REPLIES 29
Read only

Former Member
0 Likes
3,380

Why don't you try a search in SCN "Declare string more than 255 characters".

Its discussed lots of times.

Read only

0 Likes
3,380

Yes , tahst correct , I did go through those posts but the problem with my thing is that while I am looping through the

 LOOP AT TA_TLINE.
     CONCATENATE LTP_BUFFER TA_TLINE-TDLINE+0(48) INTO LTP_BUFFER RESPECTING BLANKS .
    ENDLOOP.

here itself the ltp_buffer dosent take in all the texts, theer are actually 9 lines of text in the ta_tline table, it concatenates only 5 lines and after that its not doing , so finally in lktp_buffer I am getting only half of teh text . I want to get all the text in that ltp_buffer but its not coming on here itself. I ahve passed this ltp_buffer itself in my smartform to print so it prints only half of te text.

Thanks

Read only

0 Likes
3,380

You say it won't take more than 255 characters, but you haven't provided the data declaration?? And you haven't said which function module is actually being called.

Rob

Edited by: Rob Burbank on Apr 21, 2010 2:16 PM

Read only

0 Likes
3,380

LTP_BUFFER type string. Thats is what I ahve declared and teh function module called is mentioned in the code above as mentioned , bsically its calling the smartforms and its FM. The problem is that its not concatinating all of the lines from the internal table ta_tline, only half of teh text is concatenated until 255 char. I wanted to know why is it not taking all of them present there.

Thanks

Read only

0 Likes
3,380

No - I meant - what is the value of ltp_func?

OK - I see. It's your Smartform FM. How is this declared in that FM?

Rob

Edited by: Rob Burbank on Apr 21, 2010 4:55 PM

Read only

0 Likes
3,380

Are you saying that the CONCATENATE doesn't work? If so, that's incorrect. It does.

Rob

Read only

0 Likes
3,380

The FM works fine , teh concatenate also works fine but at the end of concatenation it shows up only 255 chars, even in debug mode if I try increasing it wont accept , I beleive its declkared as string so maybe thats why but I have no idea how to do it the other way so that text of any lenght it takes can be concatenate dinto one and printed.

Thanks

Read only

0 Likes
3,380

>

> ... teh concatenate also works fine but at the end of concatenation it shows up only 255 chars,

Which is it? does it work or not?

Rob

Read only

0 Likes
3,380

NO , it does not work , I meant it goes through the loop but at teh end of loop only 255 chars come in . So it does not take in all the text . I wnat all teh text to come in.

IT does not work.

Thanks,

Read only

0 Likes
3,380

So after:

LOOP AT TA_TLINE.
  CONCATENATE LTP_BUFFER TA_TLINE-TDLINE INTO LTP_BUFFER RESPECTING BLANKS .<<<<<<<<Here
ENDLOOP.

There are only 255 characters in LTP_BUFFER. Is that correct?

Rob

Read only

0 Likes
3,380

Thast correct.

Read only

0 Likes
3,380

Please run this and let me know the result. You will have to scroll the output right.

report ztest message-id 00 line-size 520.

data: begin of itab occurs 0,
        tdline type tdline,
      end   of itab.

data: buffer type string.

itab-tdline = 'From the information contained in your message to us,'.
append itab.

itab-tdline = 'we conclude that this is a Consulting issue, and not a'.
append itab.

itab-tdline = 'product-related issue. The issue you have reported can'.
append itab.

itab-tdline = 'be solved using the online help, SAP Notes, WebEx '.
append itab.

itab-tdline = 'sessions, the knowledge database, and so on'.
append itab.

itab-tdline = 'To ensure that we can provide you and other customers '.
append itab.

itab-tdline = 'with the best support, and to reduce processing times,'.
append itab.

itab-tdline = 'we recommend that you check all of the information'.
append itab.

itab-tdline = 'available to you before opening a message.'.
append itab.

itab-tdline = 'We look forward to working with you again in the future'.
append itab.

loop at itab.
  concatenate buffer itab-tdline into buffer respecting blanks.
endloop.

condense buffer.

write: /001 buffer.

Rob

Read only

0 Likes
3,380

Yes , it does show me the entire text till the end . This does bring in all the text , but I dont understnd why its not doing it my program . I have checked in debugging mode and it brings in just a part of the text not the whole text.

Thanks.

Read only

0 Likes
3,380

I suggest you do what I did. afterthe LOOP, WRITE the field. Make sure the report is wide enough to display the full width you want.

Rob

Read only

0 Likes
3,380

Well I could have done that , but I am not writing the report in the output as such , instead when the program is run it outputs teh details and on left there is a text editor box where we input the text . This text is then saved and after that when we click on the print tab it reads teh text and copies this very text onto a Notes window in the smartform . I ahve checked the size of the Notes window and its large enough to take in double the text that I have entered , so there is no spacing issue at all , yet the entire text is not copied onto the form.

Thanks

Read only

0 Likes
3,380

Are you going to do what I suggested??

Rob

Read only

0 Likes
3,380

Sure , Ill just do that right now in my report .

Read only

0 Likes
3,380

I did that and ran the report , it still did not take in all the text , it says it can take only 255 units of the text for output . Half of the text were left behind.

Thanks.

Read only

0 Likes
3,380

We're not looking at the SmartForm, just the output from the WRITE.

Rob

Read only

0 Likes
3,380

Its not bringing in all teh text in after teh write statment in the output. Only half of teh text shows up.

Thanks

Read only

0 Likes
3,380

What is the line-size on your report statement?

Rob

Read only

0 Likes
3,380

This is a module pool program and I dont have any line size specified on here in the program .

Thanks

Read only

0 Likes
3,380

Why are you not using type c with length say 1000?

Read only

0 Likes
3,380

With data type c you can actually split the data upto the line size and print the remaining data on the next line...

Read only

0 Likes
3,380

I did try using that too and it did bring me in the complete text onto the output form , but then I had a different problem with that , the line was ending abrubtly , men words ending on the line eg: "insatlling" was splitting into two word if the line was chnaging to inst and then next line started wit "alling".


 data: ltp_buffer1 type tchar255,
          ltp_buffer2 TYPE char255,
          ltp_buffer3 TYPE char255.
    data: w_len type i,
          w_len1 TYPE i.
    ta_prevl[] = ta_tline[].

    LOOP AT TA_TLINE.
      ltp_buffer3 = ta_tline-tdline.
        w_len = 80 - strlen( ltp_buffer2 ).
        w_len1 = strlen( ltp_buffer3 ).
        IF w_len > w_len1.
          CONCATENATE LTP_BUFFER2 TA_TLINE-TDLINE INTO LTP_BUFFER2 SEPARATED BY space.
          SHIFT LTP_buffer2 LEFT BY 1 PLACES.
        ELSE.
          IF w_len EQ 0.
            CONCATENATE LTP_BUFFER2 TA_TLINE-TDLINE INTO LTP_BUFFER2 SEPARATED BY space.
          ELSE.
            CONCATENATE LTP_BUFFER2 TA_TLINE-TDLINE+0(w_len) INTO LTP_BUFFER2 SEPARATED BY space.
          ENDIF.

          APPEND ltp_buffer2 to ltp_buffer1.
          CLEAR ltp_buffer2.
          CONCATENATE LTP_BUFFER2 TA_TLINE-TDLINE+w_len INTO LTP_BUFFER2 SEPARATED BY space.

        ENDIF.
    ENDLOOP.
    CONDENSE ltp_buffer2.

    APPEND ltp_buffer2 to ltp_buffer1.

Read only

0 Likes
3,380

You have to LEAVE TO LIST PROCESSING.

It doesn't really matter. The full data should be there. The problem is likely that the SmartForm FM cannot handle the text more than 255 characters. You should take the first advice you got and search the forums for Smartform+255.

Rob

Read only

0 Likes
3,380

Hello,

Smartform does not print more than 255 characters for STRING type variables.

You just break the string into pieces of 255 or whatever, store it in a internal table of type something like TDLINE, loop it and and print it.

Make sure, in the text element you are giving START as - A (Append Directly)

Read only

Former Member
0 Likes
3,380

Hi,

You can use LCHR data type.

LCHR: Character string of any length, but has to be declared with a minimum of 256 characters. Fields of this type must be located at the end of transparent tables (in each table there can be only one such field) and must be preceded by a length field of type INT2. If there is an INSERT or UPDATE in ABAP programs, this length field must be filled with the length actually required. If the length field is not filled correctly, this may lead to a data loss in the LCHR field! A fields of this type cannot be used in the WHERE condition of a SELECT statement.

Refere this link for more details.

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/cf/21f2e5446011d189700000e8322d00/content.htm

See if its useful.

Read only

Former Member
0 Likes
3,380

You see, you've made the same mistake you quite often make when you post your questions. Your program does something wonky; you think you see a problem and you frame your question in terms of what you think the problem is rather than the actual behavior of the program.

Then you remain focused on that and concentrate on answers that try to solve what you think is the problem.

When responders answers don't work exactly as promised, rather than trying to do further analysis and figure out what is going on, you just ask another then another then another follow up question. You're questions tend to be like this one; they go on and on without much thought on your part.

Given that you have so many posts in the forum, in the future, I'd really like to see some evidence that you have:

a) thought about your problem

b) tried to solve it before asking here

c) searched for answers before asking here.

Rob