07-19-2007 1:53 PM
first i called READ_TEXT.
EDIT_TEXT.
SAVE_TEXT.
COMMIT_TEXT.
PLEASE CHECK THIS CODE ONCE ..PLEASE LET ME KNOW THE PROBLES.
gv_vlsch = gs_bmw_std_a1020-vlsch.
gv_lng = 'DE'.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = 'SUBM'
language = gv_lng
name = gv_vlsch
object = 'WORKST'
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
header = gs_thead
TABLES
lines = gt_text
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.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DATA:lv_clnt TYPE sy-mandt.
********CHANGE 5/7**********
CLEAR gv_index.
CLEAR gt_line[].
SET PF-STATUS 'VIEW'.
LOOP AT gt_bmw_std_a1020 INTO gs_bmw_std_a1020 WHERE ch = 'X'.
gv_index = gv_index + 1.
ENDLOOP.
IF gv_index GE 2.
MESSAGE s000.
leave to screen 0.
CLEAR gv_index.
ELSEIF gv_index LT 1.
MESSAGE s001.
leave to screen 0.
ELSE.
CLEAR gv_index.
CLEAR gs_bmw_std_a1020.
READ TABLE gt_bmw_std_a1020 INTO gs_bmw_std_a1020 WITH KEY ch = 'X'.
IF sy-subrc EQ 0.
gv_vlsch = gs_bmw_std_a1020-vlsch.
gv_lng = 'DE'.
PERFORM read_text.
ENDIF.
CALL FUNCTION 'EDIT_TEXT'
EXPORTING
display = ' '
EDITOR_TITLE = ' '
header = gs_thead
PAGE = ' '
WINDOW = ' '
save = 'X'
LINE_EDITOR = ' '
CONTROL = ' '
PROGRAM = ' '
LOCAL_CAT = ' '
IMPORTING
FUNCTION =
NEWHEADER =
RESULT =
TABLES
lines = gt_text
EXCEPTIONS
ID = 1
LANGUAGE = 2
LINESIZE = 3
NAME = 4
OBJECT = 5
TEXTFORMAT = 6
COMMUNICATION = 7
OTHERS = 8
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*****************5/7******************
lv_clnt = sy-mandt.
**************************************************
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
client = lv_clnt
header = gs_thead
INSERT = ' '
SAVEMODE_DIRECT = ' '
OWNER_SPECIFIED = ' '
LOCAL_CAT = ' '
IMPORTING
FUNCTION =
NEWHEADER =
TABLES
lines = gt_text
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.
CALL FUNCTION 'COMMIT_TEXT'
EXPORTING
OBJECT = '*'
NAME = '*'
ID = '*'
LANGUAGE = '*'
SAVEMODE_DIRECT = ' '
KEEP = ' '
LOCAL_CAT = ' '
IMPORTING
COMMIT_COUNT =
TABLES
T_OBJECT =
T_NAME =
T_ID =
T_LANGUAGE =
.
07-19-2007 1:59 PM
Not sure about your code, but this code works absolutly fine for me. It retreives some text, presents it to the user, you can modifiy it and click the save button and it is then saved. No reason to execute the SAVE_TEXT or COMMIT_TEXT function modules
report zrich_0003 .
data: xthead type thead.
data: ilines type table of tline with header line.
xthead-tdobject = 'ZPT_DET'.
xthead-tdid = 'Z001'.
xthead-tdname = '004500'.
xthead-tdspras = sy-langu.
xthead-tdlinesize = 72.
call function 'READ_TEXT'
exporting
id = xthead-tdid
language = xthead-tdspras
name = xthead-tdname
object = xthead-tdobject
tables
lines = ilines
exceptions
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
others = 8.
call function 'EDIT_TEXT'
exporting
header = xthead
tables
lines = ilines
exceptions
id = 1
language = 2
linesize = 3
name = 4
object = 5
textformat = 6
communication = 7
others = 8.
check sy-subrc = 0.
Regards,
Rich Heilman
07-19-2007 1:59 PM
Not sure about your code, but this code works absolutly fine for me. It retreives some text, presents it to the user, you can modifiy it and click the save button and it is then saved. No reason to execute the SAVE_TEXT or COMMIT_TEXT function modules
report zrich_0003 .
data: xthead type thead.
data: ilines type table of tline with header line.
xthead-tdobject = 'ZPT_DET'.
xthead-tdid = 'Z001'.
xthead-tdname = '004500'.
xthead-tdspras = sy-langu.
xthead-tdlinesize = 72.
call function 'READ_TEXT'
exporting
id = xthead-tdid
language = xthead-tdspras
name = xthead-tdname
object = xthead-tdobject
tables
lines = ilines
exceptions
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
others = 8.
call function 'EDIT_TEXT'
exporting
header = xthead
tables
lines = ilines
exceptions
id = 1
language = 2
linesize = 3
name = 4
object = 5
textformat = 6
communication = 7
others = 8.
check sy-subrc = 0.
Regards,
Rich Heilman
07-19-2007 2:07 PM
Hi Kranthi,
I have sample code pls can you compare with this and check what went wrong :
data: header type thead.
data: txt_lines type table of tline with header line.
data: mode(1) type c.
parameters: p_edit radiobutton group grp1 default 'X',
p_disp radiobutton group grp1.
* Set up the text header
header-tdobject = 'AUFK'.
header-tdname = '001000000001'.
header-tdid = 'LTXT'.
header-tdspras = sy-langu.
header-tdlinesize = 70.
* First read the text, if there is any.
call function 'READ_TEXT'
exporting
* CLIENT = SY-MANDT
id = header-tdid
language = sy-langu
name = header-tdname
object = header-tdobject
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
tables
lines = txt_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.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
if p_edit = 'X'.
mode = space.
else.
mode = 'X'.
endif.
* throw editor, allow user to change
call function 'EDIT_TEXT'
exporting
display = mode
* EDITOR_TITLE = ' '
header = header
* PAGE = ' '
* WINDOW = ' '
save = 'X'
* LINE_EDITOR = ' '
* CONTROL = ' '
* PROGRAM = ' '
* LOCAL_CAT = ' '
* IMPORTING
* FUNCTION =
* NEWHEADER =
* RESULT =
tables
lines = txt_lines
* EXCEPTIONS
* ID = 1
* LANGUAGE = 2
* LINESIZE = 3
* NAME = 4
* OBJECT = 5
* TEXTFORMAT = 6
* COMMUNICATION = 7
* OTHERS = 8
.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
* When user comes back from editor, save the text
* Only for edit mode.
check mode = space.
call function 'SAVE_TEXT'
exporting
client = sy-mandt
header = header
* INSERT = ' '
* SAVEMODE_DIRECT = ' '
* OWNER_SPECIFIED = ' '
* LOCAL_CAT = ' '
* IMPORTING
* FUNCTION =
* NEWHEADER =
tables
lines = txt_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.
write : 'Hi'.
Reward pts if found usefull:)
Regards
Sathish