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

Strings on Screens

IanStubbings
Active Participant
0 Likes
2,638

I have a requirement to have a STRG type element on a screen.

I wish to populate this field with data that is longer than the visible length of the field but as the field is scrollable (greyed out checkbox) and does indeed allow me to scroll I thought I would be able to pass in a string of any length. This does not seem to be true as if I go over a certain amount of characters the program dumps with a 'field too short' error.

Has anyone had much experience with strings on screen?

Thanks in advance

Ian

11 REPLIES 11
Read only

Former Member
0 Likes
2,098

Hi Ian,

I understand from your problem , what you need is a Long text editor to store certain values, something similar to the message text we type in this message box editor of sdn.sap.com to report our problems

For that SAP has provided a class, I am not quite sure which class is this but it is something cleditor

Hope you find it useful, although I am not am able to find the correct class at the moment

Read only

0 Likes
2,098

Hi Subramanian

Thank you for your reply. What I was hoping to do was just use a field of type string and be able to scroll the field just be using the left/right cursor keys in it. What I can't understand is that if I am putting text in the field of type string and the screen field is type string, why do I get an error message saying the field I am putting the text into is too short??

Ian

Read only

0 Likes
2,098

Are you sure that the definition length of the field is big enough?

Regards,

Rich Heilman

Read only

0 Likes
2,098

Hi Rich

Surely if the definintion of the field is of type string, it doesn't have a maximum length?

The visible length is 60 and I can pass in more than this. The defined length is greyed out and blank, presumably reinforceing paragraph one above.

Ian

Read only

mbiwer
Associate
Associate
0 Likes
2,098

Hi Ian,

i've just tried it with a string-field on a dynpro and i encountered no problems (i've put in a string of ~3000 characters)! Could you be more precise at what lenght you get the error?

kind regards,

Michael

Read only

IanStubbings
Active Participant
0 Likes
2,098

That is excellent news. I may not need my workaround after all.

Currently it is blowing at > 133 chars.

Read only

mbiwer
Associate
Associate
2,098

Hi Ian,

I must correct my first answer a little bit: it seems that an input field on a dynpro can not hold more than 1023 characters (I've just testet it once again ;-).

Nevertheless, this is more than 133 characters and should suffice ...

I've created a test-report with a global variable g_string of type string and bound this variable to an input field (with the name 'G_STRING') of my test-dynpro. The format of the input field in the dynpro is defined as STRG. Then it should work ...

kind regards,

Michael

Read only

IanStubbings
Active Participant
0 Likes
2,098

Thanks for your help Michael. Much appreciated.

My screen element is not open for input. Would this make a diffenence?

My element is part of a table the field is type string and the element is of type STRG.

I am on a 4.6C machine.

Ian

Read only

mbiwer
Associate
Associate
0 Likes
2,098

Hi Ian,

I've tested my report on a 46C-machine and then I got the error too! It's a constraint of release 46C that at most 132 characters can be transported to a dynpro-field (so stated in the SAP-Help regarding release 46C).

In release 4.70 more characters can be transported (I think 1023 or 1024 characters) and no dump occurs if the string-field contains more characters than the maximum number. But this doesn't help you much if you have only a 46C-machine ...

Maybe you should consider using a TextEdit-Control in cooperation with a Custom-Control on your dynpro if you are really forced to display so much text to a user ...

The other possibility is to upgrade to 4.70

kind regards,

Michael

Read only

IanStubbings
Active Participant
0 Likes
2,098

Thanks again for spending time to look at this problem for me, Michael.

At least I now know that I have to have the workaround. It is unlikely that I will need the full 132 chars but if I don't cater for it someone is bound to blow the field and cause the dump, so best to cater for it anyway.

Very unlikely they will be upgrading here in the near future anyway!

Cheers

Ian

Read only

Former Member
0 Likes
2,098

Hi all,

I have been following this topic and I still have one question unanswered. I get a syntax error when I use something like this in my code...

=====================================

parameters p_test type string.

=====================================

The error message reads as "The deep data type "STRING" is not allowed.

The SAP Help Documentation says "It is not yet possible to use strings in screens or database tables. However, strings can be stored in database tables as clusters using EXPORT and transferred using IMPORT".

I'm using <u><b>SAP WebAS 6.20</b></u>.

Any thoughts on this ?

Regards,

Anand Mandalika.