"Invalid Currency" in JE

Dear All,
When posting a JE in foreign currency  (USD)for a BP, the client is getting an error "Invalid Currency" even though the account currency is set to "USD" in the Chart of Accounts. The corresponding contra account is set to 'Multi Currency".
Any solutions?
Regards,
Bharath S

Hi!
What document you are posting ?
JE or Invoice ??
Did all the Tax Accounts, Freight Acc's has set as Multicurrency ?

Similar Messages

  • 'Invalid Currency' error when attempting to deliver order

    Hi Experts,
    I have a sales order which cannot be despatched or invoiced because whenever I try to convert the order into a delivery note or AR Invoice I get error message:
    Invalid Currency [Message 131-74]
    I have also tried adding a delivery note and the Copy From function with no success.
    The BP is set up to use All Currencies and the order is only in GBP.
    Thanks
    Jon

    What version of SAP Business One are you using?
    Have you had a look at SAP Note  # 1252328 ?
    Invalid currency error when copying a Sales Order
    Symptom
    You are managing an item with the FIFO valuation method. You have some open layers with zero cost. You create a Sales Order for this item and want to copy it to the next marketing document: a Delivery or an A/R Invoice. You receive the following error: Invalid currency [Message 131-74]
    Other terms
    OINM,FIFO, zero cost, sales order ,delivery ,invoice
    Reason and Prerequisites
    Application error
    example:
    1.Create item managed by FIFO.
    2.Goods Receipt for item ,quantity10, no price.
    3.Goods Receipt PO for item, quantity 10.price 5
    4.Sales Order for item ,quantity 11,
    5.e.g.copy it to Delivery or AR Invoice
    You will receive the error:Invalid Currency[Message 131-74]
    the same error message when you use the copy from function
    Solution
    SAP plans to fix this issue in a future patch. See the info.txt file on SAP Service Marketplace to verify when the fix was included.
    Apparently its affecting SAP Business One 2007 B Patch 13 and SAP Business One 2007 A Patch 47

  • Copy Sales Order to AR inv - invalid currency # 131-74

    Good morning,
    This one has us stumped...
    Customer copies Sales order to AR invoice,
    There are 2 SO's in question same BP different Shipto, but we can copy 1 to AR invoice, but it will not allow the other one - it gives the error message INVALID CURRENCY - MESSAGE # 131-74
    Please advise
    Thank you

    Hi
    I  am trying to duplicate your issue  and so far no sucess .
    I would like you to check  and answer  some of these ?
    1. when You create sales Order , What currency is it in ?(You can see in the left corner at header level)
    2.When you create /copy of Sales Order >>to A/R ,What is the currency setup by default ?
    3. Is this for only one invoice or it is for multiple ?
    4.Does A/R invoice you are doing transaction has currency setup?
    Administration >setup>Financial > Currency
    5.Your SAP version and patch level
    I hope this will help you to do trouble shooting
    Thank you
    Bishal

  • Invalid currency error when copying order to delivery

    My customer is receiving an error message "Invalid currency" when trying to copy a Sales Order to a Delivery.  Only one document seems to be giving this message, but it does not seem different from other documents.  The document currency is Local Currency (which is USD - also system currency).  Every GL account is set to "all currencies".  The BP currency is USD.  We have tried duplicating the sales order but we get the same results.
    Can anyone think of why this message appears?
    Thank you.
    Marcia

    Hi Marcia ,
    Looks like this would be a good troubleshooting
    1. Check your currency setup and see if there is changes you have found .
    2. Check your change log on Business Master Data to see if there is any change .
    3. Is this coming for particular customer and Does it come everytime for this customer only ?
    4.Also chnage log for Sales Order .
    It might not apply , there is one bug reported ,see if this is the case:1286288
    Test your solution in higher version ans see if resolves automatically  because of potential bug ..
    If not , then ..we will start troubleshooting or log a support to SAP .
    Hope this helps
    Bishal

  • Error -4008, Invalid currency

    Hello,
    After upgrade to SBO 8.8.1 PL4 addon which adds Goods Receipt via DI API returns error message: "Invalid currency".
    I checked SQL profiler and it stops after this line:
    exec sp_executesql N'SELECT T0.[CurrCode] FROM [dbo].[OCRN] T0 WHERE T0.[CurrCode] = (@P1)  ',N'@P1 nvarchar(4)',N'컘༿㄀'
    Databse is with polish localization so i guess that "컘༿㄀'" currency code is the probem. I've also noticed that this currency code is differrent every time.
    Is there any workaround for this issue.??

    Hello Gordon
    Problem was with Price rounding. In addon i used to pass Price with 6 digit precision(price was calculated from Goods Issue value) and system autoamtically rounded it . It worked for SBO 2007A. Now i need to round price as 2 digits and its working fine.
    Anyway for some reason it can be a bug.

  • Invalid currency message 131-74

    hello
    I have this message when i want to create a document in B1
    I use a demo database, where many add-on are installed, maybe it should be the reason?
    So how delete user table and user zone ?
    Thanks
    Sylvain Rouchon

    The error message can be caused by that you try to post something on an account that does not accept the currency (Not set to correct currency or multi-currency)... This often happens in demo database around the tax groups... Try check the tied account to the tax-group and set it to multi-currency in the charts of account..

  • Error Code :-5002 Error Message :Enter valid currency  , '51100000-01-001-0

    Hi all,
             I have found a error "Error Code :-5002 Error Message :Enter valid currency  , '51100000-01-001-01'" while adding the DELIVERY document.
    I have made a customer and assign then "EURO" currency and add delivery document then it prompts error.
    Could anyone solve this problem. is there any setting which i am missing..??
    Regards
    Sandesh

    HI Sandesh,
    Check Sap note :1252328
    and also check below thread of similar issue:
    Re: 'Invalid Currency' error when attempting to deliver order
    Hope this will solve your issue.
    Thanks,
    Neetu

  • Error message: "Enter valid currency [Message 173-57]" during Deposit transaction

    Hi All,
    Is there a specific reason why can't I deposit from a "Multi-currency" cash account to a "specific (i.e., USD)" cash account using the Banking> Deposits> Deposit module.
    I have already read below threads related to this issue.
    Error message "Enter valid currency [Message 173-57]" during cash deposit
    Can't Create Cash Deposit of Journal Entry due to "Invalid Currency" Error
    Transfer Between bank accounts in different currencies
    GL Postings between different currency accounts
    foreign currency transactions
    SAP Business One Note: 1260658 - Transfer monies between different monocurrency accounts
    I have posted successfully e  cash transfer from multicurrency to monocurrency cash account thru Journal Entry, However, I wanted to know the reason why it is not possible to post this transaction thru the Banking> Deposit module.
    Appreciate your feedback on this matter.
    Thanks!

    Hi,
    Same error message is appeared in 8.81 PL10. So this is not due to PL. If you select other than local currency at deposit currency, this error appears.
    Let me check and update.
    Thanks & Regards,
    Nagarajan

  • GL: Import Journal only accept those non-functional currency

    Hi,
    I have tried to run import journal using Oracle General Ledger. However, I found that there is always an error 'EC08 - Invalid currency code' when the records contains functional currency code, e.g. HKD. For all other currencies, like JPY, i.e. non-functional currency, the import journal can then be completed successfully. Kindly please explain how to import journal successfully from the data containing the functional currency, like HKD in the Oracle General Ledger module. Many Thanks.
    Please e-mail answer to [email protected]
    Thanks in advance.

    Hi,
    I have tried to run import journal using Oracle General Ledger. However, I found that there is always an error 'EC08 - Invalid currency code' when the records contains functional currency code, e.g. HKD. For all other currencies, like JPY, i.e. non-functional currency, the import journal can then be completed successfully. Kindly please explain how to import journal successfully from the data containing the functional currency, like HKD in the Oracle General Ledger module. Many Thanks.
    Please e-mail answer to [email protected]
    Thanks in advance.

  • Error while importing the Entries from Payroll

    Dear Guru's
    For the First time we are Import the Entries from Payroll , Request End with the Warning message
    when i check the Out Put file lot of Errors
    eriod Error Codes
    EP01 This date is not in any open or future enterable period.
    EP03 This date is not within any period in an open encumbrance year.
    EP04 This date is not a business day.
    DOHA COA Journal Import Execution Report Date: 21-APR-12 10:16
    Concurrent Request ID: 424967 Page: 11
    ========================================================== Error Key ===========================================================
    Period Error Codes
    EP05 There are no business days in this period.
    Unbalanced Journal Error Codes
    WU01 Warning: This journal entry is unbalanced. It is accepted because suspense posting is allowed in this ledger.
    EU02 This journal entry is unbalanced and suspense posting is not allowed in this ledger.
    EU03 This encumbrance journal entry is unbalanced and the Reserve for Encumbrance account is not defined.
    Flexfield Error Codes
    EF01 This Accounting Flexfield is inactive for this accounting date.
    EF02 Detail posting not allowed for this Accounting Flexfield.
    EF03 Disabled Accounting Flexfield.
    EF04 This is an invalid Accounting Flexfield. Check your cross-validation rules and segment values.
    EF05 There is no Accounting Flexfield with this Code Combination ID.
    EF06 The alternate account is invalid.
    WF01 An alternate account was used instead of the original account.
    WF02 A suspense account was used instead of the original account.
    Foreign Currency Error Codes
    EC01 A conversion rate must be entered when using the User conversion rate type.
    EC02 There is no conversion date supplied.
    EC03 A conversion rate type or an accounted amount must be supplied when entering foreign currency journal lines.
    EC06 There is no conversion rate for this currency, conversion type, and conversion date.
    EC08 Invalid currency code.
    EC09 No currencies are enabled.
    EC10 Encumbrance journals cannot be created in a foreign currency.
    EC11 Invalid conversion rate type.
    EC12 The entered amount must equal the accounted amount in a ledger or STAT currency journal line.
    EC13 Amount is too large.
    ECW1 Warning: Converted amounts could not be validated because the conversion rate type is not specified.
    Budget Error Codes
    EB01 A budget version is required for budget lines.
    EB02 Journals cannot be created for a frozen budget.
    EB03 The budget year is not open.
    EB04 This budget does not exist for this ledger.
    EB05 The encumbrance_type_id column must be null for budget journals.
    EB06 A period name is required for budget journals.
    EB07 This period name is not valid. Check calendar for valid periods.
    EB08 Average journals cannot be created for budgets.
    EB09 Originating company information cannot be specified for budgets.
    Encumbrance Error Codes
    EE01 An encumbrance type is required for encumbrance lines.
    EE02 Invalid or disabled encumbrance type.
    EE03 Encumbrance journals cannot be created in the STAT currency.
    DOHA COA Journal Import Execution Report Date: 21-APR-12 10:16
    Concurrent Request ID: 424967 Page: 12
    ========================================================== Error Key ===========================================================
    Encumbrance Error Codes
    EE04 The BUDGET_VERSION_ID column must be null for encumbrance lines.
    EE05 Average journals cannot be created for encumbrances.
    EE06 Originating company information cannot be specified for encumbrances.
    Reversal Error Codes
    ER01 A reversal period name must be provided.
    ER02 This reversal period name is invalid. Check your calendar for valid periods.
    ER03 A reversal date must be provided
    ER04 This reversal date is not in a valid period.
    ER05 This reversal date is not in your database date format.
    ER06 Your reversal date must be the same as or after your effective date.
    ER07 This reversal date is not a business day.
    ER08 There are no business days in your reversal period.
    ER09 Default reversal information could not be determined.
    Descriptive Flexfield Error Codes
    ED01 The context and attribute values do not form a valid descriptive flexfield for Journals - Journal Entry Lines.
    ED02 The context and attribute values do not form a valid descriptive flexfield for Journals - Captured Information.
    ED03 The context and attribute values do not form a valid descriptive flexfield for Value Added Tax.
    Miscellaneous Error Codes
    EM01 Invalid journal entry category.
    EM02 There are no journal entry categories defined.
    EM04 The value in the ACTUAL_FLAG must be "A" (actuals), "B" (budgets), or "E" (encumbrances).
    EM05 The encumbrance_type_id column must be null for actual journals.
    EM06 The budget_version_id column must be null for actual journals.
    EM07 A statistical amount belongs in the entered_dr(cr) column when entering a STAT currency journal line.
    EM09 There is no Transaction Code defined.
    EM10 Invalid Transaction Code.
    EM12 An Oracle error occurred when generating sequential numbering.
    EM13 The assigned sequence is inactive.
    EM14 There is a sequential numbering setup error resulting from a missing grant or synonym.
    EM17 Sequential numbering is always used and there is no assignment for this ledger and journal entry category.
    EM18 Manual document sequences cannot be used with Journal Import.
    EM19 Value Added Tax data is only valid in conjunction with actual journals.
    EM24 Average journals can only be imported into consolidation ledgers.
    EM25 Invalid average journal flag. Valid values are "Y", "N", and null.
    EM26 Invalid originating company.
    EM27 Originating company information can only be specified when intercompany balancing is enabled.
    EM29 You do not have access to this ledger and account combination.
    EM30 This balancing segment value is not valid for this ledger.
    EM31 This management segment value is not valid for this ledger.
    ** Batches listed under "Unbalanced Batches**" have not been imported.
    Edited by: 912775 on Apr 21, 2012 1:00 AM

    Hi Bharat17an,
    Please provide the detail information when create the MySQL connection in your PowerPivot model. Here is a good article regarding "how to Use MySQL and Microsoft PowerPivot Together" for your reference, please see:
    http://www.datamensional.com/2011/09/how-to-use-mysql-and-microsoft-powerpivot-together-2/
    If this issue still persists, please help to collection windows event log information. It maybe helpful for us to troubleshoot this issue.
    Regards,
    Elvis Long
    TechNet Community Support

  • Not able to post an accrual jnl in Oracle GL

    Journal Import Execution Report Date: 18-MAR-09 10:11
    Concurrent Request ID: 946366 Page: 1
    Total Total Total Total Unbalanced Total Unbalanced Total Flex Total Non-Flex
    Journal Entry Source Name Group Id Status Lines Batches Headers Batches Headers Errors Errors
    Spreadsheet Error 2 1 1 0 0 0 2
    *** TOTALS *** 2 1 1 0 0 0 2
    ======================================================= Batches Created ========================================================
    Total Total Total Total
    Warning Batch Name Period Name Lines Headers Accounted Debits Accounted Credits
    ================================================== Batches Posted to Suspense ==================================================
    Flexfield Line
    Error Code Batch Name Period Name Header Name Number Accounting Flexfield
    ================================================= Unbalanced Journal Entries** =================================================
    Error Total
    Code Journal Entry Name Batch Name Lines Period Name Total Debits Total Credits
    ========================================================= Error Lines ==========================================================
    Accounting
    Error Code Source Date Currency Entered Debit Entered Credit Accounting Flexfield/CCID
    ER09 Spreadsheet 31-MAR-09 AUD 1 0 21.34110.0000.00.71402.767
    ER09 Spreadsheet 31-MAR-09 AUD 0 1 21.00000.0000.90.71410.000
    ========================================================== Error Key ===========================================================
    Period Error Codes
    EP01 This date is not in any open or future enterable period.
    EP02 This set of books does not have any open or future enterable periods.
    EP03 This date is not within any period in an open encumbrance year.
    EP04 This date is not a business day.
    EP05 There are no business days in this period.
    XX Journal Import Execution Report Date: 18-MAR-09 10:11
    Concurrent Request ID: 946366 Page: 2
    ========================================================== Error Key ===========================================================
    Unbalanced Journal Error Codes
    WU01 Warning: This journal entry is unbalanced. It is accepted because suspense posting is allowed in this set of books.
    EU02 This journal entry is unbalanced and suspense posting is not allowed in this set of books.
    EU03 This encumbrance journal entry is unbalanced and the Reserve for Encumbrance account is not defined.
    Flexfield Error Codes
    EF01 This Accounting Flexfield is inactive for this accounting date.
    EF02 Detail posting not allowed for this Accounting Flexfield.
    EF03 Disabled Accounting Flexfield.
    EF04 This is an invalid Accounting Flexfield. Check your cross-validation rules and segment values.
    EF05 There is no Accounting Flexfield with this Code Combination ID.
    Foreign Currency Error Codes
    EC01 A conversion rate must be entered when using the User conversion rate type.
    EC02 There is no conversion date supplied.
    EC03 A conversion rate type or an accounted amount must be supplied when entering foreign currency journal lines.
    EC06 There is no conversion rate for this currency, conversion type, and conversion date.
    EC08 Invalid currency code.
    EC09 No currencies are enabled.
    EC10 Encumbrance journals cannot be created in a foreign currency.
    EC11 Invalid conversion rate type.
    EC12 The entered amount must equal the accounted amount in a functional or STAT currency journal line.
    EC13 Amount is too large.
    ECW1 Warning: Converted amounts could not be validated because the conversion rate type is not specified.
    Budget Error Codes
    EB01 A budget version is required for budget lines.
    EB02 Journals cannot be created for a frozen budget.
    EB03 The budget year is not open.
    EB04 This budget does not exist for this set of books.
    EB05 The encumbrance_type_id column must be null for budget journals.
    EB06 A period name is required for budget journals.
    EB07 This period name is not valid. Check calendar for valid periods.
    EB08 Average journals cannot be created for budgets.
    EB09 Originating company information cannot be specified for budgets.
    Encumbrance Error Codes
    EE01 An encumbrance type is required for encumbrance lines.
    EE02 Invalid or disabled encumbrance type.
    EE03 Encumbrance journals cannot be created in the STAT currency.
    EE04 The BUDGET_VERSION_ID column must be null for encumbrance lines.
    EE05 Average journals cannot be created for encumbrances.
    EE06 Originating company information cannot be specified for encumbrances.
    Reversal Error Codes
    ER01 A reversal period name must be provided.
    XXXXXXX Journal Import Execution Report Date: 18-MAR-09 10:11
    Concurrent Request ID: 946366 Page: 3
    ========================================================== Error Key ===========================================================
    Reversal Error Codes
    ER02 This reversal period name is invalid. Check your calendar for valid periods.
    ER03 A reversal date must be provided
    ER04 This reversal date is not in a valid period.
    ER05 This reversal date is not in your database date format.
    ER06 Your reversal date must be the same as or after your effective date.
    ER07 This reversal date is not a business day.
    ER08 There are no business days in your reversal period.
    ER09 Default reversal information could not be determined.
    Descriptive Flexfield Error Codes
    ED01 The context and attribute values do not form a valid descriptive flexfield for Journals - Journal Entry Lines.
    ED02 The context and attribute values do not form a valid descriptive flexfield for Journals - Captured Information.
    ED03 The context and attribute values do not form a valid descriptive flexfield for Value Added Tax.
    Miscellaneous Error Codes
    EM01 Invalid journal entry category.
    EM02 There are no journal entry categories defined.
    EM03 Invalid set of books id.
    EM04 The value in the ACTUAL_FLAG must be "A" (actuals), "B" (budgets), or "E" (encumbrances).
    EM05 The encumbrance_type_id column must be null for actual journals.
    EM06 The budget_version_id column must be null for actual journals.
    EM07 A statistical amount belongs in the entered_dr(cr) column when entering a STAT currency journal line.
    EM09 There is no Transaction Code defined.
    EM10 Invalid Transaction Code.
    EM12 An Oracle error occurred when generating sequential numbering.
    EM13 The assigned sequence is inactive.
    EM14 There is a sequential numbering setup error resulting from a missing grant or synonym.
    EM17 Sequential numbering is always used and there is no assignment for this set of books and journal entry category.
    EM18 Manual document sequences cannot be used with Journal Import.
    EM19 Value Added Tax data is only valid in conjunction with actual journals.
    EM21 Budgetary Control must be enabled to import this batch.
    EM22 A conversion rate must be defined for this accounting date, your default conversion rate type, and your dual currency.
    EM23 There is no value entered for the Dual Currency Default Rate Type profile option.
    EM24 Average journals can only be imported into consolidation sets of books.
    EM25 Invalid average journal flag. Valid values are "Y", "N", and null.
    EM26 Invalid originating company.
    EM27 Originating company information can only be specified when intercompany balancing is enabled.
    ** Batches listed under "Unbalanced Batches**" have not been imported.
    ***** End of Report *****
    I am geting the above report output, Please suggest.
    Thanks in advance,
    Ajit

    General Ledger: Version : 11.5.0 - Development
    Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
    GLPPOS module: Posting
    Current system time is 27-JUN-2011 08:55:27
    glpmai() 27-JUN-2011 08:55:27SHRD0176: GLPPOS started in debug mode...
    PPOS0003: *** Posting Process Started ***
    PPOS0004: All phases to posting will be detailed in this log.
    PPOS0219: glpmai() - Your Posting Run ID is 32403
    glpini() 27-JUN-2011 08:55:27
    gllock() 27-JUN-2011 08:55:27SHRD0181: glpini - Lock Name = GL_OPEN_POST_20609
    gludlk() 27-JUN-2011 08:55:27<< gludlk() 27-JUN-2011 08:55:27
    SHRD0180: glpini - Performing action >> Placed SHARE_MODE lock...
    << gllock() 27-JUN-2011 08:55:27
    SHRD0180: glpini() - Performing action >> check_batches_exist...
    glusts() 27-JUN-2011 08:55:27
    glucce() 27-JUN-2011 08:55:27
    glugsn() 27-JUN-2011 08:55:27<< glugsn() 27-JUN-2011 08:55:27
    << glucce() 27-JUN-2011 08:55:27
    << glusts() 27-JUN-2011 08:55:27
    Secondary tracking segment disabled
    SHRD0180: glpini() - Performing action >> get_bal_seg_name...
    SHRD0180: glpini() - Performing action >> get_sob_info...
    SHRD0181: glpini() - MRC TYPE = P
    SHRD0180: glpini() - Performing action >> update_batch_status...
    glpuch() 27-JUN-2011 08:55:27SHRD0180: glpuch() - Performing action >> update_cons_history(G/D/F)...
    << glpuch() 27-JUN-2011 08:55:27
    glpueh() 27-JUN-2011 08:55:27SHRD0180: glpueh() - Performing action >> update_elim_history(G/D/F)...
    << glpueh() 27-JUN-2011 08:55:27
    SHRD0180: glpini() - Performing action >> check_mrc_rpt_sob_exist...
    SHRD0180: glpini() - Performing action >> check_budget_jes_exist...
    SHRD0180: glpini() - Performing action >> check_mixed_stat_jes_exist...
    SHRD0180: glpini() - Performing action >> check_adj_periods_exist...
    SHRD0181: glpini() - control->sob_id = 20609
    SHRD0181: glpini() - control->coa_id = 52930
    SHRD0181: glpini() - control->prun_id = 32403
    SHRD0181: glpini() - control->func_curr_code = INDIAN
    SHRD0181: glpini() - control->period_set_name = DHEERAJ
    SHRD0181: glpini() - control->period_type = 685
    SHRD0181: glpini() - control->net_income_ccid = 0
    SHRD0181: glpini() - control->rounding_ccid = 0
    SHRD0181: glpini() - control->cons_sob = FALSE
    SHRD0181: glpini() - control->ab_enabled = FALSE
    SHRD0181: glpini() - control->bc_enabled = FALSE
    SHRD0181: glpini() - control->ic_allowed = TRUE
    SHRD0181: glpini() - control->sus_allowed = TRUE
    SHRD0181: glpini() - control->track_rounding_imbal = FALSE
    SHRD0181: glpini() - control->tax_enabled = TRUE
    SHRD0181: glpini() - control->aprv_enabled = FALSE
    SHRD0181: glpini() - control->batches_exist = TRUE
    SHRD0181: glpini() - control->actual_ab_jes_exist = FALSE
    SHRD0181: glpini() - control->foreign_ab_jes_exist = FALSE
    SHRD0181: glpini() - control->budget_jes_exist = FALSE
    SHRD0181: glpini() - control->mixed_stat_jes_exist = FALSE
    SHRD0181: glpini() - control->adj_periods_exist = FALSE
    SHRD0181: glpini() - control->cons_jes_exist = FALSE
    SHRD0181: glpini() - control->acct_cat_bal = FALSE
    SHRD0181: glpini() - control->mrc_primary_sob = FALSE
    SHRD0181: glpini() - control->max_days_roll_fwd = 32
    SHRD0181: glpini() - control->min_aggregate_num = 0
    SHRD0181: glpini() - control->max_aggregate_num = 0
    SHRD0181: glpini() - control->industry = C
    SHRD0181: glpini() - control->bal_seg_name = SEGMENT1
    SHRD0181: glpini() - control->bal_seg_num = 0
    SHRD0181: glpini() - control->user_name = DHEERAJ
    SHRD0181: glpini() - control->user_id = 1008079
    SHRD0181: glpini() - control->login_id = 2894296
    SHRD0181: glpini() - control->request_id = 3130531
    SHRD0181: glpini() - control->program_id = 101
    SHRD0181: glpini() - control->dmode = TRUE
    << glpini() 27-JUN-2011 08:55:27
    glppva() 27-JUN-2011 08:55:27SHRD0180: glppva() - Performing action >> Check for untaxed journals...
    << glppva() 27-JUN-2011 08:55:27
    glpmpi() 27-JUN-2011 08:55:27
    gluddl() 27-JUN-2011 08:55:27<< gluddl() 27-JUN-2011 08:55:27
    gluddl() 27-JUN-2011 08:55:27-- gluddl ad.do_ddl error buffer begin
    do_ddl(APPLSYS, SQLGL, 1, $statement$, gl_posting_interim_32403): private_do_ddl(APPS, APPLSYS, GL, 1, $statement$, GL_POSTING_INTERIM_32403): do_cd_tab_cd_seq(0, APPS, GL, 1, GL_POSTING_INTERIM_32403, $statement$): : do_apps_ddl(GL, $statement$): : substr($statement$,1,255)='
    create table gl_posting_interim_32403
         (code_combination_id number(15) not null,
         period_name     varchar2(15) not null,
         set_of_books_id number(15) not null,
         currency_code varchar2(15) not null,
         period_year     number(15),
         pe'
    -- gluddl ad.do_ddl error buffer end
    -- gluddl Message Dictionary Start:
    do_ddl(APPLSYS, SQLGL, 1, $statement$, gl_posting_interim_32403): private_do_ddl(APPS, APPLSYS, GL, 1, $statement$, GL_POSTING_INTERIM_32403): do_cd_tab_cd_seq(0, APPS, GL, 1, GL_POSTING_INTERIM_32403, $statement$): : do_apps_ddl(GL, $statement$): : substr($statement$,1,255)='
    create table gl_posting_interim_32403
         (code_combination_id number(15) not null,
         period_name     varchar2(15) not null,
         set_of_books_id number(15) not null,
         currency_code varchar2(15) not null,
         period_year     number(15),
         pe'
    ORA-01658: unable to create INITIAL extent for segment in tablespace A
    -- gluddl Message Dictionary End
    <x gluddl() 27-JUN-2011 08:55:27
    SHRD0187: Encountered the following error in routine gluddl():
    ORA-01658: unable to create INITIAL extent for segment in tablespace A
    SHRD0030: glpmpi() encountered an error returning from err_gluddl:
    <x glpmpi() 27-JUN-2011 08:55:27
    gluerr() 27-JUN-2011 08:55:27Error in ROUTINE: glpmpi, status: 0
    SHRD0043: ERROR:
    sqlcaid: sqlabc: 0 sqlcode: 0 sqlerrml: 0
    sqlerrmc:
    ORA-01658: unable to create INITIAL extent for segment in tablespace A
    sqlerrp:      sqlerrd: 0 0 1 0 0 0
    sqlwarn: sqltext:
    SHRD0044: Process logging off database and exiting ...
    glpuch() 27-JUN-2011 08:55:27SHRD0180: glpuch() - Performing action >> update_cons_history(G/D/F)...
    << glpuch() 27-JUN-2011 08:55:27
    glpueh() 27-JUN-2011 08:55:27SHRD0180: glpueh() - Performing action >> update_elim_history(G/D/F)...
    << glpueh() 27-JUN-2011 08:55:27
    PPOS0002: Posting terminated with fatal errors
    <x glpmai() 27-JUN-2011 08:55:27
    Executing request completion options...
    Finished executing request completion options.
    GLPPOS - process exiting with failure.
    Exceptions posted by this request:
    Concurrent Request for "Posting" has completed with error.
    Concurrent request completed
    Current system time is 27-JUN-2011 08:55:27
    please help me to solve this problem when iam trying to post journals in GL Iam getting this error messages

  • UDF's are gone after installing SP1

    I loaded the Webtools 6 SP1 and now my UDF's are not there in SAP (BP, Warehouses, etc..) I do not see anything different on my Synch Manager, and I am getting errors..in webtools
    Invalid currency - must be ISO 2417 compliant? What is that?
    My theme is the basic that came with the update, I was able to synch BP, items, catagories, etc...but cannot place an order as a customer without the error and I am sure my UDF's missing are part of it
    I was doing so well too! Thanks again for anyone's/everyone's help.
    Joanne

    Hi Joanne
    Under currencies in the Admin, you need to have USD for the ISO code, and not "$". B1 allows this, but it does not follow the standards of ecommerce currency display.
    As for the UDF's, the Install Plugin operation in the synch manager only adds UDF's(if they are not there already) that are relevant to Web tools, and absolutely does not remove anything. There are no delete commands in that process, so it might have been something else.
    Hope this helps!

  • Mail report spool as an attachment in a background job :)

    Hi all,
    I am trying to write a BDC for some transaction .The program runs in background .So it genertaes the spool . Now I want to mail the whole spool as an attachment . I have tried in many ways but in vain . Even the previous posts in this forum did not help much .
    <b>Two quoestions for whch I couldnt find answers are :
    How do I capture the spool ?
    How do I make an attachment with the contents of the spool ?</b>
    Can anyone please help me out with suggestions to work out this process ?
    Regards,
    Vijay . .

    hi
    check the following code. recetly i worked on the same scenario.
    *& Report ZGL0080 *
    report zgl0080 "FI DOCUMENT POSTING INTERFACE
    no standard page heading
    line-size 160. "120.
    Program Name : ZGL0080
    Program Title : FI DOCUMENT POSTING INTERFACE
    Copied from : N/A
    Release : ecc 5.0
    Module : FI
    Description : This program will read the data (given in the
    required format) either from the frontend or from
    the server and will post the FI document using
    that data.
    Authority Check : Auhority Check for Reading the Input Data File on
    the Server is done.
    Note : Ensure the 'Do not copy tax code' option in the Editing option
    is marked.
    Modification History
    Mod.
    Date Code Changed by Description
    ddmmyy M001
    I N C L U D E P R O G R A M S *
    include zglp001.
    include rsbdcil3.
    data: v_vbund(6) type c.
    Copy from RSBDC_PROTOCOL
    data: begin of bdclm occurs 0.
    include structure bdclm.
    data: counter type i,
    longtext type bdc_mpar,
    end of bdclm.
    data: save_mpar type bdc_mpar.
    data:
    digits(10) type c value '0123456789',
    mtext(124) type c, "Messagetext
    mtext1(124) type c, "Messagetext
    mtext2(273) type c, "Messagetext
    do_condense type c,
    mtvaroff type i,
    parcnt type i,
    mparcnt type i,
    x(1) type c value 'X'.
    data: "Aufbereitung Messagetext
    begin of mttab occurs 4,
    off(02) type n,
    len(02) type n,
    text(80),
    end of mttab.
    data: "ParameterAufbereitung
    begin of par,
    len(02) type n,
    text(254),
    end of par.
    field-symbols:
    End of Copy from RSBDC_PROTOCOL
    TYPE GROUPS *
    type-pools: slis,
    sabc.
    T A B L E S *
    tables: bbkpf, "Doc Header for Accntng Document (Batch Input Structure)
            bbseg, "Accounting Document Segment (Batch Input Structure)
            bwith, "Document-withholding tax info (batch input structure)
            bbtax, "Document Taxes (Batch Input Structure)
            ztif_file,"Interface Data Filenames
            t100, "Messages
            t003,"Document Types
            t041c, "Reasons for Reverse Posting
            t007a,"Tax Keys
            t036,"Planning levels
            t880, "trading partner
            ztifpr, "interface files that are processed
            t856, "consolidation transaction types
            tka02."Controlling area assignment
    S E L E C T I O N S C R E E N *
    selection-screen begin of block b1 with frame title text-105."Parameters
    PC Filename
    selection-screen begin of line.
    parameters: p_rpfile radiobutton group rgp default 'X'.
    selection-screen comment 6(40) text-p01 for field p_rpfile.
    selection-screen position 47.
    parameters: p_pfile like rlgrap-filename
    default 'c:     emp ipost.txt'.
    selection-screen end of line.
    PC File format in tab delimited format
    selection-screen begin of line.
    selection-screen position 3.
    parameters: p_pctab radiobutton group rgp2 default 'X'.
    selection-screen comment 5(20) text-p10 for field p_pctab.
    PC File format in comma delimited format (csv)
    selection-screen position 27.
    parameters: p_pccsv radiobutton group rgp2.
    selection-screen comment 29(20) text-p18 for field p_pccsv.
    PC File format in fixed length format
    selection-screen position 51.
    parameters: p_pcfix radiobutton group rgp2.
    selection-screen comment 53(20) text-p11 for field p_pcfix.
    selection-screen end of line.
    selection-screen skip.
    Read from interface directory <NFS>
    selection-screen begin of line.
    parameters:p_rnfile radiobutton group rgp. "File on the Server
    selection-screen comment 5(40) text-p19 for field p_rnfile.
    *selection-screen position 47.
    *parameters: p_nffile type c length 98 lower case
    default '/usr/sap/XXX/int/XXX/in'.
    selection-screen end of line.
    Interface file in Directory
    selection-screen begin of line.
    selection-screen comment 3(43) text-p20.
    selection-screen position 47.
    parameters: p_nffile type c length 90 lower case
    default 'leave blank!!!'.
    default '/usr/sap/CRD/interface/FMS/'.
    default '/sapdata/interface/as400/'.
    selection-screen end of line.
    selection-screen skip.
    Server Filename
    selection-screen begin of line.
    parameters:p_rsfile radiobutton group rgp. "File on the Server
    **parameters:p_rsfile(1) type c no-display.
    selection-screen comment 5(40) text-p02 for field p_rsfile.
    selection-screen position 47.
    parameters: p_sfile type c length 98 lower case
    default 'fipost.txt'.
    default 'fipost.txt' no-display.
    selection-screen end of line.
    Server File Input Directory
    selection-screen begin of line.
    selection-screen comment 3(40) text-p03.
    selection-screen position 47.
    parameters: p_sdir type c length 40 lower case"OBLIGATORY
    default '/usr/sap/SYSID/interface/xxx/in/'.
    default '/usr/sap/CRD/interface/FMS/'.
    default '/sapdata/interface/as400/'.
    selection-screen end of line.
    Server File Output Directory
    selection-screen begin of line.
    selection-screen comment 3(40) text-p04.
    selection-screen position 47.
    parameters: p_sdiro type c length 40 lower case"OBLIGATORY
    default '/usr/sap/SYSID/interface/xxx/out/'.
    default '/sapdata/interface/as400/'.
    selection-screen end of line.
    Name of Batch input session
    selection-screen begin of line.
    selection-screen comment 3(40) text-p13.
    selection-screen position 47.
    parameters: p_group(9) default 'FIPOST' obligatory.
    selection-screen end of line.
    remove trading partner value if GL account is NOT found in table ZTGL003
    selection-screen skip.
    parameters: p_tdpr as checkbox default 'X'.
    Keep Server File after processed
    *selection-screen begin of line.
    *selection-screen position 3.
    parameters: p_keep as checkbox default 'X'.
    parameters: p_keep default ' ' no-display.
    *selection-screen comment 6(40) text-p09 for field p_keep.
    *selection-screen end of line.
    selection-screen skip.
    Daily Files from table
    selection-screen begin of line.
    parameters: p_rdfile radiobutton group rgp.
    parameters: p_rdfile no-display.
    selection-screen comment 3(40) text-p05 for field p_rdfile.
    selection-screen end of line.
    selection-screen skip.
    selection-screen skip.
    Weekly Files from table
    selection-screen comment 3(40) text-p06.
    selection-screen begin of line.
    parameters: p_rw1f radiobutton group rgp.
    parameters: p_rw1f no-display.
    selection-screen comment 5(10) text-pw1 for field p_rw1f.
    selection-screen position 17.
    parameters: p_rw2f radiobutton group rgp.
    parameters: p_rw2f no-display.
    selection-screen comment 19(10) text-pw2 for field p_rw2f.
    selection-screen position 31.
    parameters: p_rw3f radiobutton group rgp.
    parameters: p_rw3f no-display.
    selection-screen comment 33(10) text-pw3 for field p_rw3f.
    selection-screen position 45.
    parameters: p_rw4f radiobutton group rgp.
    parameters: p_rw4f no-display.
    selection-screen comment 47(10) text-pw4 for field p_rw4f.
    selection-screen position 59.
    parameters: p_rw5f radiobutton group rgp.
    parameters: p_rw5f no-display.
    selection-screen comment 61(10) text-pw5 for field p_rw5f.
    selection-screen end of line.
    selection-screen begin of line.
    parameters: p_rw6f radiobutton group rgp.
    parameters: p_rw6f no-display.
    selection-screen comment 5(10) text-pw6 for field p_rw6f.
    selection-screen position 17.
    parameters: p_rw7f radiobutton group rgp.
    parameters: p_rw7f no-display.
    selection-screen comment 19(10) text-pw7 for field p_rw7f.
    selection-screen end of line.
    selection-screen skip.
    selection-screen skip.
    Monthly Files from table
    selection-screen comment 3(40) text-p07.
    selection-screen begin of line.
    parameters: p_rm1f radiobutton group rgp.
    parameters: p_rm1f no-display.
    selection-screen comment 5(15) text-pm1 for field p_rm1f.
    selection-screen position 21.
    parameters: p_rm4f radiobutton group rgp.
    parameters: p_rm4f no-display.
    selection-screen comment 23(15) text-pm4 for field p_rm4f.
    selection-screen end of line.
    selection-screen skip.
    Yearly Files from table
    selection-screen begin of line.
    parameters: p_ryfile radiobutton group rgp.
    parameters: p_ryfile no-display.
    selection-screen comment 3(40) text-p08 for field p_ryfile.
    selection-screen end of line.
    Single Files from table
    selection-screen begin of line.
    parameters: p_rafile radiobutton group rgp.
    parameters: p_rafile no-display.
    selection-screen comment 3(40) text-p12 for field p_rafile.
    selection-screen position 47.
    parameters: p_fileno like ztif_file-fileno.
    parameters: p_fileno no-display.
    matchcode object zsh_if_file.
    selection-screen end of line.
    selection-screen end of block b1.
    Batch Input Parameters
    selection-screen begin of block b2 with frame title text-119.
    selection-screen begin of line.
    selection-screen comment 1(40) text-p15. "Data Transfer Mode
    selection-screen end of line.
    Posting via batch mode
    selection-screen begin of line.
    parameters: p_rmodeb radiobutton group rgp3 default 'X'.
    selection-screen comment 3(25) text-p16 for field p_rmodeb.
    Direct posting
    selection-screen position 29.
    parameters: p_rmodec radiobutton group rgp3.
    selection-screen comment 31(25) text-p17 for field p_rmodec.
    selection-screen end of line.
    parameters: p_mode like ctu_params-dismode default 'N'.
    selection-screen skip.
    parameters: p_test as checkbox default 'X'. "Test Run
    selection-screen end of block b2.
    D A T A D E C L A R A T I O N *
    constants: c_fb01 like bbkpf-tcode value 'FB01',
    c_fbv1 like bbkpf-tcode value 'FBV1',
    c_fbb1 like bbkpf-tcode value 'FBB1',
    c_fbs1 like bbkpf-tcode value 'FBS1'.
    constants: c_daily value 'D',
    c_weekly value 'W',
    c_monthly value 'M',
    c_yearly value 'Y',
    c_filelength type i value 128,
    no_data value '/', "no data character
    c_server_tmp_path type string
    value '/usr/sap/interface/tmp/',
    c_error value 'E',
    c_success value 'S'.
    data: c_server_tmp_path type string
    value '/usr/sap/CRD/interface/fms/out/'.
    data: t_rawfile(1000) occurs 0 with header line,
    t_errfile(1000) occurs 0 with header line.
    data: begin of g_file_hdr_rec,
    stype type bbkpf-stype,"Batch Input Interface Record Type
    tcode type bbkpf-tcode,"Transaction Code
    bldat type bbkpf-bldat,"Document Date (batch input)
    blart type bbkpf-blart,"Document type
    bukrs type bbkpf-bukrs,"Company Code
    budat type bbkpf-budat,"Posting Date (batch input)
    waers type bbkpf-waers,"Currency Key
    kursf type bbkpf-kursf,"Exchange Rate Direct Quotation
    xblnr type bbkpf-xblnr,"Reference Document Number
    bktxt type bbkpf-bktxt,"Document Header Text
    vbund type bbkpf-vbund,"Company ID of Trading Partner
    stodt type bbkpf-stodt,"Reversal Posting Date (batch input)
    stgrd type bbkpf-stgrd,"Reason for Reversal
    end of g_file_hdr_rec.
    data: begin of g_file_item_rec,
    stype type bbseg-stype,"Batch Input Interface Record Type
    newbs type bbseg-newbs,"Posting Key for the Next Line Item
    newko type bbseg-newko,"Account or Matchcode for Next Line Item
    wrbtr type bbseg-wrbtr,"Amount in document currency
    dmbtr type bbseg-dmbtr,"Amount in local currency
    fwbas type bbseg-fwbas, "Tax Base Amount in Document Currency
    hwbas type bbseg-hwbas, "Tax Base Amount in Local Currency
    mwskz type bbseg-mwskz,"Tax on Sales/Purchases Code
    zuonr type bbseg-zuonr,"Assignment number
    sgtxt type bbseg-sgtxt,"Item Text
    fdlev type bbseg-fdlev,"Planning level
    zfbdt type bbseg-zfbdt,"Baseline Date
    zterm type bbseg-zterm,"Terms of payment key
    zlsch type bbseg-zlsch,"Payment Method
    zlspr type bbseg-zlspr,"Payment Block Key
    qsskz_i type bbseg-qsskz,"Withholding Tax Code for Invoice
    qsskz_p type bbseg-qsskz,"Withholding Tax Code for Payment
    kostl type bbseg-kostl,"Cost Center
    aufnr type bbseg-aufnr,"Order Number
    prctr type bbseg-prctr,"Profit Center
    vbund type bbseg-vbund,"Company ID of Trading Partner
    newum like bbseg-newum, "Spl G/L Indicator for Next Line Item
    newbw like bbseg-newbw, "asset transaction type
    gsber like bbseg-gsber, "business area
    hbkid like bbseg-hbkid, "house bank
    for extended withholding tax at invoice
    witht_i like bwith-witht, "withhold tax type
    wt_qsshb_i like bwith-wt_qsshb, "withhold tax base amt in Doc Curry
    wt_qsshh_i like bwith-wt_qsshh, "withhold tax base amt in Loc Curry
    wt_qbuihb_i like bwith-wt_qbuihb, "withholding tax amt in Doc Curry
    wt_qbuihh_i like bwith-wt_qbuihh, "withholding tax amt in Loc Curry
    for extended withholding tax at payment
    witht_p like bwith-witht, "withhold tax type
    wt_qsshb_p like bwith-wt_qsshb, "withhold tax base amt in Doc Curry
    wt_qsshh_p like bwith-wt_qsshh, "withhold tax base amt in Loc Curry
    wt_qbuihb_p like bwith-wt_qbuihb, "withholding tax amt in Doc Curry
    wt_qbuihh_p like bwith-wt_qbuihh, "withholding tax amt in Loc Curry
    valut like bbseg-valut, "value date
    bewar like bbseg-bewar, "consolidation transaction type
    end of g_file_item_rec.
    data: begin of t_doc_hdr occurs 1,
    file_row_no type i,
    runno(10).
    include structure g_file_hdr_rec.
    data: hwaer like bkpf-hwaer.
    data: end of t_doc_hdr.
    data: begin of t_doc_item occurs 1,
    file_row_no type i,
    runno(10),
    item_no type i.
    include structure g_file_item_rec.
    data: rke_prctr like bbseg-rke_prctr,
    katyp like cskb-katyp,
    end of t_doc_item.
    data: t_bidoc_hdr like t_doc_hdr occurs 1 with header line,
    t_bidoc_item like t_doc_item occurs 1 with header line.
    data: t_errdoc_hdr like t_doc_hdr occurs 1 with header line,
    t_errdoc_item like t_doc_item occurs 1 with header line.
    data: t_datafile type string occurs 1 with header line.
    data: t_abaplist like abaplist occurs 0 with header line,
    t_asciilist like solisti1 occurs 0 with header line.
    data: g_server_file like ibipparms-path,
    g_server_tmp_file like ibipparms-path,
    g_server_prc_file like ibipparms-path,
    g_server_err_file like ibipparms-path.
    data: g_doc_hdr_err,
    g_doc_item_err,
    g_doc_hdr_read_cnt type i,
    g_doc_item_read_cnt type i,
    g_total_rec_read_cnt type i.
    data: g_doc_check type i,
    g_doc_posted type i,
    g_doc_error type i.
    data: g_title2 like sy-title.
    data: g_session_name like bgr00-group,
    g_bdc_prog_name like sy-repid value 'RFBIBL01'.
    data: g_start_time like sy-uzeit,
    g_end_time like sy-uzeit.
    data: g_prog_call_mode.
    data: g_job_error. "To indicate overall job is success
    data: gztifpr type ztifpr,
    g_housekeep_stat(1) type c.
    data: subrc_file like sy-subrc,
    i_listfile LIKE BTCXPM OCCURS 0 WITH HEADER LINE.
    data: fname LIKE RLGRAP-FILENAME.
    constants: cmd_listfile LIKE SXPGCOLIST-NAME VALUE 'ZLIST_FILE',
    opt_listfile LIKE SXPGCOLIST-PARAMETERS VALUE '$file'.
    ranges: r_tcode for bbkpf-tcode.
    A T S E L E C T I O N - S C R E E N *
    *checking for the blank entry in the file name field
    at selection-screen.
    if p_rpfile = 'X' and p_rsfile = 'X'. "this occurs during submit program again
    clear p_rpfile. "hence has to reset p_rpfile as this is default to X.
    elseif p_rnfile = 'X' and p_rsfile = 'X'.
    clear p_rnfile.
    endif.
    if p_rpfile = 'X'.
    if p_pfile is initial.
    message e398(00) with 'Enter PC filename'.
    endif.
    else.
    if p_sfile is initial.
    message e398(00) with 'Enter Server filename'.
    endif.
    if p_sdir is initial.
    message e398(00) with 'Enter Server input directory'.
    endif.
    if p_rafile = 'X' and p_fileno is initial.
    message e398(00) with 'Enter file no in table'.
    endif.
    endif.
    *getting the value of the frontend filename field
    at selection-screen on value-request for p_pfile.
    call function 'F4_FILENAME'
    EXPORTING
    program_name = syst-cprog
    dynpro_number = syst-dynnr
    IMPORTING
    file_name = p_pfile.
    at selection-screen on value-request for p_fileno.
    perform f4_help_on_p_fileno.
    TOP-OF-PAGE *
    top-of-page.
    perform page_header using t_doc_hdr-bukrs sy-title g_title2.
    S T A R T O F D A T A S E L E C T I O N *
    start-of-selection.
    if p_test is initial.
    g_title2 = '(Actual run)'.
    else.
    g_title2 = '(Test run)'.
    endif.
    g_job_error = 'N'.
    concatenate '/usr/sap/' sy-sysid '/interface/temp/' into c_server_tmp_path.
    perform write_start_message_log.
    if p_rnfile = 'X'. "read from interface directory
    perform submit_files_fr_interface_dir.
    perform write_end_message_log.
    concatenate p_group 'Overview' into p_sfile
    separated by space.
    perform send_mail_to_user.
    stop.
    endif.
    if p_rdfile = 'X' or
    p_rw1f = 'X' or p_rw2f = 'X' or p_rw3f = 'X' or p_rw4f = 'X' or
    p_rw5f = 'X' or p_rw6f = 'X' or p_rw7f = 'X' or
    p_rm1f = 'X' or p_rm4f = 'X' or p_ryfile = 'X' .
    perform submit_multiple_files.
    perform write_end_message_log.
    stop.
    endif.
    if p_rpfile = 'X' and sy-batch = 'X'.
    write: at /3 'PC file cannot be uploaded using background mode'.
    perform stop_processing.
    elseif p_rpfile = 'X'.
    perform read_pc_file.
    elseif p_rsfile = 'X'.
    perform read_server_file.
    elseif p_rafile = 'X'.
    perform read_single_job_file.
    endif.
    perform validate_file_data.
    clear g_housekeep_stat.
    if p_test is initial and g_job_error = 'N'.
    perform post_data.
    endif.
    if p_test is initial and g_job_error <> 'N'.
    perform file_housekeep.
    endif.
    perform write_end_message_log.
    perform send_mail_to_user.
    end-of-selection.
    S U B - R O U T I N E S *
    *& Form get_internal_format
    Convert number fields to prefix with '0'
    form get_internal_format changing p_runno type c."LIKE itab_head-runno.
    call function 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    input = p_runno
    IMPORTING
    output = p_runno.
    endform. " get_internal_format
    *& Form build_data_file
    Prepare internal table to format into structure for FI posting
    form build_data_file.
    data: t_bgr00 like bgr00.
    data: begin of t_bbkpf occurs 0,
    runno(10).
    include structure bbkpf.
    data: end of t_bbkpf.
    data: begin of t_bbseg occurs 0,
    runno(10).
    include structure bbseg.
    data: end of t_bbseg.
    data: begin of t_bwith occurs 0,
    runno(10).
    include structure bwith.
    data: end of t_bwith.
    data: begin of t_bbtax occurs 0,
    runno(10).
    include structure bbtax.
    data: end of t_bbtax.
    data: s_bbkpf like dfies occurs 0 with header line.
    data: s_bbseg like dfies occurs 0 with header line.
    data: s_bbtax like dfies occurs 0 with header line.
    data: s_bwith like dfies occurs 0 with header line.
    data: itab_lfbw like lfbw occurs 0 with header line.
    data: ind_itab like sy-tabix.
    data: fname(61),
    f_line type i,
    l_acctno like bseg-saknr,
    l_acct_type like tbsl-koart,
    l_saknr like skb1-saknr,
    l_ktopl like t001-ktopl.
    field-symbols: .
    *populate the document item data strcuture
    loop at t_bidoc_item where runno = t_bidoc_hdr-runno
    and fwbas is initial and hwbas is initial. "syp
    move-corresponding t_bidoc_item to bbseg.
    If item has trading partner value, remove trading partner value
    if GL account is NOT found in ZTGL003
    if not t_bidoc_item-vbund is initial and not p_tdpr is initial.
    clear: l_acct_type, l_saknr, l_acctno, l_ktopl.
    select single koart into l_acct_type
    from tbsl
    where bschl = t_bidoc_item-newbs.
    if l_acct_type = 'S'.
    l_saknr = t_bidoc_item-newko.
    perform get_internal_format changing l_saknr.
    select single ktopl into l_ktopl from t001 where bukrs = t_bidoc_hdr-bukrs.
    select single glacc into l_acctno from ZTGL003
    where coa = l_ktopl and
    ( type = 'F' or type = 'Z' )
    and glacc = l_saknr.
    if sy-subrc <> 0.
    remove trading partner value
    clear bbseg-vbund.
    endif.
    endif.
    endif.
    bbseg-tbnam = 'BBSEG'.
    clear: bbseg-fwbas, bbseg-hwbas.
    if t_bidoc_hdr-waers = t_bidoc_hdr-hwaer.
    clear: bbseg-hwbas.
    endif.
    perform check_doc_and_local_currency using t_bidoc_hdr-bukrs
    t_bidoc_hdr-waers
    changing bbseg-dmbtr.
    perform conver_date_int_to_ext
    changing bbseg-zfbdt.
    perform conver_date_int_to_ext
    changing bbseg-valut.
    perform get_internal_format changing bbseg-newko.
    if not bbseg-kostl is initial.
    perform get_internal_format changing bbseg-kostl.
    endif.
    if not bbseg-prctr is initial.
    perform get_internal_format changing bbseg-prctr.
    endif.
    if not bbseg-aufnr is initial.
    perform get_internal_format changing bbseg-aufnr.
    endif.
    *pass company code to the CO-PA structure
    if not bbseg-rke_prctr is initial or
    not bbseg-rke_wwbsg is initial or
    not bbseg-rke_wwspn is initial or
    not bbseg-rke_wwprd is initial or
    not bbseg-rke_wwchl is initial or
    not bbseg-rke_wwcst is initial or
    not bbseg-rke_wwtmk is initial or
    not bbseg-rke_wwexc is initial.
    if t_bidoc_item-katyp = '11'.
    bbseg-rke_bukrs = t_bidoc_hdr-bukrs.
    endif.
    assign bbseg to  = '/'.
    endif.
    endif.
    enddo.
    t_datafile = bbseg.
    append t_datafile.
    move-corresponding bbseg to t_bbseg.
    t_bbseg-runno = t_bidoc_item-runno.
    append: t_bbseg.
    clear: t_bbseg, t_datafile,bbseg.
    check not ( t_bidoc_item-qsskz_i is initial and
    t_bidoc_item-qsskz_p is initial ).
    unassign: .
    perform get_vendor_wt_tax_info tables itab_lfbw
    using t_bidoc_item-newko
    t_bidoc_hdr-bukrs.
    loop at itab_lfbw where wt_subjct = 'X'.
    bwith-stype = t_bidoc_item-stype.
    bwith-tbnam = 'BWITH'.
    if itab_lfbw-witht = 'IV'.
    if itab_lfbw-witht = t_bidoc_item-witht_i.
    bwith-witht = t_bidoc_item-witht_i.
    bwith-wt_withcd = t_bidoc_item-qsskz_i.
    bwith-WT_QSSHB = t_bidoc_item-wt_qsshb_i.
    bwith-WT_QBUIHB = t_bidoc_item-wt_qbuihb_i.
    if t_bidoc_hdr-waers <> t_bidoc_hdr-hwaer.
    bwith-WT_QSSHH = t_bidoc_item-wt_qsshh_i.
    bwith-WT_QBUIHH = t_bidoc_item-wt_qbuihh_i.
    endif.
    elseif itab_lfbw-witht = 'PM'.
    elseif itab_lfbw-witht = t_bidoc_item-witht_p.
    bwith-witht = t_bidoc_item-witht_p.
    bwith-wt_withcd = t_bidoc_item-qsskz_p.
    bwith-WT_QSSHB = t_bidoc_item-wt_qsshb_p.
    bwith-WT_QBUIHB = t_bidoc_item-wt_qbuihb_p.
    if t_bidoc_hdr-waers <> t_bidoc_hdr-hwaer.
    bwith-WT_QSSHH = t_bidoc_item-wt_qsshh_p.
    bwith-WT_QBUIHH = t_bidoc_item-wt_qbuihh_p.
    endif.
    else.
    that is vendor master has withholding tax type and it does
    not exist in the file; need to set to zero.
    bwith-witht = itab_lfbw-witht.
    bwith-wt_withcd = itab_lfbw-witht.
    bwith-WT_QSSHB = 0.
    bwith-WT_QBUIHB = 0.
    if t_bidoc_hdr-waers .
    *populate the tax data structure
    loop at t_bidoc_item where runno = t_bidoc_hdr-runno.
    if ( not t_bidoc_item-fwbas is initial )
    or ( not t_bidoc_item-hwbas is initial ).
    bbtax-stype = t_bidoc_item-stype.
    bbtax-tbnam = 'BBTAX'.
    bbtax-fwste = t_bidoc_item-wrbtr.
    bbtax-fwste = bbtax-fwste * 100.
    PERFORM get_internal_format CHANGING bbtax-fwste.
    bbtax-mwskz = t_bidoc_item-mwskz.
    bbtax-bschl = t_bidoc_item-newbs.
    bbtax-hwste = t_bidoc_item-dmbtr.
    perform check_doc_and_local_currency using t_bidoc_hdr-bukrs
    t_bidoc_hdr-waers
    changing bbtax-hwste.
    assign bbtax to  = '/'.
    endif.
    endif.
    enddo.
    t_datafile = bbtax. append t_datafile.
    move-corresponding bbtax to t_bbtax.
    t_bbtax-runno = t_bidoc_item-runno.
    append t_bbtax.
    clear: t_bbtax,t_datafile, bbtax.
    endif.
    clear t_bidoc_item.
    endloop.
    clear: t_bbkpf.
    endloop.
    endform. " build_data_file
    *& Form fill_structure_with_no_data
    form fill_structure_with_no_data using p_t_bgr00" structure bgr00
    p_no_data.
    call function 'FILL_STRUCTURE'
    EXPORTING
    fill_value = p_no_data
    CHANGING
    fill_struc = p_t_bgr00.
    endform. " fill_structure_with_no_data
    *& Form get_table_fields
    form get_table_fields tables p_tab_struct structure dfies
    using value(p_tabname) like dcobjdef-name.
    call function 'RM_TABLE_FIELDS_GET'
    exporting
    tabname = p_tabname
    IMPORTING
    GOTSTATE =
    tables
    c_table_struct = p_tab_struct
    C_ERROR_ITAB =
    endform. " get_table_fields
    *& Form transfer_data_file_to_server
    form transfer_data_file_to_server.
    data: l_msg(60),
    l_cnt type i.
    CONCATENATE '/sapdata/interface/tmp/' sy-cprog sy-datum
    get time.
    concatenate c_server_tmp_path sy-cprog '_' sy-datum '_'
    sy-uzeit '_' sy-uname into g_server_tmp_file.
    open dataset g_server_tmp_file for output in text mode
    encoding default message l_msg.
    if sy-subrc ne 0.
    write: at /3 'Error in writing to temporary file:',
    (70) g_server_tmp_file.
    write: at /3 'Error message:', l_msg.
    perform stop_processing.
    else.
    write: at /3 'Writing to temporary file:', (70) g_server_tmp_file.
    endif.
    clear l_cnt.
    loop at t_datafile.
    transfer t_datafile to g_server_tmp_file.
    add 1 to l_cnt.
    endloop.
    close dataset g_server_tmp_file.
    write: at /3 'No. of records written:', (10) l_cnt.
    skip.
    endform. " transfer_data_file_to_server
    *& Form call_update_program
    form call_update_program.
    call function 'LIST_FREE_MEMORY'
    TABLES
    listobject = t_abaplist.
    submit rfbibl01
    with ds_name = g_server_tmp_file
    with fl_check = p_test
    with callmode = p_mode
    with max_comm = '1000'
    with pa_xprot = 'X'
    with xlog = 'X'
    exporting list to memory
    and return.
    call function 'LIST_FROM_MEMORY'
    TABLES
    listobject = t_abaplist
    EXCEPTIONS
    not_found = 1
    others = 2.
    if sy-subrc = 0.
    call function 'LIST_TO_ASCI'
    EXPORTING
    list_index = -1
    TABLES
    listasci = t_asciilist
    listobject = t_abaplist
    EXCEPTIONS
    empty_list = 1
    list_index_invalid = 2
    others = 3.
    if sy-subrc = 0.
    skip.
    write: at /3 'Batch Input Session Log'.
    write: at /3 '----
    loop at t_asciilist.
    write: at /3(117) t_asciilist-line.
    endloop.
    endif.
    endif.
    skip.
    endform. " call_update_program
    *& Form conver_date_int_to_ext
    form conver_date_int_to_ext changing p_date.
    data: f_date1 like sy-datum,
    f_date2(10),
    f_date3(8),
    slen type i,
    pos1(2)." TYPE i,
    pos2(2)." TYPE i.
    f_date1 = p_date.
    write f_date1 to f_date2.
    slen = strlen( f_date2 ).
    do slen times.
    pos1 = sy-index - 1.
    pos2 = sy-index.
    if f_date2+pos1(01) co digits.
    concatenate f_date3 f_date2+pos1(01) into f_date3.
    endif.
    enddo.
    p_date = f_date3.
    endform. " conver_date_int_to_ext
    *& Form check_doc_and_local_currency
    form check_doc_and_local_currency using p1_bukrs
    p1_waers
    changing p1_dmbtr.
    data: wa_t001 like t001.
    call function 'FI_COMPANY_CODE_DATA'
    EXPORTING
    i_bukrs = p1_bukrs
    IMPORTING
    e_t001 = wa_t001
    EXCEPTIONS
    system_error = 1
    others = 2.
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    if wa_t001-waers = p1_waers.
    clear p1_dmbtr.
    endif.
    endform. " check_doc_and_local_currency
    *& Form get_vendor_wt_tax_info
    form get_vendor_wt_tax_info tables p_itab_lfbw structure lfbw
    using p_newko
    p_bukrs.
    data: f_lifnr like lfb1-lifnr.
    refresh p_itab_lfbw.
    shift p_newko left deleting leading '0'.
    f_lifnr = p_newko.
    perform get_internal_format changing f_lifnr.
    call function 'FI_WT_READ_LFBW'
    exporting
    i_lifnr = f_lifnr
    i_bukrs = p_bukrs
    I_TYPE =
    tables
    t_lfbw = p_itab_lfbw
    exceptions
    not_found = 1
    others = 2
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    endform. " get_vendor_wt_tax_info
    *& Form validate_file_data
    form validate_file_data.
    data: begin of l_t001.
    include structure t001.
    data: kalsm like t007a-kalsm,
    end of l_t001.
    data: l_pc_bukrs like t001-bukrs.
    data: l_saknr like skb1-saknr,
    l_lifnr like lfb1-lifnr,
    l_kunnr like knb1-kunnr,
    l_witht like lfbw-witht,
    l_qsskz like lfbw-wt_withcd,
    l_acct_type like tbsl-koart,
    l_umskz like tbslt-umskz,
    l_account like bbseg-newko,
    l_asset like anla-anln1,
    l_subasset like anla-anln2,
    l_sep_anln2(1) type c.
    data: l_fwbas like bseg-fwbas,
    l_hwbas like bseg-hwbas,
    l_amount like bseg-dmbtr.
    data: l_wt_qsshb_i like bwith-wt_qsshb,
    l_wt_qsshb_p like bwith-wt_qsshb,
    l_wt_qsshh_i like bwith-wt_qsshh,
    l_wt_qsshh_p like bwith-wt_qsshh,
    l_gsber like tgsb-gsber,
    l_bwasl like tabw-bwasl,
    l_hbkid like bseg-hbkid,
    l_vbund like bseg-vbund,
    l_shkzg like bseg-shkzg,
    l_trtyp like t856-trtyp.
    data: lt_lfbw like lfbw occurs 0 with header line.
    data: l_subrc like sy-subrc.
    data: lt_item like t_doc_item occurs 1 with header line.
    data: l_doc_err_cnt type i,
    l_doc_ok_cnt type i,
    l_item_no type i.
    data: begin of l_cost_element,
    kstar type cskb-kstar,
    katyp type cskb-katyp,
    end of l_cost_element.
    data: l_debit_docamt like bseg-wrbtr,
    l_credit_docamt like bseg-wrbtr,
    l_debit_locamt like bseg-dmbtr,
    l_credit_locamt like bseg-dmbtr,
    e_gjahr like bkpf-gjahr,
    e_monat like bkpf-monat,
    l_pdate like bkpf-budat,
    l_monat like t001b-frpe1,
    lchar type string.
    define transaction_codes.
    r_tcode-sign = 'I'.
    r_tcode-option = 'EQ'.
    r_tcode-low = &1.
    append r_tcode.
    end-of-definition.
    transaction_codes c_fb01.
    transaction_codes c_fbv1.
    transaction_codes c_fbb1.
    transaction_codes c_fbs1.
    write: at /3 'Validating input file.'.
    skip.
    describe table t_doc_hdr lines g_doc_hdr_read_cnt.
    if g_doc_hdr_read_cnt = 0.
    write: at /3 'No document header records found.'.
    perform stop_processing.
    endif.
    describe table t_doc_item lines g_doc_item_read_cnt.
    if g_doc_item_read_cnt = 0.
    write: at /3 'No document item records found.'.
    perform stop_processing.
    endif.
    g_total_rec_read_cnt = g_doc_hdr_read_cnt + g_doc_item_read_cnt.
    loop at t_doc_hdr.
    clear: g_doc_hdr_err,
    g_doc_item_err.
    add 1 to g_doc_check.
    Check Transaction code
    if not t_doc_hdr-tcode in r_tcode.
    perform output_doc_hdr_err using
    'Invalid transaction code :'
    t_doc_hdr-tcode.
    endif.
    Check document date
    perform check_date using t_doc_hdr-bldat
    'Y'
    'Y'
    'Document date'.
    Check document type
    select single * from t003
    where blart = t_doc_hdr-blart.
    if not sy-subrc is initial.
    perform output_doc_hdr_err using
    'Invalid document type :'
    t_doc_hdr-blart.
    endif.
    Check Company Code
    if t_doc_hdr-bukrs ne l_t001-bukrs or
    l_t001-bukrs is initial.
    clear l_t001.
    select single * into corresponding fields of l_t001
    from t001
    where bukrs = t_doc_hdr-bukrs.
    if sy-subrc <> 0.
    perform output_doc_hdr_err using
    'Invalid company code :'
    t_doc_hdr-bukrs.
    else.
    select single kalsm into l_t001-kalsm
    from t005
    where land1 = l_t001-land1.
    select single *
    from tka02 into tka02
    where bukrs = l_t001-bukrs.
    endif.
    endif.
    t_doc_hdr-hwaer = l_t001-waers.
    Check Posting Date
    perform check_date using t_doc_hdr-budat
    'Y'
    'Y'
    'Posting date'.
    Check Currency key
    call function 'READ_TCURC'
    EXPORTING
    i_waers = t_doc_hdr-waers
    EXCEPTIONS
    not_found = 1
    others = 2.
    if sy-subrc <> 0.
    perform output_doc_hdr_err using
    'Invalid currency :'
    t_doc_hdr-waers.
    endif.
    Check trading partner
    if not t_doc_hdr-vbund is initial.
    clear l_vbund.
    l_vbund = t_doc_hdr-vbund.
    perform get_internal_format changing l_vbund.
    select single * from t880 where rcomp = l_vbund..
    if not sy-subrc is initial.
    perform output_doc_hdr_err using
    'Trading Partner cannot be entered at header level :'
    t_doc_hdr-vbund.
    endif.
    endif.
    Check reversal date
    if t_doc_hdr-tcode = 'FBS1'.
    reversal date is required
    perform check_date using t_doc_hdr-stodt
    'Y'
    'Y'
    'Reversal date'.
    else.
    perform check_date using t_doc_hdr-stodt
    'Y'
    'N'
    'Reversal date'.
    endif.
    Check Reversal Reason
    if not t_doc_hdr-stgrd = space.
    select single *
    from t041c
    where stgrd = t_doc_hdr-stgrd.
    if not sy-subrc is initial.
    perform output_doc_hdr_err using
    'Invalid Reversal Reason :'
    t_doc_hdr-stgrd.
    endif.
    endif.
    Check whether posting period is open
    call function 'RP_CHECK_DATE'
    EXPORTING
    date = t_doc_hdr-budat
    EXCEPTIONS
    date_invalid = 1
    others = 2.
    if sy-subrc = 0.
    write t_doc_hdr-budat to l_pdate DD/MM/YYYY.
    CALL FUNCTION 'FI_PERIOD_DETERMINE'
    EXPORTING
    i_budat = l_pdate
    i_bukrs = t_doc_hdr-bukrs
    IMPORTING
    e_gjahr = e_gjahr
    e_monat = e_monat
    EXCEPTIONS
    OTHERS = 8.
    if sy-subrc = 0.
    l_monat = e_monat.
    CALL FUNCTION 'FI_PERIOD_CHECK'
    EXPORTING I_BUKRS = t_doc_hdr-bukrs
    I_GJAHR = e_gjahr
    I_KOART = '+'
    I_KONTO = '+'
    I_MONAT = l_monat
    EXCEPTIONS OTHERS = 4.
    if not sy-subrc is initial.
    perform output_doc_hdr_err using
    'Posting period for posting date not open :'
    t_doc_hdr-budat.
    endif.
    endif.
    endif.
    refresh lt_item.
    clear l_item_no.
    clear: l_debit_docamt, l_credit_docamt, l_debit_locamt, l_credit_locamt.
    Check items
    loop at t_doc_item where runno = t_doc_hdr-runno.
    add 1 to l_item_no.
    t_doc_item-item_no = l_item_no.
    Check posting key
    clear: l_acct_type, l_shkzg.
    select single koart shkzg into (l_acct_type, l_shkzg)
    from tbsl
    where bschl = t_doc_item-newbs.
    if sy-subrc ne 0.
    perform output_doc_item_err using
    'Invalid posting key:'
    t_doc_item-newbs.
    endif.
    check for invalid characters in amount field.
    clear lchar.
    lchar = t_doc_item-wrbtr.
    if not lchar co '1234567890.'.
    perform output_doc_item_err using
    'Invalid characer in document amount field:'
    t_doc_item-wrbtr.
    endif.
    clear lchar.
    lchar = t_doc_item-dmbtr.
    if not lchar co '1234567890.'.
    perform output_doc_item_err using
    'Invalid characer in local currency amount field:'
    t_doc_item-dmbtr.
    endif.
    sum up total debit and credit for line items in each document
    if l_shkzg = 'S'. "debit.
    l_debit_docamt = l_debit_docamt + t_doc_item-wrbtr.
    l_debit_locamt = l_debit_locamt + t_doc_item-dmbtr.
    else.
    l_credit_docamt = l_credit_docamt + t_doc_item-wrbtr.
    l_credit_locamt = l_credit_locamt + t_doc_item-dmbtr.
    endif.
    Check special G/L indicator
    select single umskz into l_umskz
    from tbslt
    where spras = sy-langu
    and bschl = t_doc_item-newbs
    and umskz = t_doc_item-newum.
    if sy-subrc ne 0.
    perform output_doc_item_err using
    'Invalid special G/L indicator:'
    t_doc_item-newum.
    endif.
    Check the account (gl,vendor,customer)
    if t_doc_item-newko is initial.
    perform output_doc_item_err using
    'Enter account'
    t_doc_item-newko.
    endif.
    if not l_t001-bukrs is initial.
    if l_acct_type = 'S'.
    shift t_doc_item-newko left deleting leading '0'.
    l_saknr = t_doc_item-newko.
    perform get_internal_format changing l_saknr.
    call function 'FI_GL_ACCOUNT_CHECK'
    EXPORTING
    i_bukrs = l_t001-bukrs
    i_saknr = l_saknr
    EXCEPTIONS
    gl_account_a = 1
    gl_account_b = 2
    others = 3.
    if sy-subrc <> 0.
    perform output_doc_item_err using
    'Invalid G/L account :'
    t_doc_item-newko.
    endif.
    elseif l_acct_type = 'K'.
    shift t_doc_item-newko left deleting leading '0'.
    l_lifnr = t_doc_item-newko.
    if l_lifnr(2) <> 'JD'.
    perform get_internal_format changing l_lifnr.
    call function 'FI_VENDOR_CHECK'
    EXPORTING
    i_bukrs = t_doc_hdr-bukrs
    i_lifnr = l_lifnr
    EXCEPTIONS
    vendor = 1
    others = 2.
    if sy-subrc <> 0.
    perform output_doc_item_err using
    'Invalid vendor account :'
    t_doc_item-newko.
    endif.
    else.
    If vendor number start with JDE, this is old vendor number,
    need to lookup LFB1 to search for actual vendor number,
    shift l_lifnr left by 2 places.
    select lifnr into t_doc_item-newko
    from lfb1
    where bukrs = t_doc_hdr-bukrs
    and altkn = l_lifnr.
    exit.
    endselect.
    if sy-subrc <> 0.
    perform output_doc_item_err using
    'Invalid JDE vendor number :'
    t_doc_item-newko.
    endif.
    endif.
    clear t_doc_item-prctr.
    elseif l_acct_type = 'D'.
    shift t_doc_item-newko left deleting leading '0'.
    l_kunnr = t_doc_item-newko.
    perform get_internal_format changing l_kunnr.
    call function 'FI_CUSTOMER_CHECK'
    EXPORTING
    i_bukrs = t_doc_hdr-bukrs
    i_kunnr = l_kunnr
    EXCEPTIONS
    customer = 1
    others = 2.
    if sy-subrc <> 0.
    perform output_doc_item_err using
    'Invalid customer account :'
    t_doc_item-newko.
    endif.
    clear t_doc_item-prctr.
    elseif l_acct_type = 'A'.
    shift t_doc_item-newko left deleting leading '0'.
    l_account = t_doc_item-newko.
    perform get_internal_format changing l_account.
    l_sep_anln2 = '-'.
    clear: l_asset, l_subasset.
    call function 'AM_ASSET_NUMBER_INPUT'
    EXPORTING
    i_input = l_account
    i_separator = l_sep_anln2
    IMPORTING
    e_anln1 = l_asset
    e_anln2 = l_subasset.
    call function 'ASSET_EXISTENCE_CHECK'
    EXPORTING
    i_bukrs = t_doc_hdr-bukrs
    i_anln1 = l_asset
    i_anln2 = l_subasset
    EXCEPTIONS
    ANLAGE_DEAKTIV = 1
    ANLAGE_GELOESCHT = 2
    ANLAGE_NOT_FOUND = 3
    ANLAGE_IST_INVM = 4
    ANLAGE_GESPERRT = 5
    OTHERS = 6.
    if sy-subrc <> 0.
    perform output_doc_item_err using
    'Invalid asset number :'
    t_doc_item-newko.
    endif.
    else.
    perform output_doc_item_err using
    'Account type (posting key) not catered for:'
    l_acct_type.
    endif.
    endif.
    Check amount in Document currency must ne 0 if tcode ne FBB1
    l_amount = t_doc_item-wrbtr.
    if l_amount is initial and t_doc_hdr-tcode ne 'FBB1'.
    perform output_doc_item_err using
    'Enter amount in document currency.'
    endif.
    Checking Tax code
    if t_doc_item-mwskz ne space.
    select single * from t007a where kalsm = l_t001-kalsm and
    mwskz = t_doc_item-mwskz.
    if not sy-subrc is initial.
    perform output_doc_item_err using
    'Invalid tax code :'
    t_doc_item-mwskz.
    endif.
    endif.
    Check tax amount
    l_fwbas = t_doc_item-fwbas.
    if l_fwbas is initial.
    clear t_doc_item-fwbas.
    endif.
    l_hwbas = t_doc_item-hwbas.
    if l_hwbas is initial.
    clear t_doc_item-hwbas.
    endif.
    Checking planning level
    if t_doc_item-fdlev ne space.
    select single * from t036 where ebene = t_doc_item-fdlev.
    if not sy-subrc is initial.
    perform output_doc_item_err using
    'Invalid planning level :'
    t_doc_item-fdlev.
    endif.
    endif.
    Check baseline date
    perform check_date using t_doc_item-zfbdt
    'N'
    'N'
    'Baseline date'.
    perform check_date using t_doc_item-valut
    'N'
    'N'
    'Value date'.
    Check payment method
    if t_doc_item-zlsch ne space and
    not l_t001-land1 is initial.
    call function 'T042Z_SINGLE_READ'
    EXPORTING
    i_land1 = l_t001-land1
    i_zlsch = t_doc_item-zlsch
    EXCEPTIONS
    not_found = 1
    others = 2.
    if sy-subrc <> 0.
    perform output_doc_item_err using
    'Invalid payment method :'
    t_doc_item-zlsch.
    endif.
    endif.
    Check withholding tax code
    if not t_doc_item-qsskz_i is initial or
    not t_doc_item-qsskz_p is initial.
    perform get_vendor_wt_tax_info tables lt_lfbw
    using t_doc_item-newko
    t_doc_hdr-bukrs.
    endif.
    if not t_doc_item-qsskz_i is initial.
    l_witht = 'IV'.
    l_witht = t_doc_item-witht_i.
    l_qsskz = t_doc_item-qsskz_i.
    elseif not t_doc_item-qsskz_p is initial.
    l_witht = 'PM'.
    l_witht = t_doc_item-witht_p.
    l_qsskz = t_doc_item-qsskz_p.
    endif.
    if not t_doc_item-qsskz_i is initial or
    not t_doc_item-qsskz_p is initial.
    l_lifnr = t_doc_item-newko.
    perform get_internal_format changing l_lifnr.
    read table lt_lfbw with key lifnr = l_lifnr
    bukrs = t_doc_hdr-bukrs
    witht = l_witht
    wt_withcd = l_qsskz.
    clear l_lifnr.
    if not sy-subrc is initial.
    perform output_doc_item_err using
    'Invalid withholding tax type/tax code :'
    l_qsskz.
    endif.
    endif.
    Check withholding tax base amount
    l_wt_qsshb_i = t_doc_item-wt_qsshb_i.
    if l_wt_qsshb_i is initial.
    clear t_doc_item-wt_qsshb_i.
    endif.
    l_wt_qsshb_p = t_doc_item-wt_qsshb_p.
    if l_wt_qsshb_p is initial.
    clear t_doc_item-wt_qsshb_p.
    endif.
    l_wt_qsshh_i = t_doc_item-wt_qsshh_i.
    if l_wt_qsshh_i is initial.
    clear t_doc_item-wt_qsshh_i.
    endif.
    l_wt_qsshh_p = t_doc_item-wt_qsshh_p.
    if l_wt_qsshh_p is initial.
    clear t_doc_item-wt_qsshh_p.
    endif.
    Check cost element type
    if l_acct_type = 'S'.
    if l_saknr ne l_cost_element-kstar.
    clear l_cost_element.
    select single * into corresponding fields of l_cost_element
    from cskb
    where kokrs = tka02-kokrs
    and kstar = l_saknr
    and datbi >= sy-datum.
    endif.
    else.
    clear l_cost_element.
    endif.
    t_doc_item-katyp = l_cost_element-katyp.
    if not l_cost_element is initial.
    if l_cost_element-katyp <> '01'.
    No cost center required for revenue element <not true for CapitaLand>
    cost centre is now required for revenue and expense accounts
    clear t_doc_item-kostl.
    if l_cost_element-katyp = '11'.
    t_doc_item-rke_prctr = t_doc_item-prctr.
    endif.
    elseif l_cost_element-katyp = '01' and
    else.
    if t_doc_item-kostl is initial.
    perform output_doc_item_err using
    'Missing cost center for account'
    t_doc_item-newko.
    endif.
    endif.
    else.
    clear: t_doc_item-kostl.
    endif.
    Check cost center
    if t_doc_item-kostl ne space.
    perform get_internal_format changing t_doc_item-kostl.
    call function 'K_COSTCENTER_EXISTENCE_CHECK'
    EXPORTING
    kokrs = tka02-kokrs
    kostl = t_doc_item-kostl
    bypassing_buffer = 'X'
    EXCEPTIONS
    not_at_all = 1
    others = 2.
    if sy-subrc <> 0.
    perform output_doc_item_err using
    'Invalid cost center :'
    t_doc_item-kostl.
    endif.
    endif.
    Check internal order
    if t_doc_item-aufnr ne space.
    perform get_internal_format changing t_doc_item-aufnr.
    perform read_order using t_doc_item-aufnr
    changing l_subrc.
    if l_subrc <> 0.
    perform output_doc_item_err using
    'Invalid internal order :'
    t_doc_item-aufnr.
    endif.
    endif.
    check business area
    if not t_doc_item-gsber is initial.
    clear l_gsber.
    select single gsber into l_gsber from tgsb
    where gsber = t_doc_item-gsber.
    if sy-subrc <> 0.
    perform output_doc_item_err using
    'Invalid business area :'
    t_doc_item-gsber.
    endif.
    endif.
    check asset transaction type
    if not t_doc_item-newbw is initial.
    clear l_bwasl.
    select single bwasl into l_bwasl from tabw
    where bwasl = t_doc_item-newbw.
    if sy-subrc <> 0.
    perform output_doc_item_err using
    'Invalid transaction type :'
    t_doc_item-newbw.
    endif.
    endif.
    check consolidation transaction type
    if not t_doc_item-bewar is initial.
    clear l_trtyp.
    select single trtyp into l_trtyp from t856
    where trtyp = t_doc_item-bewar.
    if sy-subrc <> 0.
    perform output_doc_item_err using
    'Invalid transaction type :'
    t_doc_item-bewar.
    endif.
    endif.
    Check house bank
    if not t_doc_item-hbkid is initial.
    clear l_hbkid.
    select single hbkid into l_hbkid from t012
    where bukrs = t_doc_hdr-bukrs
    and hbkid = t_doc_item-hbkid.
    if sy-subrc <> 0.
    perform output_doc_item_err using
    'Invalid house bank :'
    t_doc_item-hbkid.
    endif.
    endif.
    Check profit center
    if not t_doc_item-prctr is initial.
    perform get_internal_format changing t_doc_item-prctr.
    select single bukrs into l_pc_bukrs
    from cepc_bukrs
    where kokrs = tka02-kokrs
    and prctr = t_doc_item-prctr.
    if sy-subrc <> 0.
    perform output_doc_item_err using
    'Invalid profit center :'
    t_doc_item-prctr.
    endif.
    endif.
    Check trading partner
    if not t_doc_item-vbund is initial.
    v_vbund = t_doc_item-vbund.
    clear l_vbund.
    l_vbund = t_doc_item-vbund.
    perform get_internal_format changing l_vbund.
    if strlen( v_vbund ) = 1.
    concatenate '00000' v_vbund into v_vbund.
    elseif strlen( v_vbund ) = 2.
    concatenate '0000' v_vbund into v_vbund.
    elseif strlen( v_vbund ) = 3.
    concatenate '000' v_vbund into v_vbund.
    elseif strlen( v_vbund ) = 4.
    concatenate '00' v_vbund into v_vbund.
    elseif strlen( v_vbund ) = 5.
    concatenate '0' v_vbund into v_vbund.
    endif.
    select single * from t880 where rcomp = t_doc_item-vbund.
    select single * from t880 where rcomp = l_vbund.
    if not sy-subrc is initial.
    perform output_doc_item_err using
    'Invalid Trading Partner entered at item level :'
    t_doc_item-vbund.
    endif.
    endif.
    modify t_doc_item.
    append t_doc_item to lt_item.
    endloop. "End of check items loop
    Check total debit and credit in document is equal
    if not ( l_debit_docamt = l_credit_docamt and
    l_debit_locamt = l_credit_locamt ).
    perform output_doc_hdr_err using
    'Total debit amount not equal to total credit amount' ''.
    endif.
    if g_doc_hdr_err = 'Y' or g_doc_item_err = 'Y'.
    add 1 to l_doc_err_cnt.
    append t_doc_hdr to t_errdoc_hdr.
    append lines of lt_item to t_errdoc_item.
    else.
    add 1 to l_doc_ok_cnt.
    append t_doc_hdr to t_bidoc_hdr.
    append lines of lt_item to t_bidoc_item.
    endif.
    modify t_doc_hdr.
    endloop.
    skip.
    write: at /3 'No. of document headers read :',
    (6) g_doc_hdr_read_cnt,
    at /3 'No. of document items read :',
    (6) g_doc_item_read_cnt,
    at /3 'Total

  • Database is Hanging after executing the Procedure ...

    Dear All i am using 10G.
    I Have a procedure . After executing the Procedure when i try to call that procedure it is hanging ...
    it is creating Locks .. As our DBA told..And told to check the code ...
    Can any one tell me how can i put mu codes with formatting ? When i copy paste my code it is showing properly but after POST MESSAGE it is showing like i have written history ...--*
    I am Executing the procedure like this ...
    EXEC simulator_validation ('0|BP-V1|20101004|01|1|2430962.89|27|2430962.89|MUR|20100928120106','04-SEP-2010',27,2430962.89,'MUR','000111111111');
    And my code is :-
    {Create Or Replace Procedure simulator_validation (lstring varchar2,ldate date,lno_item number,ltotal number,lcur varchar2,lac_no Varchar2)
    IS
      l_swift_code_acno number;
      l_ACno_Valid number;
      l_swift_code_others Number;
      lpcode varchar2(5);
      lCcode Varchar2(4);
      lval number;
      lacno varchar2(16);
      v_file varchar2(20);
      v_path varchar2(50);
      LToken   VARCHAR2(100) ;
      i        PLS_INTEGER := 2 ;
      lfirst_char  number;
      lvalue  Varchar2(100) ; 
      lcol number:= 1;
    Begin
      lfirst_char := Substr(lstring,0,1);
      Dbms_output.put_line(lfirst_char);
          IF lfirst_char  = '0' Then ------------------- For the 1st Line - Should be start from 0
                Loop
                  LToken := mcb_simulator_pkg.Split( lstring, i , '|') ;  
                  lvalue := LToken;
                      IF lcol=1 then
                             If lvalue='BP-V1' THEN
                                   Dbms_output.put_line('1');
                             Else
                                 Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0003','Invalid file type and version number');
                                Dbms_output.put_line('2');
                            End if;
                      Elsif lcol=2 then
                              If lvalue=To_Char(ldate,'YYYYMMDD') THEN
                                 Dbms_output.put_line('3');                                                                                                                                                                                                                                       
                            Else
                                 Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0004','Due date differs from the value inputted in the loading screen');
                                 Dbms_output.put_line('4');
                            End if;
                      Elsif lcol=3 then
                                   Begin
                                         Select PAYMENT_PURPOSE_CODE into lpcode
                                         From MU_PURPOSE_CODE
                                         Where PAYMENT_PURPOSE_CODE = lvalue;
                                     IF lpcode = lvalue Then
                                           Dbms_output.put_line('5');
                                     Else
                                          Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0006','Invalid payment purpose code');
                                          Dbms_output.put_line('6');
                                     End If;
                                Exception
                                    When No_data_found Then
                                    Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0006','Invalid payment purpose code');
                                End;
                      Elsif lcol=4 then
                                    If lvalue='1' THEN
                                         Dbms_output.put_line('7');
                                    Else
                                       Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0008','Total number of debit records in header does not tally with number                   debit records in the file.');
                                      Dbms_output.put_line('8');
                                   End if;
                      Elsif lcol=5 then
                                    If lvalue=ltotal THEN
                                          Dbms_output.put_line('9');
                                    Else
                                        Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0010','Total debit transaction amount in header does not tally with the sum of debit transaction amount in the file');
                                       Dbms_output.put_line('10');
                                  End if;
                     Elsif lcol=6 then
                                    If lvalue=lno_item THEN
                                         Dbms_output.put_line('11');
                                    Else
                                        Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0025','Number of credit records does not tally with credit records in the file.');
                                    End if;
                     Elsif lcol=7 then
                                    If lvalue=ltotal THEN
                                         Dbms_output.put_line('12');
                                    Else
                                         Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0026','Sum of credit records does not tally with total transaction amount as inputted in the loading screen');
                                    End if;
                    Elsif lcol=8 then                
                                    If lvalue=lcur  THEN
                                          Begin
                                                    Select Cur_CODE into lCcode
                                                      From Mu_currency_Code
                                                    Where Cur_CODE = lvalue;
                                                    Dbms_output.put_line('13');
                                          Exception
                                              When No_data_found Then--------------------
                                                 Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0014','Invalid Currency');
                                          End;
                                    Else
                                          Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0013','Currency differs from the value inputted in the loading screen');
                                   End if;
                     Elsif lcol=9 then
                                    If lvalue=Null  THEN
                                          Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0015','Timestamp should not be null');
                                    Elsif lvalue <> lvalue Then
                                         Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0046','Timestamp in header should be in the format YYYYMMDDHHMMSS');
                                    End if;
                       End IF;
                      EXIT WHEN LToken IS NULL ;
                         i := i + 1 ;
                         lcol:=lcol+1;
                       End LOOP;
              Else
                                      Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (9999,'0002','First line should always start with 0');
              End if ;}
    -------------------- For the 2nd Line , should be start from 9 .-----------------------------
    {  lfirst_char := Substr(lstring,0,1);
    IF lfirst_char = '9' Then
    LOOP
    LToken := mcb_simulator_pkg.Split( lstring, i , '|') ;
    lvalue := LToken;
    IF lcol=1 then
    If lvalue < 0 THEN
    Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0017','Amount should be greater than zero');
    Elsif lvalue = ltotal THEN
    Dbms_output.put_line('20');
    Else
    Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0018','Transaction amount differs from the value inputted in the loading screen');
    End if;
    ELSIF lcol = 2 THEN
    If lvalue = Substr(lac_no,4,9) THEN
    mcb_simulator_pkg.Acct_no_Validator(lvalue,1111,l_ACno_Valid);
    mcb_simulator_pkg.Swift_code_validator_for_ac_no(lvalue,1111,l_swift_code_acno);
    Else
    Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0020','Account number differs from the account number inputted in the loading screen');
    End if;
    ELSIF lcol = 3 THEN
    If lvalue is not null THEN
    mcb_simulator_pkg.Swift_code_validator_for_other(lvalue,1111,l_swift_code_others);
    Else
    Dbms_output.put_line('21');
    End if;
    END IF;
    EXIT WHEN LToken IS NULL ;
    i := i + 1 ;
    lcol:=lcol+1;
    End Loop;
    Else
    Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (8888,'0016','Second line should start with 9');
    End IF; }
    -------------------- For the 3rd Line Should be start from 1.--------------------------
    { LOOP
    lfirst_char := Substr(lstring,0,1);
    IF lfirst_char = '1' Then
    Loop
    LToken := mcb_simulator_pkg.Split( lstring, i , '|') ;
    lvalue := LToken;
    IF lcol=1 then
    If lvalue > 0 THEN
    Dbms_output.put_line('24');
    Else
    Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (1111,'0017','Amount should be greater than zero'); End if;
    ELSIF lcol=2 then
    Mcb_simulator_pkg.Acct_no_Validator(lvalue,1111,l_ACno_Valid);
    Mcb_simulator_pkg.Swift_code_validator_for_ac_no(lvalue,1111,l_swift_code_acno);
    ELSIF lcol = 3 THEN
    If lvalue is not null THEN
    mcb_simulator_pkg.Swift_code_validator_for_other(lvalue,1111,l_swift_code_others);
    Else
    Dbms_output.put_line('26');
    End
    END IF;
    EXIT WHEN LToken IS NULL ;
    i := i + 1 ;
    lcol:=lcol+1;
    End Loop;
    Else
    Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (7777,'0022','The third line onward should start with 1');
    End if;
    END LOOP;
    Commit;
    End;}
    Edited by: LuKKa on Oct 4, 2010 9:20 PM
    Edited by: LuKKa on Oct 4, 2010 9:25 PM

    Yes i gave {} but it is also coming like this ...Yes, since you should use {noformat}{noformat} before and after your example, and not putting your example between a '{' and a '}'.
    So, when you post/type/copypaste:
    {noformat}select *
    from emp;{noformat}
    on this forum, it will appear as:select *
    from emp;See the FAQ for more tags/tips:
    http://forums.oracle.com/forums/help.jspa                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • DI: Problem in Creating a Credit Memo

    The problem is when i want to create an a/r credit memo  based in an invoice of a customer with multycurrency with sdk i got an error
    "-5002 invalid currency code [orin.doccur], ‘mxp’. "
    This error only ocurred with a customer with multycurrency
    I appreciate any kind of help, thanks.
    Best Regards

    Hello Rafael ,
    have u solved our problem ?
    i have the same problem too when create credit memo based on invoice but i used batch number for items.But i have the different error i.e Error Number -5002 but error description only a dash "-" . What's that supposed to me ? i dont know where's the error located ?
    Maybe Others can help me ?
    Thanks

Maybe you are looking for