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: 

alv field with string

Former Member
0 Kudos

hi,

I HAVE A TABLE IN WHICH ONE FIELD SAY F1 IS OF TYPE STRING

I HAVE CREATED AN ALV REPORT IN WHICH THIS FIELD F1 IS editable

when i press save button it ads the new row in the database

the Problem lies here is that the output length is viewed only to lenght of 15 infact outlen of fieldcatalog is set to 30

and i could only ad 30 character at max infact of being a type string

how can i add data in the table through alv with lenght more than 256 characters

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

(1) How do you build the transparent table with type string field. This type is not allowed in transparent table.

Do you mean CHAR (til 255) or LCHR type (<a href="http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCDWBDIC/BCDWBDIC.pdf">BC - ABAP Dictionary</a>)

<i><b>STRING</b>: Character string with variable length This type can only be used in types (data

elements, structures, table types) and domains. It cannot be used in database tables. In ABAP, this type is implemented as a reference to a storage area of variable size.

<b>CHAR</b>: Character string. Fields of type CHAR may have a maximum length of only 255 in tables. If longer character fields are to be used in tables, you must choose data type LCHR. There are no restrictions on the length of such fields in structures.

<b>LCHR</b>: Character string of any length, but with a minimum of 256 characters. Fields of this type must be located at the end of transparent tables 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. A fields of this type cannot be used in the WHERE condition of a SELECT statement.</i>

(2) Use of long text (in fact that's your need ?) in ALV

<i>1. Declare the internal and the external length of the field to the ALV Grid Control.

• For fields with DDIC reference, the ALV Grid Control automatically uses the internal and the external length.

• For fields without DDIC reference, you must specify the internal length using field INTLEN and the external length using field DD_OUTLEN of the field catalog (see Parameters for Fields Without DDIC Reference).

2. Specify the conversion exit using field EDIT_MASK of the field catalog (see Formatting Column Contents).

3. Pass the field catalog with method</i>

If you really need long text, you may declare an output length of say 80 in the ALV grid, and provide an icon to edit a very-long text (via a popup screen with a container and a use of class cl_gui_textedit for example)

Regards

3 REPLIES 3

raymond_giuseppi
Active Contributor
0 Kudos

(1) How do you build the transparent table with type string field. This type is not allowed in transparent table.

Do you mean CHAR (til 255) or LCHR type (<a href="http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCDWBDIC/BCDWBDIC.pdf">BC - ABAP Dictionary</a>)

<i><b>STRING</b>: Character string with variable length This type can only be used in types (data

elements, structures, table types) and domains. It cannot be used in database tables. In ABAP, this type is implemented as a reference to a storage area of variable size.

<b>CHAR</b>: Character string. Fields of type CHAR may have a maximum length of only 255 in tables. If longer character fields are to be used in tables, you must choose data type LCHR. There are no restrictions on the length of such fields in structures.

<b>LCHR</b>: Character string of any length, but with a minimum of 256 characters. Fields of this type must be located at the end of transparent tables 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. A fields of this type cannot be used in the WHERE condition of a SELECT statement.</i>

(2) Use of long text (in fact that's your need ?) in ALV

<i>1. Declare the internal and the external length of the field to the ALV Grid Control.

• For fields with DDIC reference, the ALV Grid Control automatically uses the internal and the external length.

• For fields without DDIC reference, you must specify the internal length using field INTLEN and the external length using field DD_OUTLEN of the field catalog (see Parameters for Fields Without DDIC Reference).

2. Specify the conversion exit using field EDIT_MASK of the field catalog (see Formatting Column Contents).

3. Pass the field catalog with method</i>

If you really need long text, you may declare an output length of say 80 in the ALV grid, and provide an icon to edit a very-long text (via a popup screen with a container and a use of class cl_gui_textedit for example)

Regards

0 Kudos

hi raymond,

yes you can create transparent table with type string field.create a field ,its new data element ,its new domain and select string here

actually i am maintaing a table which contains soltions to some common errors

sine the solution are too large we need a field like string to add data

0 Kudos

I try to create such a field but was rejected by system on activation on table, but got no error when checking syntax...

Maybe it depends on OS/database and version of R3?

If you really need a long text, use a text table (one "solution header table" and one "solution texts table" and use a custom container, and class cl_gui_textedit to create a small text input window.

<b>PBO </b>

First call :

   CREATE OBJECT: container EXPORTING container_name = 'CONTAINER',
                   editor    EXPORTING parent = container
                                       wordwrap_mode = 2
                                       wordwrap_position = 80
                                       wordwrap_to_linebreak_mode = 1.

Send text to editor

    CALL METHOD editor2->set_text_as_r3table
      EXPORTING table = texttab
      EXCEPTIONS
        error_dp = 1
        error_dp_create = 2.

<b>PAI</b>

Read text from editor

      CALL METHOD editor3->get_text_as_r3table
        IMPORTING table = texttab
        EXCEPTIONS
          error_dp = 1
          error_cntl_call_method = 2
          error_dp_create = 3
          potential_data_loss = 4.

(You could also use GET/SET_DATA_AS_STREAM, (Look at <a href="http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCITEXTEDIT/BCCITEXTEDIT.pdf">SAP Textedit</a>)

If you want "formated" text go to sap script editor.

Regards