2008 Feb 28 9:21 AM
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 ....
2008 Feb 28 9:53 AM
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.
2008 Feb 28 9:53 AM
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.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |