No Vendor Found

Hi,
We have created a contract in SRM system and are trying to send that contract to the attached ERP system.
But the idoc which is generated in the background gives the following error:
"No Vendor found"
We have checked and the vendors exist in both ERP and SRM.
Could anyone give me other reasons for the same?
Regards
Karan

Hello,
Please check note no:842181.
The reason for the idocs are not geting created could be due to the
condition mapping.
Could you please check for the distribution and conditions mapping in
the contracts.
Any GOA contract in EBP has to be mapped in R/3 with the corresponding
entry for conditions i.e 01CT to synchronise the two systems.
If the conditions are not mapped, the idocs will not be created.
Hence, please map the conditions and check for the distribution.
If the problem still persists, kindly provide us a couple more of
sample contracts for us to analyse the issue.
Also it can be possible when a purchasing organisation is not assigned
to a company code, we have no chance in a standard SRM solution to
determine the correct company code (especially if multiple company
codes are available). In this case, if a user tries to create a
contract manually via transaction ME31K, he/she will need to manually
determine the correct company code via the pop-up screen. Here the
system will list all possible company codes that is defined in the
system and the user must determine which one to use. This can not
be programmed in a standard SRM solution.
Therefore, I can only recommend that you do one of the following:
1. maintain the company code/purchase organisation customising
   Transaction (in your case this is most likely not desired).
2. program customer specific logic to determine the company code
   via the PlugIn BADI BBP_CTR using the method MODIFY_IDOC_DATA_CTR.
   The company code must be filled in the BLAORD03 idoc segment E1EDK14
   in the field ORGID where the field QUALF has the value '011'.
Thanks and regards,
Gaurav

Similar Messages

  • Error in PRFI: no vendor found

    Hello everyone
    I have an error when posting in PRFI T-Code - it says that there is no vendor found by these criteria.
    Though I did PRAA T-code and SM35 batch input for the personnel number and created a vendor.
    What is wrong?
    Thanks in advance!
    Edited by: Eldar Hamitov on Apr 5, 2010 10:45 AM

    Vijay,
    I guess that the problem is caused by the wrong assignment of symbolic account to a wage type and in HRT/HRP procedures. Guess this is where it is coming from.
    I have the following situation.
    FI-TV was customized to be connected with HR Payroll and all the calculation and posting were conducted one time at the end of the accounting period. Everything worked fine.
    But now the client wants direct postings from FI-TV to FI and we have to do modifications.
    I am testing on one expense type - "accomodation". It is Paid by Company. "Accomodation" was connected to a wage type, let's say, AAAA. AAAA was posted via symbolic accounts to FI accounts 995-701 (Debit) and 3350-999 (Credit). Everything worked fine. But how to customize it in HRT?
    Let's say 15A in HRT is connected to 995-701,     159 is connected with 3350-999, When I put in T706K this +5A and -59 in the columns opposite the wage type AAAA thus trying to connect wage type with accounts from HRT, in PR05 when approving the trip I get the error that my wage type is connected to two expense types in T706K and it is not allowed. But if I take away one of the +5A or -59 in T706K, I get the error in PR05 "there is no financial position for 995-701" when approving the trip.
    How to post "Accomodation" -- wage type AAAA to Debit 995-701 and Credit 3350-999????
    I guess that the point is in that situation.
    Appreciate any assistance.

  • Automatic PO creation when neither Contract or fixed vendor found

    Hi All,
        This is continuation of my previous thread. the issue has not been resolved and needs suggestions.
    SRM 5.0 ECS SP15. The issue happens sporadically when SRM SC is created without contract item (catalog/direct mat).
    So, when SC is created with above condition, instead of going to sourcing, system directly creates the PO. The only thing I noticed was the SC contained entry in preferred vendor field. there is no custom code on turning preferred vendor to fixed. And this does not happen often.
    Please advise
    Regards
    Rao

    hello,
    the preferred vendor maintained is treated as a source of supply. below is the IMG documentation for Sourcing is carried out for items without a source of supply setting
    SAP Enterprise Buyer transfers all requirements that have multiple sources of supply, of which none are assigned, to the purchaser's sourcing application. Once you have selected a source of supply in the shopping cart, the item does not go to the sourcing application and a PO is created.
    as suggested by Ricardo, you may implement BBP_SRC_DETERMINE BAdI to overwrite this, i.e. Sourcing will not be carried out only when a contract is assigned to a shopping cart item.
    regards.

  • Vendor Master Update

    Hi,
    My requirement is to interface with leagacy system the vendor master data . For this i am using RFBIKR00 in my z-prg. The structures that are getting passed are BGR00, BLF00, BLFA1, BLFB1... In structure BLF00 I am getting the T-code & the Vendor number ... The inputfile is coming with t-code XK01... My program changes t-code to XK02 if vendor is already pressent in LFA1 & LFB1 ... but my program is failing when the vendor num exists in LFA1 but not in LFB1...because the t-code remains XK01 & when the session is created at that it throws an error saying "XK01" ... Vendor already exists... & If I check for vendors only in LFA1... the t-code chages to XK02 ... but in SM35 it gives an error saying Vendor -
    has not being created for company -
    .... Please help me to figure out how do I handle this type of situation... Also please tell me that in real time can there be a reverse situation ??... means Vendor present in LFB1 but not in LFA1 ?? ... I am also encloing my code below :-
    Select vendors number from LFA1 & then from LFB1
    FORM GET_VENDOR_NUMBER .
      SELECT LIFNR
             KTOKK
        INTO TABLE T_VENDOR
        FROM LFA1 CLIENT SPECIFIED
        WHERE MANDT = SY-MANDT AND
              KTOKK = C_KTOKK.
      IF SY-SUBRC <> 0.
        MESSAGE I010.    " No vendor found
      ELSE.
        SORT T_VENDOR BY LIFNR KTOKK.
        IF NOT T_VENDOR[] IS INITIAL.
          SELECT LIFNR
                 BUKRS
             INTO TABLE T_CCVENDOR
             FROM LFB1 CLIENT SPECIFIED
             FOR ALL ENTRIES IN T_VENDOR
             WHERE MANDT = SY-MANDT   AND
                   LIFNR = T_VENDOR-LIFNR AND
                   BUKRS = C_BUKRS.
          IF SY-SUBRC = 0.
            SORT T_CCVENDOR BY LIFNR BUKRS.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDFORM.                    " GET_VENDOR_NUMBER
          Perform to process the logic
    FORM PROCESS_FILES .
    Open the file
      LOOP AT T_LISTFILES.
        CONCATENATE C_DIRFILES
                    T_LISTFILES-NAME
               INTO V_FILEPATH.
        OPEN DATASET V_FILEPATH FOR INPUT IN TEXT MODE ENCODING DEFAULT
                                                  MESSAGE V_MSG.
       WRITE: V_FILEPATH.
        IF SY-SUBRC <> 0.
          MESSAGE I008.              "'File cannot be opened.
          EXIT.
        ENDIF.
    Reading the file.
        DO.
          READ DATASET V_FILEPATH INTO T_INPUTFILE.
          IF SY-SUBRC <> 0.
            EXIT.
    Capture session name.
          ELSEIF T_INPUTFILE+0(1) = '0'.
            V_SESS_NAME = T_INPUTFILE+1(12).
    Get Vendor account group info
          ELSEIF T_INPUTFILE0(1) = '1' AND T_INPUTFILE1(4) = 'XK01'.
            READ TABLE T_RECACC WITH KEY Z_INTERFACE = 'RB'.
            IF SY-SUBRC = 0.
              T_INPUTFILE+39(4) = T_RECACC-Z_KTOKK.
            ENDIF.
    Check for vendor number.
            READ TABLE T_CCVENDOR WITH KEY LIFNR = T_INPUTFILE+21(10)
                                           BUKRS = C_BUKRS.
            IF SY-SUBRC = 0.
              T_INPUTFILE+1(4) = 'XK02'.
            ENDIF.
          ENDIF.
          APPEND T_INPUTFILE.
          CLEAR  T_INPUTFILE.
        ENDDO.
    Close the file.
        CLOSE DATASET V_FILEPATH.

    Hi Rob,
      It gave an error for the 1st record where t-code got changed to XK02 as Vendor -
    has not been created for company code -
      The second record gave an error saying that "No batch input data for screen SAPMF02K 0111" , which means it could not find the general data ... I inquired here & they told me that I should pass the input file as :-
    0Sessname  210usernam       00000000X/
    1XK01                00001000151001/
    2BLFB1                                   /
    But my incoming flat file will have the records in this format:-
    0Sessname  210usernam       00000000X/
    1XK01                00001000151001/
    2BLFA1                         /
    2BLFB1                                   /
    Currently I want to know that if my record pointer is in record 1XK01 line ... how should it skip directly to 2BLFB1 line ...
    If I follow the below code ... it errors saying that general data it not found "No batch input data for screen SAPMF02K 0111"
    Check for the condition vendor number present in LFA1 but not in LFB1
            READ TABLE T_VENDOR WITH KEY LIFNR = T_INPUTFILE+21(10)
                                         KTOKK = C_KTOKK.        "check LFA1
            IF SY-SUBRC = 0.
              READ TABLE T_CCVENDOR WITH KEY LIFNR = T_INPUTFILE+21(10)
                                            BUKRS = C_BUKRS.    "check LFB1
              IF SY-SUBRC <> 0.
                APPEND T_INPUTFILE.
                CLEAR T_INPUTFILE.
                READ DATASET V_FILEPATH INTO T_INPUTFILE.
                  IF SY-SUBRC = 0.
                   IF T_INPUTFILE0(1) = '2' AND T_INPUTFILE1(5) = 'BLFA1'.
                     CONTINUE.
                   ENDIF.
                  ENDIF.
              ENDIF.
            ENDIF.
    So i believe I should not do a read instea directly skip the line of 1BLFA1 & directly go to 2BLFB1 record line...
    Can you help me please....
    Thank you,
    SB.

  • Problem while posting to accounts on vendor account

    Hi experts,
    We have a wagetype "Advance deduction"
    For the particuar employee we created a vendor account.
    We ran the payroll successfully and  we tried to post it to accounts.
    Im getting the errors 
    ""No creditor with serach key  Companycode  LFB1 PERNR
    Has bben found""
    No vendor found for this selection
    Required field GLACCOUNT was not transferred in parameter ACCOUNTGL"""_
    Eventhough we maintained the Vendor account for the particular employee.
    Did i miss any config.
    Please advice me to resolve the problem.
    Regards,
    V Sai.

    HI Experts,
    Im facing the problem in creation of a Vendor account for a newly created company code.
    Through PRAA we have created the new vendor account for an employee who has advance deductions.
    The system is showing  the screen Create vendor master records according to HR master records.
    Through XK03 i can able to see the created vendor.
    Later i performed live run and posting to accounts.
    there im getting the incorrect documents for the particular wagetype.
    Where we have to enter a valid value in field GL_Account in parameter accountGL.
    Please addvice me to solve the prob;lem.
    Regards,
    Vi sai.

  • Detect potential duplicate vendor master records

    Hi all,
    Our external auditor has the following comment:
    'Match codes and message control can be used to help identify duplicate vendor records. Fields such as “Name”, “Address” and “Country” can be set as searchable fields in order to detect potential duplicate vendor records.  The message control (with identifier “144”) in SAP can give a message prompt when duplicate vendors are identified.
    We noted that your system had not been configured to display a warning message if the name or address, etc of a new record is identical to an existing vendor record.'
    Any idea to implement this?
    I searched for message 144 and found that there is a similar message in message class F2: 'Vendors found with same address; check', but I cannot find where to trigger this error message.
    Please help.
    Best Regards,
    Chris.

    Goto SPRO-Financial accounting-Accounts Receivable and Accounts Payable
    -vendro account-master data- Preparations for Creating Vendor Master Data 
    - Change Message Control for Vendor Master Data
    here you can maekk the messge 144 to Error

  • Vendor Master Creation FK01

    Hi
    I created one vendor as MNO Limited. Vendor number generated is 1000098. Afterwards i came to know that the Vendor 1000065 is already created with same name. So now same vendor is created twice.
    Let me know is there possibility in SAP to have check on this. How to avoid duplicate vendor creation?
    Second doubt is that, i want to have dropdown for field Corporate Group field. Is it possible in Standard way?

    Hi,
    You can configure the vendor duplicacy check in the below path:-
    Goto SPRO: SAP Reference IMG:
    1. Financial Accounting(New)->Accounts Receivable and Accounts Payable->Vendor Accounts->Master Data->Preparations for Creating Vendor Master Data->Change Message Control for Vendor Master Data
    2. The next screen will be displayed where you can define your message for Ex:
    F2 144 u2013 Vendors found with same address; check
    Set the values Online = u2018Iu2019 and BatchI (Batch Input) = u2018Iu2019
    If you want to make this check user specific then enter the User Name else leave it blank to make it applicable for all users.
    3.Again go to SPRO:
    Financial Accounting (New)->Accounts Receivable and Accounts Payable->Vendor Accounts->Master Data->Match Code->Check Search Fields for (Vendor) Matchcodes
    The standard fields on which the check is performed are:
    1.NAME1,  2.NAME2,  3.ORT01
    You can include here other field also to check the duplicacy. If the need to check the duplicate vendor on more complex creterias, you can use the user exit function module EXIT_SAPMF02K_001 which calls the custom program ZXF05U01.
    Regards,
    Gaurav

  • Line vendor Items FB1LN

    Hi guru's,
    I try to display the vendor line items in my program per Company Code, Vendor number, Profit center,  Account, for after that to do a resposting for the atypical balances.
    I select the datas from BSIK/BSAK table joined to Falglflext table. The problem is when I choose the atypical balances and put them in my internal table (li_total) and when I check the amount in Faglflext, the amount are not exact.
    My Result has to be the same than in FBL1N.
    ** Read Open Items For Vendor
      REFRESH li_vend.
      SELECT DISTINCT a~bukrs a~lifnr a~wrbtr a~dmbtr a~gjahr a~budat b~prctr
             b~segment a~waers b~kokrs a~hkont a~umskz a~shkzg
                      APPENDING CORRESPONDING FIELDS OF TABLE  li_vend
                      FROM   bsik AS a JOIN faglflexa AS b
                      ON     a~bukrs  = b~rbukrs
                      AND    a~belnr  = b~docnr
                      AND    a~gjahr  = b~ryear
                      AND    a~buzei  = b~buzei
                      and    a~hkont  = b~racct
                      WHERE  b~rldnr  = '0L'
                      AND    a~bukrs  IN sel-fi-bukrs
                      AND    a~lifnr  IN sel-fi-lifnr
                      AND    a~vbund  IN sel-fi-vbund
                      AND    a~umskz  IN sel-fi-umskz
                      AND    b~segment IN sel-fi-segment
                      AND    b~prctr  IN sel-fi-prctr
                      AND    a~budat  <= wa_sel_fi_budat.
      IF  sy-subrc NE 0.
        MESSAGE e324(zst1) DISPLAY LIKE c_error. " No Vendor Found
      ENDIF.
    * Read Cleared Items For Vendor
      SELECT distinct a~bukrs a~lifnr a~wrbtr a~dmbtr a~gjahr a~budat b~prctr
             b~segment a~waers b~kokrs a~hkont a~umskz a~shkzg
                      APPENDING CORRESPONDING FIELDS OF TABLE  li_vend
                      FROM   bsak AS a join faglflexa AS b
                      ON     a~bukrs  = b~rbukrs
                      AND    a~belnr  = b~docnr
                      AND    a~gjahr  = b~ryear
                      AND    a~buzei  = b~buzei
                      and    a~hkont  = b~racct
                      WHERE  b~rldnr  = '0L'
                      AND    a~bukrs  IN sel-fi-bukrs
                      AND    a~lifnr  IN sel-fi-lifnr
                      AND    a~vbund  IN sel-fi-vbund
                      AND    a~umskz  IN sel-fi-umskz
                      AND    b~segment IN sel-fi-segment
                      AND    b~prctr  IN sel-fi-prctr
                      AND    a~budat  <= wa_sel_fi_budat
                      AND    a~augdt  > wa_sel_fi_augdt.
    Edited by: rahhaoui mohamed on Aug 27, 2009 8:25 PM

    Sorry I split the message in 2.
    1) I check if the total per Compay and Vendor is atypical. I
    2) I put the lines of my total per COmpany code, Vendor, profit center, Account in another table.
    * Reclassification Check
    *Check Local Currency is < 0.
      LOOP AT li_vend INTO wa_vend.
        wa_vend2-bukrs = wa_vend-bukrs.
        wa_vend2-lifnr = wa_vend-lifnr.
        IF wa_vend-shkzg = 'H'.
          wa_vend2-dmbtr = wa_vend-dmbtr * -1.
          wa_vend2-wrbtr = wa_vend-wrbtr * -1.
         endif.
        COLLECT wa_vend2 INTO li_vend2.
      ENDLOOP.
    * Check if reposting is needed
      IF sel-rprt-flag2 = 'Y'.
        DELETE li_vend2 WHERE wrbtr < 0.
      ELSEIF sel-rprt-flag2 = 'N'.
        DELETE li_vend2 WHERE wrbtr  > 0.
      ENDIF.
      LOOP AT li_vend INTO wa_vend.                     * I'm not sure but I think my problem comes from here.
        LOOP AT li_vend2 INTO wa_vend2 WHERE bukrs = wa_vend-bukrs
                                      AND  lifnr = wa_vend-lifnr
          MOVE-CORRESPONDING wa_vend TO wa_total.
          MOVE wa_vend-lifnr TO wa_total-third.
          IF wa_vend-shkzg = 'H'.
            wa_vend-dmbtr  = wa_vend-dmbtr * -1.
            wa_vend-wrbtr  = wa_vend-wrbtr * -1.
          ENDIF.
          MOVE wa_vend-wrbtr TO wa_total-tsl.
          MOVE wa_vend-dmbtr TO wa_total-hsl.
          wa_total-flag = c_lifnr.
          COLLECT  wa_total INTO li_total.
        ENDLOOP.
      ENDLOOP.

  • Prevent duplicate vendor

    Hi,
    Is there any efficient way to prevent the duplicate creation of vendor via FK01 or XK01? 
    I know we can incorporate a system check via user exit.  However, the problem is that this check is only activated upon saving and not on the screen where user enters the vendor name and address.
    Best regards.

    The best thing is keeping the message a error in OBA5.
    Application area is F2
    Message no      Message description                                     Online      Batch split
    144
                      Vendors found with same address; check          E             E
    You can also restrict to one each user by specifying the user name
    Thanks

  • Vendor code with the same name - Check required

    Hi experts,
    We are using three account groups for creating vendor thru tcode XK01. A/C group 1000, 2000, 3000 & two company codes SCL , SGL.
    We want to built some error msg control that if some body tries to create vendor with the same name again with in the same company code, purchase organisation, account group, system should throw a error message.
    Currently  warning msg is appearing in our system which is only based on the duplicate name but not considering porg, co. code, a/c group.
    Please suggest.  Suggestions / Solutions will be highly rewarded.
    Regards,
    ( Rajneesh Gulati )

    If You are Using Internal Number Assignments for Vendor Master then Set Messages  F2144 - Vendor found with same address & F2272 - Vendor's with same VAT Reg numbers and your Problem will solve.
    Else Try User Exit EXIT_SAPMF02K_001

  • Create employee vendor to post net salary

    Hi Experts,
    We have a client requirement where they want to post employee salary net salary to employee vendor. Currently i have configured employee salary to go to balance sheet account.
    Can someone please tell me how to create employee vendor in HR and then post net salary to employee vendor account so the HR and finance can see employee wise ledger.
    Really appreciate any help.
    Regards,
    Jyoti

    Jyoti,
    If you will refer your message, it is cleared that vendor of this PERNR is not created, In FI end, for every pernr they create vendor, so you please coordiante with FI people to resolve the issue,
    This is a very simply issue, dont know why your FI people is treating like.
    1. No creditor with the search key 1000 LFB1 PERNR 00100005 has been found
    2. No vendor found for this selection
    3. Required field GL_ACCOUNT was not transferred in parameter ACCOUNTGL
    4. Error in document: HRPAY 0000000102 CLNTAVD510
    5. No data was transferred in parameter ACCOUNTPAYABLE
    Further read the doc. of Vendor accuount, you will get more clarity, Please go thru the same and discuss with your FI people
    There are two kinds of vendor accounts available:
    Fixed vendor accounts: Employee grouping for account determination offers the most precise means of control for posting to fixed vendor accounts.
    Employee vendor accounts: Posting to employee vendor accounts enables posting for a specific personnel number.
    In this step, you make entries in table T030 for the assignment of vendor accounts to symbolic accounts.
    Example
    Fixed vendor account
    You want to deduct dues to various unions from the employees in your enterprise. For each union, you have set up a specific wage type for dues and a specific symbolic account. In this step, you assign a fixed vendor account to each of these symbolic accounts.
    Employee vendor account
    You want to post dues to a different vendor account for each employee. To this effect, you have created a symbolic account for all employees. In this step, you specify how the corresponding employee vendor accounts are determined.
    Requirements
    You have created the required vendor accounts in Financial Accounting.
    You have carried out the step Define Symbolic Accounts. In that step, you created symbolic accounts with the relevant account assignment types (KF for fixed vendor accounts, K for personal vendor accounts). In that same step, you flagged the indicator EG-depend  for symbolic accounts to which you want to post in line with the Employee grouping for account determination.
    If you want to post to employee vendor accounts, you have entered the relevant personnel number in one of the following fields in the vendor master data of Financial Accounting. We recommend that you use the Personnel number field. If you use another field, you must enter the personnel number with leading zeros.
    Personnel number
    Search term
    Telephone 2
    Data line
    Teletext number
    Standard settings
    There are no standard settings for posting to vendor accounts. If, in the step Define Symbolic Accounts, you have not created any symbolic accounts with the account types KF or K, you do not have to carry out the step Assign Vendor Accounts.
    Activities
    1. Enter the required chart of accounts.
    2. To make settings for the posting procedure Personnel posting to vendors (HRK), choose Rules
    3. Choose Posting key. Enter the posting key for postings to vendor accounts or copy the default values (21 for debit posting and 31 for credit postings).
    4. Choose Accounts. Make the corresponding entries in the table T030.
    a) If you want to assign a fixed vendor account to a symbolic account, and if required, an employee grouping, enter the number of the vendor account in the Acco column.
    b) If you want to assign an employee vendor account to a symbolic account, and, if required a employee grouping, enter the relevant key (see table below) in the Acco column.
    Personnel number in field (Vendor master data) Entry in the Account column (T030)
    Personnel number    *0002
    Search term    *0001
    Telephone 2    *0003
    Data line    *0004
    Teletext number    *0005

  • Vendor Search not returning any values in SRM

    Hi Gurus
    Has any one come accross the following issue? Kindly advice.
    SRM 3.0
    Search Vendor (F4) not returning any value although Vendor exist in SRM (system allows to raise Cart if Requestioner keys in the Vendor Number manually, ie. Vendor has very much got replicated in SRM)
    Steps to replicate the issue
    1) Log on to SRM portal
    2) Expand the Go Shopping and click on Shop (Extended Form)
    3) Click on Create Limit Item
    4) Fill in the Description, Select the Product Category, Enter the Value Limit & Expected Value & fill in the required date
    5) To search for Supplier, click on the find button
    6) In the Find Vendor screen press the start button without entering any restriction
    7) System throws a message "No Vendor found"
    Kind regards,
    Mehul Shah

    Hi Muthu,
    Thanks for replying Muthu.
    Entries do exists in VENMAP.
    No filters are set while searching for Vendor.
    In fact, If I find the Vendor code from ERP and key in the vendor number in the Supplier field in SRM, it rightly picks up the vendor from the Vendor code.
    The only issue is....while I try to search for Supplier using the Supplier search functionality (by clicking on the binocular), the search functionality does not return any values (I put no restriction).
    By the way, Is there any missing Attribute in PPOMA_BBP that may be causing this?
    Regards,
    Mehul.

  • Goods Receipt in Subcontracting process

    Hi,
    I am beginner in SAP.
    This is regarding Goods Receipt in Subcontracting process.
    I have provided raw material Quantity = 100 Nos. to subcontracting vendor.
    Subcontracting vendor done machining on 80 Quantity, and we have done Goods Receipt for 80 Quantity as Finished Parts.
    Subcontracting vendor found 20 Quantity as Defected.
    Shall I take back 20 Quantity by Movement Type 542.
    OR
    Shall I do Goods Receipt of 20 Quantity as Finished Product and price = 0. & then stock transfer of Finished to Raw Material.
    Please reply.

    Hi,
    It depends on what you want your subcontractor to do with the faulty raw material stock - if you want them to scrap it you can scrap stock from subcontractor stock using movement type 551 and special stock "O" (the system should prompt you to enter the vendor code). If you want it returned for you to scrap it - movement 542 to return it then scrap it from your own stock.
    You shouldn't receive an additional 20 of the finished parts - as you only received 80 not 100. Close the purchase order off to close off the balance of 20 remaining.
    Thanks

  • Advanced Update Rules Routine

    I have a routine in my update rule that performs a lookup to another ODS.  To improve my performance I would like to try writing a temporary variable to memory that can then be referenced when loading each record.  For example here's some pseudo code:
    1) if vendor already exists then do nothing
    2) set AP key and set Purchasing key for performing lookups
    (ie: AP key = Company Code + FiscalYearPeriod + AccountingDocumentNumber)
    (ie: Purchasing key = Company Code + FiscalYearPeriod + PurchasingDocumentNumber)
    3) does temporary AP variable exist and does it match AP key?
         3a) if yes then EXIT and return temporary AP variable
         3b) if no then perform ap lookup based on AP key
         3c) was lookup successful - was vendor found?
    if yes then set temporary AP variable and EXIT and return value
    if no then continue
    4) does temporary Purchasing variable exist and does it match Purchasing key?
         4a) if yes then EXIT and return temporary Purchasing variable
         4b) if no then perform purchasing lookup based on Purchasing key
         4c) was lookup successful - was vendor found?
    if yes then set temporary Purchasing variable and EXIT and return value
    if no then EXIT (Do nothing - essentially leave blank)
    My question is 1) Whether it's indeed possible to pass this temporary variable and 2) can you give me a sample of code that I would use to read/write the variable?
    Thanks so much!

    You can use Import/Export to cluster database. This way you can share the same variable value between different programs/routine.
    EXPORT value TO DATABASE INDX(Indx) ID 'Variable Id'.
    IMPORT value FROM DATABASE INDX(Indx) ID 'Variable Id'.
    For more details you can refer the following:
    http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3c53358411d1829f0000e829fbfe/frameset.htm
    Regards,
    RB

  • BAPI for fb65

    Hi ,
    I want to call transaction FB65 for the company code , vendor , amount and GL_account.
    Is there any BAPI which i can use for this purpose.
    Thanks in advance.

    sample code using RFBIBL00
    TABLES : BGR00,    " Batch Input Structure for Session Data
             BBKPF,    " Doc Hdr for Accntng Doc (Batch Input Structure)
             BBSEG,    " Accounting Document Segment (Batch Input Structure)
             USR01.
    Internal Table and structure Declarations                           *
    Internal table to hold input file data
    DATA:BEGIN OF IT_INFILE OCCURS 0.
            INCLUDE STRUCTURE Z0FI_AP_FADS_TO_SAP. "Input file format
    DATA:ERROR(1) TYPE C,                          "error indicator
    END OF IT_INFILE.
    Internal table to hold input file data
    DATA:BEGIN OF IT_ERRORS OCCURS 0.
            INCLUDE STRUCTURE Z0FI_AP_FADS_TO_SAP. "Input file format
    DATA: MSG(200) TYPE C,                         "message
    END OF IT_ERRORS.
    Internal table to hold GL data
    DATA:BEGIN OF IT_GL OCCURS 0,
    SAP_GL_ACCOUNT  LIKE ZFGLT_GL_PRI_SUB-SAP_GL_ACCOUNT, "G/L Account
    LGCY_SYSTEM     LIKE ZFGLT_GL_PRI_SUB-LGCY_SYSTEM,    "Legacy System
    LGCY_PRIME_ACCT LIKE ZFGLT_GL_PRI_SUB-LGCY_PRIME_ACCT,"Legacy Account
    LGCY_SUB_ACCT   LIKE ZFGLT_GL_PRI_SUB-LGCY_SUB_ACCT,  "Legacy Sub Acct
    END OF IT_GL.
    Internal table to hold cost center data
    DATA:BEGIN OF IT_COSTCTR OCCURS 0,
    COST_OBJECT    LIKE ZFCFT_CTR_DPT_LG-COST_OBJECT,     "Cost center
    LGCY_LDGR      LIKE ZFCFT_CTR_DPT_LG-LGCY_LDGR,       "Legacy ledger
    LGCY_DEPT      LIKE ZFCFT_CTR_DPT_LG-LGCY_DEPT,       "Legacy Department
    END OF IT_COSTCTR.
    Internal table to hold vendor data
    DATA:BEGIN OF IT_LFA1 OCCURS 0,
    LIFNR TYPE LIFNR,                                     "Vendor no
    BUKRS TYPE BUKRS,                                     "Company code
    STCD1 TYPE STCD1,                                           "Tax ID1
    STCD2 TYPE STCD2,                                           "Tax ID2
    END OF IT_LFA1.
    Internal table to hold Primary Sub Acct data
    DATA:BEGIN OF IT_SUBACCT OCCURS 0,
    PRYACT1(10) TYPE C,                                    "Pry sub Acct1
    PRYACT2(10) TYPE C,                                    "Pry sub Acct2
    END OF IT_SUBACCT.
    Internal table to hold ledger data
    DATA:BEGIN OF IT_LEDGER OCCURS 0,
    LGR_ID(4) TYPE C,                                      "Ledger ID
    DEPT(4) TYPE C,                                        "Department
    END OF IT_LEDGER.
    Internal table to hold tax id
    DATA:BEGIN OF IT_TAXID OCCURS 0,
    TAXID1(16) TYPE C,                                          "Tax ID1
    TAXID2(11) TYPE C,                                          "Tax ID2
    END OF  IT_TAXID.
    Internal table to hold line amounts sum data
    DATA:BEGIN OF IT_SUM OCCURS 0,
    TAX_ID_NO(10) TYPE C,                                  "Tax Id No
    INVOICE_NO(12) TYPE C,                                 "Invoice No
    SUM2(11) TYPE P DECIMALS 2,                            "Sum
    END OF IT_SUM.
    Internal table to hold Error records
    DATA:BEGIN OF IT_ERROR OCCURS 0,
    TAX_ID_NO(10) TYPE C,                                  "Tax Id No
    INVOICE_NO(12) TYPE C,                                 "Invoice No
    MSG(200) TYPE C,                                       "Message
    END OF IT_ERROR .
    Internal table to hold success records
    DATA : BEGIN OF IT_SUCCESS OCCURS 0,
            DOCNUM(10) TYPE C,                           "Document No
            BUKRS(4) TYPE C,                             "Company code
            FISYR(4) TYPE C,                             "Fiscal year
            MSG(100) TYPE C,                             "Message
           END OF IT_SUCCESS.
    Internal table to hold invoice no
    DATA:BEGIN OF IT_INVNO OCCURS 0,
          XBLNR(16) TYPE C,                              "Ref Doc No
          END OF IT_INVNO.
    Internal table to hold Invoice Document no's
    DATA:BEGIN OF IT_BKPF OCCURS 0,
          BUKRS LIKE BKPF-BUKRS,
          BELNR LIKE BKPF-BELNR,
          XBLNR LIKE BKPF-XBLNR,
          END OF IT_BKPF.
    Internal table to initialise structures
    DATA:    BEGIN OF IT_NAMETAB OCCURS 120.
            INCLUDE STRUCTURE DNTAB.
    DATA:    END OF IT_NAMETAB.
    Internal table to hold sessions data
    DATA:BEGIN OF IT_LIST OCCURS 0.
            INCLUDE STRUCTURE ABAPLIST.
    DATA:END OF IT_LIST.
    Structure to hold input file
    DATA:X_INFILE LIKE IT_INFILE.
    Structure to hold company code & currency data
    DATA:BEGIN OF X_T001,
    BUKRS LIKE T001-BUKRS,                                "Company code
    WAERS LIKE T001-WAERS,                                "Currency
    END OF X_T001.
    Global Variables                                                     *
    DATA: V_PGM_ID         LIKE SY-REPID,                "Program id
          V_COUNT_INFILE   TYPE I,                       "Counter
          V_TEXT(100)      TYPE C,                       "Text
          V_CHAR(61)       TYPE C,                       "Field name
          V_FILE           LIKE RLGRAP-FILENAME.         "File name
    DATA:
          V_ERR            TYPE I,                       "Counter
          V_OBJKEY         LIKE  BAPIACHE09-OBJ_KEY,     "object key
          V_ERR_REC        TYPE I,                       "Error Records
          V_SUC_REC        TYPE I,                       "Success Records
          V_SESS           LIKE APQI-GROUPID.            "Session name
    Field symbols
    FIELD-SYMBOLS: <F1> .
    Constants.                                                           *
    DATA:
         C_ITEMNO(6)   TYPE C VALUE '000001',            "Item no
         C_DOCTYPE(2)  TYPE C VALUE 'KU',                "Doc type
         C_BUSACT(4)   TYPE C VALUE 'RMRP',              "Business Account
         C_FADS(7)     TYPE C VALUE 'FADS',              "Legacy system
         C_COMMA(1)    TYPE C VALUE ',' ,                "Comma
         C_NODATA(1)   TYPE C VALUE '/',                 "NODATA
         C_SESS        LIKE APQI-GROUPID VALUE 'FADS2SAP'."Session
    Selection Screen
    SELECTION-SCREEN: BEGIN OF BLOCK NO1 WITH FRAME TITLE TEXT-001.
    *Input file name
    PARAMETERS:P_BUKRS  LIKE T001-BUKRS OBLIGATORY,
               P_INFILE LIKE RLGRAP-FILENAME LOWER CASE DEFAULT
                                               'C:\FB60.txt' OBLIGATORY,
    *Filename for Error records
                P_ERR LIKE RLGRAP-FILENAME LOWER CASE DEFAULT
      '/int/D01/030/in/REQ853err.txt' OBLIGATORY.
    *For selecting either a sequential file or local file.
    PARAMETERS:
               R_PSERV RADIOBUTTON GROUP GR1 DEFAULT 'X',
               R_ASERV RADIOBUTTON GROUP GR1.
    SELECTION-SCREEN: END OF BLOCK NO1.
    INITIALIZATION
    INITIALIZATION.
      V_PGM_ID = SY-REPID.
    AT SELECTION-SCREEN                                                 *
    AT SELECTION-SCREEN.
    Validating company code
      SELECT SINGLE BUKRS
             WAERS INTO (X_T001-BUKRS, X_T001-WAERS)
             FROM T001 WHERE BUKRS = P_BUKRS.
      IF SY-SUBRC <> 0.
        MESSAGE E014 WITH 'Invalid Company code'(E01).
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_INFILE.
    Getting help for presentation server files
      IF R_PSERV = 'X'.
        CALL FUNCTION 'F4_FILENAME'
             EXPORTING
                  PROGRAM_NAME  = V_PGM_ID
                  DYNPRO_NUMBER = SY-DYNNR
                  FIELD_NAME    = ' '
             IMPORTING
                  FILE_NAME     = P_INFILE.
      ENDIF.
    START-OF-SELECTION                                                  *
    START-OF-SELECTION.
    If sequential file is selected
      IF R_ASERV = 'X'.
    Form to get  data for apllication server
        PERFORM F_GET_INPUT_DATA.
    if local file
      ELSE.
    If sequential file is selected
        PERFORM F_GET_LOCAL_DATA.
      ENDIF.
    Selecting GL, Costcenter, vendor data
      PERFORM F_SELECT_DATA.
    Validate the the input file data
      PERFORM F_VALIDATE_DATA.
    Populate data to fill structures
      PERFORM F_POPULATE_DATA.
    Populate the error data
      PERFORM F_ERROR_DATA.
    END-OF-SELECTION
    END-OF-SELECTION.
      IF NOT IT_INFILE[] IS INITIAL.
    For submitting the program to rfbibloo
        PERFORM F_SUBMIT_RFBIBLOO.
      ENDIF.
    WRITE : / 'Number of success records '(003),
               v_suc_rec LEFT-JUSTIFIED.
    WRITE : / 'Number of error records '(004),
                v_err_rec LEFT-JUSTIFIED.
      IF NOT IT_ERRORS[] IS INITIAL.
    Form to display the error report
        PERFORM F_DISPLAY_REPORT.
      ENDIF.
      IF NOT IT_SUCCESS[] IS INITIAL.
    Form to display the success report
        PERFORM F_DISPLAY_SUC_REPORT.
      ENDIF.
    *--Standard footer
      PERFORM STD_END_OF_REPORT.
    TOP OF PAGE                                                         *
    TOP-OF-PAGE.
    *---Standard header
      PERFORM STD_TOP_OF_PAGE CHANGING SY-TITLE.
    *&      Form  f_get_local_data
          Getting the data from presentation server
    FORM F_GET_LOCAL_DATA.
      DATA:LV_FILNAM TYPE STRING.     "File name
      LV_FILNAM = P_INFILE.
      CALL FUNCTION 'GUI_UPLOAD'
           EXPORTING
                FILENAME                = LV_FILNAM
                FILETYPE                = 'ASC'
               has_field_separator     = ' '
           TABLES
                DATA_TAB                = IT_INFILE
           EXCEPTIONS
                FILE_OPEN_ERROR         = 1
                FILE_READ_ERROR         = 2
                NO_BATCH                = 3
                GUI_REFUSE_FILETRANSFER = 4
                INVALID_TYPE            = 5
                NO_AUTHORITY            = 6
                UNKNOWN_ERROR           = 7
                BAD_DATA_FORMAT         = 8
                HEADER_NOT_ALLOWED      = 9
                SEPARATOR_NOT_ALLOWED   = 10
                HEADER_TOO_LONG         = 11
                UNKNOWN_DP_ERROR        = 12
                ACCESS_DENIED           = 13
                DP_OUT_OF_MEMORY        = 14
                DISK_FULL               = 15
                DP_TIMEOUT              = 16
                OTHERS                  = 17.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CLEAR V_COUNT_INFILE.
      DESCRIBE TABLE IT_INFILE LINES V_COUNT_INFILE.
    Determine if input file has data
      IF V_COUNT_INFILE EQ 0.
        MESSAGE A001(ZFI).
        EXIT.
      ELSE.
        CONCATENATE 'Number of records read from input file  '(002)
                    P_INFILE
                    ': ' INTO V_TEXT.
        WRITE: / V_TEXT, V_COUNT_INFILE LEFT-JUSTIFIED.
      ENDIF.
    ENDFORM.                    " f_get_local_data
    *&      Form  F_GET_INPUT_DATA
          Getting the data from apllication server
    FORM F_GET_INPUT_DATA.
      DATA: LV_FILNAM LIKE FILENAME-FILEEXTERN."File name
      LV_FILNAM = P_INFILE.
    Opening Dataset
      OPEN DATASET LV_FILNAM FOR INPUT IN TEXT MODE.
    Read legacy input file into internal table for furthing processing
      DO.
        CLEAR IT_INFILE.
        READ DATASET P_INFILE INTO IT_INFILE.
        IF SY-SUBRC NE 0.
          EXIT.
        ENDIF.
        ADD 1 TO V_COUNT_INFILE.
      ENDDO.
    Determine if input file has data
      IF V_COUNT_INFILE EQ 0.
        MESSAGE A001(ZFI).
        EXIT.
      ELSE.
        CONCATENATE 'Number of records read from input file  '(002)
                    P_INFILE
                    ': ' INTO V_TEXT.
        WRITE: / V_TEXT, V_COUNT_INFILE LEFT-JUSTIFIED.
        EXIT.
      ENDIF.
    closing dataset
      CLOSE DATASET LV_FILNAM.
    ENDFORM.
    *&      Form  f_populate_data
          Populate data
    FORM F_POPULATE_DATA.
      CLEAR: X_INFILE,IT_SUCCESS,V_SUC_REC.
      REFRESH IT_SUCCESS.
      SORT IT_INFILE BY TAX_ID_NO INVOICE_NO.
      CONCATENATE '/int/' SY-SYSID '/' SY-MANDT '/in/IR853_FB01.dat'
                                                         INTO V_FILE.
      CONDENSE V_FILE NO-GAPS.
    Open the dataset
      OPEN DATASET V_FILE FOR OUTPUT IN TEXT MODE.
      IF SY-SUBRC EQ 0.
        LOOP AT IT_INFILE.
          X_INFILE = IT_INFILE.
          AT FIRST.
    To populate BGR00 structure
            PERFORM F_POPULATE_BGR00.
            TRANSFER BGR00 TO V_FILE.
          ENDAT.
          AT NEW INVOICE_NO.
    To populate BBKPF structure
            PERFORM F_POPULATE_BBKPF.
            TRANSFER BBKPF TO V_FILE.
    To populate BBSEG structure Credit
            PERFORM POPULATE_BBSEG_C.
            TRANSFER BBSEG TO V_FILE.
          ENDAT.
    To populate BBKPF structure Debit
          PERFORM POPULATE_BBSEG_D.
          TRANSFER BBSEG TO V_FILE.
          CLEAR:X_INFILE.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " f_populate_data
    *&      Form  f_display_report
          Display error report
    FORM F_DISPLAY_REPORT.
    Open the dataset
      OPEN DATASET P_ERR FOR OUTPUT IN TEXT MODE.
      IF SY-SUBRC EQ 0.
        LOOP AT IT_ERRORS.
    Transfer the error records to error file on application server
          TRANSFER IT_ERRORS TO P_ERR.
        ENDLOOP.
      ENDIF.
    Closing the dataset
      CLOSE DATASET  P_ERR.
      IF NOT IT_ERRORS[] IS INITIAL.
        FORMAT COLOR 1 INTENSIFIED OFF.
        SKIP 2.
        WRITE:/1(673) 'ERROR REPORT'(H01) CENTERED.
        ULINE /1(673).
        WRITE:/(4)'S.No'(005),
                SY-VLINE,
               (10) 'Tax Id No'(006),
               SY-VLINE,
               (12) 'Invoice No'(007),
               SY-VLINE,
               (8) 'Rec Type'(008),
               SY-VLINE,
               (6) 'Seq No'(009),
               SY-VLINE,
               (8) 'Batch No'(010),
               SY-VLINE,
               (8) 'UserID'(011),
               SY-VLINE,
               (8) 'NU1'(012),
               SY-VLINE,
               (11) 'Inv Amt'(013),
               SY-VLINE,
               (8) 'Inv Date'(014),
               SY-VLINE,
               (10) 'G/L Org ID'(015),
               SY-VLINE,
               (4) 'NU4'(012),
               SY-VLINE,
               (4) 'NU5'(012),
               SY-VLINE,
               (4) 'NU6'(012),
               SY-VLINE,
               (4) 'NU7'(012),
               SY-VLINE,
               (11) 'NU8'(012),
               SY-VLINE,
               (4) 'NU9'(012),
               SY-VLINE,
               (10) 'PO No'(016),
               SY-VLINE,
               (30) 'Inv Desc'(017),
               SY-VLINE,
               (10) 'Voucher No'(018),
               SY-VLINE,
               (10) 'Inv LinNo'(019),
               SY-VLINE,
               (11) 'Inv Lin Amt'(020),
               SY-VLINE,
               (9) 'Led ID-1'(021),
               SY-VLINE,
               (9) 'Led ID-2'(022),
               SY-VLINE,
               (15) 'Pri Sub Acc-1'(023),
               SY-VLINE,
               (15) 'Pri Sub Acc-2'(024),
               SY-VLINE,
               (15) 'Dept Win Lgr'(025),
               SY-VLINE,
               (5) 'NU2'(012),
               SY-VLINE,
               (6) 'NU3'(012),
               SY-VLINE,
               (11) 'Dist Amt'(026),
               SY-VLINE,
               (8) 'Inv Type'(027),
                SY-VLINE,
               (12) 'PO Line No'(028),
               SY-VLINE,
               (15) 'Inv Line Amt'(029),
               SY-VLINE,
               (5) 'NU10'(012),
               SY-VLINE,
               (13) 'NU11'(012),
               SY-VLINE,
               (5) 'NU12'(012),
               SY-VLINE,
               (6) 'NU13'(012),
               SY-VLINE,
               (5) 'NU14'(012),
               SY-VLINE,
               (5) 'NU15'(012),
               SY-VLINE,
               (200) 'Message'(030),
               SY-VLINE.
        FORMAT COLOR 6 INTENSIFIED OFF.
        LOOP AT IT_ERRORS.
          WRITE:/(4) SY-TABIX,
                SY-VLINE,
               (10) IT_ERRORS-TAX_ID_NO,
               SY-VLINE,
               (12) IT_ERRORS-INVOICE_NO,
               SY-VLINE,
               (8) IT_ERRORS-RECORD_TYPE,
               SY-VLINE,
               (6) IT_ERRORS-SEQ_NO,
               SY-VLINE,
               (8) IT_ERRORS-BATCH_NO,
               SY-VLINE,
               (8) IT_ERRORS-USERID,
               SY-VLINE,
               (8) IT_ERRORS-NU1,
               SY-VLINE,
               (11) IT_ERRORS-INV_HEADER_AMT,
               SY-VLINE,
               (8) IT_ERRORS-INVOICE_DATE,
               SY-VLINE,
               (10) IT_ERRORS-GL_ORG_ID,
               SY-VLINE,
               (4) IT_ERRORS-NU4,
               SY-VLINE,
               (4) IT_ERRORS-NU5,
               SY-VLINE,
               (4) IT_ERRORS-NU6,
               SY-VLINE,
               (4) IT_ERRORS-NU7,
               SY-VLINE,
               (11) IT_ERRORS-NU8,
               SY-VLINE,
               (4) IT_ERRORS-NU9,
               SY-VLINE,
               (10) IT_ERRORS-PONUMBER,
               SY-VLINE,
               (30) IT_ERRORS-INV_DESC,
               SY-VLINE,
               (10) IT_ERRORS-VOUCHER_NO,
               SY-VLINE,
               (10) IT_ERRORS-INV_LINE_NO,
               SY-VLINE,
               (11) IT_ERRORS-INV_LINE_AMT,
               SY-VLINE,
               (9) IT_ERRORS-LEDGER_ID1,
               SY-VLINE,
               (9) IT_ERRORS-LEDGER_ID2,
               SY-VLINE,
               (15) IT_ERRORS-PRI_SUBACCT1,
               SY-VLINE,
               (15) IT_ERRORS-PRI_SUBACCT2,
               SY-VLINE,
               (15) IT_ERRORS-DEPT_WIN_LDGR,
               SY-VLINE,
               (5) IT_ERRORS-NU2,
               SY-VLINE,
               (6) IT_ERRORS-NU3,
               SY-VLINE,
               (11) IT_ERRORS-DIST_AMT,
               SY-VLINE,
               (8) IT_ERRORS-INV_TYPE,
               SY-VLINE,
               (12) IT_ERRORS-PO_LINE_NO,
               SY-VLINE,
               (15) IT_ERRORS-INV_LINE_AMT_D,
               SY-VLINE,
               (5) IT_ERRORS-NU10,
               SY-VLINE,
               (13) IT_ERRORS-NU11,
               SY-VLINE,
               (5) IT_ERRORS-NU12,
               SY-VLINE,
               (6) IT_ERRORS-NU13,
               SY-VLINE,
               (5) IT_ERRORS-NU14,
               SY-VLINE,
               (5) IT_ERRORS-NU15,
               SY-VLINE,
               (200) IT_ERRORS-MSG,
               SY-VLINE.
        ENDLOOP.
        ULINE /1(673).
      ENDIF.
    ENDFORM.                    " f_display_report
    *&      Form  f_select_data
    Selection of GL, Costcenter, vendor data
    FORM F_SELECT_DATA.
      DATA:L_DEPT(4) TYPE N. "Legacy department
      CLEAR:IT_GL, IT_COSTCTR, IT_LFA1, IT_SUBACCT, IT_TAXID , IT_SUM.
      REFRESH:IT_GL, IT_COSTCTR, IT_LFA1, IT_SUBACCT, IT_TAXID,IT_SUM.
      SORT IT_INFILE BY TAX_ID_NO INVOICE_NO.
    *Looping at input file
      LOOP AT IT_INFILE.
        X_INFILE = IT_INFILE.
    *Summing the invoice line items amount and moving the sum to it_sum
        IT_SUM-TAX_ID_NO = IT_INFILE-TAX_ID_NO.
        IT_SUM-INVOICE_NO  = IT_INFILE-INVOICE_NO.
        IT_SUM-SUM2 = IT_INFILE-INV_LINE_AMT.
        COLLECT IT_SUM.
        CLEAR IT_SUM.
    *Storing Primary Sub Account data
        IT_SUBACCT-PRYACT1 = IT_INFILE-PRI_SUBACCT1.
        IT_SUBACCT-PRYACT2 = IT_INFILE-PRI_SUBACCT2.
        APPEND IT_SUBACCT.
        CLEAR IT_SUBACCT.
    *Storing Ledger ID data
        CONCATENATE IT_INFILE-LEDGER_ID1 IT_INFILE-LEDGER_ID2 INTO
        IT_LEDGER-LGR_ID.
        L_DEPT = IT_INFILE-DEPT_WIN_LDGR.
        IT_LEDGER-DEPT = L_DEPT.
        APPEND IT_LEDGER.
        CLEAR IT_LEDGER.
    *Storing Tax ID data
        IT_TAXID-TAXID1 = IT_INFILE-TAX_ID_NO.
        IT_TAXID-TAXID2 = IT_INFILE-TAX_ID_NO.
        APPEND IT_TAXID.
        CLEAR IT_TAXID.
        CONDENSE IT_INFILE-INVOICE_NO.
        IT_INVNO-XBLNR = IT_INFILE-INVOICE_NO.
        APPEND IT_INVNO.
        CLEAR IT_INVNO.
      ENDLOOP.
      SORT IT_SUBACCT BY PRYACT1  PRYACT2.
      SORT IT_LEDGER BY LGR_ID DEPT.
      SORT IT_TAXID BY TAXID1 TAXID2.
      SORT IT_SUM  BY TAX_ID_NO INVOICE_NO.
      SORT IT_INVNO BY XBLNR.
      DELETE ADJACENT DUPLICATES FROM IT_SUBACCT COMPARING PRYACT1  PRYACT2.
      DELETE ADJACENT DUPLICATES FROM IT_LEDGER COMPARING LGR_ID DEPT.
      DELETE ADJACENT DUPLICATES FROM IT_TAXID COMPARING TAXID1 TAXID2.
      IF NOT IT_INVNO[] IS INITIAL.
        SELECT BUKRS
               BELNR
               XBLNR
               INTO TABLE IT_BKPF
               FROM BKPF
               FOR ALL ENTRIES IN IT_INVNO
               WHERE BUKRS = P_BUKRS AND
                     GJAHR = SY-DATUM+0(4) AND
                     BLART = C_DOCTYPE AND
                     XBLNR = IT_INVNO-XBLNR.
      ENDIF.
      IF NOT IT_SUBACCT[] IS INITIAL.
    *Selecting G/L Account from General Ledger Z Table
        SELECT SAP_GL_ACCOUNT
        LGCY_SYSTEM
        LGCY_PRIME_ACCT
        LGCY_SUB_ACCT FROM ZFGLT_GL_PRI_SUB
        INTO TABLE IT_GL
        FOR ALL ENTRIES IN IT_SUBACCT
        WHERE LGCY_SYSTEM = C_FADS AND
               LGCY_PRIME_ACCT = IT_SUBACCT-PRYACT1 AND
               LGCY_SUB_ACCT = IT_SUBACCT-PRYACT2.
        IF SY-SUBRC  = 0.
          SORT IT_GL BY SAP_GL_ACCOUNT
          LGCY_SYSTEM
          LGCY_PRIME_ACCT
          LGCY_SUB_ACCT.
        ENDIF.
        IF NOT IT_LEDGER[] IS INITIAL.
    *Selecting cost center from Cost Center Z Table
          SELECT COST_OBJECT
          LGCY_LDGR
          LGCY_DEPT FROM ZFCFT_CTR_DPT_LG
          INTO TABLE IT_COSTCTR
          FOR ALL ENTRIES IN IT_LEDGER
          WHERE LGCY_LDGR = IT_LEDGER-LGR_ID AND
                LGCY_DEPT = IT_LEDGER-DEPT.
          IF SY-SUBRC = 0.
            SORT IT_COSTCTR BY COST_OBJECT
            LGCY_LDGR
            LGCY_DEPT.
          ENDIF.
        ENDIF.
        IF NOT IT_TAXID[] IS INITIAL.
    *Selecting vendor no from vendor master data
          SELECT A~LIFNR
                 B~BUKRS
                 A~STCD1
                 A~STCD2
                 FROM LFA1 AS A JOIN LFB1 AS B
                 ON ALIFNR = BLIFNR
                 INTO TABLE IT_LFA1
                 FOR ALL ENTRIES IN IT_TAXID
                 WHERE BUKRS = P_BUKRS AND
                (  STCD1 = IT_TAXID-TAXID1 OR
                  STCD2 = IT_TAXID-TAXID2 ).
        ENDIF.
      ENDIF.
    ENDFORM.                    " f_select_data
    *&      Form  f_validate_data
             Validation of input file data
    FORM F_VALIDATE_DATA.
      DATA:L_ERRFLAG TYPE C,              "Error flag
           L_DEPT(4) TYPE N,              "Department
           L_LGR_ID(4) TYPE C,            "Ledger ID
           LV_NO_OF_VENDORS TYPE I,       "No of vendors
           L_SUM(11) TYPE P DECIMALS 2,   "Sum
           LV_MSG1(30) TYPE C,            "Message
           LV_MSG2(25) TYPE C,            "Message
           LV_MSG3(6) TYPE C,             "Message
           LV_MSG4(31) TYPE C,            "Message
           LV_MSG5(53) TYPE C,            "Message
           LV_MSG6(30) TYPE C,            "Message
           LV_MSG7(50) TYPE C.            "Message
      LOOP AT IT_INFILE.
        CLEAR:LV_MSG1,LV_MSG2, LV_MSG3,LV_MSG4,LV_MSG5, LV_MSG6, LV_MSG7.
        CLEAR L_ERRFLAG.
        SORT IT_SUM BY TAX_ID_NO
                       INVOICE_NO.
        CLEAR IT_SUBACCT.
    Validating Primary Sub Acct1 and Acct2.
        READ TABLE IT_GL WITH KEY LGCY_SYSTEM = C_FADS
                   LGCY_PRIME_ACCT = IT_INFILE-PRI_SUBACCT1
                   LGCY_SUB_ACCT  = IT_INFILE-PRI_SUBACCT2 .
        IF SY-SUBRC <> 0.
          LV_MSG1 = 'Primary Sub Acct1 and Acct2'(035).
          L_ERRFLAG = 'X'.
        ENDIF.
        MOVE IT_INFILE-DEPT_WIN_LDGR TO L_DEPT.
        MOVE L_DEPT TO IT_INFILE-DEPT_WIN_LDGR.
        CONCATENATE IT_INFILE-LEDGER_ID1 IT_INFILE-LEDGER_ID2 INTO
    L_LGR_ID.
        CLEAR: IT_COSTCTR.
    Validating Ledger id & department
        READ TABLE IT_COSTCTR WITH KEY LGCY_LDGR = L_LGR_ID
                                 LGCY_DEPT = IT_INFILE-DEPT_WIN_LDGR.
        IF SY-SUBRC <> 0.
          LV_MSG2 = 'Ledger id & department'(036).
          L_ERRFLAG = 'X'.
        ENDIF.
    Validating Tax ID
        CLEAR:IT_LFA1.
        READ TABLE IT_LFA1 WITH KEY STCD2 = IT_INFILE-TAX_ID_NO..
        IF SY-SUBRC <> 0.
          READ TABLE IT_LFA1 WITH KEY STCD1 = IT_INFILE-TAX_ID_NO..
          IF SY-SUBRC <> 0.
            LV_MSG3 = 'Tax ID'(041).
            L_ERRFLAG = 'X'.
          ENDIF.
        ENDIF.
    Checking for no of vendors selected based on tax id. If no of vendors
    selected are more than 1 or 0 then error out the record
        LV_NO_OF_VENDORS = 0.
        LOOP AT IT_LFA1 WHERE STCD1 = IT_INFILE-TAX_ID_NO OR
                              STCD2 = IT_INFILE-TAX_ID_NO.
          LV_NO_OF_VENDORS = LV_NO_OF_VENDORS + 1.
        ENDLOOP.
        IF LV_NO_OF_VENDORS = 0.
          LV_MSG6 = 'No vendor found for TAXID'(037).
          L_ERRFLAG = 'X'.
        ELSEIF LV_NO_OF_VENDORS > 1.
          LV_MSG4 = 'More than one vendor for Tax id'(038).
          L_ERRFLAG = 'X'.
        ENDIF.
    Checking whether KU Document already exists for this Invoice No
        CLEAR IT_INVNO.
        READ TABLE IT_BKPF WITH KEY XBLNR = IT_INFILE-INVOICE_NO.
        IF SY-SUBRC = 0.
          LV_MSG7 = 'KU Document already exists for this Invoice No '(042).
          L_ERRFLAG = 'X'.
        ENDIF.
    Checking whether the invoice header amt is equal to the line items amt
        CLEAR IT_SUM.
        READ TABLE IT_SUM WITH KEY TAX_ID_NO = IT_INFILE-TAX_ID_NO
                       INVOICE_NO = IT_INFILE-INVOICE_NO BINARY SEARCH.
        CLEAR L_SUM.
        L_SUM = IT_INFILE-INV_HEADER_AMT.
        IF L_SUM <> IT_SUM-SUM2.
      LV_MSG5 = 'Header amt is not equal to the sum of all line items'(039).
          L_ERRFLAG = 'X'.
        ENDIF.
    Moving error records to error internal table
        IF L_ERRFLAG = 'X'.
          MOVE IT_INFILE TO IT_ERRORS.
        CONCATENATE 'Invalid:'(040) LV_MSG1 LV_MSG2 LV_MSG3 LV_MSG4 LV_MSG5
                 LV_MSG6 LV_MSG7 INTO IT_ERRORS-MSG SEPARATED BY SPACE.
          APPEND IT_ERRORS.
          CLEAR : IT_ERRORS.
    Deleting all the errors records from the processing internal table
    and moving them to error table
          V_ERR = V_ERR + 1.
          IT_INFILE-ERROR = 'X'.
          MODIFY IT_INFILE TRANSPORTING ERROR.
          CLEAR IT_INFILE.
        ENDIF.
      ENDLOOP.
      DELETE IT_INFILE WHERE ERROR = 'X'.
    Deleting all the line items from the processing internal table where
    atleast one line item is error one
      SORT IT_ERRORS BY TAX_ID_NO
                        INVOICE_NO.
      CLEAR V_ERR_REC.
      LOOP AT IT_ERRORS.
        DELETE IT_INFILE WHERE TAX_ID_NO = IT_ERRORS-TAX_ID_NO AND
                               INVOICE_NO = IT_ERRORS-INVOICE_NO.
        AT NEW INVOICE_NO.
          V_ERR_REC = V_ERR_REC + 1.
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " f_validate_data
    *&      Form  f_error_data
          Processing error data
    FORM F_ERROR_DATA.
      DELETE IT_ERROR WHERE MSG = 'Error in document: BKPFF $ D01030'(E02).
      SORT IT_ERROR BY TAX_ID_NO INVOICE_NO.
      LOOP AT IT_INFILE.
        X_INFILE = IT_INFILE.
        READ TABLE IT_ERROR WITH KEY TAX_ID_NO = IT_INFILE-TAX_ID_NO
                          INVOICE_NO = IT_INFILE-INVOICE_NO BINARY SEARCH.
        IF SY-SUBRC = 0.
          AT NEW INVOICE_NO.
            V_ERR_REC = V_ERR_REC + 1.
          ENDAT.
          MOVE X_INFILE TO IT_ERRORS.
          IT_ERRORS-MSG = IT_ERROR-MSG.
          APPEND IT_ERRORS.
          CLEAR IT_ERRORS.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " f_error_data
    *&      Form  f_display_suc_report
          Display success report
    FORM F_DISPLAY_SUC_REPORT.
      FORMAT COLOR OFF.
      FORMAT COLOR 1 INTENSIFIED OFF.
      SKIP 2.
      WRITE:/1(150) 'SUCCESS REPORT'(S01) CENTERED.
      ULINE /1(150).
      WRITE:/1 SY-VLINE,
             2 'Doc No'(031),
            13 SY-VLINE,
            14 'Company code'(032),
            26 SY-VLINE,
            27 'Fiscal Year'(033),
            40 SY-VLINE,
            41 'Message'(034),
           150 SY-VLINE.
      FORMAT COLOR OFF.
      FORMAT COLOR 5 INTENSIFIED OFF.
      LOOP AT IT_SUCCESS.
        WRITE:/1 SY-VLINE,
                 2 IT_SUCCESS-DOCNUM,
                13 SY-VLINE,
                14 IT_SUCCESS-BUKRS,
                26 SY-VLINE,
                27 IT_SUCCESS-FISYR,
                40 SY-VLINE,
                41 IT_SUCCESS-MSG,
               150 SY-VLINE.
      ENDLOOP.
      ULINE /1(150).
    ENDFORM.                    " f_display_suc_report
    *&      Form  F_populate_bgr00
    To populate BGR00 structure
    FORM F_POPULATE_BGR00.
      PERFORM F_INIT_STRUCTURES USING 'BGR00' C_NODATA.
      CLEAR V_SESS.
      CONCATENATE C_SESS SY-DATUM+4(4) INTO V_SESS SEPARATED BY '-'.
      BGR00-STYPE  = '0'.
      BGR00-GROUP  = V_SESS.
      BGR00-MANDT  = SY-MANDT.
      BGR00-USNAM  = SY-UNAME.
      BGR00-START  = SPACE.
      BGR00-XKEEP  = 'X'.
    ENDFORM.                    " F_populate_bgr00
    *&      Form  F_init_structures
       Form to initialise structures
    FORM F_INIT_STRUCTURES USING TABNAME  LIKE DNTAB-TABNAME
                               I_NODATA LIKE C_NODATA.
      REFRESH IT_NAMETAB.
      CLEAR IT_NAMETAB.
      CALL FUNCTION 'NAMETAB_GET'
           EXPORTING
                LANGU          = SY-LANGU
                TABNAME        = TABNAME
           TABLES
                NAMETAB        = IT_NAMETAB
           EXCEPTIONS
                NO_TEXTS_FOUND = 1.
      IF SY-SUBRC = 0.
        LOOP AT IT_NAMETAB.
          CLEAR V_CHAR.
       CONCATENATE  IT_NAMETAB-TABNAME '-' IT_NAMETAB-FIELDNAME INTO V_CHAR.
          ASSIGN (V_CHAR) TO <F1>.
          <F1> = I_NODATA.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " INIT_STRUCTURES
    *&      Form  f_populate_bbkpf
    To populate BBKPF structure
    FORM F_POPULATE_BBKPF.
      DATA:LV_DAT LIKE BKPF-BUDAT.
      PERFORM F_INIT_STRUCTURES USING 'BBKPF' C_NODATA.
    To post Header record.
      BBKPF-STYPE = '1'.
      BBKPF-TCODE = 'FB01'.
      CLEAR LV_DAT.
      LV_DAT = SY-DATUM.
      WRITE LV_DAT TO BBKPF-BUDAT.
      CLEAR LV_DAT.
      LV_DAT = X_INFILE-INVOICE_DATE.
      WRITE LV_DAT TO BBKPF-BLDAT.
      BBKPF-BLART = C_DOCTYPE.
      BBKPF-BUKRS = P_BUKRS..
      BBKPF-WAERS = X_T001-WAERS.
      BBKPF-XBLNR = X_INFILE-INVOICE_NO.
    ENDFORM.                    " f_populate_bbkpf
    *&      Form  populate_bbseg_c
    To populate BBSEG structure Credit
    FORM POPULATE_BBSEG_C.
      PERFORM F_INIT_STRUCTURES USING 'BBSEG' C_NODATA.
      BBSEG-STYPE = '2'.
      BBSEG-TBNAM = 'BBSEG'.
      BBSEG-NEWBS = '31'.
      READ TABLE IT_LFA1 WITH KEY STCD2 = X_INFILE-TAX_ID_NO .
      IF SY-SUBRC  = 0.
        BBSEG-NEWKO = IT_LFA1-LIFNR.
      ELSE.
        READ TABLE IT_LFA1 WITH KEY STCD1 = X_INFILE-TAX_ID_NO .
        IF SY-SUBRC  = 0.
          BBSEG-NEWKO = IT_LFA1-LIFNR.
        ENDIF.
      ENDIF.
      BBSEG-WRBTR = X_INFILE-INV_HEADER_AMT.
      BBSEG-SGTXT = X_INFILE-INV_DESC.
    ENDFORM.                    " populate_bbseg_c
    *&      Form  POPULATE_BBSEG_D
    To populate BBSEG structure Debit
    FORM POPULATE_BBSEG_D.
      DATA:L_LGR_ID(4) TYPE C. "ledger id
      CLEAR L_LGR_ID.
      PERFORM F_INIT_STRUCTURES USING 'BBSEG' C_NODATA.
      BBSEG-STYPE = '2'.
      BBSEG-TBNAM = 'BBSEG'.
      BBSEG-NEWBS = '40'.
    *Fetching G/L account
      READ TABLE IT_GL WITH KEY LGCY_SYSTEM = C_FADS
                     LGCY_PRIME_ACCT = X_INFILE-PRI_SUBACCT1
                     LGCY_SUB_ACCT  = X_INFILE-PRI_SUBACCT2.
      IF SY-SUBRC = 0.
        BBSEG-NEWKO  = IT_GL-SAP_GL_ACCOUNT.
      ENDIF.
      BBSEG-WRBTR = X_INFILE-INV_LINE_AMT.
      CONCATENATE X_INFILE-LEDGER_ID1 X_INFILE-LEDGER_ID2 INTO
    L_LGR_ID.
    *Fetching  costcenter
      READ TABLE IT_COSTCTR WITH KEY LGCY_LDGR = L_LGR_ID
                               LGCY_DEPT = X_INFILE-DEPT_WIN_LDGR.
      IF SY-SUBRC = 0.
        BBSEG-KOSTL = IT_COSTCTR-COST_OBJECT.
      ENDIF.
      BBSEG-SGTXT = X_INFILE-INV_DESC.
    ENDFORM.                    " POPULATE_BBSEG_D
    *&      Form  f_submit_rfbibloo
         Submit the program to rfbibloo
    FORM F_SUBMIT_RFBIBLOO.
    Submitting the file for RFBIBL00
      SUBMIT RFBIBL00 WITH DS_NAME = V_FILE
                      WITH CALLMODE = 'B'
                      WITH MAX_COMM = '9999'
                      WITH XINF = 'X'
                      AND RETURN.
    Process the session if created successfully
      IF SY-SUBRC = 0.
        SUBMIT RSBDCSUB  WITH MAPPE    = V_SESS
                         WITH Z_VERARB = 'X'
                         WITH FEHLER = ''
                         EXPORTING LIST TO MEMORY
                         AND RETURN.
        IF SY-SUBRC  = 0.
    Displaying the sessions data
          PERFORM F_SESSION_LIST.
        ENDIF.
      ENDIF.
    ENDFORM.                    " f_submit_rfbibloo
    *&      Form  f_session_list
          Displaying the sessions data
    FORM F_SESSION_LIST.
      DATA:LV_UCOMM LIKE SY-UCOMM. "usercommand
      CALL FUNCTION 'LIST_FROM_MEMORY'
           TABLES
                LISTOBJECT = IT_LIST
           EXCEPTIONS
                NOT_FOUND  = 1
                OTHERS     = 2.
      IF NOT IT_LIST[] IS INITIAL.
        CALL FUNCTION 'DISPLAY_LIST'
    EXPORTING
      FULLSCREEN                  = 'X'
      CALLER_HANDLES_EVENTS       =
         IMPORTING
           USER_COMMAND                =  LV_UCOMM
          TABLES
            LISTOBJECT                  = IT_LIST
       EXCEPTIONS
         EMPTY_LIST                  = 1
         OTHERS                      = 2
      ENDIF.
    ENDFORM.                    " f_session_list

Maybe you are looking for