Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Layout bring random record incase of draft or unadded documents

Dear Experts ,

am having a layout which is working fine , except for one part ,

If we use this layout to view or print any added document (AR Invoice) it will ring the write data and records.

but if the user click view or print before adding the document to the system , or if the document was saved as draft then : a random records will come into the layout , in a very randomly way , meaning if  close the view and open it again another record different than the precious shown one will come .

What am looking for is simple as i thought , if a user tried to view or print a document thats not added into system then show blank page , 

any help ?

here is the query am using in CR

SELECT   ohem.[U_Employee_Code] as'Cashier',OUSR.USER_CODE, OUSR.U_NAME,OUDG.[Code],OUDG.Phone1,OUDG.Phone2, OINV.DocEntry,oinv.docnum,  OINV.DocType, OINV.DocStatus, OINV.InvntSttus, OINV.DocDate, OINV.DocDueDate, OINV.CardCode, nnm1.seriesname,

         OINV.Address2, OINV.Printed, OINV.CardName, OINV.U_Address, OINV.NumAtCard, OINV.VatSum, OINV.DiscPrcnt, OINV.DiscSum, OINV.DocTotal, OINV.DocRate, OINV.u_deldate,

                      OINV.ReceiptNum, OINV.GroupNum, OINV.OwnerCode,OINV.JrnlMemo, OINV.VatPaid, OINV.Address2 AS Expr2, OINV.U_CUSTNAME1 as 'Customer Name' , OINV.U_PHONE1, OINV.ExepAmnt, OINV.ExepAmntSC, OINV.ExepAmntFC, OINV.VatDate,OINV.TotalExpns,

                      OINV.PaidSum, OINV.OwnerCode, OINV.BillToOW, OINV.ShipToOW, OINV.RetInvoice, OINV.ReqName, OINV.Requester, INV1.ItemCode, INV1.Dscription, INV1.Quantity, inv1.PriceBefDi,

                      INV1.SubCatNum, INV1.ShipDate, INV1.Price, INV1.Currency, INV1.Rate, INV1.DiscPrcnt AS Expr1, INV1.LineTotal, INV1.OpenSum, INV1.VatPrcnt, INV1.PriceAfVAT,

                      INV1.unitMsr, OINV.TaxDate, INV1.GTotal, OINV.Comments, OCTG.PymntGroup, OINV.LicTradNum, INV1.BaseDocNum, INV1.LineVat, OINV.WTSum, oinv.u_cancelled,

                      OCRN.CurrName, oslp.SlpName,OUDG.Phone1,OUDG.phone2,

        oinv.u_empid as'Sales man',OUDG.Phone1 as 'Branch Phone',OUDG.phone2 as 'Customer Support Phone',OINV.U_PHONE1 as 'Customer Phone',inv1.shipdate as 'Item Delivery Date',  OINV.TotalExpns AS 'FREIGHT CHARGES',OINV.U_Address as 'Customer Address',oinv.UpdateDate, OINV.DocEntry

FROM         OINV INNER JOIN

                      INV1 ON OINV.DocEntry = INV1.DocEntry INNER JOIN

                      OUSR ON OINV.UserSign = OUSR.USERID INNER JOIN

                      OCTG ON OINV.GroupNum = OCTG.GroupNum INNER JOIN

                      OCRN ON OINV.DocCur = OCRN.CurrCode inner join

                     oslp on oinv.SlpCode = oslp.SlpCode INNER JOIN

       OUDG ON OUSR.[DfltsGroup] = OUDG.[Code] inner join

        nnm1 on OINV.series = nnm1.series LEFT JOIN

                      OHEM on OUSR.[userId] = OHEM.[USERID]

         

                        where OINV.DocEntry = {?DocKey@}

Tags:
Former Member
replied

The draft document is using different table, ODRF.

So in ur query, u will need to make judgment on the ObjectId, if it is 124, then u will need to query ODRF.

Frank

1 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question