Skip to Content

How to use current user login as a condition in Crystal Report

Hi Experts!

I just want to ask how a Crystal report be filtered based on the current user login in SAP B1. To give you an idea of the report, it pulls Incoming payment transactions (with Posting Date as parameter), but the output should only be seen by the User who entered the transaction.

Any ideas?

Thanks in advance.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jul 11, 2017 at 06:07 PM

    Hi Carah,

    There is a trick you can use:

    Use sql command to retrieve your results, on sql command window add a new parameter called printbyusername@ like this:

    This field brings the name of the user. U_NAME field from OUSR table.

    After this, use the following instruction in your command to retrieve de user id.

    DECLARE @UserId AS INT
    SET @UserId = (SELECT INTERNAL_K FROM OUSR WHERE U_NAME = '{?printbyusername@}')
    

    After this, user this variable @UserId in your where clause.

    Hope it helps.

    Kind Regards,

    Diego Lother

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 11 at 06:26 PM

    Hi Diego,

    I have Facing same issue . i want to get current user in crystal report which is login in SAP B1 and report show data according to current user login into sap system.

    Add comment
    10|10000 characters needed characters exceeded