Skip to Content
author's profile photo Former Member
Former Member

Make document owner as current login user.

Hi,

My client wants the document owner to always = the user who creates the document.

So, in employee master, I have each user assigned to a user id, but no sale employee attached.

In Document Owner field, I have the follwoing FMS that triggered by Customer No.

SELECT T0.[U_NAME] FROM OUSR T0 WHERE T0.UserId=$[User]

The problem is:

I have 2 users which were wrongly assigned sales employee and now I can not get rid of the Sales Employee.

Eg: Customer = C001 has Sales Person = Anthony.

In Employee Master, Anthony has sales employee assigned as himself. So, when Peter login to SAP, create Sales Order for Customer C001, the Document owner is showing 'Anthony'. I need to show 'Peter'.

Please advise.

I have tried using DTW, Employee Info template with following value, but receive error 'Method ~~~ object'.

RecordKey = 1

EmployeeID = 6 (as seen on Employee screen).

SalesPersonCode = /

Thanks for any help in advance.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 13, 2007 at 07:00 AM

    After reading you message I have the following questions

    This statement does not seem right "when Peter logs in to SAP, create Sales Order for Customer C001, the Document owner is showing 'Anthony'. I need to show 'Peter' "

    When Peter logs in to SAP, SAP knows that the user is Peter and if you using the following SQL it should only fetch the name of Peter

    SELECT T0.[U_NAME] FROM OUSR T0 WHERE T0.UserId=$[User]

    Note: It is a good practice to use <b>T0.Internal_K=$[USER]</b> instead of T0.UserId

    The problem is SAP expects the User Name to in the format <b>LastName, FirstName</b>

    Try this

    <i><b>SELECT T0.LastName + ', ' + T0.FirstName FROM [dbo].[OHEM] T0 WHERE T0.UserId = $[USER]</b></i>

    Let me know if you need further help on this

    Suda

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hey Suda, I've just been trying to make the document owner be the current login user, but the code in this thread triggers an error message.

      I go to Query Generator and put <b>SELECT T0.[U_NAME] FROM OUSR T0 WHERE T0.UserId=$[User]</b> in, and it says 'incorrect syntax near User'

      Can you please supply me with the right command to make the owner field (now called Document Creator in our system) automatically filled in as the person logged in?

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 12:49 PM

    Groovy,

    The $[User] field gets a value when you have a Form Open. If you try to run it from a Query Window it cannot evaluate $[USER] and thats why the error.

    The Query is Correct. Just save it and try to invoke it from within a Form and it will work.

    Suda

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.