FBL5N t code and BSEG table is showing wrong contract number

Hi,
The proces flow is contract number>sales order>DMR-->Invoice
Now when I am checking the VBFA table it's showing correct contract number against invoices but FBL5N t code and BSEG table are showing wrong contract numbers.
Why FBL5N and BSEG table is showing wrong contract number?
Currently we are using one enhancement and user exit is used to incorporate one customized field as identifier for bill type.
1. During the billing document release to accounting VFX3, The user exit triggering and it is update the customized fields and Net settlement indicator.
2. Using the Invoice number, get the fields VGBEL(Document number of the reference document) and VGPOS (Item number of the reference item) from VBRP and read table VBAP with VBELN and POSNR, to get DMR number (Sales Document) that created for the Invoice.
3. Use fields VGBEL and VGPOS on table VBAP to get the sale order number.
4. By using the Sales order number, get the Distribution channel to update Net indicator field
In accounting table BSEG-UZAWE = JF must be updated on the customer line.
5. Retrieve the sale order number and item level to get customized field from table VBAP
Any pointers.
Thanks
Ashu

Hi Reazuddin,
Thanks for your reply,
I am concercerned about BSEG table and using user exit EXIT_SAPLV60B_008 to post the document in FI.
Now in we have enhanced this user exit  for contracts and included in this way.
  SELECT SINGLE ZZ_CONTRACT FROM VBAK INTO (LC_CONTRACT) WHERE VBELN EQ cvbrp-vgbel.
Endloop.
*Moving the values to final accounting table
loop at xaccit.
xaccit-vertn = lc_contract.
xaccit-VBEL2 = xaccit-AUBEL.
xaccit-xref3 = lc_vbel2.
MODIFY xaccit .
ENDLOOP.
Clear: lc_contract,lc_vgbel,lc_vgpos,lc_vbel2.
But I am getting correct data when checked other clients( development and quality), this problem I am getting in production.
Do I need to ask the ABAP'er to debug this enhancement in production?
Thanks
Ashutosh

Similar Messages

  • Link between Anep and bseg table.

    How are ANEP and BSEG table related functionally? I am using the ANBTR field from ANEP table and retrieving the HKONT(G/L account) field from BSEG. I want to ask if entry for some assete exists in ANEP table then is it necessarty to have G/L account in BSEG table corresponding to this asset in ANEP. I am joining the two tables on BUKRS, BELNR, BUZEI and GJAHR fields.

    Hi
    For BSEG you cannot inner join. Its a cluster table and u dont have option to inner join. Instead take neccessary record in BSEG with valid condition.

  • Performance issue in BI due to direct query on BKPF and BSEG tables

    Hi,
    We had a requirement that FI document number fieldshould be extracted in BI.
    Following code was written which has the correct logic but performance is bad.
    It fetched just 100 records in more than 4-5 hrs.
    The reason is there was a direct qury written on BSEG and BKPF tables(without WHERE clause).
    Is there any way to improve this code like adding GJAHR field  in where clause? I dont want to change the logic.
    Following is the code:
    WHEN '0CO_OM_CCA_9'." Data Source
        TYPES:BEGIN OF ty_bkpf,
        belnr TYPE bkpf-belnr,
        xblnr TYPE bkpf-xblnr,
        bktxt TYPE bkpf-bktxt,
        awkey TYPE bkpf-awkey,
        bukrs TYPE bkpf-bukrs,
        gjahr TYPE bkpf-gjahr,
        AWTYP TYPE bkpf-AWTYP,
        END OF ty_bkpf.
        TYPES : BEGIN OF ty_bseg1,
        lifnr TYPE bseg-lifnr,
        belnr TYPE bseg-belnr,
        bukrs TYPE bseg-bukrs,
        gjahr TYPE bseg-gjahr,
        END OF ty_bseg1.
        DATA: it_bkpf TYPE STANDARD TABLE OF ty_bkpf,
        wa_bkpf TYPE ty_bkpf,
        it_bseg1 TYPE STANDARD TABLE OF ty_bseg1,
        wa_bseg1 TYPE ty_bseg1,
        l_s_icctrcsta1 TYPE icctrcsta1.
        "Extract structure for Datasoure 0co_om_cca_9.
        DATA: l_awkey TYPE bkpf-awkey.
        DATA: l_gjahr1 TYPE gjahr.
        DATA: len TYPE i,
        l_cnt TYPE i.
        l_cnt = 10.
        tables : covp.
        data : ref_no(20).
        SELECT lifnr
        belnr
        bukrs
        gjahr
        FROM bseg
        INTO TABLE it_bseg1.
        DELETE ADJACENT DUPLICATES FROM it_bseg1 COMPARING belnr gjahr .
        SELECT belnr
        xblnr
        bktxt
        awkey
        bukrs
        gjahr
        AWTYP
        FROM bkpf
        INTO TABLE it_bkpf.
        IF sy-subrc EQ 0.
          CLEAR: l_s_icctrcsta1,
          wa_bkpf,
          l_awkey,
          wa_bseg1.
          LOOP AT c_t_data INTO l_s_icctrcsta1.
            MOVE l_s_icctrcsta1-fiscper(4) TO l_gjahr1.
          select single AWORG AWTYP INTO CORRESPONDING FIELDS OF COVP FROM COVP
          WHERE belnr = l_s_icctrcsta1-belnr.
          if sy-subrc = 0.
              if COVP-AWORG is initial.
           concatenate l_s_icctrcsta1-refbn '%' into ref_no.
                  READ TABLE it_bkpf INTO wa_bkpf WITH KEY awkey(10) =
                  l_s_icctrcsta1-refbn
                  awtyp = COVP-AWTYP
                  gjahr = l_gjahr1.
            IF sy-subrc EQ 0.
              MOVE wa_bkpf-belnr TO l_s_icctrcsta1-zzbelnr.
              MOVE wa_bkpf-xblnr TO l_s_icctrcsta1-zzxblnr.
              MOVE wa_bkpf-bktxt TO l_s_icctrcsta1-zzbktxt.
              MODIFY c_t_data FROM l_s_icctrcsta1.
              READ TABLE it_bseg1 INTO wa_bseg1
              WITH KEY
              belnr = wa_bkpf-belnr
              bukrs = wa_bkpf-bukrs
              gjahr = wa_bkpf-gjahr.
              IF sy-subrc EQ 0.
                MOVE wa_bseg1-lifnr TO l_s_icctrcsta1-lifnr.
                MODIFY c_t_data FROM l_s_icctrcsta1.
                CLEAR: l_s_icctrcsta1,
                wa_bseg1,
                l_gjahr1.
              ENDIF.
            ENDIF.
                ELSE. " IF AWORG IS NOT BLANK -
                concatenate l_s_icctrcsta1-refbn COVP-AWORG into ref_no.
                READ TABLE it_bkpf INTO wa_bkpf WITH KEY awkey(20) =
                ref_no
                awtyp = COVP-AWTYP
                gjahr = l_gjahr1.
            IF sy-subrc EQ 0.
              MOVE wa_bkpf-belnr TO l_s_icctrcsta1-zzbelnr.
              MOVE wa_bkpf-xblnr TO l_s_icctrcsta1-zzxblnr.
              MOVE wa_bkpf-bktxt TO l_s_icctrcsta1-zzbktxt.
              MODIFY c_t_data FROM l_s_icctrcsta1.
              READ TABLE it_bseg1 INTO wa_bseg1
              WITH KEY
              belnr = wa_bkpf-belnr
              bukrs = wa_bkpf-bukrs
              gjahr = wa_bkpf-gjahr.
              IF sy-subrc EQ 0.
                MOVE wa_bseg1-lifnr TO l_s_icctrcsta1-lifnr.
                MODIFY c_t_data FROM l_s_icctrcsta1.
                CLEAR: l_s_icctrcsta1,
                wa_bseg1,
                l_gjahr1.
              ENDIF.
            ENDIF.
               endif.
          endif.
            CLEAR: l_s_icctrcsta1.
            CLEAR: COVP, REF_NO.
          ENDLOOP.
        ENDIF.

    Hello Amruta,
    I was just looking at your coding:
    LOOP AT c_t_data INTO l_s_icctrcsta1.
    MOVE l_s_icctrcsta1-fiscper(4) TO l_gjahr1.
    select single AWORG AWTYP INTO CORRESPONDING FIELDS OF COVP FROM COVP
    WHERE belnr = l_s_icctrcsta1-belnr.
    if sy-subrc = 0.
    if COVP-AWORG is initial.
    concatenate l_s_icctrcsta1-refbn '%' into ref_no.
    READ TABLE it_bkpf INTO wa_bkpf WITH KEY awkey(10) =
    l_s_icctrcsta1-refbn
    awtyp = COVP-AWTYP
    gjahr = l_gjahr1.
    Here you are interested in those BKPF records that are related to the contents of c_t_data internal table.
    I guess that this table does not contain millions of entries. Am I right?
    If yes, the the first step would be to pre-select COVP entries:
    select BELNR AWORG AWTYP into lt_covp from COVP
    for all entries in c_t_data
    where belnr = c_t_data-belnr.
    sort lt_covp by belnr.
    Once having this data ready, you build an internal table for BKPF selection:
    LOOP AT c_t_data INTO l_s_icctrcsta1.
      clear ls_bkpf_sel.
      ls_bkpf_sel-awkey(10) = l_s_icctrcsta1-refbn.
      read table lt_covp with key belnr = l_s_icctrcsta1-belnr binary search.
      if sy-subrc = 0.
        ls_bkpf_sel-awtyp = lt_covp-awtyp.
      endif.
      ls_bkpf_sel-gjahr = l_s_icctrcsta1-fiscper(4).
      insert ls_bkpf_sel into table lt_bkpf_sel.
    ENDLOOP.
    Now you have all necessary info to read BKPF:
    SELECT
    belnr
    xblnr
    bktxt
    awkey
    bukrs
    gjahr
    AWTYP
    FROM bkpf
    INTO TABLE it_bkpf
    for all entries in lt_bkpf_sel
    WHERE
      awkey = lt_bkpf_sel-awkey and
      awtyp = lt_bkpf_sel-awtype and
      gjahr = lt_bkpf_sel-gjahr.
    Then you can access BSEG with the bukrs, belnr and gjahr from the selected BKPF entries. This will be fast.
    Moreover I would even try to make a join on DB level. But first try this solution.
    Regards,
      Yuri

  • Code and core tables in different schemas

    Hi,
    My db version : Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    I would like to understand, the pros and cons of the following situation:
    We have a single application.
    The db design for this application has 44 tables out of which 28 are core tables related by PK and FK relationships. The remaining 16 are look up and reference tables which are not related to any.
    The team decided to place the 28 core tables in one schema A and the remaining 16 in another schema B within same database. (The reason for this is..since it is done in other projects lets do it here too).
    Now comming to the code (stored procs, functions, packages etc). The teams wants to place most of the code in the schema B that has the 16 ref tables. (the reason again being the same).
    What are the pros and cons doing this???
    Please advice.
    PS:
    I have googled and found sth on these lines:
    cons: 
    o harder to manage
    o harder to upgrade
    o harder to patch
    o harder to maintain
    o causes your shared pool size to increase 1,000 times (shared sql goes down the tubes)
    o takes more space
    o queries against the dictionary will be impacted
    o latching on the shared pool goes WAY up (latching = locks = serialization device =
    slows you down)
    pros:
    o none that I can think of.

    >
    I would like to understand, the pros and cons of the following situation:
    Yes I am straining to find more points (was not good at it though).
    >
    You just want to understand? Are you sure? Your thread reads more like you just want to do things your way and are looking for support.
    >
    The team decided to place the 28 core tables in one schema A and the remaining 16 in another schema B within same database. (The reason for this is..since it is done in other projects lets do it here too).
    Now comming to the code (stored procs, functions, packages etc). The teams wants to place most of the code in the schema B that has the 16 ref tables. (the reason again being the same).
    >
    My question to you is: what PROBLEM are you trying to solve? If the 'team' already uses this approach and there haven't been any substantive problems then why try to change things now? Why have you chosen to fight this battle?
    Your 'team' has already decided and now, after that decision, you want to argue about it with them? The time to present arguments for/against a given plan is BEFORE the decisions are made, not after. Once a decision is made you need to be a team player and implement that decision to the best of your ability.
    One thing I'm certain of. If you try to support your argument using things like that 'AskTom' link you posted any credibility you had will go out the window. That link, as you already hinted yourself, is not your use case at all. All it takes is for one of your 'team' members to point that out and everyone will pretty much stop listening to any other arguments you make.
    People are generally not going to 'change their ways' unless you can show them:
    a) there is something seriously wrong with the way they are now doing things or
    b) a new way of doing things provides some substantial benefits
    Choice 'a' above is where you need to start but you haven't provided ANY information in this post that you have identified any serious issues with the status quo.
    The main task for Oracle is to be able to FIND the objects being referenced. So, in my opinion, that is what you should focus on when looking for PRO/CON arguments.
    That is: What issues are there if an object being referenced is in a different schema than the session that needs to use the object?
    1. objects may need to be prefixed with the schema name
    2. public or private synonyms may need to be created/maintained to avoid having to deal with item #1 above
    3. new grants may be needed to implement/maintain the proper security
    4. new roles may need to be created to maintain proper security (see item #3 above)
    5. additional work will be needed to maintain the new roles in item #4 above
    6. PL/SQL code may not be able to reference the object or may reference the wrong object
    7. Roles are disabled in PL/SQL (see item #6 above) - this means that the new grants (see item #3) may need to be granted directly to the schema users that need access instead of to roles. That can make it harder to create and maintain a role-base security schema.
    If I were you I would spend my time on other more important thingsd. But if I chose to fight this particular battle then I would make a list of problems that occured in the past with the current method of doing things and also problems related to the above list of items and then show how many of those problems will 'disappear' if the new method is used.

  • Fetching data slow from MSEG and BSEG table

    Dear Experts,
    Out  MSEG and BSEG are major tables which are very slow and taking 5-10 minutes in fetching just 20/30 records.
    Why this table taking more time and how I can fatch fast  data from these table.
    regards

    > Out  MSEG and BSEG are major tables which are very slow and taking 5-10 minutes in fetching just 20/30 records.
    > Why this table taking more time and how I can fatch fast  data from these table.
    Do you select on key fields or on indexed fields? How do you select?
    If not, then the database must read the full table and check which of the entries are valid for your selection.
    Do an SQL trace using ST05, run the command, stop the trace and check the explain.
    Markus

  • Tax Code and amount is not showing in one AR invoice print

    Hi Folks,
    When I print AR invoice # 444 the VAT amount appears on the invoice. however when I print AR invoice 555 the VAT amount does not appear on the invoice.
    What determines whether or not the tax code and amount will appear on the invoice? Is there something in the invoice template that determines this?
    Could any expert help me in this, please? BTW, we are in 11.5.10.2 ver.
    Thanks in advance.

    Hi,
    Check whether the recipient type CO or OT is updated in With_item table for the line items that are missing in J1INCHLN.
    If Recipient type is not maintained in vendor master, at the time of posting the entry, then it does not get picked up in J1INCHLN. Even if you maintain in Vendor master later on, the With_item table does not get updated. This is one of the reasons why the line items does not get picked up in J1INCHLN. Check this, as you are confirming that Business Place, Section code etc.. are all present in line items and also that it is appearing correctly in With_item table.
    Regards,
    SAPFICO

  • Payment means shows wrong check number

    Dear All,
    Once we have added an outgoing payment and go back to the payment means window, it shows the wrong check number and not the one initially entered. Please advice on why this is occuring and how to solve this problem.
    Kind Regards,
    Monil.

    Hi,
    Can you please update us with the following information :
    1) When in the Payment Means in the Outgoing Payment, the Check number was selected to be Manual or to be taken from the House Bank account? As if the check number is manually selected, only then the option to enter a Check number is available.
    2) If the Manual Check number is entered, then please confirm whether the Print of the Payment was tried or not?
    Kind Regards,
    Jitin
    SAP Business One Forum Team

  • Source of supply in SC shows wrong contracts when changing cocode

    Hi experts,
    Some details:
    We are on an SRM 5.0 implementation, in classic scenario.
    We have a problem when using source of supply in a shopping cart.
    When we select a certain product and let the system suggest a source of supply, it gives us a list of contracts. However, when we change the company code, we would expect that these same contracts would not be visible anymore (as the R/3 contract has a company code). Even after refreshing, the system keeps giving wrong contracts.
    Any suggestions?
    Best Regards,
    Tom

    Hi. Are these backend contracts and do your contracts have plants on?
    I have a feeling that SRM only uses Plant, Unit of Measure and Material group to calculate if a backend contract is valid.
    If your contracts have no plants that might explain it.
    BADI BBP_SOS_BADI should allow you to restrict on custom criterea though.
    Regards,
    Dave.

  • Table Space showing wrong data in ST04

    Hi All,
    We have oracle 10.2.0.4 installed and SAP SRM with latest kernel.
    When i login to SAP and check tablespace in st04 / DB02 it is showing PSAPSR3 TAble space auto extend as on, but i have deactivated the auto extend in all the table space.
    And for the same thing in DB check it is showing as CRITICAL_TABLESPACE having auto extend on as warning.
    Please let me know as it is creating problem in daily monitoring of the system
    Thanks & Regards,
    Balaji.S

    Can you once again check the value for max_extn for those table space?
    This error by brconnect is checked by calculating max_extn.
    You can also check Note 849484 - New CRITICAL_TABLESPACE check condition in BRCONNECT
    Thanks and Regards
    Anindya

  • VA01 and from material view and last SO it shows wrong last sales price

    Hi,
    In sales order condtions the current flow is as follows:
    sales price PR00 - 8.36
    insurance ZZC0 - 0.03
    So the total value is 8.39 inr.
    But the client requirement is, the total value should be 8.36 only.  Insurance value should not add to the net price, but it should display in sales order condtions.
    we can do the pricing as statistical in pricing procedure for insurance.  But  client is not accepting for that.
    please letme know is there any other alternative way to get the required solution.
    look forward for your answers.
    thanks in anticipation.
    br,
    Hari.
    Moderator message: not directly related to ABAP development, please post again in the appropriate functional forum.(ERP SD?)
    Edited by: Thomas Zloch on Jul 13, 2010 2:43 PM

    When you use the query as a formatted search with auto refresh the query will Populate the Value of the first column from the first row of the query result.  Therefore the user will not see the last 2 prices for which the SELECT statement was created.
    To see the last 2 prices the user has to manually press ShiftF2 which is the same effort as CTRLTab.
    Writing a simple SQL is easy but it is important to educate the client with the benefits of using out of the box functionality when one already exists
    -Suda

  • IPod showing wrong podcast number

    In iTunes (Windows), when I go to my iPod (Shuffle 4th generation), switch to "Podcasts" and tick "Sync Podcasts" with the default settings "Automatically include all episodes of all podcasts", it says "1 episode" on the right of "Sync Podcasts", though my iTunes Library says that I don't have any podcasts (which is right). After syncing, "On this iPod" shows no Podcasts too. Could anyone tell me how to correct this?

    Just go to Settings > Store > and Sign Out.
    Then if you want to buy an app it will ask for you ID

  • Facetime is showing wrong phone number

    Hi,
    I got a new iphone a few months ago, and got my old number transferred over - but I have just noticed that when I look in the setting's - the number that can receive facetimes is the old number that came with the phone, not the new number that was moved over.
    How can I change this so that I can receive FT's on my new number? It won't let me add another phone number to the settings as I already have my workphone attached to my apple id.
    Thanks!

    iOS and OS X: Link your phone number and Apple ID for use with FaceTime and iMessage - Apple Support

  • HT204053 You can be reached by iMessage is showing wrong phone number

    My iMessage phone number is wrong on my phone

    Hi,
    You have posted in Mavericks (the previous Mac OS X) forum whilst only listing iOS items.
    On the iPhone in Settings > Messages > Send and Receive the phone number is greyed out.
    It should be ticked.
    However I have had two occasions when the tick disappeared.
    The remedy is to removes the Apple ID option
    Set the phone to Airplane Mode to break with the Servers. (for a few mins)
    On going back to the settings wait until the iPhone Number is verified.
    Test an iMessages by sending it to the Apple ID.
    If this works add back the Apple ID.
    Any Mac that you have using iMessages in that version of Messages will get a pop up about the details the iPhone is using.
    Accept this again.
    The Using iPhone Forum is here Using iPhone
    9:00 PM      Friday; December 5, 2014
    ​  iMac 2.5Ghz i5 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • Mail Showing Wrong Uncount Number

    It says I have 3 messages and 23 unread.

    That's not the right attitude and will never have a success. If Apple wants to better their products, they can easily sacrifice the salary of one, or even many guys, who will scroll Apple's forums in particular, but also the net in general, looking for reported bugs and forward them to development. I myself, as a customer should not be burdened with the inconvenience of reporting to the "mighty one" without a sole acknowledgment on top of having to live with countless bugs, that should have not been there to begin with. And frankly not only me, but most of users are way too busy with their own problems, to spend precious time chasing king Apple. Apple is not god and will never be! Just a lousy, self absorbed, profit seeking corporation. Mark my words - soon, very soon all those misconceptions will be revised through force in the heads of the people. Time has come for a fundamental change of all known understanding to date!

  • Incorrect cont. number in FBL5N and BSEG

    Hi Friends,
    I hve created contract>sales order->Debit memo request>Invoice.
    Now ; Invoices were created correctly and all SD tables look right. The issue is after creating Invoice in SD while creating FI document the FI table BSEG is updated with wrong contract number and FBL5N  t code is also showing wrong contract number?
    Currently we are using one enhancement  and user exit is used to incorporate one customized field as identifier for bill type.
    1.     During the billing document release to accounting VFX3, The user exit triggering and it is  update the customized fields  and Net settlement indicator.
    2.     Using the Invoice number, get the fields VGBEL(Document number of the reference document) and VGPOS (Item number of the reference item) from VBRP and read table VBAP with VBELN and POSNR, to get DMR number  (Sales Document) that created for the Invoice.
    3.     Use fields VGBEL and VGPOS on table VBAP to get the sale order number.
    4.     By using the Sales order number, get the Distribution channel to update Net indicator field
          In accounting table BSEG-UZAWE = JF must be updated on the customer line.
    5.     Retrieve the sale order number and item level to get customized field from table VBAP
    What may be the reason and how can I overcome it
    Any pointers
    Thanks
    Ashu
    Edited by: ashutosh p on Dec 3, 2009 4:51 AM

    closed

Maybe you are looking for