‎2008 Jan 25 5:08 AM
Hi Experts
In dialog programming, am using table control inwhich i want to upload a text file as the value for a particular field. How to store in the database.
Pls explain me with the example coding part also.
Thanks in advance.
Regards
Rajaram
‎2008 Jan 25 5:11 AM
Hi
try this hope it will help you.
Reward if help.
The usage of texts in SAP is very generic and it is used for all entities and documents . For example the texts exist for Vendor master / CUstomer master and in Sales as well as Purchase orders at item and header level .The long texts are used to maintain certain informative texts which the user wants to have and major benefit is that the additional long texts can be provided to the user through functional customising in IMG - SPRO you do not need any ABAP exit or enhancement for this.
Now you can maintain these texts programatically using the FM :
CREATE_TEXT
SAVE_TEXT
while you can read the existing texts using the FM ' READ_TEXT' .
For this purpose you can also go thru this blog /people/deepak.bhalla/blog/2005/01/24/storing-and-retreiving-of-texts .
I am giving extract from same below :
Please let me know if you need anything further on this .
********************************************************************
There are following ways of storing text in SAP.
1. Using Text Object and Text ID
2. Using Standard text with placeholders
1. Using Text Object and Text ID:
I am assuming that we already have a data in structure required by function module save_text for tables paramenter lines.
1. Use Transaction SE75 to create Text Object and Text ID.
2. Choose first radio button Text Object and ID's
3. Click at create. It will create Text Object.
4. Create Text ID for Text Object.
Now this created Text ID and Text Object can be used to Save and Retreive texts using following function module.
CALL FUNCTION 'ZSAVE_READ_TEXT'
EXPORTING
Save_read_indicator = 'X'
header = p_header
TABLES
lines = p_line.
Exporting parameter Save_read_inidcator type char1. default 'X' for Save.
Header should be of type thead
Tables parameter lines should be of type tline.
Header values should be populated as follows.
p_header-tdobject = name of the text object created.
p_header-tdname = It can be any Unique name.
p_header-tdid = name of text id created.
p_header-tdspras = sy-langu.
p_header-tdtitle = title of text.
Table P_lines will contain all data that is to be saved.It may be through Text control.
call function module save_text as follows to Save text.
If save_read_indicator = 'X'.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
client = sy-mandt
header = p_header
IMPORTING
FUNCTION =
NEWHEADER =
TABLES
lines = p_line
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5.
ELSE.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = TEXT_ID
LANGUAGE = SY-LANGU
NAME = Same as TDNAME in Save_text
OBJECT = TEXT_OBJECT
TABLES
LINES = LI_LINE
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
Endif.
2. Using Standard text with placeholders
Here I am assuming that for all placeholders we will have value availble.
1. Maintain standard text with place holder using transaction SO10.
for example :
Dear &1,
Your purchase requisition &2 was approved on &3 .
2. Use following following function module to read Standard text.
CALL FUNCTION 'READ_STDTEXT'
EXPORTING
id = 'ST'
language = sy-langu
name = name of standard text
USE_AUX_LANGUAGE = ' '
USE_THRUCLIENT = ' '
LOCAL_CAT = ' '
IMPORTING
HEADER =
TABLES
lines = p_std_text
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
REFERENCE_CHECK = 5
OTHERS = 6.
3. Use following code to replace Placeholders returned in table p_std_text.
Loop at p_std_text.
SEARCH p_std_text-tdline FOR '&1'.
IF sy-subrc = 0.
REPLACE '&1' WITH p_name INTO p_std_text-tdline.
ENDIF.
SEARCH p_std_text-tdline FOR '&2'.
IF sy-subrc = 0.
REPLACE '&2' WITH p_name INTO p_std_text-tdline.
ENDIF.
SEARCH p_std_text-tdline FOR '&3'.
IF sy-subrc = 0.
REPLACE '&3' WITH p_name INTO p_std_text-tdline.
ENDIF.
MODIFY p_std_text.
Endloop.[/nobr]
‎2008 Jan 25 5:29 AM
hi deepankar
Thank you for your reply, can you explain me, how we relate our own database and the standard text for further processing.
do we need to create any field in our database for this text id, pls explain me clearly.
Thanks
Regards
Rajaram