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

Problems setting MAX_NUMBER_CHARS in TEXTEDIT CONTROL

Former Member
0 Kudos
1,149

Hi, I have a problem with C_TEXTEDIT_CONTROL interface.

I have to maintain a Function Module that displays a TEXT EDIT CONTROL in a popup. One parameter of this FM is MAX_NUMBER_CHARS that is passed to the control in the constructor method.

This parameter pretends to lock the maximum quantity of characters written in the popup. It’s set to 255 characters.

At first, when user writes his commentary with 255 ch (yeah, he writes till the end) everything works ok; but after that, when he tries to visualize his commentary, nothing appears in the control, although the commentary is passed correctly to the control via set_text_as_r3table method.

I have done some tests, and sawn in Debugger Time that if I change the parameter MAX_NUMBER_CHARS to 265 when the commentary length is 255, the control displays the text.

Does anyone know what happens or what I’m doing wrong?

10 REPLIES 10
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
996

Hmmm....seems to me that you have found your problem. Is there a specific reason why you want to limit the text to 255 characters? Does the control stop the user from typing more than 255 characters?

Regards,

Rich Heilman

Read only

0 Kudos
996

"Hmmm....seems to me that you have found your problem."

Wow.... amazing response. O_o

Of course I have to limit input text, it's a requirement, and C_TEXTEDIT_CONTROL, and also CL_GUI_TEXT_EDITOR, allows it.

The problem is, why it's not working?!

Read only

0 Kudos
996

.

Message was edited by: Rich Heilman

Read only

0 Kudos
996

I just written a quick & dirty to test this out. I have set my text editor to 20 max characters, I does limit my entry to the 20 characters, when setting it, it shows my 20 characters. In debug, if I change the max characters to 19, then the text no longer shows. In your case you put in 255 and expect to get out 255 when the max characters is set to 255, and you are not, right?

Would you be able to post your code?

Regards,

Rich Heilman

Read only

996

Yeah, that's it.

Here is the code:

EDITOR is declared as follows

data: editor type ref to c_textedit_control .

Here I'm trying to create the Obj. and gv_length is set to 255.

create object editor

exporting

repid = repid

dynnr = '0100'

dynpro_container = 'TEXTEDITOR1'

max_number_chars = gv_length

exceptions

others = 1.

In the next code, I pretend to pass the TEXT written by user.

call method editor->set_text_as_r3table

exporting

table = mytable

exceptions

error_dp = 1

error_dp_create = 2

others = 3

There are more lines of code, but they are not relevant to this problem.

At first, the user can write a comment with 255 characters, but I'm not able to show this same comment although mytable is fulfilled.

Thx

Read only

0 Kudos
996

Yes, I'm now seeing the same. My test for 20 characters was working, but when doing the same thing with 160 characters, I have to set the max to 174 to get the text to show. This is weird. I'll keep looking at it.

Regards,

Rich Heilman

Read only

996

Its counting the CR as part of the text. You can see this by using the method get_text_as_stream. The CR are the "##" This explains why I need 14 more characters for the text to show. I had 8 lines of 20 with CR at the end of the first 7. Not sure how you are suppose to get around this.

Regards,

Rich Heilman

Read only

0 Kudos
996

But I think this is not the problem.

I you retrieves the information with editor->get_text_as_r3table method, the CR doesn't appears; and if you check the length of the table, is the correct length (in my case 255).

I was looking into OSS but I saw nothing, I'll try posting a SAP OSS Note.

If I have some answer I'll post it here.

Thx

Read only

0 Kudos
996

The problem is solved with <b>SAPGui's patch 52</b>.

Thanks to all.

Read only

Former Member
0 Kudos
996

Hi.

Ive been looking in to this and as you both can see is very strange.

If its very important you should post a message to SAP to see if it might be an error they can solve.

I've been looking into notes to see if any solves it but no god luck...

If you find a solution please post it... I'm also interested.

Kind Regards.

Jorge Balart.