Validate duplicated BKPF - XBLNR

Does anybody knows if there is any standard functionality in order to validate if a document already exist in the system with the same BKPF - XBLNR ? (Duplicated invoices).
I need to check that for <b><u>customer </u></b> invoices. I know that there is this functionality for vendors.
Thanks in advance
Rafa

Hi,
Good morning and greetings,
The standard SAP Process is as below for Sales & Distribution
Create a Sale Order (VA01)
Create an Outbound Delivery (VL01N)
    The system would be using Movement Type 601 (Using OBYC Customization)
    The system would pass the following accounting entry and creates a delivery
          Dr. Cost of Sales
          Cr. Inventory
Create an Invoice (VF01)
   The system will ask for the Delivery document number
   Providing the Delivery document number that was created in the above step
   The system will pass the following accounting entry (using VKOA Customizn.)
   Dr. Customer (picked up from Sales Order)
   Cr. Sales (picked up from VKOA Customization)
   Cr. Sales Tax (picked up through FTXP)
If you provide the delivery document again, the system will not bill the customer again and that is the standard check.
Please reward points if found useful
Thanking you
With kindest regards
Ramesh Padmanabhan

Similar Messages

  • ABC COPA, how to derive charateristic value from BKPF-XBLNR

    Hello,
    As we only use FI-CO modules in our SAP solution, I am implementing the ABC COPA
    I have created one characteristic (user defined, with reference to existing field - data element XBLNR1)
    When I post my invoice I want to pass the value in the BKPF-XBLNR to my characteristic.
    I used the" table lookup" to get my value for this characteristic (the only one which allows getting values from non COPA tables)
    SAP automatically suggests company code, document number and fiscal year as source fields for lookup.
    Then I assign BKPF-XBLNR to my characteristic.
    In OKB9 I have also checked the indicator "Find profitability segment using substitution" for the GL account I use for my test.
    When I enter my customer invoice in FB01, I press the "segment" button, but my characteristic is empty (unlike the profit centre characteristic which is taken over from my entry screen)
    When I execute "analyse derivation", the document number has no content (Source field contain no value) which is normal as the accounting document is not yet posted...
    I tried to post my invoice using document type with external numbering, but it doesn't work neither.
    When I save the document it automatically creates a segment with empty values.
    So how can I pass the characteristic values from the accounting document fields?
    In this example from BKPF-XBLNR?

    Hi Dawid,
    First think I would recommend you is not to attempt this step at all. Once you create FI document as a chaechteristic it will spoil the performance of your CE4 table totally. So we do not recommend to do this. The second thing is it is technically not possible to derive FI document number from SD invoice as these are two completely different tables and there are no link between them at all.
    Regards,
    Abhisek

  • Length of Reference document number (BKPF-XBLNR)

    Hello Experts,
    I have a serious problem on the length of FI reference document number (BKPF-XBLNR).
    As you know, it is 16 digits, but, we have some invoices with more than 16 digits.
    Is there any way to extend the length of this field?
    Otherwise, if someone had similar cases, please let me know how you deal with this problem. 
    Thanks in advance for your help.
    BR,
    Chris Kim
    Edited by: Chris Kim on Jun 17, 2009 12:46 AM

    Dear Gladys,
    Thank you for your update.
    I have expected not to extend this field because it is SAP standard.
    Speaking of coding block, is there any way to create new coding block for document header not line item?
    Thanks again.
    BR,
    Chris Kim

  • Reference document number BKPF-XBLNR

    Hi,
    Is BKPF-XBLNR is always a unique number? How's this field populated ?
    Thanks & regards,
    Yogita

    hi yogita,
      BKPF-XBLNR is not an unique number. for same reference doc no you can create multiple doc number.
    thanks,
    murugan.

  • Agreement Type, Reference, BKPF-XBLNR

    Hi there,
    I am busy implementing vendor rebates and I require assistance with the following:
    I would like the<b> reference field</b> (BKPF-XBLNR) found on the header when you do a good receipt in MIGO to pull through the <b>rebate agreement number</b> (KOMV-KNUMA_BO).
    How do I go about doing this?
    Regards,
    Shiyam

    Hi,
    You can only do something like this with a user exit but you have to be sure that there is enough data in MIGO to lead you to the correct agreement number. You also have to check things like the data on the info record to see if this is relevant to the agreement.
    But there is no standard way of doing this without using a mod or user exit.
    Why would you need it anyway? What are you hoping to do with this field?
    Steve B

  • Provide more than 16 characters on BKPF-XBLNR

    We have a request to make available more than 16 characters on field BKPF-XBLNR for input.
    Short to background. We are using IHC for vendor payments. The vendor payments from our affiliates are managed  on IHC. The IHC carry out all payments to external banks centrally. Some of our vendors (especially tax offices or public organizations) requested to have payment information which are longer than 16 digits. Usually the payment information are entered on the field BKPF-XBLNR and transferred via PAYEXT-IDocs into the IHC payment process.
    We found SAP notes with regards to Brasilia but all of these are not valid for us.
    Does anybody know a solution or workaround to provide more than 16 characters for payment information by use of field BKPF-XBLNR?
    Thanks
    Jakob

    If the field has only 16characters, then you really cant enter morethan 16 characters.
    If you want to do that, there are 2 options.
    1. Change the domain of that field to the number of characters you want. In this case, please note that all the fields having this domain will get changed. So you need to make an implication analysis for this and then do.This work is done by an ABAPer
    2. Make a new field in BKPF and fill that field instead of filling XBLNR. Second one is easy and without any strings attached. But it involves little bit of development.
    Also post this question in Development forum if both of these dont serve your purpose.
    Hope this helps you.
    Reward if this helps.

  • Bkpf-xblnr & bseg-rebzg

    hi all,
    may i know where does the system define or which tcode that i can see to have the billing number updated in bkpf-xblnr and bseg-rebzg after posted to fi?
    thanks
    rgds

    Dear Eliana,
    I think you should confirm the billing doc No in BSEG-VBELN.
    Best Regards,
    Gladys xing

  • Reference field (BKPF-XBLNR) not auto populate during simulation

    Hi all,
    During GL posting using t-code FB50 or FB01, I already entered value in Reference field.
    After all fields keyed-in, I choose Document - Simulate to check the entries.
    In this simulation screen, value which I entered in Reference field previously is gone.
    Anyone knows what happened? As far as i know, the value should just carry from the initial screen I entered.
    Thank you.

    Hi Dev,
    Apart from SAP note, I am thinking of using BKPF-BKTXT for storing UTR number & later on use for clearing BRS. Am not getting Int. algorithm for this field. Am doing Manual Reco by FF67.
    Am planning to use manual Int Alg. 901. I need steps to use the same. Any idea please ?
    PS: SAP note suggests us to add new field specifically for this in mother table BSEG & BSIS, which I want to avoid.
    Regards
    Message was edited by: raju M

  • Unable to update XBLNR field on BKPF when posting a document using BAPI_ACC_GL_POSTING_POST

    Hi,
    I'm trying to post a clearing document using BAPI_ACC_GL_POSTING_POST, but after posting i'm unable to see the data in the reference field on header (BKPF-XBLNR). I'm passing the data in the header structure of the BAPI  (DOCUMENTHEADER-REF_DOC_NO).
    Thanks in advance.
    Regards,
    Sandeep

    We restricted our entry to five decimals and solved the issue.

  • FV60 - validate duplicate invoices by reference and vendor number

    Hi,
    How to configure the system to validate duplicated invoice by REFERENCE AND VENDOR NUMBER irrespective of dates? This validation need in FV60.

    Hi Paul,
    if you want a duplicate invoice check from the FI side, then you may have to activate BTE 1110 by creating your own Z function module (by copying FM SAMPLE_PROCESS_00001110).
    In  FI,when checking for duplicated invoices, the system compares the following : Vendor, currency, company code, gross amount of the invoice,reference document number and Invoice document date.
    Also refer to SAP Note 305201. It clarifies this in more details.The following fields must be identical for Duplicate invoice check
    Company code (BUKRS)
    Vendor number (LIFNR)
    Currency (WAERS)
    Reference number (XBLNR)
    Amount in document currency (WRBTR)
    Document date (BLDAT)
    If the document is having any one of the above filed different then the system does not consider it as a duplicate invoice.
    In OB41, also check whether the Posting Key is defined as Sales-related. You have to flag this field if the duplicate invoice check is to work.
    Regards,
    SAPFICO

  • Duplicated entries in BSIK using Logical Database KDF

    Hello everyone,
    I'm using Logical Database KDF to retrieve some data, but i'm getting duplicated entries when getting to BSIK. Can anyone point out in my program what could i be doing wrong?
    If i put a breakpoint in the line immediatly below GET bsik, i can watch several entries being duplicated.
                                         Thanks in advance to everyone,
                                                       Nuno
    START-OF-SELECTION.
    GET lfa1.
      MOVE-CORRESPONDING lfa1 TO t_alv.
    GET lfb1.
    GET bsik.
      MOVE-CORRESPONDING bsik TO t_alv.
      CLEAR bkpf.
      SELECT SINGLE * FROM  bkpf CLIENT SPECIFIED
             WHERE  mandt  = syst-mandt
             AND    bukrs  =  bsik-bukrs
             AND    belnr  = bsik-belnr
             AND    gjahr  = bsik-gjahr.
      t_alv-xblnr = bkpf-xblnr.
      SELECT        * FROM  bset CLIENT SPECIFIED
             WHERE  mandt  = syst-mandt
             AND    bukrs  = bsik-bukrs
             AND    belnr  = bsik-belnr
             AND    gjahr  = bsik-gjahr.
         t_alv-mwskz = bset-mwskz.
          t_alv-hwbas = bset-hwbas.
          t_alv-hwste = bset-hwste.
          t_alv-dmbtr = bset-hwbas + bset-hwste.
          t_alv-stceg = lfa1-stceg.
        APPEND t_alv.
      ENDSELECT.

    Hello Nuno Centeio ,
                                      According to the table definition there can be more than one entries for a vendor based on the table key definition.
    Thanks,
    Greetson

  • 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

  • Get FI Documet number from BKPF table using CO document number in COVP tabl

    Hi,
    In  datasource 0CO_OM_CCA_9 , we have written a code in CMOD to get the FI Document Number from CO document Number.
    The flow of code is:
    1) From the CO document number, get reference document number  (REFBNfield) from, COVP table
    2) Pass this REFBN in AWKEY(10) field of BKPF table.
    3) We have created new field in datasource named 'ZBELRE' which gets populated with BELNR field obtained from BKPF table.
    This ZBELNR is the FI Document number.
    But somehow wrong FI Document number is getting populated.
    After analyzing code, we found that the AWKEY which we passed in BKPF table is incomplete and the full AWKEY is
    COVP-REFBN+COVP-AWORG
    Is this condition always remains true in all the cases? Also, is the selection criterion which we have used to find the FI document number from BKPF table is sufficient?
    Our CO Consultant says that we should also pass AWTYP along with AWKEY in BKPF table.
    Please suggest a solution.
    Following is the code :
    ***********Datasource Modification for0CO_OM_CCA_9*******************
      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,
        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.
        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
        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.
            READ TABLE it_bkpf INTO wa_bkpf WITH KEY awkey(10) =
            l_s_icctrcsta1-refbn
            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.
            CLEAR: l_s_icctrcsta1.
          ENDLOOP.
        ENDIF.
    ***End of Datasource Modification for 0CO_OM_CCA_9*******************

    Hi,
    this forum is for the SAP BusinessObjects BI Solution Architecture. Please post your question into the corresponding product forum for SPA BW
    regards
    Ingo Hilgefort

  • JOIN for BSEG, BSIS, BSAS, MSEG, BKPF and MKPF

    I am developing a report related to G/L . i am using the Tables BSEG BSIS BSAS MSEG BKPF MKPF ............please give me the Joinings of these tables.......how exactly we can join and get the prefect Data....
    Thank U waiting for ur replies....
    Title edited by: Alvaro Tejada Galindo on Jun 3, 2008 3:41 PM

    I have given the tables, internal tables and the select queries which can give you the join conditions of your requirement.
    tables: bsis,
            bsas,
            bkpf,
            bseg,
            ekbe,
            mkpf,
            mseg.
    select-options: s_hkont  for bseg-hkont,
                    s_bldat  for bkpf-budat,
                    s_budat  for bkpf-bldat obligatory,
                    s_lifnr  for bseg-lifnr,
                    s_lfbnr  for ekbe-lfbnr no intervals no-extension.
    data: begin of i_bsis_bsas occurs 0,
            bukrs like bsis-bukrs,
            hkont like bsis-hkont,
            gjahr like bsis-gjahr,
            belnr like bsis-belnr,
            budat like bsis-budat,
            bldat like bsis-bldat,
            xblnr like bsis-xblnr,
            wrbtr like bsis-wrbtr,
            buzei like bsis-buzei,
          end   of i_bsis_bsas,
          begin of i_bkpf     occurs 0,
            bukrs like bsis-bukrs,
            belnr like bsis-belnr,
            gjahr like bsis-gjahr,
            xblnr like bkpf-xblnr,
            stblg like bkpf-stblg,
            awtyp like bkpf-awtyp,
            tcode like bkpf-tcode,
          end   of i_bkpf,
          begin of i_bseg     occurs 0,
            bukrs like bsis-bukrs,
            belnr like bsis-belnr,
            gjahr like bsis-gjahr,
            buzei like bseg-buzei,
            buzid like bseg-buzid,
            koart like bseg-koart,
            zuonr like bseg-zuonr,
            hkont like bseg-hkont,
            lifnr like bseg-lifnr,
            sgtxt like bseg-sgtxt,
            ebeln like bseg-ebeln,
            ebelp like bseg-ebelp,
            wrbtr like bseg-wrbtr,
          end   of i_bseg,
          begin of i_ekbe    occurs 0,
            ebeln like ekbe-ebeln,
            ebelp like ekbe-ebelp,
            gjahr like ekbe-gjahr,
            belnr like ekbe-belnr,
            buzei like ekbe-buzei,
            lfgja like ekbe-lfgja,
            lfbnr like ekbe-lfbnr,
            lfpos like ekbe-lfpos,
            matnr like ekbe-matnr,
          end   of i_ekbe,
          begin of i_mkpf_mseg occurs 0,
            mblnr like mkpf-mblnr,
            mjahr like mkpf-mjahr,
            bktxt like mkpf-bktxt,
            xblnr like mkpf-xblnr,
            frbnr like mkpf-frbnr,
            zeile like mseg-zeile,
            matnr like mseg-matnr,
            erfmg like mseg-erfmg,
          end   of i_mkpf_mseg.
    *data: wa_ekbe like i_ekbe.
    select  bukrs
              hkont
              gjahr
              belnr
              budat
              bldat
              xblnr
              wrbtr
              buzei appending corresponding fields of table i_bsis_bsas
                    from  bsis
                    where bukrs eq p_bukrs
                      and hkont in s_hkont
                      and gjahr eq p_gjahr
                      and budat in s_budat
                      and shkzg eq 'S'.
      select  bukrs
              hkont
              gjahr
              belnr
              budat
              bldat
              xblnr
              wrbtr appending corresponding fields of table i_bsis_bsas
                    from  bsas
                    where bukrs eq p_bukrs
                      and hkont in s_hkont
                      and gjahr eq p_gjahr
                      and budat in s_budat
                      and shkzg eq 'S'.
    endform.                    " f_get_bsis_bsas_data
    *&      Form  f_get_bkpf_bseg_data
          Subroutine to get BKPF and BSEG data
    form f_get_bkpf_bseg_data.
      check not i_bsis_bsas[] is initial.
      select  bukrs
              belnr
              gjahr
              xblnr
              stblg
              awtyp
              tcode into table i_bkpf
                    from bkpf
                     for all entries in i_bsis_bsas
                   where bukrs eq i_bsis_bsas-bukrs
                     and belnr eq i_bsis_bsas-belnr
                     and gjahr eq i_bsis_bsas-gjahr.
                    and awtyp = 'BKPFF'
                    and tcode = 'J1IE'.
      check not i_bkpf[] is initial.
      select  bukrs
              belnr
              gjahr
              buzei
              buzid
              koart
              zuonr
              hkont
              lifnr
              sgtxt
              ebeln
              ebelp
              wrbtr  into corresponding fields of table i_bseg
                     from bseg
                      for all entries in i_bsis_bsas
                    where bukrs eq i_bsis_bsas-bukrs
                      and belnr eq i_bsis_bsas-belnr
                      and gjahr eq i_bsis_bsas-gjahr.
                     and buzei eq i_bsis_bsas-buzei
                     and hkont eq i_bsis_bsas-hkont.
      delete i_bseg where not hkont in s_hkont.
    endform.                    " f_get_bkpf_bseg_data
    *&      Form  f_get_ekbe_data
          Subroutine to get EKBE data
    form f_get_ekbe_data.
      data: $i_bseg like i_bseg occurs 0 with header line.
      $i_bseg[]  =  i_bseg[].
      delete $i_bseg where ebeln is initial.
      check not $i_bseg[] is initial.
      select ebeln
             ebelp
             gjahr
             belnr
             buzei
             lfgja
             lfbnr
             lfpos
             matnr into table i_ekbe
                   from ekbe
                    for all entries in $i_bseg
                  where ebeln eq $i_bseg-ebeln
                    and ebelp eq $i_bseg-ebelp
                    and gjahr eq $i_bseg-gjahr
                    and bwart = '101'.
                   and belnr eq $i_bseg-belnr.
    check not i_ekbe[] is initial.
      select a~mblnr
             a~mjahr
             a~bktxt
             a~xblnr
             a~frbnr
             b~zeile
             b~matnr
             b~werks
             b~erfmg  into table i_mkpf_mseg
                      from mkpf as a inner join
                           mseg as b on amblnr eq bmblnr
                                    and amjahr eq bmjahr
                       for all entries in i_ekbe
                       where a~mblnr eq i_ekbe-lfbnr
                      and a~mjahr eq i_ekbe-gjahr
                      and b~zeile eq i_ekbe-lfpos
                        and b~werks eq p_werks.
    <REMOVED BY MODERATOR>
    Edited by: Srikanth Kadiyala on Jun 3, 2008 7:24 AM
    Edited by: Alvaro Tejada Galindo on Jun 3, 2008 3:40 PM

  • How to get required data in Reference (XBLNR)

    As a result of posting customer partial payment there is a new document posted with a new amount that is left to be paid, however this new document doesnu2019t derive Invoice number / Reference from the original document. The invoice number is copied only to field u2018Assignmentu2019 (BSEG-ZUONR) which is in customer line item while I need it in u2018Referenceu2019 (BKPF-XBLNR). As Reference is empty, instead of invoice number there is a document number printed on dunning letters that doesnu2019t say anything to customer and make him confused.
    Do you know how to create substitution that will copy data fromu2019 Assignmentu2019 to u2018Referenceu2019 of the same document (I was trying to write exit in ZGGBS000 but it didnu2019t work).
    Second idea is to write some program that when posting / clearing via F-28 will derive invoice number from cleared document (from its u2018Referenceu2019) but where I should do this?
    The last idea that comes to my mind is to change dunning printout so that when u2018Referenceu2018 is empty then data from u2018Assignmentu2019 should be printed instead of document number.
    Anybody knows how to realize these ideas or knows any other solution?
    Thank you in advance.

    Hi Anna
    We welcome you to SDN!
    I think ZGGBS000 should work, provided you create it at Call up Point = "Doc Header" and Not "Line Item" (in OBBH)
    If not ZGGBS000, you can use BTE 1120.... I had similar requirement to copy invoice no in F-28.. But, there is a catch in it... What if you select 2 invoices in F-28? Which invoice no would you update in reference?
    If you want to use F-28 option, then you will have to put a restriction in the BTE saying that you cant select more than 1 line item in F-28... Then only you can update invoice no in XBLNR field
    Regards
    Ajay M

Maybe you are looking for