cancel
Showing results for 
Search instead for 
Did you mean: 

need to print Current user Name in crystal report in B1

Former Member
0 Kudos
5,071

Hi all,

In Crystal reports there are 2 current user fields

CurrentCEUserName

and CurrentCEUserID

I have tried to add these fields to the footer of my reports, but no information comes out.

Is there any way to find out the current user and print their user name on the report?

Users have 2 id's. Where can I find this info and add it to the report.

A) the windows user id if possible

B) the SAP user id

Thanks

Chris

0 Kudos

Try this ...

CREATE PROCEDURE HR_INFO_USR_LOGIN LANGUAGE SQLSCRIPT SQL SECURITY INVOKER AS BEGIN SELECT X."CardCode", Y."PrintBy", Y."Client" FROM DUMMY LEFT JOIN ( SELECT "CardCode" FROM OCRD WHERE LEFT("CardCode",2) = 'CJ' ) X ON 1 = 1 LEFT JOIN ( SELECT XX."UserCode" as "PrintBy", UPPER(XX."WinUsrName") as "Client" FROM M_SESSION_CONTEXT YY INNER JOIN ( select "UserCode" , "WinUsrName", ( select case when "Action" = 'I' then 'OPEN' when "Action" = 'O' then 'CLOSED' end from USR5 r1 where r1."UserCode" = r."UserCode" and r1."Date" = r."Date" and r1."Time" = Max(r."Time") ) "Login Status" ,"Date", "ClientName", Max(r."Time") "Login Time" from USR5 r where "ProcName" = 'SAP Business One.exe' and TO_VARCHAR(r."Date",'YYYY-MM-DD') = TO_VARCHAR(NOW(),'YYYY-MM-DD') group by "UserCode" , "WinUsrName", "Date", "ClientName" having MAX("Time") = Max(r."Time") ) XX ON YY.value = XX."WinUsrName" INNER JOIN OUSR USR ON XX."UserCode" = USR."USER_CODE" WHERE connection_id=current_connection AND KEY ='APPLICATION_OS_USER' ) Y ON 1 = 1; END

View Entire Topic
tony_matar2
Explorer
0 Kudos

i dont know if you have fixed it but you can create a parameter with the name PrintByUserName@.

include this parameter in the report and then you will get printer by sap username.