Purchase Register with Item

Hi Friends,
                I want purchase register report in which i can see all row on each docentry, I have a query like
SELECT
M.DocNum as 'A/P Invoice No.',
M.DocDate as 'Inv. Date',
M.CardName as 'Vendor Name',
M.NumAtCard as 'Vendor Ref. No.',
(Select Sum (isnull (LineTotal,0)) FROM pch1 L Where L.DocEntry=M.DocEntry) - isnull (((Select Sum (isnull(LineTotal,0)) FROM rpc1 r Where R.baseEntry=L.DocEntry)),0) as 'Base Amt(Rs.)',
(SELECT AVG (TaxRATE) FROM pch4 where statype=1 and DocEntry=M.DocEntry) - isnull (((SELECT Sum(TaxRATE) FROM Rpc4 R4 where statype=1 and R4.DocEntry=R.DocEntry)),0) as ' VAT_RATE ',
(SELECT Sum(TaxSum) FROM pch4 where statype=1 and DocEntry=M.DocEntry) - isnull(((SELECT Sum(TaxSum) FROM Rpc4 R4 where statype=1 and R4.DocEntry=R.DocEntry)),0) as ' VAT(Rs.)',
(SELECT avg(TAXRATE) FROM pch4 where statype=4 and DocEntry=M.DocEntry) - isnull(((SELECT Sum(Taxrate) FROM Rpc4 R4 where statype=4 and R4.DocEntry=R.DocEntry)),0) as ' CST_RATE ',
(SELECT Sum(TaxSum) FROM pch4 where statype=4 and DocEntry=M.DocEntry) - isnull(((SELECT Sum(TaxSum) FROM Rpc4 R4 where statype=4 and R4.DocEntry=R.DocEntry)),0) as ' CST(Rs.) ',
(Select Sum(LineTotal) From pch3 Q Where Q.DocEntry=M.DocEntry) - isnull(((SELECT Sum(Linetotal) FROM Rpc3 R3 where R3.DocEntry=R.DocEntry)),0) AS 'Freight(Rs.)' ,
(M.DocTotal - isnull(M.PaidToDate,0)) as 'Total (Rs.)'
from opch M
LEFT OUTER JOIN pch1 L on L.DocEntry=M.DocEntry
LEFT OUTER JOIN pch4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum
LEFT OUTER JOIN pch5 J ON M.DocEntry = J.AbsEntry
LEFT OUTER JOIN pch3 Q ON M.DocEntry = Q.DocEntry
left outer join RPC1 R On R.Baseentry = L.Docentry
left outer join RPC4 R4 On R.docentry = R4.Docentry
left outer join RPC3 R3 On R.docentry = R3.docentry
left outer join ORPC RP On R.docentry = RP.docentry
WHERE M.DocDate >= [%0] AND M.DocDate <= [%1] and m.doctype = 'I'
GROUP BY
M.DocNum,M.DocDate,M.CardName,M.NumAtCard,
M.DocEntry,M.DiscSum,M.WTSum,M.DocTotal,L.docentry,R.docentry,RP.Doctotal, M.Paidtodate
ORDER BY
M.DocNum,M.DocDate,M.CardName,M.NumAtCard,
M.DocEntry,M.DiscSum,M.WTSum,M.DocTotal
    My requirement is to show all row items corresponding to docnumber.
Thanks
Andy

Hi Andy,
Try:
SELECT
M.DocNum as 'A/P Invoice No.',
M.DocDate as 'Inv. Date',
M.CardName as 'Vendor Name',
M.NumAtCard as 'Vendor Ref. No.',
(Select Sum (isnull (LineTotal,0)) FROM pch1 L Where L.DocEntry=M.DocEntry) - isnull (((Select Sum (isnull(LineTotal,0)) FROM rpc1 r Where R.baseEntry=L.DocEntry)),0) as 'Base Amt(Rs.)',
(SELECT AVG (TaxRATE) FROM pch4 where statype=1 and DocEntry=M.DocEntry) - isnull (((SELECT Sum(TaxRATE) FROM Rpc4 R4 where statype=1 and R4.DocEntry=R.DocEntry)),0) as ' VAT_RATE ',
(SELECT Sum(TaxSum) FROM pch4 where statype=1 and DocEntry=M.DocEntry) - isnull(((SELECT Sum(TaxSum) FROM Rpc4 R4 where statype=1 and R4.DocEntry=R.DocEntry)),0) as ' VAT(Rs.)',
(SELECT avg(TAXRATE) FROM pch4 where statype=4 and DocEntry=M.DocEntry) - isnull(((SELECT Sum(Taxrate) FROM Rpc4 R4 where statype=4 and R4.DocEntry=R.DocEntry)),0) as ' CST_RATE ',
(SELECT Sum(TaxSum) FROM pch4 where statype=4 and DocEntry=M.DocEntry) - isnull(((SELECT Sum(TaxSum) FROM Rpc4 R4 where statype=4 and R4.DocEntry=R.DocEntry)),0) as ' CST(Rs.) ',
(Select Sum(LineTotal) From pch3 Q Where Q.DocEntry=M.DocEntry) - isnull(((SELECT Sum(Linetotal) FROM Rpc3 R3 where R3.DocEntry=R.DocEntry)),0) AS 'Freight(Rs.)' ,
(M.DocTotal - isnull(M.PaidToDate,0)) as 'Total (Rs.)',
L.ItemCode,L.Quantity,L.LineTotal
from opch M
LEFT OUTER JOIN pch1 L on L.DocEntry=M.DocEntry
LEFT OUTER JOIN pch4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum
LEFT OUTER JOIN pch5 J ON M.DocEntry = J.AbsEntry
LEFT OUTER JOIN pch3 Q ON M.DocEntry = Q.DocEntry
left outer join RPC1 R On R.Baseentry = L.Docentry
left outer join RPC4 R4 On R.docentry = R4.Docentry
left outer join RPC3 R3 On R.docentry = R3.docentry
left outer join ORPC RP On R.docentry = RP.docentry
WHERE M.DocDate >= [%0\] AND M.DocDate <= [%1\] and m.doctype = 'I'
GROUP BY
M.DocNum,M.DocDate,M.CardName,M.NumAtCard,
M.DocEntry,M.DiscSum,M.WTSum,M.DocTotal,L.docentry,R.docentry,RP.Doctotal, M.Paidtodate,
L.ItemCode,L.Quantity,L.LineTotal
ORDER BY
M.DocNum,M.DocDate,M.CardName,M.NumAtCard,
M.DocEntry,M.DiscSum,M.WTSum,M.DocTotal
Thanks,
Gordon

Similar Messages

  • Purchase requisition with Item Category – L creation via Maintenance orders (Plant Maintenance)

    Hi Guru’s,
    I have a scenario where purchase requisition with Item Category – L (subcontract External) for Repair items (Storeroom Process) need to get generated with Item category-L.This requirement is to MAP in my system.
    I am aware that purchase requisition can be created with reference to maintenance orders.
    Can anybody through some light on the integration between PM and MM.
    If creation of purchase requisition is possible via maintenance orders then please explain me with detailed steps both configurations and master data so that I can able to replicate the same as per business requirement.
    I look forward to the expert’s response.
    Regards,
    Kumar

    Hi Kumar.S
    You have to installed DIMP 6.0, and activated the business function Refurbishment and Subcontracting (LOG_EAM_ROTSUB) and Serial Numbers in Purchasing (LOG_MM_SERNO) .
    Please check the below link:
    http://scn.sap.com/thread/1956895
    Hope it will help you to resolve your issue.
    Regards,
    Ritesh

  • How To Restrict Users To Only Create Purchase Requisitions with Item Catalog?

    Hi, everyone 
    Please help me, 
    How To Restrict Users To Only Create Purchase Requisitions with Item Catalog? is it possible? 
    Regards,   Manuel

    Hi Steenie Norman
    First click on the text item ---> Tools ---> Property Pallete ---->
    and change the Keyboard State to Local Only also this Depend in your OS
    hope this useful ....
    Regards
    Mohammed

  • MD04: Unable to see Purchase Orders with Item Category S

    Hi,
    Whenever we create Purchase Orders with Item Category S (3rd party), they are not visible in MD04 Stock Requirements list.
    Is there anyway we can get the Item category S Orders to be displayed in the MD04 list?

    Hi,
    I am unable to see Third party POs with open quantity also.
    If I create a PO with blank item category (i,e to stock, it will show in MD04)
    but if i create PO with item category S (it does not show in MD04)
    Can you suggest how we can get item category S POs to be displayed in MD04

  • Delete purchase requisition with item category Subcontracting

    Hi all,
    I need to delete a purchase requisition with item category = L (subcontracting).
    I am using already BAPI_REQUISITION_DELETE to delete other purchase requisitions but for the subcontracting it doest not work. In fact in the BAPI code you can see:
    Requisitions with dependent reservations won't be processed
        IF xeban-pstyp EQ 3 AND xeban-rsnum NE space.
    So I am looking for other BAPI but I don't find any to delete this kind of requisitions. Do you know any way to do that or I have to do a batch input?
    Thx,
    Manel

    Hi Manel,
    I am using BAPI_PO_CHANGE to set EBAN_EBAKZ, however in most of the cases error thrown as "Instance PO Number of object type  could not be changed".
    Could you please help on this?
    Thanks,
    Murali

  • To create purchase requisition with item cat L through mrp

    dear all,
               when ever i m running mrp a pur req is created but my requirement is to create a pur req with item cat L.
    even i m unable to change the item cat of pur req while editing it so pls tell me how to config to create pur req with item cat L after dooing mrp run.
    thanks
    ujwal

    Hi
    Have you set the master data's for sub contracting process?
    Following Master Data should be in place;
    u2022     MM01- Material Masters for Components and FG
    u2022     XK01 - Vendor Master (Subcontractor)
    u2022     CS01 - BOM for FG
    u2022     ME11 - Purchase Info record for Subcontracting info catergory 
                     Me01- Source list
    thanks
    Prasanna

  • Project Commitment Cost not visible for Purchase Orders with Item Categry Q

    Hello All
    I have a problem. My project commitment cost is not visible for PO's with Item Category Q. I assume that as the stock can be issued against any WBS elements I might not be able to see the cost against a single WBS element. But the cost should get recorded against the project right? If so where can I see it?
    Request your help with this problem
    Regards
    Renjith

    Hello
    Could you please explain how to maintain that?
    Best Regards
    Renjith

  • Multiple purchase orders with items in one IDOC

    Hello Team
    Now i got a the below requirement. please check and suggest me accordingly.
    1. In my souce system (ie legacy system) i have  a table which is having PO related header and item data. now i need to post that data into SAP by using IDOC. so now i need to create a IDOC in middleware system with PO related data. Here my question is for how many POs i can create 1 idoc, i mean i want to know what is the maximum PO's i can put in 1 IDOC. parallely i want to see the performance issue also. so please suggest me on what is the maximum no of POs with item data i can put in 1 idoc and suggest me what is the preffered limit based on performance issues.
    2. Suppose if i put 10 POs in 1 idoc, out of which there is issue with PO data for 1 PO in that idoc. so i want to know whether the idoc will process or not. if process how many PO's it will process. is it like 9 POs it will process and 1 PO it wont process. please clarify.
    Regards
    Raj

    Hi Nagaraju,
    As others suggested you can use 1 idoc per po. So for each header and its items in XI a message will be created.
    Else
    With select statement you can select all the POs and change the occurrence of idoc from 1..1 to 1..unbounded. Now also one message will be created in xi, (within the message you will have multiple idocs) but when posting in sap each one post as a seperate idoc. Here the advantage is you have one message where as in another you have multiple messages. But the disadvantage is trouble shooting might have some issues and if it is more than 1000 idocs the performance may take a hit. Here 1000 is just an example.
    Regards,
    ---Satish

  • QN reference to purchase order with item task

    Intention: Wanted to run a report to have the following information:
    - QN number
    - Item task
    - Reference document: Purchase order
    Is there any way to run such report? Have tried QM13 but it does not contains purchase order

    SAP has provided two type of report for QN.
    one at header level (QM11) & second is item level (QM13).
    QM11  contain Ref. document & PO number but not task information. QM13 contain task info but not PO number.
    SO to fulfill your req. go with custom one. copy QM13 & add PO number & other header info if required.
    Hope this help.
    Thanks!!!

  • Third-party Purchase Order with Item Cat. : S

    Hi,
      I want to know about third party Po ? is there any customization required for this type of PO,  what are the cases wehe we can use the Third party PO  what is main difference between Normal PO and Po with Thiedt part Item category.
    regards,
      zafar

    Dear,
    You dont need to have any specific config only need to mainatin in Material Master view for ITEM CATEGORY GROUP sa BANC, which will propose ITEM CATEGORY in Sales Order as TAS,which automatically generate a Purchse No. and against this purchase requsition u will create P.O. and will do MIRO and after MIRO u can bill this to customer and it will be ORDER RELATED BILLING as in Third party once u raise the P.O. the vendor deliver goods directly to ur Customer against P.O..
    Futher need clarification revert back to me.
    Regards
    AJIT K SINGH
    HAPPY TO HELP U

  • Purchase requisitions with item category "consigment" in transaction MD04.

    Hi,
    I need to configure the system in order to create purchase requisitions where every item category should be "consignment" when executing transaction MD04. What should I do?
    Thanks in advance,
    Luis.

    hi Might
    hope this may help u in some regard
    in MD04 go to collective acess and choose special procurement as consignment and then excute  and remove the setting from set up lists in background

  • Inputs or tables required for customizing purchase register

    Hi,
          I have encountered a problem regarding Purchase Register.
    The requirement of the Client is that, he wants to have the Tax Details populated in the Purchase Register with reference to Tax Code in the Invoice Screen.
    This should happen, once the Client enters the Details related to Invoice Document in the Selection Screen.
    I searched for Table and Field related to Tax code.
    I found the Field for Tax Code and it is MWSKZ.
    But, the Table is a Structure.
    So, please guide me how to find the link so as to fetch the Tax Details with respect to Tax Code in the Invoice Screen?
    Please reply as soon as possible.
    Waiting for your responsw,
    Thanks in advance.
    Thanks & Regards
    Srinivasa M.S
    +91-9910077829
    Edited by: Jeyakanthan A on Jul 4, 2011 4:36 PM

    hi
    Logic For tax register
    Table
    EKBE
    1)     BELNR=MATERIAL DOC= HERE MOVEMENT TYPE  BWART=101
    2) GJAHR=MATERIAL DOC YEAR=2011
           3) BUZEI=ITEM OF MATERIAL DOC=1 and 2
        4)  BUDAT=posting date of material doc=28.2.2011
       5) MENGE=GRN QTY=1 FOR LINE ITEM 1,1 FOR LINE ITEM 2
    FOR ABOVE COMBINATION IN TABLE EKBE
    WE WILL GET FOLLOWING FIELDS
    1)     Po number= =EBELN
    2)     Po line item=10 and 20=EBELP
    TABLE
    EKPO
    NOW PASS THIS FIELD EBELN AND EBELP INTO TABLE EKPO AND GET FOLLOWING FIELDS
    1)     MATERIAL CODE=MATNR
    2)     MATERIAL DICRIPTION=EMATN
    3)     MATERIAL GROUP=MATKL
    4)     ITEM CATEGORY=PSTYP
    5)     ACCOUNT ASSIGEMENT=KNTTP
    6)     TAX CODE=MWSKZ
    7)     PLANT=WERS
    8)     COMPANY CODE=BUKRS
    TABLE
    EKKO
    NOW PASS EBELN FROM EKPO INTO TABLE EKKO AND GET FOLLOWINGS
    1)     VENDOR CODE=LIFNR
    2)     PURCHASING GROUP=EKGRP
    TABLE
    LFA1
    NOW PASS LIFNR FROM TABLE EKKO INTO TABLE LFA1 AND GET FOLLOWINGS
    1)     VENDOR NAME=NAME1
    2)     CITY=ORT01
    TABLE
    MSEG
    NOW PASS  MATERIAL DOCBELNR=
    MATERIAL DOC YEAR=GJAHR=2011
    MATERIAL DOC ITEM= BUZEI=1 AND 2
    PO NUMBER =EBELN=
    PO ITEM NUMBER=EBELP=10 AND 20
    ALL FROM TABLE EKBE AND GET FOLLOWING FIELDS
    1)     PROFIT CENTER=PRCTR
    2)     WBS ELEMNT=PS_PSP+PNR
    TABLE
    RSEG
    PASS FROM TABLE EKPO
    PO NUMBER =EBELN
    PO ITEM =EBELP
    INTO TBALE RSEG AND GET FOLLOWING FIELDS
    1)     INVOICE DOC NUMBER=BELNR=
    2)     FISCAL YEAR=GJAHR=2010
    3)     INVOICE ITEM=BUZEI
    4)     VALUVATION CLASS=BKLAS=7900
    5)     REFERNCE =XBLNR=156
    TABLE
    T025T
    PASS VALUVATION CALSS FROM TABLE RSEG INTO TABLE T025T ,USE LANUAGE KEY EN AND GET  FOLLOWINGFIELD
    1)     VALUVATION CALSS DISCRIPTION=BKBEZ=SEMIFINISH PRODUCT
    TABLE
    BKPF
    NOW PASS BELNR+GHJAR ( 51056016262010) ,FIELD AWKEY OF TABLE BKPF
    FISCAL YEAR=GHJAR INTO TABLE BKPF FROM TABLE RSEG AND GET FOLLOWING FIELDS
    1)     FI DOC NUMBER=5100001482
    2)     FISCAL YEAR=GHJAR=2010
    3)     DOC TYPE=BLART=RE
    4)     DOC DATE=BLDAT=23.2.2011
    5)     POSTING DATE=BUDAT=28.2.2011
    6)     TRASNCTION CODE=TCODE=MIRO
    7)     REFERNCE=XBELNR=156
    TABLE
    BSET
    NOW PASS
    FI DOC NUMBER=BELNR
    FISCAL YEAR=GHJAR=2010
    AND GET FOLLOWING VALUES
    1)     CONDITION TYPE =KSCHL
    A)     VAT=JVRD=12127.29
    B)     JVRN=CST
    C)     SERVICE TAX=JSRT
    D)      ECESS ON SERVICE=JEC3
    E)     HECESS ON SERVICE=JES3
    HERE APPLY LOGIC TAXPS FIELD =1=ONE LINE ITEM FOR BELNR
    Table
    BSAK
    NOW PASS BELNR,GHJAR ,BEART FROM TABLE BKPF AND VENDOR NUMBER LIFNR FROM TABLE  EKKO
    AND PASS THIS INTO TABLE BSAK
    AND GET FOLLOWING FIELDS
    1)     CLEARING DOC NUMBER=AUGBAL
    2)     CLEARING DATE=AUGDT
    I)Logic For excise values flow
    B.E.D,=
    A.E.D=
    S.E.D. =
    ECESS=
    HECESS=
    Pass GRN number From EKBE field MBLNR ,material doc year= MJAHR ,AND BUZEI=ITEM OF MATERIAL DOC=1 and 2
    into table J_1IPART1 and get
    Following
    a)     Excise group=field EXGRP=30
    b)     EXCISE REGISTER TYPE=REGTYP=A
    c)     INTERNAL DOC NUMBER=DOCNO=8100000013
    d)     Year=DOCYR=2011
    e)     ITEM=ZEILE
    TABLE
    J_1IEXCDTL       
    PASS DOCNO, EXGRP, RGTYP,DOCYR,ZEILE  INTO TABLE J_1IEXCDTL        AND GET values
    B.E.D, =field EXBED =8772
    A.E.D=field EXAED
    S.E.D. =field EXSED
    ECESS=field ECS=175.44
    HECESS=field EXADDTAX1=87.72
    TABLE J_1IEXCHDR
    NOW PASS EXGRP AND DOCNO,DOCYR FROM TABLE J_1IPART2  AND VENDOR CODE LIFNR FROM TABLE EKKO INTO TABLE J_1IEXCHDR AND GET FOLLOWING VALUES
    VENDOR ECC NUMBER=EXCCD
    CST NNUMBER=CST NO
    TABLE
    J_1IMTCHID
    CHAPTER ID LOGIC FOR MATERIAL
    From table EKPO
    Pass material number=MATNER and Plant=WERS into table J_1IMTCHID and get following field
    Chapter id=J_1ICHID
    Selection parameter for tax registers
    1)     Company code( mandatory)
    2)     Plant
    3)     Fi doc fiscal year( mandatory=GHJAR)
    4)     Fi doc posting date( mandatory=BUDAT from table BKPF)
    5)     Doc type from table BKPF( Mandatory field BLART)
    6)     Excise group
    7)     Vendor number
    8)     Fi doc number ( BELNR FROM TABLE BKPF)
    9)     Purchasing group
    10)     Material doc =BELNR from ekbe
    11)     Tax code
    HERE
    FISCAL YEAR=2010
    FI DOC PSOTING DATE=28.2.2011
    FI DOC TYPE =BLART=RE
    COMPANY CODE=
    Regards
    kailas
    Edited by: kailasugale on Jul 4, 2011 5:47 PM

  • Create a variant for Purchase register

    Hi,
    while implementing MM& CIN for my client, created one T.code YDOM ( customized T.code) for purchase register.
    with YDOM t.code users can see the purchase register reports. but some entries are not showing values.
    user is asking why some entries not showing any value?
    with the help of YDOM t.code, shall i create any Variant? so that remianing entries values flow correctly.
    what is the procedure  to create a variant for YDOM t.code?
    please let me know
    regards,
    obulesu

    do you mean that system is displaying the fields but values are not coming in there then variant is not the solution and you need to check with an abaper why data is not flowing there
    and if you want to change the screen layout then you are going the right way as mentioned in above thread

  • Difference MBRL - ME21N with items specified as return items

    Hi Gurus,
    can you please help me to understand the difference of these two return processes.
    We are using ECC 6.0 and want to implement a "standard" process for returning goods to the supplier if they don't meet our expectations.
    So now i have implemented the whole customizing for doing this with ME21N and now i found the transaction MBRL, wich also allows to creaty SD-Deliveries. And now i am wondering where is the difference.
    With ME21N i found one big disatvantage - i can not refere to another document, like a delivery schedule or former purchase order.
    For information i would be very grateful.
    Thanks in advance.
    Georg

    Hi Gordon,
    thanks for your reply.
    So for me it seems that ME21N (PO creation) has no advantage for returing goods to the supplier. No reference to previous document, additonal step in the process to create a PO.
    With MIGO (Return Delivery) or MBRL you can refer to another document and you can also create SD-Deliveries.
    So my question is more general - why does SAP provide the possibility to return goods within the ME21N when there is an easier and faster possibility. For me having another document (purchase order with item specified as return item) just means having additional complexity.
    But maybe I am wrong and there is an advantage i am not able to see at the moment.
    Thanks
    Georg

  • How to Create Purchase Order with Co Product greater than Consumption

    Hi All,
    I'm new to SAP. Can any one please help with the steps to create PO with Co Product greater than Consumption.
    Thanks in Advance.    

    Hi Srinivasu,
    If you are talking about handling by-products during subcontracting follow the following steps.
    Create Purchase order with item category "L". In the components tab maintain by-product in negative quantity. If you are not sure about the actual quantity, enter theoretical quantity ( Actual quantity can be adjusted in Subsequent adjustment in Goods receipt).
    Hope this helps you.
    If this has not helped you, please elaborate your requirement.
    Thanks
    Vasuki B S

Maybe you are looking for

  • How do I unlock my iPod touch when it has been disabled?

    How do I unlock my iPod touch when it has been disabled? My children can't remember the four digit pass code they entered and it is now disabled.

  • My subscriprion not working

    my user name is jaisriram81. My subscription is not working.. The message shown that will activate on 1st of Nov. now suddenly showing that will activate on 2nd of Nov.. Can u pls tel me when ll b activate.Pls help me on this issue

  • Try this in DTW (oStockTransfer) -- No data is visible

    Hi Experts, I have a problem, I want to use the DTW to import the Inventory Transfers so i have to use the oStockTransfer template provided by SAP, I have put some data in the Header and lines templates, Now when i check the source data and target da

  • Flash Player for Mac OSX 10.5.8

    I've been trying to find the right flash player to install on my mac osx 10.5.8 using safari. I can't play video on youtube or facebook because it says im missing plug-in. This issue keeps coming up. I have in the past few months uninstalled the vers

  • Using debug in console (java -debug ??)

    How can I turn on the java debug option .. to display on the screen the info about the current running application ? (I know this is an old question but I didn't found it in the search space...)