05-29-2009 9:39 AM
Hi Experts,
I have one special requirement ,
i have one "Edit" buton it will edit text using "Edit_text" functionmodule.
If the user dont have autherization it should be in "Displaymode" not in "Editmode" with same text.
how can we do it?
sample code here.
data:l_textname type stxh-l_textname.
data: l_langname type t002-spras.
SELECT SINGLE * FROM stxh
INTO lw_text_name
WHERE tdname = l_text_name
AND tdspras = l_langname
AND tdid = 'ST'
AND tdobject = 'TEXT' .
*Moving data from work area to internal table
gt_text_name-mandt = lw_text_name-mandt.
gt_text_name-tdobject = lw_text_name-tdobject.
gt_text_name-tdname = lw_text_name-tdname.
gt_text_name-tdid = lw_text_name-tdid.
APPEND gt_text_name.
CLEAR lw_text_name.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = gt_text_name-mandt
object = gt_text_name-tdobject
name = gt_text_name-tdname
id = gt_text_name-tdid
language = l_langname
IMPORTING
header = gs_thead
TABLES
lines = gt_lines
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'EDIT_TEXT'
EXPORTING
display = g_c_x
header = gs_thead
TABLES
lines = gt_lines
EXCEPTIONS
id = 1
language = 2
linesize = 3
name = 4
object = 5
textformat = 6
communication = 7
OTHERS = 8.
check the autherization here.
if user have authrization
display text with "edit"screen with "editmode".
else.
display text with "edit"screen " with "dispalymode".
endif.
Thanks.
05-30-2009 8:02 AM
check your authorisation befor edit text fm
like
define 1 variable say
data : display .
check the autherization here.
if user have authrization
display text with "edit"screen with "editmode".
dispay = ' '.
else.
display text with "edit"screen " with "dispalymode".
display = 'X'.
endif.
pass this display to edit_text fm like
CALL FUNCTION 'EDIT_TEXT'
EXPORTING
display = Display
header = gs_thead
TABLES
lines = gt_lines
EXCEPTIONS
id = 1
language = 2
linesize = 3
name = 4
object = 5
textformat = 6
communication = 7
OTHERS = 8.
05-29-2009 10:58 AM
Hi
I dont remember the exact syntax code, but u can do it by "check authorisation activity",search with these words in sdn or help...this will solve.
Regards
Sajid
05-29-2009 3:57 PM
Hi ,
you need to check the authorization syntax, check the below example,
AUTHORITY-CHECK OBJECT 'Z_AUGRU_2'
ID 'Z_AUGRU2' FIELD XVBAK-AUGRU.
you need to create an object and id just consult your basis to create an authorization object and id.
05-30-2009 8:02 AM
check your authorisation befor edit text fm
like
define 1 variable say
data : display .
check the autherization here.
if user have authrization
display text with "edit"screen with "editmode".
dispay = ' '.
else.
display text with "edit"screen " with "dispalymode".
display = 'X'.
endif.
pass this display to edit_text fm like
CALL FUNCTION 'EDIT_TEXT'
EXPORTING
display = Display
header = gs_thead
TABLES
lines = gt_lines
EXCEPTIONS
id = 1
language = 2
linesize = 3
name = 4
object = 5
textformat = 6
communication = 7
OTHERS = 8.