cancel
Showing results for 
Search instead for 
Did you mean: 

<textarea> text lost in ITS when using carriage return

former_member498918
Participant
0 Kudos

If the user hits carriage return in a <textarea>, i.e. to create a new line of text, everything after the carriage return is ignored by R/3 when retrieving the text.

Is there a way to avoid this loss of text.

Thanks

Karen

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Try with this.

On the html:

<textarea name="ztdline1[]" cols="100" rows="3">`if (ztdline1.dim > 0)` `repeat with r from 1 to 3; if ( ztdline1[r] != "*" ) ;write (strSub (ztdline1[r], 3, 132), "\r\n"); end; end` `end`</textarea>

On the PBO dynpro:

loop at ztdline1 cursor top_line.

endloop.

On the PAI dynpro:

module get_text1.

loop.

endloop.

where module get_text1 is:

clear ztdline1.

refresh ztdline1.

do.

field-get 'ZTDLINE1' sy-index message_line datalen.

if sy-subrc <> 0.

exit.

endif.

read table message_line index 1.

if sy-subrc eq 0.

ztdline1-tdline = message_line.

append ztdline1.

else.

clear ztdline1-tdline.

append ztdline1.

endif.

enddo.

former_member498918
Participant
0 Kudos

That solved my problem.

Thank-you very much

Karen

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Karen,

could you let us know what ITS it is you are using (integrated or stand-alone 6.20)? Also, what is the Patch level.

I assume the problem occurs in the SAPGui for HTML - have you tried searching SAPNet notes for this in the support forums?

Does the problem only occur when the textarea is submitted to the ITS or when the CR is pressed when navigating inside the textarea.

Regards,

Michael

former_member498918
Participant
0 Kudos

The text is only lost when you send the form back to SAP. However, the ABAP editor works through SAPGUI for HTML, which seems to use a <textarea>.

I'm using the following code to access the data in the textarea when it gets back to SAP. The field-get only returns the text upto the carraige return, however long or short the text is.

FIELD-GET 'nameoftextfield' 1 ITS_VAR LEN.

if sy-subrc = 0.

loop at its_var.

i_tab-notes = its_var-value.

i_tab-line = sy-tabix.

append itab.

endloop.

endif.

Is this the wrong way to do this? Can you tell me a better way?

We are using ITS 6.20 up to patch 9. Version 6200.1016.50133.0, Build 713534

Thank-you for your help

Karen

Former Member
0 Kudos

Hi Karen,

the FIELD-GET is a good option if your textarea field is quite long. Otherwise I'd use Step-Loop or a simple text string field on the ABAP screen to retrieve the content. Disadvantage with Step-Loop are the memory limitations - again, it depends how big your textarea is. Maybe worth a shot.

Another thought: have you checked you LEN variable? Is it set to the max-length of the textarea field?

Regards,

Michael

former_member498918
Participant
0 Kudos

Thank-you for your suggestion, but the text is cut off wherever the carriage return is, not after a number of characters. Therefore it’s not a sizing issue. The size of the textarea will vary, but could be quite long.

I don’t think I can use a step loop because we need to put more than one textarea in the form.

Anyone else got any ideas why I'm getting this problem.

Thanks

Karen

Former Member
0 Kudos

> I don’t think I can use a step loop because we need

> to put more than one textarea in the form.

>

You can have more than one steploop in your HTML screens/ABAP biz logic, so that should not hold you back.

regards,

M

former_member498918
Participant
0 Kudos

I've re-done the textarea as a step loop, but it still loses text after a carraige return.

I've looked in the help for step loops in the ITS, but I can't see any information on retrieving information from a textarea.

The help does say to use field-get for large amounts of data and step loop for smaller amounts. However, both have the problem of not returning data after a carriage return.

Does anyone have any more advice.

Thanks for your help

Karen