2007 Apr 24 8:46 AM
Hi all,
i need clarification on long text upload for ac02 (display service. in this transaction i had to upload the following fields.
asnum,astyp,bklas,meins,..etc. and also long text field.
i developed seperate program for uploading asnum,astyp,bklas,meins.
and seperate program to upload long text.
i uploaded long text based on asnum.
both the programs are working fine.
when i check in the transaction ac03 for my input data give asnum. i am not able to see the long text field data to that corresponding asnum.
below is the code wat i used to upload long text.
REPORT Z_DISPLAY_SERVICE1.
Internal Table for Upload of Long Texts Data
DATA: BEGIN OF itab OCCURS 0,
asnum like asmd-asnum, " Service No
text LIKE tline-tdline, " Long Text
END OF itab.
To create Long Text lines for CREATE_TEXT function module
DATA:BEGIN OF dt_lines OCCURS 0.
INCLUDE STRUCTURE tline. " Long Text
DATA:END OF dt_lines.
Variable declarations for CREATE_TEXT function module
DATA : dl_name TYPE thead-tdname, " Object Name
dl_lan TYPE thead-tdspras. " Language
Constants
Object ID for Long Text of Service Master
CONSTANTS:c_best TYPE thead-tdid VALUE 'LTXT',
c_material TYPE thead-tdobject VALUE 'ASMD'. " Object
PARAMETERS p_file LIKE rlgrap-filename."input file
At selection-screen on Value Request for file Name
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
Get the F4 Values for the File
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = p_file.
Start Of Selection
START-OF-SELECTION.
*To Upload Flat file
CALL FUNCTION 'UPLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab = itab
EXCEPTIONS
conversion_error = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
OTHERS = 7.
Upload the Texts
SORT itab BY asnum.
LOOP AT itab.
dt_lines-tdformat = 'ST'.
dt_lines-tdline = itab-text.
APPEND dt_lines.
dl_lan = sy-langu.
concatenate '00000000000' itab-asnum into dl_name.
Call the Function Module to Create Text
CALL FUNCTION 'CREATE_TEXT'
EXPORTING
fid = c_best
flanguage = dl_lan
fname = dl_name
fobject = c_material
save_direct = 'X'
fformat = '*'
TABLES
flines = dt_lines
EXCEPTIONS
no_init = 1
no_save = 2
OTHERS = 3.
IF sy-subrc <> 0.
WRITE:/ 'Long Text Creation failed for Service No'(001),
itab-asnum.
ELSE.
WRITE:/ 'Long Text Created Successfully for Service No'(002),
itab-asnum.
ENDIF.
AT END OF asnum.
REFRESH dt_lines.
ENDAT.
ENDloop.
can any body help me in this regard y its not displaying long text for corresponding asnum. please provide solution for this.
thanks in advance.
siva
Hi all,
i need clarification on long text upload for ac02 (display service. in this transaction i had to upload the following fields.
asnum,astyp,bklas,meins,..etc. and also long text field.
i developed seperate program for uploading asnum,astyp,bklas,meins.
and seperate program to upload long text.
i uploaded long text based on asnum.
both the programs are working fine.
when i check in the transaction ac03 for my input data give asnum. i am not able to see the long text field data to that corresponding asnum.
below is the code wat i used to upload long text.
REPORT Z_DISPLAY_SERVICE1.
Internal Table for Upload of Long Texts Data
DATA: BEGIN OF itab OCCURS 0,
asnum like asmd-asnum, " Service No
text LIKE tline-tdline, " Long Text
END OF itab.
To create Long Text lines for CREATE_TEXT function module
DATA:BEGIN OF dt_lines OCCURS 0.
INCLUDE STRUCTURE tline. " Long Text
DATA:END OF dt_lines.
Variable declarations for CREATE_TEXT function module
DATA : dl_name TYPE thead-tdname, " Object Name
dl_lan TYPE thead-tdspras. " Language
Constants
Object ID for Long Text of Service Master
CONSTANTS:c_best TYPE thead-tdid VALUE 'LTXT',
c_material TYPE thead-tdobject VALUE 'ASMD'. " Object
PARAMETERS p_file LIKE rlgrap-filename."input file
At selection-screen on Value Request for file Name
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
Get the F4 Values for the File
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = p_file.
Start Of Selection
START-OF-SELECTION.
*To Upload Flat file
CALL FUNCTION 'UPLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab = itab
EXCEPTIONS
conversion_error = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
OTHERS = 7.
Upload the Texts
SORT itab BY asnum.
LOOP AT itab.
dt_lines-tdformat = 'ST'.
dt_lines-tdline = itab-text.
APPEND dt_lines.
dl_lan = sy-langu.
concatenate '00000000000' itab-asnum into dl_name.
Call the Function Module to Create Text
CALL FUNCTION 'CREATE_TEXT'
EXPORTING
fid = c_best
flanguage = dl_lan
fname = dl_name
fobject = c_material
save_direct = 'X'
fformat = '*'
TABLES
flines = dt_lines
EXCEPTIONS
no_init = 1
no_save = 2
OTHERS = 3.
IF sy-subrc <> 0.
WRITE:/ 'Long Text Creation failed for Service No'(001),
itab-asnum.
ELSE.
WRITE:/ 'Long Text Created Successfully for Service No'(002),
itab-asnum.
ENDIF.
AT END OF asnum.
REFRESH dt_lines.
ENDAT.
ENDloop.
can any body help me in this regard y its not displaying long text for corresponding asnum. please provide solution for this.
thanks in advance.
siva
2007 Apr 24 8:54 AM
2007 Apr 24 9:04 AM
2007 Apr 24 9:09 AM
Hi Siva,
First goto AC02 transaction code, Then goto the text which you need to create, there(In the Change mode) you will find a button to for the text, click that one, a line editor will open, there press GOTO --> HEader, here a pop up wil come with all the values, these values you need to pass to the CREATE_TEXT function module,
Pass all the values, you will be success
Regards
Sudheer
2007 Apr 24 9:18 AM
CHeck the parameters but I have had problems with this for cor2/3 i.e. long text visible in change transaction but not in display transaction is this your problem?
2007 Apr 24 10:30 AM
hi,
thanks for ur response
i am not able to get that in change mode also.but this asnum is populated in table stxh.
wen i see ac03 for corresponding asnum its not reflecting in long text .
help me in this regard
thanks
siva
2007 Apr 24 10:47 AM
HI
Irrespective of the txn. that you use, long txts uniquely have the id, object, name...use init_text and save_text fms consecutively...this code works fine for me, it updates STXH and long texts in the txn...let me know if you face any problems..
tables asmd.
parameters p_srno like asmd-asnum.
DATA BEGIN OF TNAME OCCURS 10.
INCLUDE STRUCTURE THEAD.
DATA END OF TNAME.
DATA BEGIN OF TXTLINES OCCURS 10.
INCLUDE STRUCTURE TLINE.
DATA END OF TXTLINES.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = p_srno
IMPORTING
OUTPUT = p_srno
.
move p_srno to tname-tdname.
MOVE 'ASMD' TO TNAME-TDOBJECT.
MOVE 'LTXT' TO TNAME-TDID.
MOVE SY-LANGU TO TNAME-TDSPRAS.
APPEND TNAME.
CALL FUNCTION 'INIT_TEXT'
EXPORTING
ID = 'LTXT'
LANGUAGE = SY-LANGU
NAME = TNAME-TDNAME
OBJECT = 'ASMD'
IMPORTING
HEADER = TNAME
TABLES
LINES = TXTLINES
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.
TXTLINES-TDFORMAT = '*'.
TXTLINES-TDLINE = 'This will produce the long text lines'.
APPEND TXTLINES.
CLEAR TXTLINES.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
HEADER = TNAME
INSERT = 'X'
SAVEMODE_DIRECT = 'X'
OWNER_SPECIFIED = ' '
LOCAL_CAT = ' '
IMPORTING
FUNCTION =
NEWHEADER = TNAME
TABLES
LINES = TXTLINES
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.
*
reward, if useful.
Sathish. R
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |