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

SAPTEXTEDIT_DEMO_3 problem

Former Member
0 Likes
513

Hi Gurus ...

I used the demo program SAPTEXTEDIT_DEMO_3 to start using the Textedit functionality.

My problem now is how can i store the thing that i write in the Textedit to a custom table that i will make . Also the fields of the table what type must be ?

Does anyone have any example ?

Points will be rewarded ....

Please help ....

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
445

Hi,

As you can see the text entered by the user on the text edit control is recoeved in the following code:

line 101


      CALL METHOD g_editor->get_text_as_r3table
          IMPORTING
              table = g_mytable
          EXCEPTIONS
              OTHERS = 1.

Now the internal table g_mytable has a single component of length 256 and type character.

Hence what you do is , create a database table ZTABLE with the following fields:

FIELD KEY TYPE

ID X <your choice>

SEQNR X SEQNR

LINE CHAR256

Now, ID here would be an identifier for the text entered on the screen, e.g. if you are entering the text for a material number then

ID would be material number and then you would put all the lines typed in the text edit control against the ID. since we can have multiple lines entered, we need the SEQNR ...

Hence code to implement this would be something like this:



DATA: BEGIN OF it_table OCCURS 0.
INCLUDE STRUCTURE ZTABLE.
DATA: END OF it_table,
w_line TYPE mytable_line,
v_seqnr TYPE seqnr.
CLEAR v_seqnr.
REFRESH it_table.
MOVE: <id> TO it_table-id.
LOOP AT g_mytable  INTO w_line.
 it_table-seqnr = v_seqnr + 1.
 v_seqnr = v_seqnr + 1.
it_table-line = w_line-line.
APPEND it_table.
ENDLOOP.

MODIFY ztable FROM TABLE it_table.

This would end up updating your DB table with the text.

Cheers.

Hi Gurus ...

I used the demo program SAPTEXTEDIT_DEMO_3 to start using the Textedit functionality.

My problem now is how can i store the thing that i write in the Textedit to a custom table that i will make . Also the fields of the table what type must be ?

Does anyone have any example ?

Points will be rewarded ....

Please help ....

1 REPLY 1
Read only

Former Member
0 Likes
446

Hi,

As you can see the text entered by the user on the text edit control is recoeved in the following code:

line 101


      CALL METHOD g_editor->get_text_as_r3table
          IMPORTING
              table = g_mytable
          EXCEPTIONS
              OTHERS = 1.

Now the internal table g_mytable has a single component of length 256 and type character.

Hence what you do is , create a database table ZTABLE with the following fields:

FIELD KEY TYPE

ID X <your choice>

SEQNR X SEQNR

LINE CHAR256

Now, ID here would be an identifier for the text entered on the screen, e.g. if you are entering the text for a material number then

ID would be material number and then you would put all the lines typed in the text edit control against the ID. since we can have multiple lines entered, we need the SEQNR ...

Hence code to implement this would be something like this:



DATA: BEGIN OF it_table OCCURS 0.
INCLUDE STRUCTURE ZTABLE.
DATA: END OF it_table,
w_line TYPE mytable_line,
v_seqnr TYPE seqnr.
CLEAR v_seqnr.
REFRESH it_table.
MOVE: <id> TO it_table-id.
LOOP AT g_mytable  INTO w_line.
 it_table-seqnr = v_seqnr + 1.
 v_seqnr = v_seqnr + 1.
it_table-line = w_line-line.
APPEND it_table.
ENDLOOP.

MODIFY ztable FROM TABLE it_table.

This would end up updating your DB table with the text.

Cheers.