Application Development 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: 

ALV Reports: How do i show data based on the User Login

Former Member
0 Kudos

Hi all,

I have a report and want to show data based on the User login.

E.g.

1. sapuser : show data specific to this user.

2.sapuser1 : show data specific to this user.

Regards,

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Check for sy-uname.. You could use case..endcase for customizing output.

4 REPLIES 4

Former Member
0 Kudos

Check for sy-uname.. You could use case..endcase for customizing output.

Former Member
0 Kudos

Hi,

The system variable SY-UNAME will give u the name of the user who has logeed in.

You can chek for the value of this variable before performing ur user specific operations.


if sy-uname = 'SAPUSER'.
   do this.
elseif sy-uname = 'SAPUSER1'.
   do that.
endif.

dont forget to give the values in capslock. (SAPUSER)

Former Member
0 Kudos

Ask your Admin/Basis What is the Authorisation Object for the User ...

if not then Create one Authorisation Object .And do validation in your Program.

The Example Program is as follow :

REPORT demo_authorithy_check.

PARAMETERS pa_carr LIKE sflight-carrid.
DATA wa_flights LIKE demo_focc.

AT SELECTION-SCREEN.

  AUTHORITY-CHECK OBJECT 'S_CARRID'
                  ID 'CARRID' FIELD pa_carr
                  ID 'ACTVT' FIELD '03'.

  IF sy-subrc = 4.
    MESSAGE e045(sabapdocu) WITH pa_carr.
  ELSEIF sy-subrc <> 0.
    MESSAGE e184(sabapdocu) WITH text-010.
  ENDIF.

START-OF-SELECTION.

  SELECT  carrid connid fldate seatsmax seatsocc
    FROM  sflight
    INTO  CORRESPONDING FIELDS OF wa_flights
    WHERE carrid = pa_carr.

    WRITE: / wa_flights-carrid,
             wa_flights-connid,
             wa_flights-fldate,
             wa_flights-seatsmax,
             wa_flights-seatsocc.

  ENDSELECT.

so in the above example the Authorisation Object is : 'S_CARRID' it has field like 'CARRID' and the Activity is '03'-> Display

like this you have to Create one Authorisation Object for SY-USER , Basically already the User Name Authorisation Obecjt was there ...as of now i am not able to retrieve ...if you ask YOUR admin/basis He would be Regulary giving the Authorisations for User so he will be nowing defulat .. so

Write

AT SELECTION-SCREEN.

  AUTHORITY-CHECK OBJECT 'S_XXXX'
                  ID 'uname'  FIELD  sy-username
                  ID 'ACTVT' FIELD '03'.

Reward points if it is usefull .....

Girish

Former Member
0 Kudos

Thanks for the info