‎2006 Oct 30 6:36 AM
Hi Friends,
Can anyone tell me how to upload long text in VD51(Customer Mterial Inforecods) , this is the field corresponding to which user should be able to upload N number page text/document.While recording it looks like SAPScript editor.
Please help me
Regards
Sonal
‎2006 Oct 30 7:05 AM
Dear Sonal
Please try using FM: <b>SAVE_TEXT</b>.
Parameters to be passed:
1. Text-ID: '0001'.
2. Text Object: 'KNMT'.
3. Language: SY-LANGU.
4. Text Name: Combination of Sales Orgranization, Distribution Channel, Customer Number, Material Number.
5. Text in internal table of type TLINE.
Below example might give you some idea:
data: head type THEAD.
head-tdname = name. -> Combination of Sales Orgn + Dist. Chn + Customer + Material.
head-tdspras = sy-langu.
head-tdobject = 'KNMT'.
head-tdid = '0001'.
data: it_tline type standard table of tline with header line.
it_tline-tdline = 'testing only'.
append it_tline.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
* CLIENT = SY-MANDT
HEADER = head
INSERT = 'X'
SAVEMODE_DIRECT = 'X'
* OWNER_SPECIFIED = ' '
* LOCAL_CAT = ' '
* IMPORTING
* FUNCTION =
* NEWHEADER =
TABLES
LINES = it_tline
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.Hope this helps you.
Kind Regards
Eswar
‎2006 Oct 30 7:12 AM
thanks Eswar ,
Can i upload 3-4 pages texts through save_text ?
Also what should be the approach for upload as i already have created a LSMW to upload VD51 and now suffering for LONG TEXT. Will it require development of one more load program ? can't i use SAVE_TEXT in my LSMW ?
Please Suggest
regards
Sonal
‎2006 Oct 30 9:31 AM
Hi Sonal,
Inside LSMW we can use direct input option if any standard SAP program available for updating long text. you can just check..or
Use SAVE_TEXT function module.Yes with the help of SAVE_TEXT function module you can save 3-4 pages text even more than that also.
But be cautious as SAVE_TEXT function module is not saveing text in first line of your upload file for each record.
here is an example of ABAP code you can use if require :
FORM upload_file .
Source file name is mandatory
IF p_path1 IS INITIAL.
MESSAGE I001 WITH TEXT-002.
LEAVE LIST-PROCESSING .
ENDIF.
Upload source file from presentation server
l_ws_path = p_path1.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_ws_path
filetype = 'ASC'
has_field_separator = '#'
Start of revision for DG1K982887
codepage = '6300'
End of revision for DG1K982887
TABLES
data_tab = i_aenr
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
MESSAGE e001(rlb) WITH text-001.
ENDIF.
ENDFORM. " upload_file
&----
*& Form save_long_texts
&----
Subroutine to save long text of ecm
----
None
----
FORM save_long_texts.
Loop at interal table to find out unique tdname.
LOOP AT i_aenr into wa_aenr.
MOVE wa_aenr-object TO i_header-tdobject.
MOVE wa_aenr-name TO i_header-tdname.
MOVE wa_aenr-id TO i_header-tdid.
MOVE wa_aenr-lang TO i_header-tdspras.
MOVE wa_aenr-format TO i_line-tdformat.
MOVE wa_aenr-line TO i_line-tdline.
APPEND i_header.
APPEND i_line.
AT END OF name.
Delete adjacent duplicate from i_header to find out unique name.
DELETE ADJACENT DUPLICATES FROM i_header.
Call function module 'SAVE_TEXT' to save ECM header long text.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
client = sy-mandt
header = i_header
savemode_direct = 'X'
TABLES
lines = i_line
EXCEPTIONS
id = 1
language = 2
name = 3
object = 4
OTHERS = 5.
IF sy-subrc <> 0.
WRITE : /1 'Change number ',
i_header-tdname,
'Could Not be Saved.'.
ELSE.
WRITE : /1 'Change number :',
i_header-tdname,
'Has been Saved.'.
ENDIF.
REFRESH i_header.
REFRESH i_line.
ENDAT.
ENDLOOP.
Thanks & Regards,
Shilpa K.
‎2006 Oct 30 9:59 AM
Thanks Shilpa,
Suppose my text is of 1000 line/char , i hve uploaded it to my internal table and when i try to append this to internal table i_line(as per ur code sample) , its length is only 132 char. How u'll process this ?
Thanks
Sonal
‎2006 Oct 30 4:31 PM
Use Standard longtext program available in LSMW Object = 0001 and method = 0001.
‎2006 Oct 31 6:59 AM
thanks Venkatesh ,
Can you please help me further like what will be the source file structure and no of files and their links ?
Regards
Sonal
‎2006 Oct 31 4:59 PM
check standard program structure it has Header long texts & Line long texts. Most of the header structure fields can be constants . All you have to do is pass line long texts in the form of flat file.