‎2009 Jul 02 6:51 AM
Hi all,
I want to develop a module pool program where i already develop a custom control tab where long text is entered.Upto this step is over.Now I want to save this long text to R/3 Table and i want to retrieve the same.I am not able to do this because i have no idea how to create text id, object etc and how this actually works.I know READ TEXT ,SAVE TEXT FM use to save or read the long text but i am not able to use it.
Please help me out from this problem.
Advance Thanks
Nirmal
‎2009 Jul 02 7:11 AM
Hi
I am sending a sample code please go through this
THIS IS TO INSERT INTO DATABASE.
MODULE USER_COMMAND_0200 INPUT.
CASE OKCODE.
OKCODE = SY-UCOMM.
CLEAR SY-UCOMM.
WHEN 'CRT'. "this the push button function code.
INSERT INTO YEMPDATA VALUES YEMPDATA." first one is the database table the second one is wa.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH 'EMPLOYEE CREATION FAILED'.
ELSE.
MESSAGE S000 WITH 'EMPLOYEE CREATED SUCCESSFULLY'.
ENDIF.
WHEN 'EXT'.
LEAVE TO SCREEN 100.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
READ FROM DATA BASE
MODULE USER_COMMAND_0400 INPUT.
CASE OKCODE.
OKCODE = SY-UCOMM.
CLEAR SY-UCOMM.
WHEN 'DSP'.
SELECT SINGLE * FROM YEMPDATA
INTO YEMPDATA
WHERE EMPID = YEMPDATA-EMPID.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH 'EMPLOYEE NOT EXISTED'.
ELSE.
MESSAGE S000 WITH 'EMPLOYEE DISPLAYED SUCCESSFULLY'.
ENDIF.
WHEN 'EXT'.
LEAVE TO SCREEN 100.
ENDCASE.
ENDMODULE. " USER_COMMAND_0400 INPUT
THIS IS THE SAMPLE CODE ITS WORKING FOR ME IF ANY DOUBT REPLY I WILL HELP YOU OUT IF I NOW.
‎2009 Jul 02 7:16 AM
Hi ,
to use Read text call this FM in ur Program and pass the parameters like :--
data: object type thead-tdobject value 'KNA1'.
data: lang type spras value 'E'.
data: id type tdid
data: nam type thead-tdname.
call function 'READ_TEXT'
exporting
CLIENT = SY-MANDT
id = id
language = lang
name = nam
object = object
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER =
tables
lines = lines
exceptions
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
others = 8
.
if sy-subrc <> 0.
concatenate 'No Data Found For ' id into rc separated by space .
wa-tdline = rc.
append wa to lines.
endif.
regards,
Prakash
‎2009 Jul 02 7:23 AM
Regarding SAVE_TEXT.
data: object type thead-tdobject value 'KNA1'.
data: lang type spras value 'E'.
data: id type tdid
data: nam type thead-tdname.
data: lines type table of tline .
data: header like Thead.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
header = header
INSERT = ' '
SAVEMODE_DIRECT = ' '
OWNER_SPECIFIED = ' '
LOCAL_CAT = ' '
IMPORTING
FUNCTION =
NEWHEADER =
tables
lines = lines
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
regards,
Prakash
‎2009 Jul 02 7:30 AM
LRAW
Any uninterpreted string of bytes at least 256 places in length.
Fields of this type must be at the end for transparent tables and
have a preceding length field of type INT2. For an INSERT or UPDATE
in ABAP programs, this length field must be filled with the length
actually required.
use this datatype for storing your field for storing long text
cheers
s.janagar
‎2009 Jul 02 7:25 AM
First : call transaction SE75 to create an object definition that you will use within the text FM.
look at SAP documentation at [SAPscript Control Tables and Structures|http://help.sap.com/saphelp_nw04/helpdata/en/d6/0db81a494511d182b70000e829fbfe/frameset.htm] and [Integrating Text-Processing into Application Programs|http://help.sap.com/saphelp_nw04/helpdata/en/d6/0db757494511d182b70000e829fbfe/frameset.htm]
Regards,
Raymond
‎2009 Jul 02 11:57 AM
Hi Raymond,
As per your suggestion I have created new object and id in SE75 T.code.Now I want to save the long text against this newly created id and object.Please let me know the process how i save this long text and also retrival process so that i fetch long text data in report or module.
Advance Thanks
Nirmal
‎2009 Jul 02 12:07 PM
Structure for your maintenance program
- initial screen for id input
- lock objects
- read database
- [READ_TEXT|http://help.sap.com/saphelp_nw04/helpdata/en/d6/0db8c8494511d182b70000e829fbfe/frameset.htm]
- call maintenance screen
- - use of a SAP class to edit text
- - in PBO/PAI exchange data between text editor and internal table (TLINE)
- at end of maintenance
- if SAVE
- - [SAVE_TEXT |http://help.sap.com/saphelp_nw04/helpdata/en/d6/0db8ef494511d182b70000e829fbfe/frameset.htm](COMMIT_TEXT if required in SE75)
- - [update database|http://help.sap.com/saphelp_nw04/helpdata/en/5f/6f8337dd34ca76e10000009b38f8cf/frameset.htm]
- - commit work
- if EXIT/BACK
- - free data
- - unlock
Regards,
Ramond
‎2009 Jul 02 7:26 AM
Hi Prakash,
I want to know how object ,id etc created and where it will save.In my module pool program user put some long text in screen and i want to save this so that I can fetch in report.I develop this program but i am not able to create text name,object,id and due to this i am not able to save it.
Please help me.
Thanks & Regards
Nirmal
‎2009 Jul 02 7:57 AM
Hi
Plz tell wether u want to save text of SAP STANDARD T Code or our any Z module pool program.
regards,
Prakash
Edited by: Abaplover on Jul 2, 2009 8:58 AM
‎2009 Jul 02 10:51 AM
‎2009 Jul 02 11:14 AM
hi,
In any Z program text symbols is created by goto->text elements->Text-symbols but it will remain constant throught the Program.
If you want to save from the user then decleare the particular text field as norla datatype (c or string ) push this data into ur particular Itab and through this itab u can update the Datsbase table.
regards,
Prakash
‎2009 Jul 02 11:21 AM
Hi Nirmal,
You can read the text from custom control in following way.
Declare the custom control.
data : clgrp_editor type ref to cl_gui_textedit.
data : clgrp_container type ref to cl_gui_custom_container.
if clgrp_editor is initial.
create object clgrp_container
exporting
container_name = 'CC_TEXT'.
create object clgrp_editor
exporting
parent = clgrp_container
exceptions
others = 1.
if sy-subrc ne 0.
endif.
endif.
To read data from the custom control.
data : text_tab type table of line,
wa_text type line.
data : lv_txt type string.
refresh: text_tab.
call method clgrp_editor->get_text_as_stream " here the whole text is returned into in text_tab table.
importing
text = text_tab.
Now loop at this table and concatenate the data into a variable of string type.
loop at text_tab into wa_text.
if not wa_text-line is initial.
concatenate lv_txt wa_text-line
into lv_txt separated by space.
endif.
endloop.
Hope this will be useful.
Edited by: Poorvika on Jul 2, 2009 3:52 PM
‎2009 Jul 02 11:58 AM
Hi Prakash
I have created new object and id in SE75 T.code.Now I want to save the long text against this newly created id and object.Please let me know the process how i save this long text and also retrival process so that i fetch long text data in report or module.
Advance Thanks
Nirmal
‎2016 May 07 12:35 PM
@supraja your solution is relevant for this scenario and it worked.
Regards,
Karthik Gali