Update Purchase Order number.(Link GL to PO)

Hi all,
Currently i am using the below query for one of our report(R12). However there is a need to update Purchase Order Number .Could anyone please help on how to link GL to PO and provide the updated query.The query is as follows.
SELECT gjl.je_line_num,
    gjl.code_combination_id,
    SUM(NVL(GJL.accounted_dr, 0))                                     AS Accounted_DR,
    SUM(NVL(GJL.accounted_cr, 0))                                     AS Accounted_CR,
    ( SUM(NVL(GJL.accounted_dr, 0)) - SUM(NVL(GJL.accounted_cr, 0)) ) AS Accounted_Balance,
    gjb.actual_flag,
    NULL     AS "Check Number",
    gjb.name AS "Batch Name",
    TO_CHAR(gjh.currency_conversion_date, 'DD-Mon-YYYY') currency_conversion_date,
    ROUND(gjh.CURRENCY_CONVERSION_RATE,4) CURRENCY_CONVERSION_RATE,
    gjh.currency_conversion_type,
    NULL                                                          AS Document_Number,
    SUM(NVL(GJL.entered_dr, 0))                                   AS Entered_DR,
    SUM(NVL(GJL.entered_cr, 0))                                   AS Entered_CR,
    ( SUM(NVL(GJL.entered_dr, 0)) - SUM(NVL(GJL.entered_cr, 0)) ) AS Entered_Balance,
    gcc.segment1
    || '.'
    || gcc.segment2
    || '.'
    || gcc.segment3
    || '.'
    || gcc.segment4
    || '.'
    ||gcc.segment5
    || '.'
    || gcc.segment6
    || '.'
    || gcc.segment7
    || '.'
    || gcc.segment8 "Account Code",
    gl.currency_code AS "Ledger Currency",
    gjh.name         AS "Header Name",
    gjl.description  AS "Journal Line Description",
    NULL             AS party_name,
    NULL             AS party_id,
    GJH.period_name,
    TO_CHAR(gjh.POSTED_DATE, 'DD-Mon-YYYY') POSTED_DATE,
    NULL AS "Purchase Invoice Number",
    NULL AS "AP Invoice Line Description",
    NULL AS "Sales Invoice Number",
    gcc.segment1 Company ,
    gcc.segment2 Account,
    DECODE(gcc.segment2,NULL,'',apps.gl_flexfields_pkg.get_description_sql(gcc.chart_of_accounts_id,2,gcc.segment2)) AS "Seg2 Desc",
    gcc.segment3 AS "Business Model",
    gcc.segment4 Region,
    gcc.segment5 AS "Cost Profit Center",
    gcc.segment6 AS "Product Group",
    gcc.segment7 AS "Related Company",
    gcc.segment8 AS "Reserve",
    gjl.status   AS "Journal Line Status",
    GL.name      AS "LEDGER NAME",
    GJH.currency_code,
    GJH.je_category je_cat_f,
    GJCT.user_je_category_name je_category,
    GJH.je_source,
    NULL AS "Sales_order" ,
    NULL AS "Purchase Order Number"
  FROM APPS.gl_je_headers gjh,
    APPS.gl_je_batches gjb,
    APPS.gl_ledgers gl,
    APPS.gl_je_lines gjl,
    APPS.gl_code_combinations gcc,
    (SELECT je_category_name,
      user_je_category_name
    FROM APPS.GL_JE_CATEGORIES_TL
    WHERE language='E'
    ) GJCT
  WHERE gjh.je_from_sla_flag IS NULL
  --AND gjh.EXTERNAL_REFERENCE IS NULL
  AND gjb.je_batch_id         = gjh.je_batch_id
  AND gjh.ledger_id           = gl.ledger_id
  AND gjh.je_header_id        = gjl.je_header_id
  AND gcc.code_combination_id = gjl.code_combination_id
  AND GJH.JE_CATEGORY         = GJCT.je_category_name(+)
  AND GL.name NOT IN('NL ABX RepCorp USD (EUR)')
  GROUP BY gjl.je_line_num,
    gjl.code_combination_id,
    gjb.actual_flag,
    gjb.name,
    gjh.currency_conversion_date,
    ROUND(gjh.CURRENCY_CONVERSION_RATE,4),
    gjh.currency_conversion_type,
    gcc.segment1
    || '.'
    || gcc.segment2
    || '.'
    || gcc.segment3
    || '.'
    || gcc.segment4
    || '.'
    ||gcc.segment5
    || '.'
    || gcc.segment6
    || '.'
    || gcc.segment7
    || '.'
    || gcc.segment8,
    gl.currency_code,
    gjh.name,
    gjl.description,
    gjb.je_batch_id,
    gjb.status,
    gjb.posted_date,
    gjb.description,
    gl.name,
    gjh.name,
    GJH.period_name,
    gjh.posted_date,
    gcc.segment1,
    gcc.segment2,
    gcc.segment3,
    gcc.segment4,
    gcc.segment5,
    gcc.segment6,
    gcc.segment7,
    gcc.segment8,
    GL.name,
    gjl.status,
    GJH.je_category,
    GJCT.user_je_category_name,
    GJH.je_source,
    GJH.currency_code,
    DECODE(gcc.segment2,NULL,'',apps.gl_flexfields_pkg.get_description_sql(gcc.chart_of_accounts_id,2,gcc.segment2))

Finally Resolved the problem by writing 2 exits.
one exit 'EXIT_SAPLVEDB_007'  for identify correct item in the sales order by updating the customer purchase order item number i.e., VBAP-POSEX.  if we update the POSEX field then it wont create new item instead, it will update the item which it is referring to .
2nd exit for updating the purchase order number. 
I have tried to pass the program name, screen number, field name, field value etc to bdcdata in the exit 'EXIT_SAPLVEDB_002'. but I observed that it is not going to that screen in the debugging.
when I try E1EDP02 with QUALF '044' it will update ship-to party's purchase order number.  so to update ship-to party's purchase order number it is going to that screen. 
so I have used that thing to update purchase order number in sold-to party's purchase order number.
so when it is going that screen iam changing the field name 'VBKD-BSTKD_E' to 'VBKD-BSTKD' in bdcdata.  Then it is worked.
This is the solution I found in my time.
Any way it is solved.  Hope it will be helpful for others who will get this problem.

Similar Messages

  • Update Purchase order number in Sales order item level from inbound ORDCHG iDoc

    Hi Gurus,
    I want to update purchase order number from the iDoc 'ORDCHG' to sales order item level (sold to party purchase order number) i.e, VBAK-BSTKD.
    Which exit I need to use?  where to update?  Can you please help.
    Thank you in advance.
    Regards,
    San

    Finally Resolved the problem by writing 2 exits.
    one exit 'EXIT_SAPLVEDB_007'  for identify correct item in the sales order by updating the customer purchase order item number i.e., VBAP-POSEX.  if we update the POSEX field then it wont create new item instead, it will update the item which it is referring to .
    2nd exit for updating the purchase order number. 
    I have tried to pass the program name, screen number, field name, field value etc to bdcdata in the exit 'EXIT_SAPLVEDB_002'. but I observed that it is not going to that screen in the debugging.
    when I try E1EDP02 with QUALF '044' it will update ship-to party's purchase order number.  so to update ship-to party's purchase order number it is going to that screen. 
    so I have used that thing to update purchase order number in sold-to party's purchase order number.
    so when it is going that screen iam changing the field name 'VBKD-BSTKD_E' to 'VBKD-BSTKD' in bdcdata.  Then it is worked.
    This is the solution I found in my time.
    Any way it is solved.  Hope it will be helpful for others who will get this problem.

  • Purchase order number not update in purchase requisition status tab

    Purchase order is created for purchase requisition. The purchase requisition is triggered through process order. When I checked purchase requisition details in ME53N status tab, status is not edited and purchase order number also not present.
    Kindly let me know the possible reason for this.
    Appreciate your help..
    Thanks,
    SAP PQ

    If the PO had been created without reference to the PR, it will not be updated in the PR.
    If it has been created with reference to the PR, then the PR number gets updated in the PR status.

  • Updating Purchase Order data in VBKD table

    Hello,
    We are trying to update Purchase order data in VBKD table for Sales Order at Item level. When sales Order is created, VBKD has a default record with VBELN = 'sales order number' and Item = '00000'. We want to update BSTKD_E field with Purchase order number for VBELN= 'sales order number' and Item = '00010'.
    We wrote our logic in USEREXIT_SAVE_DOCUMENT_PREPARE and USEREXIT_MOVE_FIELDS_TO_VBKD in MV50AFZZ to append new entries in XVBKD with VBELN= 'sales order number' and Item = '00010'. But in this case Sales order is not created with UPDATE TERMINATED message. We are not sure if we can append a new record in XVBKD.
            wa_xvbkd = xvbkd.
            wa_xvbkd-posnr = wa_xvbap-posnr.  "00010
            wa_xvbkd-bstkd_e = vbkd-bstkd.   "PO no
            wa_xvbkd-posex_e = wa_xvbap-posnr. "Purch. order item no
            wa_xvbkd-updkz = C_I.
            APPEND wa_xvbkd TO xvbkd.
            CLEAR wa_xvbkd.
    Please advice the suitable way to have a Purchase Order item level data in Sales Order.
    Thanks
    Rohit

    Hi,
    You can try these FM to update info record.
    ME_DB_UPDATE_INFORECORDS
    ME_UPDATE_INFORECORD
    ME_UPDATE_INFORECORD_COND
    ME_UPDATE_INFORECORD_PD
    Check the sample code on BAPI_PO_CHANGE
    http://www.sap-img.com/abap/sample-abap-code-on-bapi-po-change.htm
    Regards,
    Shiva Kumar

  • Problem in Shipment purchase order number

    Hello Experts,
    At time of shipment count number(VI02), purchase order and service entry is created automatically. But whenever created new shipment count same purchase order number is updated ie sequentially not taking, but service entry has not problem.
    Pls tell why this problem is occured.

    Hi,
    It depends on customizing settings for the PO for shipment costing. You can set a period for validity of the PO. In standard it is set to a month (I believe). It will split up per forwarding agent.
    Quote of help.sap:
    The purchase order can be valid for the following periods:
    Day
    Week
    Month
    In Customizing the purchasing organization, the purchasing group and the plant must be assigned to the corresponding transportation planning point and the shipment cost type. You make these settings in the IMG. Choose Logistics Execution ® Transportation ® Shipment costs ® Settlement ® Assign purchasing data.
    End quote.
    MdZ

  • Can anyone give me user exit name for create/update purchase order partners

    Hello guys
      Can anyone gives me user exit name for create/update purchase order partners?
      Requirement is to insert/update partner when SC flag is checked while creating/updating purchase order (ME22N / ME21N)  by using user exit.

    hi,
    check these exits.
    Transaction Code - ME21N                    Create Purchase Order
    Enhancement/ Business Add-in            Description
    Enhancement
    MEQUERY1                                Enhancement to Document Overview ME21N/ME51N
    MEVME001                                WE default quantity calc. and over/ underdelivery tolerance
    MM06E001                                User exits for EDI inbound and outbound purchasing documents
    MM06E003                                Number range and document number
    MM06E004                                Control import data screens in purchase order
    MM06E005                                Customer fields in purchasing document
    MM06E007                                Change document for requisitions upon conversion into PO
    MM06E008                                Monitoring of contr. target value in case of release orders
    MM06E009                                Relevant texts for "Texts exist" indicator
    MM06E010                                Field selection for vendor address
    MMAL0001                                ALE source list distribution: Outbound processing
    MMAL0002                                ALE source list distribution: Inbound processing
    MMAL0003                                ALE purcasing info record distribution: Outbound processing
    MMAL0004                                ALE purchasing info record distribution: Inbound processing
    MMDA0001                                Default delivery addresses
    MMFAB001                                User exit for generation of release order
    MRFLB001                                Control Items for Contract Release Order
    MELAB001                                Gen. forecast delivery schedules: Transfer schedule implem.
    AMPL0001                                User subscreen for additional data on AMPL
    LMEDR001                                Enhancements to print program
    LMELA002                                Adopt batch no. from shipping notification when posting a GR
    LMELA010                                Inbound shipping notification: Transfer item data from IDOC
    LMEQR001                                User exit for source determination
    LMEXF001                                Conditions in Purchasing Documents Without Invoice Receipt
    LWSUS001                                Customer-Specific Source Determination in Retail
    M06B0001                                Role determination for purchase requisition release
    M06B0002                                Changes to comm. structure for purchase requisition release
    MEFLD004                                Determine earliest delivery date f. check w. GR (only PO)
    MEETA001                                Define schedule line type (backlog, immed. req., preview)
    ME590001                                Grouping of requsitions for PO split in ME59
    M06E0005                                Role determination for release of purchasing documents
    M06E0004                                Changes to communication structure for release purch. doc.
    M06B0005                                Changes to comm. structure for overall release of requisn.
    M06B0004                                Number range and document number
    M06B0003                                Number range and document number

  • Purchase order number in FBL1N

    Dear all,
    Please suggest how we can fetch purchase order number in fbl1n report even by putting sort key 014 (purchase order number) in vendor master and G/L master it is not fetching
    Thanks and Regards
    Priya

    Hello Priya,
    You should get PO number on vendor account with using FBL1N. But you must do some developments for it.
    I wrote message how can you add additional field in FBL1N before message below.
    Re: Vendor & Customers in FBL3N
    But you can update PO field on vendor line items display.
    You can skip adding field section on message which I gave you above.
    You must copy from SAMPLE_INTERFACE_00001650 to ZFI_INTERFACE_00001650 FM and some customizing for updation BTE. I specified it on message.
    Then you'll write some ABAP for PO number update in vendor line items.
    I'm giving to you some examples below.
      TABLES : bkpf, bseg.
      e_postab = i_postab.
      IF sy-tcode EQ 'FBL1N'.
        SELECT SINGLE *
          FROM bkpf
          WHERE bukrs = i_postab-bukrs
            AND belnr = i_postab-belnr
            AND gjahr = i_postab-gjahr.
        IF sy-subrc EQ 0.
          IF bkpf-awtyp EQ 'RMRP'.
            SELECT SINGLE *
              FROM bseg
              WHERE bukrs = i_postab-bukrs
                AND belnr = i_postab-belnr
                AND gjahr = i_postab-gjahr
                AND ebeln NE space.
            IF sy-subrc EQ 0.
              e_postab-ebeln = bseg-ebeln.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDIF.

  • Item number from purchase order number....

    Hi,
    How do I get the POSEX (line item number)  field for a given Purchase order number LIKP-VBELN

    Hi,
    Let me be more clear.
    I have to find item number of the underlying purchase order (POSEX).
    So based on VBELN of LIKP table I have to find POSEX from VBAP table.
    ( I guess I need to find subsequent or preceding document stuff. I am not so sure about it. And then
    based on that I go in VBAP and find POSEX )
    <b>So what is the link between LIKP and VBAP table...</b>

  • Getting delivery number by  using Purchase order number

    Hi,
      I need to get a delivery number for a perticular Purchase order number.give me the sap tables link for getting the delivery number by using the purchase order number.
    As per my knowledge,
    'Likp' for delivery number and
    'ekbe' for purchase order.how we can link these 2 tables?
    Thanks,
    suma.

    U can use the field BELNR field EKBE to link the two tables..please not that it is only valid for VGABE = 8.
    select EEBELN EEBELP EBELNR LVBELN
    into itab
    from ekbe as E inner join likp as L
    on Ebelnr = lvbeln
    where vgabe = 8
    Regards
    Anurag
    Message was edited by: Anurag Bankley

  • How to trace purchase order number with respect to Purchase requestion numb

    Hi friends,
    Can u please help me how to Trace purchase order number with respect to purchase Requetuion  number. Is there any standard report  available in R/3

    Hi Vamsi,
    Thats what!!!
    Goto SE16 - EBAN - Give PR number in the iput screen.
    In the output screen you will have to do field selection from Menu - Settings - formatlist - choose fields.
    There you choose Purchase Order.
    So the output will display for you POs for the PR that you entered.
    Regards,
    Vishal

  • Purchase order number for each postings with FBL3N

    Hello
    With tcode FBL3N, I need to get all the postings on expenses accounts. Additionally it is possible to get more information on the postings from the orginal paper invoice. It shall be also more convenient to get the purchase order number walk trhough SAP with it. Then is it possible to get the purchase order number for each postings with FBL3N?
    thanks for inputs
    sb

    Hello,
    Could you please add field BSEG-EBELN as a special field in FBL3N (from
    menu path Settings -> Special fields).
    Then, select the Purchase order field again from "Change Layout"
    (Ctrl+F8). Now this field is available for display variants, it has the
    technical name 1-U_EBELN and the description 'Purchase Document'.
    The other field has the same description but as technical name
    '1-EBELN'. When you create a display variant be aware that you select
    1-U_EBELN and not 1-EBELN.
    *******Please also refer to attached notes 215798 and 984305.
    Best regards, Hana

  • CREATION OF SET FOR PURCHASE ORDER NUMBER

    Dear Sirs,
    I want to create a basic set containing all purchase order number, even though i am using table MSEG and field EBELN, i am not getting and values in it. how to create a basic set containing all the available PO numbers, which can be used in FI validation.
    Give me the full setting to create a above mentioned set.
    Thanks and Regards

    i didn't get what u are saying please elobrate. let me put forth my issue clearly.
    my client want to check where there is any PO available are not, for payments exceeding 1,00,000/-
    So i am cofiguring a validation, for which i want to keep the  "set of PO numbers" in "CHECK" part of the validation. which i am unable to do. when ever i try to select the set it is saying no valid object found.
    SO please help me with ur expert knowledge in this regards
    Thanks & Regards

  • How to provide relation b/w sales order number &  purchase order number

    hi.....
    i created one report  based on sales order number and displayed by alv grid then by selecting one sales record  using bdc i created purchase order number ,then i have to display that purchase order in alv again,hoe to provide relation b/w sales order and purchase order

    This is what VA05 Does
    SELECT bstkd 
                   vbeln  "Sale order Number
                   posnr
              FROM m_vmvaa
              INTO TABLE i_m_vmvaa
              FOR ALL ENTRIES IN i_bstkd
              WHERE bstkd = i_bstkd-bstkd.   "Your PO Number

  • Goods Receipt Screen: Purchase Order number stored

    Hi all.
    SRM 4.0, server 5.5.
    When going into the Goods Receipt screen (BBPCF02 for example), the field Purchase Order Number is pre-filled with the latest PO, that a user has searched for. How could I make sure, that this screen is not filled out with the latest PO but just let the screen display the open POs from within the timeframe? I have too many users that have made a GR, return to the GR screen and then their previous PO number is stored, and they believe they still have not made the GR for that PO, so they do it again. I need to make sure, that the purchase order number value is never stored in this field - any ideas?

    OMBT click on the groups button, select the
    Material documents for goods movements and inventory diffs.
    WA WE WF WH WI WL WO WQ WR WS WV WW WZ
    And then select the maintain icon, you need to maintain the number range
    for the year 2010.
    ands OMBA for accounting finance doc number range
    hope this helps

  • "In FBL5N unable to view purchase order number and the sales order number"

    Hi,
    Below mentioned is the problem we are facing,
    In the Customer Line Item Display (FBL5N) it is vital for us to be able to view the customer's purchase order number as well as the sales order number for each billing document listed by customer.
    We need to be able to extract this information for each customer and import to an excel spread sheet for analysis, specifically for our larger customers that have over 500 plus lines.
    Kindly advise how to go about the same.
    Regards
    Harish

    Dear,
    Please also check note 152335. There, you will find a more detailed            
    explanation of the issue.                                                                               
    The only way to see some information regarding related PO-es in a Vendor       
    line items is a workaround. For example, it is possible to create              
    a substitution in order to fill in one of not currently used fields            
    like Reference, Text, etc.    
    I hope this helps You.
    mauri

Maybe you are looking for

  • Sync multiple iTunes libraries on one ATV

    Is it possible to sync the itunes libraries from my two macs onto one appleTV? The libraries are unique. When I try to switch source to sync....ATV says I will replace the contents from the previous sync with the contents of the other mac.

  • PDFing Spot Colour Transparencies from Indesign CS2

    Hello!, I think this is a common question, but I can't find a definitive answer. I am trying to PDF a file which has an image and then a spot colour transparency over part of it. When I PDF the file at Press Quality the spot colour transparency is wh

  • LDAP configuration un UPM under Site fails with correct info

    After TS for hrs, we discovered that basically the LDAP (optional) configuration fails for no good reason, since we finally gave up with UPM and configured CUCM for LDAP, and it worked like a champ.           

  • How can I get a trial version of Acrobat X on Mac?

    I have downloaded an Akamai Dowload Manager but it downloads the version for Windows. Is there a version for Mac? thx

  • Default sharing login

    I have an Intel iMac i7 that acts as fileserver for our office. It's running 10.6.8. I just upgraded my Intel Macbook Pro to Lion and connecting to the iMac has become a pain. I used to click a folder from the share that I had added to my favorites a