Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

System Variable That Holds The User Group Value

Former Member
0 Likes
899

Hi Guys/Dolls

I've written a program (ok I lie not me - some other ABAPER) but I need to modify it slightly.

I need to evaluate which user group the person is in and based upon that enable or diasble a selection item on the front screen.

Would appreciate any help + a very small code example would suffice.

Many thanks in advance.

Raj

Hi Guys/Dolls

I've written a program (ok I lie not me - some other ABAPER) but I need to modify it slightly.

I need to evaluate which user group the person is in and based upon that enable or diasble a selection item on the front screen.

Would appreciate any help + a very small code example would suffice.

Many thanks in advance.

Raj

5 REPLIES 5
Read only

Former Member
0 Likes
820

Hi,

use the select query in the initialization event.

data : begin of wa,
           BNAME type XUBNAME,
           CLASS type XUCLASS,
         end of wa.

INITIALIZATION.
select  single BNAME                " BNAME gives the user name from table USR02
           class                              " Class gives the user group from table USR02
  into wa
  from usr02
 where bname = sy-uname.

AT Selection-screen ouput.
if wa-class = 'XYZ'.
loop at screen.
  if screen-name cs 'INPUTFIELD'.
     screen-active = 0.
     modify screen.
  endif.
endloop.

Regards,

Siddarth

Read only

Former Member
0 Likes
820

Ok managed to solve this via the following piece of code which needs to go within the "initialization" section but still have one problem namely variants that were setup with the extraction option selected are still coming up with that option even though the code to disable the extraction option has been implemented as shown below - should the code below be implemented within the i"initialization" section or elsewhere?

initialization.

DATA: BEGIN OF user_parameters OCCURS 20.
          INCLUDE STRUCTURE usparam.
DATA: END OF user_parameters.

  CALL FUNCTION 'SUSR_USER_READ'
    EXPORTING
      user_name                  = sy-uname
   TABLES
     user_parameters            = user_parameters.

  IF sy-subrc <> 0.
    MESSAGE i113(zh).
    RETURN.
  ELSE.
    LOOP AT user_parameters.
      IF user_parameters-parid = 'UGR' AND user_parameters-parva <> '99'.
        LOOP AT SCREEN.
          IF screen-name CS 'IEXT'.
            screen-input = 0.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ENDIF.
    ENDLOOP.
  ENDIF.

Read only

Former Member
0 Likes
820

Finally sorted

I've had to re-duplicate the code at the

at selection-screen output.

so I've procedurised it now looks like this.

initialization.
* RP 12.03.09 - Disable the extraction radio button except when the user is in
* user group 99.
  perform disable_extraction.
*


at selection-screen output.

  perform screen_control.

* RP 12.03.09 - Disable the extraction radio button except when the user is in
* user group 99.
  perform disable_extraction.

form DISABLE_EXTRACTION .

* RP - 12.03.09 - WO 1751 on CH1185.
* Disable the extraction radio button except when the user is in
* user group 99.
DATA: BEGIN OF user_parameters OCCURS 20.
          INCLUDE STRUCTURE usparam.
DATA: END OF user_parameters.

  CALL FUNCTION 'SUSR_USER_READ'
    EXPORTING
      user_name                  = sy-uname
   TABLES
     user_parameters            = user_parameters.

  IF sy-subrc <> 0.
    MESSAGE i113(zh).
    RETURN.
  ELSE.
    LOOP AT user_parameters.
      IF user_parameters-parid = 'UGR' AND user_parameters-parva <> '99'.
        LOOP AT SCREEN.
          IF screen-name CS 'IEXT'.
            screen-input = 0.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ENDIF.
    ENDLOOP.
  ENDIF.

endform.                    " DISABLE_EXTRACTION

Read only

0 Likes
820

Hi,

instead of reduplicating the code...

you can just write it in at selection-screen output...

as this will also be triggered when the selection screen is displayed for the first time and all other time as well.

so just writing at that place will do...

Regards

Siddarth

Read only

Former Member
0 Likes
820

Weel done Raj/Matt