Skip to Content
0

Add Document Creator Name in a Query

Feb 14, 2017 at 08:25 PM

155

avatar image
Former Member

I am making a query about the status of a certain document and all its related target document (PR - PO - GRPO - AP Invoice - Outgoing Payment)

This is my query:

How can I insert the creator name of each of the document in my query?

My SAP version is 9.2 PL 3

Thanks

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Agustin Marcos Cividanes Feb 15, 2017 at 12:11 PM
0

Hi

try this query:

select a.docdate as 'PO Date', a.DocDueDate as 'GRPO Date', a.DocNum as 'PO Number', a.CardCode as 'Supplier Code', a.CardName as 'Supplier Name', b.Dscription as 'Product', b.Quantity, a.docstatus as 'PO Status', d.DocNum as 'GRPO Number', d.DocStatus as 'GRPO Status', f.DocNum as 'AP Invoice Number', f.DocStatus as ' AP Invoice Status', g.u_name as 'User' from OPOR a left join POR1 b on a.docentry = b.docentry left join PDN1 c on c.baseref = b.TrgetEntry and c.ItemCode = b.ItemCode left join OPDN d on c.docentry = d.docentry left join PCH1 e on e.BaseRef = c.TrgetEntry and e.ItemCode = c.ItemCode left join OPCH f on e.docentry = f.DocEntry
inner join OUSR g on g.userid = a.usersign where a.U_NT is null and a.DocDate between [%0] and [%1]

Kind regards

Agustín

Share
10 |10000 characters needed characters left characters exceeded
Nagarajan K Feb 14, 2017 at 10:47 PM
0

Hi,

Try this for PO and follow for other documents:-

SELECT T1.[U_NAME] FROM OPOR T0 INNER JOIN OUSR T1 ON T0.[UserSign] = T1.[USERID]

Regards,

Nagarajan

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hello Nagarajan,

Sorry but the query you suggested does not work.

This is my query to see the PO status and all its' related target documents:

select a.docdate as 'PO Date', a.DocDueDate as 'GRPO Date', a.DocNum as 'PO Number', a.CardCode as 'Supplier Code', a.CardName as 'Supplier Name', b.Dscription as 'Product', b.Quantity, a.docstatus as 'PO Status', d.DocNum as 'GRPO Number', d.DocStatus as 'GRPO Status', f.DocNum as 'AP Invoice Number', f.DocStatus as ' AP Invoice Status' from OPOR a left join POR1 b on a.docentry = b.docentry left join PDN1 c on c.baseref = b.TrgetEntry and c.ItemCode = b.ItemCode left join OPDN d on c.docentry = d.docentry left join PCH1 e on e.BaseRef = c.TrgetEntry and e.ItemCode = c.ItemCode left join OPCH f on e.docentry = f.DocEntry where a.U_NT is null and a.DocDate between [%0] and [%1]

Now, I need to see who created the PO, the GRPO, AP Invoice and Outgoing Payment

Thanks

0

To get user name of each document, you have to link OUSR table with OPOR, OPDN, OPCH. Please try yourself.

Let me know if you face any issue.

0