BAPI_ACC_DOCUMENT_POST with TAX posting for FB60 t-code

Hi Experts,
I am trying upload the data using BAPI_ACC_DOCUMENT_POST with Tax(ACCOUNTTAX) for the FB60 t-code. But not getting right.
Any help on this issue greatly appreciated.
Thanks & Regards,
Harish

Hi,
Check out this-
FU BAPI_ACC_DOCUMENT_POST
Short Text
Accounting: Posting
Functionality
Using this method you can create a posing in accounting for certain business transactions.
Possible ( Business Transactions):
Postings that generally only affect the general ledger. (RFBU)
Billing: For billing in Sales and Distribution, accounting is supplied with the relevant billing data. (SD00) Billing Document
Accounting can use the data of a logistics system that result from an Invoice Receipt. (RMRP)
Goods Movement are triggered by transactions in Sales and Distribution or by inventory postings. Within logistics, they lead to a change in the warehouse stocks of <DS:GLOS.Inventory Management>Inventory Management. This results in a posting in accounting. This is why accounting is supplied with the relevant data from logistics. (RMWA)
Example
Billing document:
By selling goods in accordance with targets, revenue is generated. The revenue is posted in billing and forwarded to accounting.
Invoice receipt:
Raw materials are purchased in accordance with targets. The invoice receipt is posted in a logistics system. The data from the raw materials is forwarded to accounting.
Goods Movment:
The use of raw materials leads to a change in stock in inventory managment. The posting of raw material consumption is forwarded to accounting.
G/L Account Posting:
Provision posting for an expected warranty service. This can refer to acquisitions or retirements belonging to stocks that are not in subledger accounting relevant to inventory management. This is particularly the case if such materials are not displayed as vendor/customer, materials, loans etc. or cannot be displayed in this way. This can also refer to write-ups or depreciation that contain higher aggregations of values than are maintained in a corresponding subledger that is relevant to inventory management.
The conversion of foreign currencies for receivables/payables due to large exchange rate changes that should not lead to an update of the accounts payable or accounts receivable accounting. A similar transaction can arise for the revaluation of raw materials if this revaluation takes place at a correspondingly aggreagated level.
Reclassification of inventory of P&L statement accounts that are only used for reconcilliation purposes in the general ledger (this rearranges values for balance sheet items).
Balance reclassifications of stocks to receivables with different return times.
Notes
If the parameter CurrencyAmount is filled with the currency fields, a complete document check including characteristics and value components of profitability analysis (CO-PA). Otherwise, the account assignment objects are checked.
Messages are returned in the parameter Return. In the parameter documentation you can find the return values and their meaning.
Further information
You can find further information in the SAP Library under "Financials -> Accounting - General (AC) -> Interfaces to Accounting (AC)".
Parameters
DOCUMENTHEADER
CUSTOMERCPD
CONTRACTHEADER
OBJ_TYPE
OBJ_KEY
OBJ_SYS
ACCOUNTGL
ACCOUNTRECEIVABLE
ACCOUNTPAYABLE
ACCOUNTTAX
CURRENCYAMOUNT
CRITERIA
VALUEFIELD
EXTENSION1
RETURN
PAYMENTCARD
CONTRACTITEM
EXTENSION2
REALESTATE
ACCOUNTWT
Reward if useful!

Similar Messages

  • USE TAX Posting for Procedure TAXUSJ

    HI,
    Does anybody know which accounting KEY and Condition type should be used to perform use tax posting for procedure TAXUSJ?
    Our requirement for use tax posting during MIGO and MIRO will be:
    Use Tax- 
    At the time of Good Receipts-(MIGO)
    Debit Expense in total including tax amount
    Credit GR/IR for line item amount
    Credit 71410 (AP Sales and Use tax account) amount of tax
    Sample- MIGO Posting
    GL-  510000 $10,000
    GL-  71035 $(9,125)
    GL-  71410 $(875)
    *The Use tax accrual goes directly to the correct account and will be reported by tax accountant on quarterly tax return.
    At the time of Invoice receipt (which should not have tax on it)-(MIRO)
    Debit GR/IR for line item amount
    Credit Vendor
    Sample- MIRO Posting
    GL-  71035 $9,125
    GL- vendor $(9,125)
    Does any account key for TAXUSJ perform this function for use tax posting?
    Thanks.
    Rickey.

    Hi,
    Please, refer to this link:
    Re: Table for tax rate
    Regards,
    Eli

  • F-02 Docment posted for cross company code TAX

    Dear Experts ,
    Can you please explain me ,
    when i posted docment in F-02 for cross company code postings that is Dr for 1150 company code and credit for 5500 company code ,
    1] i need to enter tax  code is YY is same to both company codes 1150 & 5500
    ] i need to enter  tax jurisdiction code for company code 1150 is 1254693  and company code 5500 is 4525658
    when i enter these two Tax jurisdiction code system shows error when i saved error message # FF 744
    ERROR MESSAGE  BELOW
    [  The jurisdiction codes entered on the individual line items have different controls for determinating the cash discount base amount (upper level  and ).
    This is not allowed within a document.
    Procedure
    Please correct the entered jurisdiction code (if not correct) or if need be, post the transaction to two single documents.
    Can you please help me how i enter postings in F-02
    Regards
    Bhaskar

    Thanks

  • BAPI_ACC_DOCUMENT_POST and tax posting through the BAPI

    Hi,
    We are using the BAPI_ACC_DOCUMENT_POST to post accounting documents. The BAPI works fine without the tax data but we need the tax data also to get posted for the line items. Please let me know how the ACCOUNTTAX
    and CURRENCYAMOUNT table parameters needs to be populated.
    A sample code would be of much use.
    Currently if we have 3 line items in GL to be posted we fill 3 line items in AccountGL table, one line item in Accounts payable table, 4 line items in the currency table ( 3 for the actual items and 4 th item with summed up quantity of all 3 items) .
    Your help is greatly appreciated.
    Regards,
    Prabaharan.G

    hi,
    i use this function in some program i try to give to u how to set the minimum value in the structure/tables of the bapi.
    > DOCUMENTHEADER                                                        
    >        BUS_ACT                    =    'RFBU'           "for FI document    
    >        USERNAME                =    sy-uname
    >        HEADER_TXT              =    your text
    >        COMP_CODE              =    Company code
    >        DOC_DATE                  =    Document date
    >        PSTNG_DATE              =    Posting date
    >        FISC_YEAR(1)              =    The year of posting date
    >        FIS_PERIOD(1)             =    the period of posting date
    >        DOC_TYPE                  =    document type
    if you set a different year or period from the value that you have in the posting date the bapi trigger an error
    > ACCOUNT GL
    >       ITEMNO_ACC   = progessive number
    >       GL_ACCOUNT  = G/L Account
    >       ITEM_TEXT       = item text
    >       DOC_TYPE      = document type (the same of the header for all item)
    >       COMP_CODE   = company code (the same of the header for all item)
    >       BUS_AREA      = business area
    >       TAX_CODE       = tax code
    if you set a different doc_type or company code for each item the bapi trigger an error
    > ACCOUNTTAX                
    >            ITEMNO_ACC   =  progressive number
    >            GL_ACCOUNT   = G/L Account referred to TAX CODE
    >            TAX_CODE        = TAX CODE
    >            TAX_RATE        =  TAX RATE
    >            ITEMNO_TAX     = progressive number  which tax item is referred
    >CURRENCYAMOUNT
    >           ITEMNO_ACC     =  progressive number
    >           CURRENCY        =  currency
    >           CURRENCY_ISO =  iso currency that you find in TCURC-ISOCD table
    >           AMT_DOCCUR    =  amount with sign the sign +/- identify Debit/Credit Indicator
    > - this field only for tax record
    >           AMT_BASE        =   is the AMT_DOCCUR of the line which ypu want to calculate the tax with sign
    >           TAX_AMT           =    tax amount
    usually for calculate the correct value i use these functions 'CALCULATE_TAX_FROM_GROSSAMOUNT' or 'CALCULATE_TAX_FROM_NET_AMOUNT' it depends if i have the net or gross amount.
    for example:
    DOCUMENTHEADER                                  
    >        BUS_ACT                    =    'RFBU'
    >        USERNAME                =    sy-uname
    >        HEADER_TXT              =    'my_text'
    >        COMP_CODE              =    '0001'
    >        DOC_DATE                  =    '20080115'
    >        PSTNG_DATE              =    '20080115'
    >        FISC_YEAR(1)              =    '2008'
    >        FIS_PERIOD(1)             =    '01'
    >        DOC_TYPE                  =    'SA'
    ACCOUNT GL
    >Record 1
    >ITEMNO_ACC =  0000000001
    >GL_ACCOUNT =   0290111010
    >ITEM_TEXT =   ITEM_TEXT
    >DOC_TYPE =    SA
    >COMP_CODE =    0001
    >BUS_AREA =   GS1                                                                       
    >Record 2
    >ITEMNO_ACC =  0000000002
    >GL_ACCOUNT =    0500103900
    >ITEM_TEXT =   ITEM_TEXT
    >DOC_TYPE =   SA
    >COMP_CODE =   0001
    >TAX_CODE =  V2
    ACCOUNTTAX
    > Record 3
    >ITEMNO_ACC =   0000000003
    >GL_ACCOUNT =  0221103001
    >TAX_CODE =  V2
    >TAX_RATE =  20.000
    >ITEMNO_TAX = 0000000002
    CURRENCYAMOUNT
    >Record 1
    >ITEMNO_ACC = 0000000001
    >CURRENCY =  EUR
    >CURRENCY_ISO =   EUR
    >AMT_DOCCUR  = 150.00
    >AMT_BASE =  0.00
    >TAX_AMT =  0.00
    >Record 2
    >ITEMNO_ACC = 0000000002
    >CURRENCY =  EUR
    >CURRENCY_ISO =   EUR
    >AMT_DOCCUR  = -125.00
    >AMT_BASE =  0.00
    >TAX_AMT =  0.00
    >Record 3
    >ITEMNO_ACC = 0000000003
    >CURRENCY =  EUR
    >CURRENCY_ISO =   EUR
    >AMT_DOCCUR =  -25.00
    >AMT_BASE =  -125.00
    >TAX_AMT =   -25.00
    hope that is useful.
    Bye
    Marco

  • FM error while saving posting for FB60

    Dear all,
    i have implemented FM in ecc 6 ver ,while doing FB60 i got the below error.
    FM account assignment SPML/DUMMY cannot be posted in posting ledger 9A
    Message no. FMBS123
    Diagnosis
    The budget structure settings do not allow posting to the FM account assignment  SPML/DUMMY. The check of the budget structure ended with the return code 4.
    The system recognizes the following return codes for the check of posting addresses:
    u2022     Return code 1:
    The check of posting addresses is switched on. However the FM account assignment SPML/DUMMY  is missing in the budget structure. Insert this account assignment in the budget structure for the posting ledger 9A.
    u2022     Return code 2:
    The check of posting addresses is switched off, but the validation of posting addresses does not allow posting on this address.  Check the implementation of the Business Add-In (BAdI) Validate Budget and Posting Addresses in BS.
    u2022     Return code 3:
    The FM account assignment SPML/DUMMY leads to a conflict when you define a grouping key within the context of the budget structure. Check the implementation of the Business Add-In (BAdI) Define Grouping Key.
    u2022     Return code 4:
    The derivation strategy used for deriving the budget address from the posting address derives an invalid budget address. You can use the program for displaying of budget structure settings to find out which derivation strategy is used. Check the Derivation Strategy for BudgetAddresses in Customizing. This error may also be caused by inconsistent customizing of active FM account assignment elements in BCS and FM. This can be checked in IMG activity Activate Account Assignment Elements in Budget Control System.
    System Response
    Processing stops.
    Procedure
    Check the budget structure settings according to the given return code.

    Hi,
    Two things:
    a) FMDERIVE is relevant for both former and BCS models. It's a strategy which derives FM objects (not address) for postings of the document which have to be assigned to FM (basically, most of FI and LO documents).
    b) Strategy for derivation of budget address is something different. Here, you can tell the system where you want your budget to be checked. For example, the posting goes to fund centre X (either by direct entry or via derivation strategy put in FMDERIVE), but the budget to be checked is on fund centre Y. This functionality could be also achieved with AVC controlling objects, but since you work with budget structure, it's more natural to do it there. If your posting and budget entries are on the same level, then you basically don't need the budget address derivation strategy at all.
    Regards,
    Eli

  • AR Tax posting for China or Shanghai invoice

    Dear All,
    According to the tax law in China, AR Tax posting in China should not be put on account of the Tax Receivale. Instead, customer should pay full amount of document, and then AR Tax poating should be billed on account of Tax Payable.
    The current SAP that I tried still post tax amount into my Tax Receivable. How can I make it adhere to the China Tax law.
    Any consultants with China implementation experience can help me?
    Warmest Regards,
    Chinho

    Hi
    If this iis required by Law and it is chinese location specific ,you can ask SAP to meet the requirement .
    I donot remember the note number but you have to fill up a form and submit to product development .
    You can also contact your channel manager to suport for this ..
    Hope this helps
    Bishal
    Edited by: BIshal Adhikari on Oct 27, 2009 7:54 AM

  • Problem with depreciation posting for an asset with a '0' net book value.

    Hi,
    I have a problem with depreciation posting on one asset. I think it should not be calculated and posted at all.
    On 1st November 2010 (our Fiscal year starts on 1st November) there was acquisition posted to an asset and then it was reversed on the same day - so the net book value was '0'.
    In AFAB depreciation run for April 2011 - it posted depreciatoion of 0.01 Euro, so now the book value is -0.01.
    Do you know how this could have happened and what can I do to get the value of this asset back to 0?
    Thank you,
    Karol

    Hi Murlidhar,
    Thank you for your reply.
    I just have one doubt - as depreciation of 0.01 Eur was posted in previous period leaving net value of asset equal to -0.01 Eur.
    Shouldn't I get ritd of this asset value before I proceed with the steps you suggested?
    I think it is not possible to reverse the depreciation - so I struggle to find a way to bring asset value back to zero.
    Thank you,
    Karol

  • Tax Apportionment for Cross-Company Code

    how can 'business area'  be inherited from the source FI documents
    which are generated by cross-company transaction?.for example:
    company code D/C account business area amount
    1000 D expense 1000 1000
    1000 D tax 234
    1000 C vendor 1000 2234
    1000 D clearingA 1000 1000
    2000 D expense 2000 1000
    2000 C clearingB 2000 1000
    after running 'rfbust10',i want the document will be like that:
    company code D/C account business area amount
    1000 c tax 1000 117
    1000 D clearing 1000 1000
    1000 C clearing 1000 883
    2000 D tax 2000 117
    2000 c clearing 2000 117

    Hi,
    In IMG under
    Financial Accounting -> Preparations for Consolidation -> Business Area Consolidation -> Materials Management -> Assign Division/Valuation Area to Business Area
    Enterprise Structure -> Assignment -> Sales and Distribution -> Assign Business Area to Plant and Division
    Enterprise Structure -> Assignment -> Sales and Distribution -> Assign Business Area by Sales Area
    Sales and Distribution -> Basic Functions -> Account Assignment/Costing -> Business Area Account Assignment -> Assign Business Area to Plant and Division
    Sales and Distribution -> Basic Functions -> Account Assignment/Costing -> Business Area Account Assignment -> Assign Business Area by Sales Area
    Regards,
    Naveen.

  • Report painter report with diff. periods for different company codes

    I need to create a report showing different period data for diff. company codes.
    If company code = 1000, start date = 1, end date is user selected
    If company code = 2000, start date = 6, end date is user selected.
    Can this be done?
    Thanks experts.

    Hello
    Can you please explain a little more in details. I know how to create a formula variable but am not sure how to frame the if statement. The company code is coming from the selection screen when the user runs the report. How do I put an If statement to say "If company code is XXXX, then start period is "06"?
    Thanks for your help,

  • Tax posting for freight charges (Tax on Freight)

    Hi All,
       I am posting freight charges in A/R Invoice. The freight charges are levied to service tax ( Serv Tax 125, Cess 1% and H edu cess 2%). Now the problem is when I am attaching the tax code to the frieght amout and adding the invoice then the tax amount is being posted to the Rounding expense A/c defined in the Gl Accnt Determination, general Tab. This is being posted as a seperate line item along with the rounding amount in the Journal.
    I have defined seperate gl accounts for the tax postings in the tax code definition but these accounts are not being effected.
    Desirable and expected is that the freight charges should fall in the freight expense a/c(which is being done), the tax amount should effect the tax gl accounts as defined in tax codes.
    how come the tax amount is being posted in the rounding expense?
    Please suggest how to correct this. 
    Raj.
    Edited by: debraj bhattacharyya on Dec 9, 2008 10:55 AM

    Hi,
    While preparing the A/R Invoice and entering the Freight Amount you will select relevant Tax code. In that tax code you should link the GL account in which the tax amount to be stored.
    From AR Invoice, you will click the link button near freight. Now new window opens for freight charges. You will enter the frieght amount and link the appropriate tax code in the "Tax Code" field. If you click the Link arrow neat Tax Code it takes you to the Tax Codes - Setup window. In this window you can view the settings you have done for the Tax code. In this windoe you have fields A/R Tax Account and A/P Tax Account.
    Please check whether you have linked the Correct Account code in A/R Tax Account field.
    Raja.S

  • AP Issue with Tax Jurisdiction in FB60

    Hello Gurus-
    I have a problem/ puzzle I cannot figure out.
    For AP invoices, the Tax Jurisdiction is determined by Ship to and all is good.  However, when AP attempts to add freight to an invoice via t-code FB60, the tax juirisdiction defaults to plant which is wrong.
    Can this be changed to mirror the ship to?  Is there a solution to this?
    Thank you

    Hi,
    In FB60, you can not link to Ship to party as it is FI transaction and not related to SD.
    Regards,
    Gaurav

  • Inspection lot with stock posting for Mvt 642

    Dear Sir
    While doing PGI reversal(642).  The stock is directly going and sitting in Unrestricted but business required to put those stock  as Quality Stock
    Regards

    Dear Sir
    As per your comment did the changes for mvt 642 E L X E but inspection mot not generated,kindly guide the step where i m going wrong.
    Regards

  • MR8M-Reversal document for cross co code

    Hi
    I tried to  reverse a purchase invoice by using T.code-MR8M.Invoice was posted for cross company code.(say co code1=P430 and co code2 =P435)
    For P430 co code-
        31 35218                                                                                5,000.00-
        21 IP435000 (cross company)                                                                                5,000.00
    For P435 co code-
        81 55000005                                                5,000.00
        31 IP430000 (cross company)                                                                                5,000.00-
    G/L account 55000005 is for co code P435.but when I tried to reverse system through an error message that G/L account 55000005 blocked for P430.
    I checked in the system for P430 co code ..yes its block for posting .
    My question is why its showing block for co code P430 because its posted for P435 not for P430 and for co code P435,G/L account is already unblock.
    Can you please explain the logic.
    Thanks
    Abhi

    Hi Murlidhar,
    See the details below and please let me correct if i am lacking on the concept:
    There are two co.codes S1 & T0. The salary  of S1 needs to be paid from bank a/c of T0. In t code OBYA, i have given the following details:
    Co.code 1: S1
    debit posting key 40 & account debit is 6 (clearing a/c no. under S1) .Same is done with credit posting key 50 & 6.
    Co.code 1: T0
    debit posting key 40 & account debit is 11 (clearing a/c no. under T0) .Same is done with credit posting key 50 & 11
    Now, in t code FB50, i need to debit salary a/c of S1 & bank a/c of T0. When i click F4 for the options, the co.code is coming supressed on both occassions. though it can work in debit entry as it is for S1 only but on credit entry, i need to change the co.code.
    Hope i have explained the situation in very detail & it should give a fair idea about the problem.
    Please look into it.
    Regards,
    Ashok.

  • Replace the following open/fetch/close statements with a cursor FOR loop

    Hi anyone could you please help me,
    I would like to replace the following open/fetch/close statements with a cursor FOR loop.
    Codes are:
    CREATE OR REPLACE PROCEDURE COMOES.orchid_shipment_interface IS
      -- get the com shipment header records
      CURSOR c_com_shphdr ( p_dwn_end_dt DATE ) IS
      SELECT custno client_id
           , plheadno plheadno
           , DECODE(carr_no,'FEDX',lading_no,'UPS',lading_no,carrier_pro_no) tracking_no
           , carr_no||'/'||carr_method carrier_id
           , plantid plant_id
           , carr_no
           , lading_no
           , del_custaddr ship_to_id
           , ol_type cfm_order_type
           , del_custno
           , shipterm    freight_terms
           , del_custattn attn_line
           , custaddr
        FROM com_plhead@com_pricing.world
       WHERE status = '9'
         AND (mod_dat) > p_dwn_end_dt;
      -- get the com shipment address records
      CURSOR c_com_shpadr (p_custaddr VARCHAR2) IS
      SELECT name1 addr_name
           , street1 addr_line1
           , street2 addr_line2
           , city city
           , state state_cd
           , zip zip
           , country country_cd
           , phone work_phone
           , email email1
        FROM com_address@com_pricing.world
       WHERE addr_id = p_custaddr;
      -- get the com shipment detail records
      CURSOR c_com_shpdtl ( p_plheadno NUMBER) IS
      SELECT pll.plheadno pllheadno
           , pll.pllineno ord_line_no
           , pll.ol_no erp_line_no
           , pll.ol_segno
           , pll.fg_id sku
           , pll.qty_shipped ship_qty
           , pll.ordno erp_ord_no
           FROM com_plline@com_pricing.world pll
       WHERE pll.plheadno = p_plheadno
         AND NOT EXISTS (SELECT '1'
                           FROM com_pkg_int_interface@com_pricing.world  cpi
                          WHERE pll.ordno = cpi.ordno
                            AND pll.ol_no = cpi.ol_no);
      -- type declaration
      -- type declaration of com table.
      TYPE t_com_shphdr IS TABLE OF c_com_shphdr%ROWTYPE INDEX BY BINARY_INTEGER;
      TYPE t_orchid_shphdr IS TABLE OF orchid_shipment_hdr_intf%ROWTYPE INDEX BY BINARY_INTEGER;
      TYPE t_com_shpadr IS TABLE OF c_com_shpadr%ROWTYPE INDEX BY BINARY_INTEGER;
      TYPE t_orchid_shpadr IS TABLE OF orchid_shipment_address_intf%ROWTYPE INDEX BY BINARY_INTEGER;
      TYPE t_com_shpdtl IS TABLE OF c_com_shpdtl%ROWTYPE INDEX BY BINARY_INTEGER;
      TYPE t_orchid_shpdtl IS TABLE OF orchid_shipment_dtl_intf%ROWTYPE INDEX BY BINARY_INTEGER;
      lv_company_code       com_customer.business_unit%TYPE;
      lv_erp_ord_no         com_plline.ordno%TYPE;
      lv_actual_ship_date   com_plline.confirm_date%TYPE;
      lv_po_no              com_oline.po_no%TYPE;
      lv_ord_date           com_oline.entrydate%TYPE;
      lv_hdr_batch_ctrl_no  download_batch_info.batch_ctrl_no%TYPE;
      lv_adr_batch_ctrl_no  download_batch_info.batch_ctrl_no%TYPE;
      lv_dtl_batch_ctrl_no  download_batch_info.batch_ctrl_no%TYPE;
      lv_sku_desc           com_salesitem.title%TYPE;
      lv_ord_qty            com_oldelseg.qty%TYPE;
      lr_com_shphdr    t_com_shphdr;
      lr_orchid_shphdr t_orchid_shphdr;
      lr_com_shpadr    t_com_shpadr;
      lr_orchid_shpadr t_orchid_shpadr;
      lr_com_shpdtl    t_com_shpdtl;
      lr_orchid_shpdtl t_orchid_shpdtl;
      -- variable declaration
      ln_shphdr_seq    NUMBER(10):= 0;
      ln_shpadr_seg    NUMBER(10):= 0;
      ln_shpdtl_seq    NUMBER(10):= 0;
      cnt              NUMBER(10):= 0;
      cnt1             NUMBER(10):= 0;
      ld_hdr_dwn_end_dt           download_batch_info.download_end_tstamp%TYPE;
      lc_hdr_dwn_status           download_batch_info.dwn_status%TYPE;
      ld_hdr_download_end_tstamp  DATE;
      ln_hdr_running_seq          NUMBER(10) := 0;
      ld_adr_dwn_end_dt           download_batch_info.download_end_tstamp%TYPE;
      lc_adr_dwn_status           download_batch_info.dwn_status%TYPE;
      ld_adr_download_end_tstamp  DATE;
      ln_adr_running_seg          NUMBER(10) := 0;
      ld_dtl_dwn_end_dt           download_batch_info.download_end_tstamp%TYPE;
      lc_dtl_dwn_status           download_batch_info.dwn_status%TYPE;
      ld_dtl_download_end_tstamp  DATE;
      ln_dtl_running_seq          NUMBER(10) := 0;
    BEGIN
      -- get the batch control number details from batch information table for shipment header
      BEGIN
        SELECT batch_ctrl_no
             , NVL(download_end_tstamp,TO_DATE('01/01/1980','MM/DD/YYYY'))
             , dwn_status
          INTO lv_hdr_batch_ctrl_no
             , ld_hdr_dwn_end_dt
             , lc_hdr_dwn_status
          FROM comoes.download_batch_info
         WHERE download_id = 'ORCHID_SHIPMENT_HDR_INTF';
      EXCEPTION
        WHEN NO_DATA_FOUND THEN
          DBMS_OUTPUT.PUT_LINE (' No Data Found for ORCHID_SHIPMENT_HDR_INTF in Download Batch Info table...!!!');
          RAISE;
        WHEN TOO_MANY_ROWS THEN
          DBMS_OUTPUT.PUT_LINE (' Too Many Rows found for ORCHID_SHIPMENT_HDR_INTF in Download Batch Info table...!!!');
          RAISE;
        WHEN OTHERS THEN
          DBMS_OUTPUT.PUT_LINE (' Following error occured while getting batch control number for ORCHID_SHIPMENT_HDR_INTF in Download Batch Info table...!!!'||SQLERRM);
          RAISE;
      END;
      -- get the batch control number details from batch information table for shipment address
      BEGIN
        SELECT batch_ctrl_no
             , NVL(download_end_tstamp,TO_DATE('01/01/1980','MM/DD/YYYY'))
             , dwn_status
          INTO lv_adr_batch_ctrl_no
             , ld_adr_dwn_end_dt
             , lc_adr_dwn_status
          FROM comoes.download_batch_info
         WHERE download_id = 'ORCHID_SHIPMENT_ADDRESS_INTF';
      EXCEPTION
        WHEN NO_DATA_FOUND THEN
          DBMS_OUTPUT.PUT_LINE (' No Data Found for ORCHID_SHIPMENT_ADDRESS_INTF in Download Batch Info table...!!!');
          RAISE;
        WHEN TOO_MANY_ROWS THEN
          DBMS_OUTPUT.PUT_LINE (' Too Many Rows found for ORCHID_SHIPMENT_ADDRESS_INTF in Download Batch Info table...!!!');
          RAISE;
        WHEN OTHERS THEN
          DBMS_OUTPUT.PUT_LINE (' Following error occured while getting batch control number for ORCHID_SHIPMENT_ADDRESS_INTF in Download Batch Info table...!!!'||SQLERRM);
          RAISE;
      END;
      -- get the batch control number details from batch information table for shipment details
      BEGIN
        SELECT batch_ctrl_no
             , NVL(download_end_tstamp,TO_DATE('01/01/1980','MM/DD/YYYY'))
             , dwn_status
          INTO lv_dtl_batch_ctrl_no
             , ld_dtl_dwn_end_dt
             , lc_dtl_dwn_status
          FROM download_batch_info
         WHERE download_id = 'ORCHID_SHIPMENT_DTL_INTF';
      EXCEPTION
        WHEN NO_DATA_FOUND THEN
          DBMS_OUTPUT.PUT_LINE (' No Data Found for ORCHID_SHIPMENT_DTL_INTF in Download Batch Info table...!!!');
          RAISE;
        WHEN TOO_MANY_ROWS THEN
          DBMS_OUTPUT.PUT_LINE (' Too Many Rows found for ORCHID_SHIPMENT_DTL_INTF in Download Batch Info table...!!!');
          RAISE;
        WHEN OTHERS THEN
          DBMS_OUTPUT.PUT_LINE (' Following error occured while getting batch control number for ORCHID_SHIPMENT_DTL_INTF in Download Batch Info table...!!!'||SQLERRM);
          RAISE;
      END;
      -- if previous run is not sucess then do nothing and return.
      OPEN c_com_shphdr ( ld_hdr_dwn_end_dt ) ;
      LOOP
        -- delete the collection for every cycle
        lr_com_shphdr.DELETE;
        lr_orchid_shphdr.DELETE;
        lr_com_shpadr.DELETE;
        lr_orchid_shpadr.DELETE;
        lr_com_shpdtl.DELETE;
        lr_orchid_shpdtl.DELETE;
        -- fetch the order header records to collection
        FETCH c_com_shphdr BULK COLLECT INTO lr_com_shphdr LIMIT 500;
        -- where there is no record in the collection the exit from the loop
        EXIT WHEN lr_com_shphdr.COUNT = 0;
        -- build your logic there to populate the data into order header collection.
          FOR i IN 1..lr_com_shphdr.COUNT
          LOOP
            -- accumulate header running sequence number
            ln_hdr_running_seq := ln_hdr_running_seq + 1;
            ln_shphdr_seq      := ln_hdr_running_seq;
             -- Get the business unit for the customer from com_customer
            BEGIN
              SELECT business_unit
                INTO lv_company_code
                FROM com_customer@com_pricing.world
               WHERE custno = lr_com_shphdr(i).del_custno;
            EXCEPTION
            WHEN OTHERS THEN
              lv_company_code := NULL;
            END;
            -- Get the ordno, confirm_date from COM_PLLINE
            BEGIN
            SELECT ordno
                 , confirm_date
              INTO lv_erp_ord_no
                 , lv_actual_ship_date
              FROM com_plline@com_pricing.world cpl
             WHERE cpl.plheadno = lr_com_shphdr(i).plheadno
               AND ROWNUM = 1;
            EXCEPTION
            WHEN OTHERS THEN
              lv_erp_ord_no       := NULL;
              lv_actual_ship_date := NULL;
            END;
            -- Get the po_no, Entry_date from COM_OLINE
            BEGIN
              SELECT po_no
                   , entrydate
                INTO lv_po_no
                   , lv_ord_date
                FROM com_oline@com_pricing.world col
               WHERE col.ordno = lv_erp_ord_no
                 AND ROWNUM = 1;
            EXCEPTION
            WHEN OTHERS THEN
              lv_po_no    := NULL;
              lv_ord_date := NULL;
            END;
            -- To assign the Bol Number from Lading Number
            IF lr_com_shphdr(i).carr_no NOT IN ('FEDX','UPS') THEN
               lr_orchid_shphdr(i).bol_no     := lr_com_shphdr(i).lading_no;
            ELSE
               lr_orchid_shphdr(i).bol_no     := NULL;
            END IF;
            -- For each order header get the Shipment Delivery Adderss
            OPEN c_com_shpadr ( lr_com_shphdr(i).custaddr);
            FETCH c_com_shpadr BULK COLLECT INTO lr_com_shpadr;
            -- where there is no record in the collection the exit from the loop
            EXIT WHEN lr_com_shpadr.COUNT = 0;
            -- biuld your logic here to populate the del address collection.
              FOR j IN 1..lr_com_shpadr.COUNT
              LOOP
                -- accumulate the loop count into temp variable, so that will through tell each set of order header.
                cnt := cnt + 1;
                -- accumolate the header running sequence number.
                ln_adr_running_seg := ln_adr_running_seg + 1;
                ln_shpadr_seg := ln_adr_running_seg;
                -- move the order address data into collection.
                lr_orchid_shpadr(cnt).client_id       := lr_com_shphdr(i).del_custno;
                lr_orchid_shpadr(cnt).ord_no          := lr_com_shphdr(i).plheadno;
                lr_orchid_shpadr(cnt).tracking_no     := lr_com_shphdr(i).tracking_no;
                lr_orchid_shpadr(cnt).addr_name       := lr_com_shpadr(j).addr_name;
                lr_orchid_shpadr(cnt).attn_line       := lr_com_shphdr(i).attn_line;
                lr_orchid_shpadr(cnt).addr_line1      := lr_com_shpadr(j).addr_line1;
                lr_orchid_shpadr(cnt).addr_line2      := lr_com_shpadr(j).addr_line2;
                lr_orchid_shpadr(cnt).addr_line3      := NULL;
                lr_orchid_shpadr(cnt).addr_line4      := NULL;
                lr_orchid_shpadr(cnt).addr_line5      := NULL;
                lr_orchid_shpadr(cnt).city            := lr_com_shpadr(j).city;
                lr_orchid_shpadr(cnt).state_cd        := lr_com_shpadr(j).state_cd;
                lr_orchid_shpadr(cnt).zip             := lr_com_shpadr(j).zip;
                lr_orchid_shpadr(cnt).zip_ext         := NULL;
                lr_orchid_shpadr(cnt).country_cd      := lr_com_shpadr(j).country_cd;
                lr_orchid_shpadr(cnt).tax_geo_cd      := NULL;
                lr_orchid_shpadr(cnt).work_phone      := lr_com_shpadr(j).work_phone;
                lr_orchid_shpadr(cnt).email1          := lr_com_shpadr(j).email1;
                lr_orchid_shpadr(cnt).cre_dat         := SYSDATE;
                lr_orchid_shpadr(cnt).cre_usr         := USER;
                lr_orchid_shpadr(cnt).batch_ctrl_no   := lv_adr_batch_ctrl_no;
              END LOOP;
            CLOSE c_com_shpadr;
            -- For each order header get the order detail/delivery segment data
            OPEN c_com_shpdtl ( lr_com_shphdr(i).plheadno );
            FETCH c_com_shpdtl BULK COLLECT INTO lr_com_shpdtl;
            -- where there is no record in the collection the exit from the loop
            EXIT WHEN lr_com_shpdtl.COUNT = 0;
            -- build your logic here to populate the order detail collection
              FOR k IN 1..lr_com_shpdtl.COUNT
              LOOP
                -- accumulate the loop count into a temp variable, so that will through till each set of Order Header.
                cnt1 := cnt1 + 1;
                -- accumulate header running sequence number
                ln_dtl_running_seq := ln_dtl_running_seq + 1;
                ln_shpdtl_seq := ln_dtl_running_seq;
                -- Get Quantity for the delvery from delevery segment table.
                BEGIN
                  SELECT NVL(Qty,0)
                    INTO lv_ord_qty
                    FROM com_oldelseg@com_pricing.world cds
                   WHERE cds.ordno = lr_com_shpdtl(k).erp_ord_no
                     AND cds.ol_no = lr_com_shpdtl(k).erp_line_no
                     AND cds.ol_segno = lr_com_shpdtl(k).ol_segno;
                EXCEPTION
                  WHEN OTHERS THEN
                    lv_ord_qty := NULL;
                END;
                -- Get Title for the salesitem from the salesitem table.
                BEGIN
                  SELECT Title
                    INTO lv_sku_desc
                    FROM com_salesitem@com_pricing.world cs
                   WHERE cs.fg_id = lr_com_shpdtl(k).sku;
                EXCEPTION
                  WHEN OTHERS THEN
                    lv_sku_desc := NULL;
                END;
                -- move the Order detail data into collection
                lr_orchid_shpdtl(cnt1).client_id         := lr_com_shphdr(i).client_id;
                lr_orchid_shpdtl(cnt1).ord_no            := lr_com_shphdr(i).plheadno;
                lr_orchid_shpdtl(cnt1).ord_line_no       := lr_com_shpdtl(k).ord_line_no;
                lr_orchid_shpdtl(cnt1).erp_line_no       := lr_com_shpdtl(k).erp_line_no;
                lr_orchid_shpdtl(cnt1).sku               := lr_com_shpdtl(k).sku;
                lr_orchid_shpdtl(cnt1).tracking_no       := lr_com_shphdr(i).tracking_no;
                lr_orchid_shpdtl(cnt1).container_no      := NULL;
                lr_orchid_shpdtl(cnt1).ord_qty           := lv_ord_qty;
                lr_orchid_shpdtl(cnt1).ship_qty          := lr_com_shpdtl(k).ship_qty;
                lr_orchid_shpdtl(cnt1).price_point       := NULL;
                lr_orchid_shpdtl(cnt1).pick_invoice_no   := NULL;
                lr_orchid_shpdtl(cnt1).cancel_qty        := NULL;
                lr_orchid_shpdtl(cnt1).bldg_id           := NULL;                              --lr_com_shpdtl(k).bldg_id;
                lr_orchid_shpdtl(cnt1).sku_company       := NULL;                              --lr_com_shpdtl(k).sku_company;
                lr_orchid_shpdtl(cnt1).sku_desc          := lv_sku_desc;
                lr_orchid_shpdtl(cnt1).icc_cd1           := NULL;                              --lr_com_shpdtl(k).icc_cd1;
                lr_orchid_shpdtl(cnt1).erp_ord_no        := lr_com_shpdtl(k).erp_ord_no;
                lr_orchid_shpdtl(cnt1).cre_dat           := SYSDATE;
                lr_orchid_shpdtl(cnt1).cre_usr           := USER;
                lr_orchid_shpdtl(cnt1).batch_ctrl_no     := lv_dtl_batch_ctrl_no;
              END LOOP;
            CLOSE c_com_shpdtl;
            -- build the logic to populate Order Header
            lr_orchid_shphdr(i).client_id              := lr_com_shphdr(i).client_id;
            lr_orchid_shphdr(i).ord_no                 := lr_com_shphdr(i).plheadno;
            lr_orchid_shphdr(i).tracking_no            := lr_com_shphdr(i).tracking_no;
            lr_orchid_shphdr(i).container_no           := NULL;                            -- container number is not maintained in COM
            lr_orchid_shphdr(i).carrier_id             := lr_com_shphdr(i).carrier_id;
            lr_orchid_shphdr(i).plant_id               := lr_com_shphdr(i).plant_id;
            lr_orchid_shphdr(i).erp_ord_no             := lv_erp_ord_no;
            lr_orchid_shphdr(i).erp_ord_no2            := NULL;
            lr_orchid_shphdr(i).po_no                  := lv_po_no;
            lr_orchid_shphdr(i).ship_to_id             := lr_com_shphdr(i).ship_to_id;
            lr_orchid_shphdr(i).ship_to_addr_id        := lr_com_shphdr(i).custaddr;
            lr_orchid_shphdr(i).scac                   := NULL;                             --lr_com_shphdr(i).scac;
            lr_orchid_shphdr(i).actual_ship_date       := lv_actual_ship_date;
            lr_orchid_shphdr(i).cfm_order_type         := lr_com_shphdr(i).cfm_order_type;
            lr_orchid_shphdr(i).company_code           := lv_company_code;
            lr_orchid_shphdr(i).no_of_order_lines      := NULL;                             --lr_com_shphdr(i).no_of_order_lines;
            lr_orchid_shphdr(i).pick_invoice_no        := NULL;
            lr_orchid_shphdr(i).ord_date               := lv_ord_date;
            lr_orchid_shphdr(i).orig_tender_date       := NULL;
            lr_orchid_shphdr(i).orig_delv_date         := NULL;
            lr_orchid_shphdr(i).delivery_flag          := NULL;
            lr_orchid_shphdr(i).delv_date_from         := NULL;
            lr_orchid_shphdr(i).delv_date_to           := NULL;
            lr_orchid_shphdr(i).orig_carr_cd           := NULL;
            lr_orchid_shphdr(i).routing_comment        := NULL;
            lr_orchid_shphdr(i).segment_type           := NULL;
            lr_orchid_shphdr(i).back_order_flag        := NULL;
            lr_orchid_shphdr(i).addr_override_flag     := NULL;
            lr_orchid_shphdr(i).fmx_assigned_carr      := NULL;
            lr_orchid_shphdr(i).fmx_assigned_ship_date := NULL;
            lr_orchid_shphdr(i).fmx_assigned_delv_date := NULL;
            lr_orchid_shphdr(i).freight_terms          := lr_com_shphdr(i).freight_terms;
            lr_orchid_shphdr(i).fmx_load_id            := NULL;
            lr_orchid_shphdr(i).asn_type               := NULL;
            lr_orchid_shphdr(i).icc_cd1                := NULL;                             --lr_com_shphdr(i).icc_cd1;
            lr_orchid_shphdr(i).trans_type             := NULL;
            lr_orchid_shphdr(i).ref_no1                := NULL;
            lr_orchid_shphdr(i).ref_no2                := NULL;
            lr_orchid_shphdr(i).ref_no3                := NULL;
            lr_orchid_shphdr(i).ref_no4                := NULL;
            lr_orchid_shphdr(i).cre_dat                := SYSDATE;
            lr_orchid_shphdr(i).cre_usr                := USER;
            lr_orchid_shphdr(i).batch_ctrl_no          := lv_hdr_batch_ctrl_no;
            -- logic to get total boxes and weight.
            BEGIN
              SELECT SUM(no_cartons), SUM(weight)
                INTO lr_orchid_shphdr(i).total_boxes
                   , lr_orchid_shphdr(i).weight
                FROM com_plline@com_pricing.world pll
               WHERE pll.plheadno = lr_com_shphdr(i).plheadno;
            EXCEPTION
             WHEN OTHERS THEN
                lr_orchid_shphdr(i).total_boxes := NULL;
                lr_orchid_shphdr(i).weight      := NULL;
            END;
          END LOOP;
        -- initialize the variables for next loop cycle.
        cnt := 0;
        cnt1 := 0;
        -- populate the shipment header interface table.
        FOR x IN 1..lr_orchid_shphdr.COUNT
        LOOP
          ld_hdr_download_end_tstamp := lr_orchid_shphdr(x).cre_dat;
          INSERT INTO orchid_shipment_hdr_intf
                    (record_qualifier
                    ,client_id
                    ,ord_no
                    ,tracking_no
                    ,container_no
                    ,bol_no
                    ,carrier_id
                    ,plant_id
                    ,erp_ord_no
                    ,erp_ord_no2
                    ,po_no
                    ,ship_to_id
                    ,ship_to_addr_id
                    ,scac
                    ,actual_ship_date
                    ,cfm_order_type
                    ,company_code
                    ,no_of_order_lines
                    ,pick_invoice_no
                    ,total_boxes
                    ,weight
                    ,ord_date
                    ,orig_tender_date
                    ,orig_delv_date
                    ,delivery_flag
                    ,delv_date_from
                    ,delv_date_to
                    ,orig_carr_cd
                    ,routing_comment
                    ,segment_type
                    ,back_order_flag
                    ,addr_override_flag
                    ,fmx_assigned_carr
                    ,fmx_assigned_ship_date
                    ,fmx_assigned_delv_date
                    ,freight_terms
                    ,fmx_load_id
                    ,asn_type
                    ,upl_status
                    ,icc_cd1
                    ,trans_type
                    ,ref_no1
                    ,ref_no2
                    ,ref_no3
                    ,ref_no4
                    ,cre_dat
                    ,cre_usr
                    ,batch_ctrl_no)
            VALUES
                    ( 10
                    ,lr_orchid_shphdr(x).client_id
                    ,lr_orchid_shphdr(x).ord_no
                    ,lr_orchid_shphdr(x).tracking_no
                    ,lr_orchid_shphdr(x).container_no
                    ,lr_orchid_shphdr(x).bol_no
                    ,lr_orchid_shphdr(x).carrier_id
                    ,lr_orchid_shphdr(x).plant_id
                    ,lr_orchid_shphdr(x).erp_ord_no
                    ,lr_orchid_shphdr(x).erp_ord_no2
                    ,lr_orchid_shphdr(x).po_no
                    ,lr_orchid_shphdr(x).ship_to_id
                    ,lr_orchid_shphdr(x).ship_to_addr_id
                    ,lr_orchid_shphdr(x).scac
                    ,lr_orchid_shphdr(x).actual_ship_date
                    ,lr_orchid_shphdr(x).cfm_order_type
                    ,lr_orchid_shphdr(x).company_code
                    ,lr_orchid_shphdr(x).no_of_order_lines
                    ,lr_orchid_shphdr(x).pick_invoice_no
                    ,lr_orchid_shphdr(x).total_boxes
                    ,lr_orchid_shphdr(x).weight
                    ,lr_orchid_shphdr(x).ord_date
                    ,lr_orchid_shphdr(x).orig_tender_date
                    ,lr_orchid_shphdr(x).orig_delv_date
                    ,lr_orchid_shphdr(x).delivery_flag
                    ,lr_orchid_shphdr(x).delv_date_from
                    ,lr_orchid_shphdr(x).delv_date_to
                    ,lr_orchid_shphdr(x).orig_carr_cd
                    ,lr_orchid_shphdr(x).routing_comment
                    ,lr_orchid_shphdr(x).segment_type
                    ,lr_orchid_shphdr(x).back_order_flag
                    ,lr_orchid_shphdr(x).addr_override_flag
                    ,lr_orchid_shphdr(x).fmx_assigned_carr
                    ,lr_orchid_shphdr(x).fmx_assigned_ship_date
                    ,lr_orchid_shphdr(x).fmx_assigned_delv_date
                    ,lr_orchid_shphdr(x).freight_terms
                    ,lr_orchid_shphdr(x).fmx_load_id
                    ,lr_orchid_shphdr(x).asn_type
                    ,00
                    ,lr_orchid_shphdr(x).icc_cd1
                    ,lr_orchid_shphdr(x).trans_type
                    ,lr_orchid_shphdr(x).ref_no1
                    ,lr_orchid_shphdr(x).ref_no2
                    ,lr_orchid_shphdr(x).ref_no3
                    ,lr_orchid_shphdr(x).ref_no4
                    ,lr_orchid_shphdr(x).cre_dat
                    ,lr_orchid_shphdr(x).cre_usr
                    ,lr_orchid_shphdr(x).batch_ctrl_no);
        END LOOP;
        -- populate the shipment address interface table.
        FOR y IN 1..lr_orchid_shpadr.COUNT
        LOOP
          ld_adr_download_end_tstamp := lr_orchid_shpadr(y).cre_dat;
          INSERT INTO orchid_shipment_address_intf
                      ( record_qualifier
                      , client_id
                      , ord_no
                      , tracking_no
                      , addr_name
                      , attn_line
                      , addr_line1
                      , addr_line2
                      , addr_line3
                      , addr_line4
                      , addr_line5
                      , city
                      , state_cd
                      , zip
                      , zip_ext
                      , country_cd
                      , tax_geo_cd
                      , work_phone
                      , email1
                      , cre_dat
                      , cre_usr
                      , batch_ctrl_no)
               VALUES ( 14
                      , lr_orchid_shpadr(y).client_id
                      , lr_orchid_shpadr(y).ord_no
                      , lr_orchid_shpadr(y).tracking_no
                      , lr_orchid_shpadr(y).addr_name
                      , lr_orchid_shpadr(y).attn_line
                      , lr_orchid_shpadr(y).addr_line1
                      , lr_orchid_shpadr(y).addr_line2
                      , lr_orchid_shpadr(y).addr_line3
                      , lr_orchid_shpadr(y).addr_line4
                      , lr_orchid_shpadr(y).addr_line5
                      , lr_orchid_shpadr(y).city
                      , lr_orchid_shpadr(y).state_cd
                      , lr_orchid_shpadr(y).zip
                      , lr_orchid_shpadr(y).zip_ext
                      , lr_orchid_shpadr(y).country_cd
                      , lr_orchid_shpadr(y).tax_geo_cd
                      , lr_orchid_shpadr(y).work_phone
                      , lr_orchid_shpadr(y).email1
                      , lr_orchid_shpadr(y).cre_dat
                      , lr_orchid_shpadr(y).cre_usr
                      , lr_orchid_shpadr(y).batch_ctrl_no);
        END LOOP;
        -- populate the shipment detail interface table.
        FOR z IN 1..lr_orchid_shpdtl.COUNT
        LOOP
          ld_dtl_download_end_tstamp := lr_orchid_shpdtl(z).cre_dat;
          INSERT INTO orchid_shipment_dtl_intf
                      ( record_qualifier
                      , client_id
                      , ord_no
                      , ord_line_no
                      , erp_line_no
                      , sku
                      , tracking_no
                      , container_no
                      , ord_qty
                      , ship_qty
                      , price_point
                      , pick_invoice_no
                      , cancel_qty
                      , bldg_id
                      , sku_company
                      , sku_desc
                      , icc_cd1
                      , erp_ord_no
                      , cre_dat
                      , cre_usr
                      , batch_ctrl_no)
               VALUES ( 20
                      , lr_orchid_shpdtl(z).client_id
                      , lr_orchid_shpdtl(z).ord_no
                      , lr_orchid_shpdtl(z).ord_line_no
                      , lr_orchid_shpdtl(z).erp_line_no
                      , lr_orchid_shpdtl(z).sku
                      , lr_orchid_shpdtl(z).tracking_no
                      , lr_orchid_shpdtl(z).container_no
                      , lr_orchid_shpdtl(z).ord_qty
                      , lr_orchid_shpdtl(z).ship_qty
                      , lr_orchid_shpdtl(z).price_point
                      , lr_orchid_shpdtl(z).pick_invoice_no
                      , lr_orchid_shpdtl(z).cancel_qty
                      , lr_orchid_shpdtl(z).bldg_id
                      , lr_orchid_shpdtl(z).sku_company
                      , lr_orchid_shpdtl(z).sku_desc
                      , lr_orchid_shpdtl(z).icc_cd1
                      , lr_orchid_shpdtl(z).erp_ord_no
                      , lr_orchid_shpdtl(z).cre_dat
                      , lr_orchid_shpdtl(z).cre_usr
                      , lr_orchid_shpdtl(z).batch_ctrl_no);
        END LOOP;
        COMMIT;
      END LOOP;
      CLOSE c_com_shphdr;
      -- set the status to success
      UPDATE comoes.download_batch_info
         SET batch_ctrl_no = orchid_plhead_btch_ctrl_seq.NEXTVAL
           , dwn_status = '90'
           , download_end_tstamp = NVL(ld_hdr_download_end_tstamp,SYSDATE)
       WHERE download_id = 'ORCHID_SHIPMENT_HDR_INTF'
         AND batch_ctrl_no = lv_hdr_batch_ctrl_no;
      UPDATE comoes.download_batch_info
         SET batch_ctrl_no = orchid_address_btch_ctrl_seq.NEXTVAL
           , dwn_status = '90'
           , download_end_tstamp = NVL(ld_hdr_download_end_tstamp,SYSDATE)
       WHERE download_id = 'ORCHID_SHIPMENT_ADDRESS_INTF'
         AND batch_ctrl_no = lv_adr_batch_ctrl_no;
      UPDATE comoes.download_batch_info
         SET batch_ctrl_no = orchid_plline_btch_ctrl_seq.NEXTVAL
           , dwn_status = '90'
           , download_end_tstamp = NVL(ld_dtl_download_end_tstamp,SYSDATE)
       WHERE download_id = 'ORCHID_SHIPMENT_DTL_INTF'
         AND batch_ctrl_no = lv_dtl_batch_ctrl_no;
      -- Update the download status to success in the interface table.
      -- Shipment Header
      COMMIT;
    EXCEPTION
      WHEN OTHERS THEN
        -- load is not sucess then set the status to fail
        UPDATE comoes.download_batch_info
           SET dwn_status = '99'
         WHERE download_id = 'ORCHID_SHIPMENT_HDR_INTF'
           AND batch_ctrl_no = lv_hdr_batch_ctrl_no;
        UPDATE comoes.download_batch_info
           SET dwn_status = '99'
         WHERE download_id = 'ORCHID_SHIPMENT_ADDRESS_INTF'
           AND batch_ctrl_no = lv_adr_batch_ctrl_no;
        UPDATE comoes.download_batch_info
           SET dwn_status = '99'
         WHERE download_id = 'ORCHID_SHIPMENT_DTL_INTF'
           AND batch_ctrl_no = lv_dtl_batch_ctrl_no;
        COMMIT;
        DBMS_OUTPUT.PUT_LINE('Following error occured while executing ORCHID_SHIPMENT_INTF procedure...!!!'||SQLERRM);
        RAISE;
    END orchid_shipment_interface;Edited by: BluShadow on 03-Aug-2011 13:28
    added {noformat}{noformat} tags. Please read {message:id=9360002} to learn to do this yourself.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                &nb

    Please read the Forum FAQ on how to ask a question, particularly how to format code
    SQL and PL/SQL FAQ
    SQL and PL/SQL FAQ
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE (' Following error occured while getting batch control number for ORCHID_SHIPMENT_HDR_INTF in Download Batch Info table...!!!'||SQLERRM);
    RAISE;http://tkyte.blogspot.com/2008/01/why-do-people-do-this.html

  • BADI/USER EXIT for FB60

    Hi,
    please can you tell any BADI or USER EXIT that are available for FB60 Transaction code.
    Thanks
    cra

    hi
    following exits are available
                                                                                    Transaction Code - FB60                     Enter Incoming Invoices                                                                               
    Exit Name           Description                                                                               
    F050S001            FIDCMT, FIDCC1, FIDCC2: Edit user-defined IDoc segment                  
    F050S002            FIDCC1: Change IDoc/do not send                                         
    F050S003            FIDCC2: Change IDoc/do not send                                         
    F050S004            FIDCMT, FIDCC1, FIDCC2: Change outbound IDoc/do not send                
    F050S005            FIDCMT, FIDCC1, FIDCC2 Inbound IDoc: Change FI document                 
    F050S006            FI Outgoing IDoc: Reset Clearing in FI Document                         
    F050S007            FIDCCH Outbound: Influence on IDoc for Document Change                  
    F180A001            Balance Sheet Adjustment                                                
    FARC0002            Additional Checks for Archiving MM Vendor Master Data                   
    RFAVIS01            Customer Exit for Changing Payment Advice Segment Text                  
    RFEPOS00            Line item display: Checking of selection conditions                     
    RFKORIEX            Automatic correspondence                                                
    SAPLF051            Workflow for FI (pre-capture, release for payment)                                                                               
    No of Exits:         13                                                                      
    To search for a badi, go to se 24 display <b>class cl_exithandler.</b>
    double click on method get_instance, get a break point on case statement.
    execute and start the required transaction in new session.
    look for variable <b>exit_name.</b> It would show the available badi's.
    Hope this helps
    <b>if it helped, you can acknowledge the same by rewarding</b>
    regards
    dinesh

Maybe you are looking for