SUSR_GET_USER_DEFAULTS
Returns standard user SAP attributes as user's date format, language, printers etc.
Sample usage:
DATA: lt_users LIKE usdef OCCURS 1 WITH HEADER LINE.
DATA: ls_users TYPE usdef.
* Get standard SAP user defaults - due to printer settings
CALL FUNCTION 'SUSR_GET_USER_DEFAULTS'
TABLES
users = lt_users
EXCEPTIONS
OTHERS = 0.
READ TABLE lt_users INDEX 1 INTO ls_users.
" set printer
IF ( sy-subrc EQ 0 ) AND ( ls_users-spdb = 'G' ).
gs_control_structure-spdb = 'X'.
ENDIF.
There is an example of returned content for FM SUSR_GET_USER_DEFAULTS.
SUSR_USER_PARAMETERS_GET
It gives internal table filled with pairs - Id of parameter (parid) and it's value (parva). Here we speak about custom user parameters set in TPARA table (maintained via SM30).Insert new user parmeter
transaction SM30, table TPARAReading of user parameter
* Get user's custom printing setting
DATA: lt_user_params TYPE ustyp_t_parameters,
ls_user_param LIKE LINE OF lt_user_params,
lv_user TYPE usr02-bname.
* Name of searched parameter id (parid)
CONSTANTS: cv_print_colli_usr_param TYPE string VALUE '/YourNameSpace/HU035_P_COLLI'.
MOVE sy-uname TO lv_user.
" get custom user default parameters
CALL FUNCTION 'SUSR_USER_PARAMETERS_GET'
EXPORTING
user_name = lv_user
TABLES
user_parameters = lt_user_params.
READ TABLE lt_user_params INTO ls_user_param WITH KEY parid = cv_print_colli_usr_param.
" set checkbox by user parameter
IF ls_user_param-parva EQ abap_true.
d1000-printbox = 'X'.
ENDIF.
There is an example of returned content for FM SUSR_USER_PARAMETERS_GET.
No comments:
Post a Comment