Skip to Content
avatar image
Former Member

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

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,

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 22, 2007 at 10:45 AM

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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 22, 2007 at 10:48 AM

    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)

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 22, 2007 at 03:20 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 25, 2007 at 08:12 AM

    Thanks for the info

    Add comment
    10|10000 characters needed characters exceeded