Close popup with branch

I have created a page with a "New party" button that opens a popup. It clears that cache for the popup and works fine.
The new party can be entered and "create"d. The page branches to itself and the create button is not displayed. The new party data is saved in the table.
The popup page has a computatoin to put the party_id into the calling page item. The Cancel button is a URL target: javascript:window.close();. This closes the window.
Two questions;
I want the branch to be a URL target that closes the page but I can't get it to work. The URL calls this in the Page HTML Header:
<script language="JavaScript1.1" type="text/javascript">
function passBack(){
window.close();
window.opener.location.reload(true);
I made the only branch a URL and entered this as the url: -- javascript:passback() -- It never executed the function.
I then tried -- javascript: window.close(); -- and the window did not close. This is the same code the Cancel button uses.
What am I missing?
Second question; I clicked the Cancel butoong, the window closed and on the calling page I looked at the session variables and the party_id was flagged as R but I did not see the value? Did it not write the session variable? Is there any way for me to check?
Tia,
Sam

Sam,
Why are you trying to take the user away from the current page? This can over complicate things. Have you considered a wizard approach where they could select "Create New" which would allow them to create the new entity?
What I've found to work best is to provide a link to another action and bring the user back. For example, lets say I have a two step process: Create User and Assign User to Projects. In the wizard to Assign User to Projects I'll provide a link that says Create User. The link takes the user to the Create User wizard while setting the value of an item that the Create User wizard will later reference to bring the user back to the same spot in the Assign Users wizard.
Regards,
Dan
http://danielmcghan.us
http://sourceforge.net/projects/tapigen

Similar Messages

  • Error after close popup with swfloader

    Hi all, hope some one could help me with this i get this
    error ( Error: Unable to load '' ) each time after i close a popup
    with a swfloader the error popsup when i click on the datagrid
    *****************************main mxml
    private function ShowPano():void
    var SWFLoaderInstance:Panoramica2 =
    Panoramica2(PopUpManager.createPopUp(this,Panoramica2,true));//
    instantiate and show the title window
    PopUpManager.centerPopUp(SWFLoaderInstance);
    SWFLoaderInstance.mainAppPano = this //Reference to the main
    app
    scope
    *******************************this is the mxml Panoramica2
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="
    http://www.adobe.com/2006/mxml"
    creationComplete="doInt()"
    cornerRadius="10" width="600" height="450">
    <mx:Script><![CDATA[
    import mx.controls.PopUpMenuButton;
    import mx.managers.PopUpManager;
    import mx.collections.ArrayCollection;
    import mx.controls.Button;
    [Bindable]public var mainAppPano:Object = null;
    //called by the close event raised byclicking the close
    button
    private function closeWindow():void
    PopUpManager.removePopUp(this);
    }//closeWindow
    private function doInt():void
    PopUpManager.centerPopUp(this);
    ]]>
    </mx:Script>
    <mx:TitleWindow layout="absolute" right="10" left="10"
    showCloseButton="true"
    close="closeWindow()" top="10" bottom="10">
    <mx:SWFLoader
    source="{mainAppPano.datagrid.selectedItem.pano..src}"
    scaleContent="false"
    horizontalCenter="0" verticalCenter="0"/>
    </mx:TitleWindow>
    </mx:Canvas>
    ********************************xml structure
    <catalog>
    <libro>
    <name><![CDATA[<b>Biblioteca Central
    </b> ]]></name>
    <desc><![CDATA[Se inauguró el 20 de noviembre
    de 1978 ]]></desc>
    <imagen>FOTOS/est/Biblioteca Central Manuel Bartlett
    Bautista.jpeg</
    imagen>
    <pano nombrePano="Biblioteca Central Bautista">
    <src>FOTOS/Panoramicas/PanoZoom642007.swf</src>
    </pano>
    <ico>BOTONES/gifs/video.gif</ico>
    <video nombreVid="Biblioteca Manuel Bartlet">
    <src>VIDEOS/Biblioteca Manuel Bartlet.flv</src>
    </video>
    <audio/>
    <pie>Biblioteca Central Manuel Bartlett
    Bautista</pie>
    </libro>
    </catalog>

    <script type="text/javascript">
    function saveChanges(){
    doSubmit('SUBMIT');
    var test = $x('P7_FLAG').value;
    if(test == '1')
    window.close();
    window.opener.doSubmit('REFRESH');
    </script>javascript does not wait for the current action to complete and then perform the next line.
    means in your function call
    doSubmit('SUBMIT');is triggered and it carry on's to next line that is
    $x('P7_FLAG').value;this will not be set because you are setting the value of P7_FLAG to 1 in plsql and trying to check in javascript, which will not work.
    what you need to do is amend your js function like below
    <script type="text/javascript">
    function saveChanges(){
    doSubmit('SUBMIT');
    </script>create a page branch to procedure and make it conditional to when P7_FLAG = 1
    and set the branch source to below
    htp.p('window.close();');
    htp.p('window.opener.doSubmit(''REFRESH'');');

  • How to close popup with af:commandButton without submitting values?

    Hi all,
    I'm using JDeveloper 11.1.2.1
    My popup has few af:inputText components with value attribute binded to view scope variables.
    I set those view scope variables in backing bean before showing popup.
    When I change values of input fields and click cancel (af:commandButton, partialSubmit=true, immediate=true), popup is closed.
    Then, when I show popup again, values that I changed are visible although I set new values to view scope variables in backing bean before showing popup again.
    I noticed that when I close popup using close icon in upper right corner of popup everything works fine.
    Also, I tried using dialog cancel button and it also works fine.
    Is there a way for closing popup using af:commandButton but without submitting values?
    In previous releases of JDeveloper (<= 11.1.1.5) I didn't noticed this problem.
    Thanks in advance,
    Aleksandar

    Alexandar wrote:
    Is there a way for closing popup using af:commandButton but without submitting values?If you really want to use your own button without submitting, then some three lines of Javascript will do the trick. See the documentation of af:popup for that. Canceling a popup is a pure client-side operation. No event is sent to the server. No submit. No need to reset anything. That's basically what the built-in cancel button does as well.
    Sascha

  • Open and Close Popup With Javascript

    Using Apex 3.2
    I have probably done this loads of times in my old job, but do not have access to the code and today I just can't get it to work properly.
    I have opened a pop up window with javascript
    Now I need to close it and refresh the calling page, but only if it passes the validation on the popup.
    I have a hidden item on my pop up called P7_FLAG.
    I have a page process after validation that sets P7_FLAG to (only set to 1, if passes validation).
    I also have a SUBMIT button.
    So once I click my SUBMIT button the page should look at the validations, if ok, set P7_FLAG to 1, then close the popup and refresh the calling page.
    My current javascript look like this
    <script type="text/javascript">
    function saveChanges(){
    doSubmit('SUBMIT');
    var test = $x('P7_FLAG').value;
    if(test == '1')
    window.close();
    window.opener.doSubmit('REFRESH');
    </script>On my button
    javascript:saveChanges();The problem is that I need to click the SUBMIT button twice.
    First time it sets P7_FLAG
    Second time it closes page and refreshes.
    I have probably made some basic error, but today I cannot see it.
    Cheers
    Gus
    Edited by: Gus C on May 10, 2012 12:48 AM

    <script type="text/javascript">
    function saveChanges(){
    doSubmit('SUBMIT');
    var test = $x('P7_FLAG').value;
    if(test == '1')
    window.close();
    window.opener.doSubmit('REFRESH');
    </script>javascript does not wait for the current action to complete and then perform the next line.
    means in your function call
    doSubmit('SUBMIT');is triggered and it carry on's to next line that is
    $x('P7_FLAG').value;this will not be set because you are setting the value of P7_FLAG to 1 in plsql and trying to check in javascript, which will not work.
    what you need to do is amend your js function like below
    <script type="text/javascript">
    function saveChanges(){
    doSubmit('SUBMIT');
    </script>create a page branch to procedure and make it conditional to when P7_FLAG = 1
    and set the branch source to below
    htp.p('window.close();');
    htp.p('window.opener.doSubmit(''REFRESH'');');

  • Flex mobile - close popUp with back hardware key - bug?

    Hi everyone,
    i am having a problem with a popUp in my firstView aka HomeView. I used a similar logic as provided by the DashBoardMobile reference example: (http://www.adobe.com/products/flex/examples/)
    when i open the PopUP i add a EventListener with the HandlerFunction to close the popUp if the device back-key is pressed:
    systemManager.stage.addEventListener(KeyboardEvent.KEY_UP, deviceKeyUpHandler, false, 1000, true);
    protected function deviceKeyUpHandler(event:KeyboardEvent):void
                    var key:uint = event.keyCode;
                    if (key == Keyboard.BACK)
                        event.stopImmediatePropagation();
                        event.stopPropagation();
                        closePopUp();
    So far this had worked fine (if a popUp is open its get closed, if no popUp is open the previous View is poped)
    Now i made a popUp for the firstView of my app, and there this doesnt works, if i press the back-kay the application is closed wether the popUp is open or not...

    You might want to try listening for the backKeyPressed event on the View instead: http://polygeek.com/4225_air-mobile_go-your-own-way-overriding-the-back-key-press-in-air-m obile-apps
    In that handler if your popup is open you'll want to preventDefault() on the event and call your close logic.

  • Close popup data input window once CREATE button pressed?

    Hello,
    I have a data input form opened as a popup, it contains 2 buttons (CANCEL & CREATE). The cancel button just uses the javascript:window.close(); command and works fine. The CREATE button creates the record correctly but when it tries to close (using a branch with the same javascript command as the create button), it fails and I get the following:
    The window doesn't close.
    It gives me the error: Cannot find server. The page cannot be displayed.
    Does anyone know how I can close the popup form after a new record has been successfully created.
    Many thanks
    Sue

    Hi
    I think it does not work because you cannot close and submit a page at the same time. One idea is to create an empty page, and add this code to the Page HTML body attribute:
    onload=window.close();
    Then make the popup page branch to this page after submit...
    I hope this helps.
    Luis

  • Open a Popup with commnadButtom

    Hello,
    can I open a Popup with a commnadButton? Und Load in the Popup a PDF`?
    I can open a PDF but only in self window :-(
    Thanks for help
       public String doActionShowPreview() {
            FacesContext facesContext = FacesContext.getCurrentInstance();
            HttpServletResponse response = (HttpServletResponse)facesContext.getExternalContext().getResponse();         
            response.setContentType("application/pdf");
            response.setHeader ("Content-disposition", "inline");
            response.setHeader("Expires:"," Wednesday, 27-Dec-95 05:29:10 GMT");
            response.setHeader("Pragma:"," no-cache");
            Documents previewDoc = getEditDocument();
            List tagListForCreator = new ArrayList();
            Set tagList = previewDoc.getText();
            Iterator iter = tagList.iterator();
            while(iter.hasNext()) {
                DocumentText docText = (DocumentText)iter.next();
                XMLParserTagInfo info = new XMLParserTagInfo(docText.getTag(),docText.getText());
                tagListForCreator.add(info);
            Collections.sort(tagListForCreator);
           XMLInDesignCreator xmlCreator = new XMLInDesignCreator();
           xmlCreator.createXML(tagListForCreator,previewDoc.getDocName(),previewDoc.getDocName());
        File file = new File("C:\\tm\\preview\\"+ previewDoc.getDocName()+".pdf");
       //convert the file content into a byte array
       FileInputStream fileInuptStream = null;
       try {
           fileInuptStream = new FileInputStream(file);
       } catch (FileNotFoundException ex1) {
       BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInuptStream);
       ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
       int start = 0;
       int length = 1024;
       int offset = -1;
       byte[] buffer = new byte[length];
       try {
           while ((offset = bufferedInputStream.read(buffer, start, length)) != -1) {
               byteArrayOutputStream.write(buffer, start, offset);
       } catch (IOException ex2) {
           ex2.printStackTrace();
        try {
            bufferedInputStream.close();
            byteArrayOutputStream.flush();
            buffer = byteArrayOutputStream.toByteArray();
            byteArrayOutputStream.close();
        } catch (IOException ex3) {
            ex3.printStackTrace();
        response.setContentType("application/pdf");
        response.setHeader ("Content-disposition", "inline");
        response.setHeader("Expires:"," Wednesday, 27-Dec-95 05:29:10 GMT");
        response.setHeader("Pragma:"," no-cache");
        try {
            response.getOutputStream().write(buffer);
            response.getOutputStream().flush();
        } catch (IOException ex4) {
            ex4.printStackTrace();
        return "";
        }

    Do the following
    1) window.open('somePath/YOUR_JSF_PAGE .jsf') in your javascript code.
    2) Invoke doActionShowPreview() method in the constructor of your BackingBean.
    Hope this helps.
    Karthik

  • How : Close PopUp after 10 seconds

    Hello I have a popup with a info text .  The popup should close after 10 seconds.
    I have create I View in the PopUp with a TimeTrigger and this TimeTrigger fire the Exit Plug of the PopUp window.
    but it doesn't work
    PopUp Cal :
      data: context_node type ref to if_wd_context_node.
      data: lr_popup type ref to if_wd_window,
            lr_view_controller type ref to if_wd_view_controller.
      data: lr_api_comp_controller type ref to if_wd_component,
            lr_window_manager type ref to if_wd_window_manager.
      lr_api_comp_controller ?= wd_this->wd_get_api( ).
      lr_window_manager = lr_api_comp_controller->get_window_manager( ).
      lr_popup = lr_window_manager->create_window(
      modal               = abap_true
      window_name         = 'W_POPCOUNTER'  "Name of the window created in step 2
      title               = 'Please enter all information'
      close_button        = abap_true
      button_kind         = if_wd_window=>CO_BUTTON_OK
      message_type        = if_wd_window=>co_msg_type_warning
      close_in_any_case   = abap_false
    *MESSAGE_DISPLAY_MODE = MESSAGE_DISPLAY_MODE
      lr_popup->open( ).

    Thanks for your soultion.  Now I have the problem that my abap code not wait until the popup is closed.
    Have you a solution for this ?
      lr_popup = lr_window_manager->create_window(
      modal               = abap_true
      window_name         = 'W_POPCOUNTER'  "Name of the window created in step 2
      title               = 'Please enter all information'
      close_button        = abap_true
      button_kind         = if_wd_window=>co_button_ok
      message_type        = if_wd_window=>co_msg_type_warning
      close_in_any_case   = abap_false
    *MESSAGE_DISPLAY_MODE = MESSAGE_DISPLAY_MODE
      lr_popup->open( ).
    '/// Not Waitung
    concatenate lv_numbersessions_str ' Active User Session from  ' iv_sid ' on system are killed' into g_text.

  • Close popup - end recording???

    I have a colleague who's experiencing some strange behavior
    recording using C2.
    He's recording a web based application in IE with buttons and
    links that cause secondary windows to popup (e.g., calendar applet
    to select date). When he clicks the Close (X) icon for the
    secondary window, C2 ends the current recording session and begins
    generating slides (as if he had pressed the End button).
    He's checked his Recording Preferences, and the End Recording
    is set to the End key. I can record the same application and popups
    with my version of C2, and it behaves just fine (i.e., continues
    recording after the popup closes).
    Any idea what might be going on, or how to troubleshoot this?
    Any suggestions would be appreciated.
    -- Bob F.

    Hi Bob F.,
    Has your colleague tried changing the key to end recording -
    to something besides "END"?
    If there is some conflict in his startup files or
    configuration that is causing the premature end of recording,
    perhaps a different keyboard shortcut might help (on his/her
    machine only).(??)

  • Close popup on completion of procedure

    I have built a custom popup that I use to record a value in conjunction with the current screen. The popup gathers values from the current screen, asks the user for a little more input, then saves the records. The procedure is working great. After the procedure completes, I would like to close the popup window.
    I've tried two things: using a Close Popup Window procedure and using hints from this thread:
    Re: Close popup after MRU
    I had it working (the close part) but I had to go back and alter some of my page and now it isn't working again. Can someone suggest what to look at?
    HTML header:
    <script language="JavaScript" type="text/javascript">
    function closeWindow()
    if ( document.getElementById("P1069_SAVESTATUS").value == 'R' )
      window.opener.location.href=window.opener.location.href;
      window.close();
    </script>One HTML region, source is:
    <script language="JavaScript" type="text/javascript">
      onLoad="closeWindow();"
    </script>Region item P1069_SAVESTATUS     is set as Hidden, set to 'N' when session state is null.
    Process is as follows (triggered by FINISH button):
    declare
      v_job        NUMBER     := :P1069_TC_ID;
      v_dt         DATE       := to_date(:P1069_DT,'MM/DD/YYYY');
      v_emp        NUMBER     := :P1069_EMP_ID;
      v_pkg        NUMBER     := :P1069_PKG_ID;
      cursor c_pkg is select COURSE_ID from TRAINING_PKG_ASSIGN
                where COURSE_PKG_ID = v_pkg and COURSE_ID > 0
                order by COURSE_ORDER;
      v_crs        NUMBER;
      v_eemp       NUMBER     := :G_USER_ID;
      v_edt        DATE       := SYSDATE;
    begin
      delete from EMP_TRN_HISTORY
       where TC_ID = v_job;
      open c_pkg;
        LOOP
          FETCH c_pkg into v_crs;
          EXIT WHEN c_pkg%NOTFOUND;
            insert into EMP_TRN_HISTORY (EVENT_ID, EVENT_DATE, TRN_CRS_ID,
                  ENTRY_EMP_ID, ENTRY_DATE, TC_ID, EMP_ID, PKG_ID)     
               values (SEQ_EMP_HISTORY.nextval, v_dt, v_crs,
                     v_eemp, v_edt, v_job, v_emp, v_pkg);
        END LOOP;
      close c_pkg;
      :P1069_SAVESTATUS  := 'R';
    end;

    Try changing the HTML in your region to
    <script language="JavaScript" type="text/javascript">
      closeWindow();
    </script>the onload="" notation would be used if you were putting the function call in the <BODY> tag of the page.

  • Tabular form on page popup with calendar popup

    Hi,
    i have a main page forrm (P5005)
    i have a botton for calling a tabular form on popup window (P5035)
    target is a: URL
    URL Target:
    javascript:popupURL('f?p=&APP_ID.:5035:&APP_SESSION.::::P5035_IDENTIF:&P5005_IDENTIF.',100,100)
    tabular form (P5035)
    i have a botton for close popup
    target is a: URL
    URL Target:
    javascript:close();
    on the same tabulare form for ogni row i have a date item with
    display as: data picker
    data picker format mask: Data Picker(DD-MON-RR)
    1. issue
    click on day calendar don't return pick value
    2. click on close button
    return on page P5005 (main form) no on popup form (P5035) (calling caledar form)
    Any help?
    Thanks in advance
    km

    Hi,
    Ummm... OK - the same thing started happening to me as well :(
    I've tried various things, and the following seems to work ok:
    &lt;a href="javascript:openPage2();"&gt;Open page 2&lt;/a&gt;
    &lt;script type="text/javascript"&gt;
    function openPage2()
    var x = open('page2.html', 'x', 'height=200,width=400,status=yes,toolbar=no,menubar=no,location=no', false);
    if (x.opener == null) {x.opener = self;}
    x.focus();
    &lt;/script&gt;and the Close option should be:
    &lt;button onclick="javascript:window.close();"&gt;Close&lt;/button&gt;So, change the url to call a function and make sure the function is defined in a similar way to the above.
    Andy

  • How to close PopUp (from taskflow region)???

    Can someone, please, explain how to solve this use-case:
    I have PopUp in which I put a region (in which is a small TaskFlow consiting of 2 JSFFs). I want to have Cancel and OK buttons in both JSFFs in TaskFlow. How to close PopUp from within TaskFlow ??? I saw the TaskFlow Return component in ADF TaskFlow diagram components (in palette) but haven't found any help/documentation on it. Or, should I use Return listener on command button used to rise popup (but, still, how to close popup from taskflow?)?
    Any help would be great!
    Thanks in advance,
    Marko

    mimarko,
    Regions/Taskflows are meant to be isolated reusable components. They are not meant to
    have knowledge of their parent or container. That said, code contained with in a region should not attempt to reach out an modify the parent. Regions can fire contextual events that can be handled by a listener declared in the parent pages pageDef. However, attempting to close a popup from a context listener would be bad practice. The easiest fixt is to put the popup in the taskflow for your region. That will create a reusable popup that you can use through out your application.
    --Ric                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • CRM70 Popup with Inputfield

    Hello all,
    again an interesting requirement from my users
    We require in an eventhandler (button_click) a popup with one inputfield from type dats.
    The date the user choose on the popup shall be used in the ON_POPUP_CLOSE event.
    I know that it is not possible with the standard reuse popup or decision popup.
    Has anybody already realised such a popup with input fields and could provide the steps?
    Thanks a lot.
    Kind regards
    Manfred

    Hi Manfred,
    Create a view with a context node, assume POPUP_CTXT and assign an input field (example DATE) to it. So the value entered in the input filed with be set in its collection wrapper.
    Call this view as a popup and in the on close event get the context node and read the value from DATE,
    sample coding in on_close_event,
    Data: lr_outputnode          TYPE REF TO cl_bsp_wd_context_node,
             lr_collection_wrapper  TYPE REF TO cl_bsp_wd_collection_wrapper,
            lr_current            TYPE REF TO if_bol_bo_property_access.
    lr_outputnode ?= popup_reference->get_context_node( 'POPUP_CTXT' ).
    lr_collection_wrapper = lr_outputnode->get_collection_wrapper( ).
    lr_current           = lr_collection_wrapper->get_current( ).
    CALL METHOD lr_current->get_property_as_value
              EXPORTING
                iv_attr_name = 'DATE'
              IMPORTING
                ev_result    = lv_date.
    The 'popup_reference' variable must be declared globally. The instance will be created while calling the popup.
    Regards,
    Arun

  • When I close firefox with ctrl-alt-delete, I want to start over on Firefox, I usually do this when too many tabs and windows are open. However, Firefox always restores the tabs and windows I previously had. How can I stop that from happening?

    This happens when FireFox is not responding, and I want to close firefox with ctrl-alt-delete. Too many tabs can make Firefox crash. That is why I want to use ctrl-alt-delete to close FireFox. I tried finding a way to disable this, but I found no option to.

    Ending the Firefox program or process with the Windows Task Manager "looks like" a crash. The proper way to exit Firefox is click Firefox button > Exit (or File > Exit, if using the Menu Bar).
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''
    Not related to your question, but...
    You need to update some plug-ins:
    *Plug-in check: https://www-trunk.stage.mozilla.com/en-US/plugincheck/
    *Adobe Shockwave for Director Netscape plug-in: [https://support.mozilla.com/en-US/kb/Using%20the%20Shockwave%20plugin%20with%20Firefox#w_installing-shockwave Installing ('''''or Updating''''') the Shockwave plugin with Firefox]
    *Adobe PDF Plug-In For Firefox and Netscape: [https://support.mozilla.com/en-US/kb/Using%20the%20Adobe%20Reader%20plugin%20with%20Firefox#w_installing-and-updating-adobe-reader Installing/Updating Adobe Reader in Firefox]
    *Shockwave Flash (Adobe Flash or Flash): [https://support.mozilla.com/en-US/kb/Managing%20the%20Flash%20plugin#w_updating-flash Updating Flash in Firefox]
    *Next Generation Java Plug-in for Mozilla browsers: [https://support.mozilla.com/en-US/kb/Using%20the%20Java%20plugin%20with%20Firefox#w_installing-or-updating-java Installing or Updating Java in Firefox]

  • 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

Maybe you are looking for

  • Confirm goods receipt search blank

    Hi All We are on SRM 5.0 SRM Server 5.5. Whenever any user ID selects "Confirm goods / services" or "Confirm goods services centrally" the search always returns no documents. No matter what is entered the result is the same. We have both SC's and dir

  • In-Context Editor can't handle implicit index.html

    The In-Context Editor can't handle implicit index.html - e.g., when a menu link points to /subfolder/ with a file named index.html inside, the link works fine on the front-end but In-Context Editor users get a 404 Page Not Found error. Naively, it ap

  • IWeb 09 and Google Adsense

    I have a six page website I created in Iweb 09 and I have a Google Adsense account as well. I cannot get the Widget to show up on any of the pages when I publish the pages locally or to my domain. Any suggestions or ideas?

  • Is it possible to do a selective restore from itunes?

    I had a wifi  issue on my iphone 4 issue after updating to IOS 6.0.1 - the wifi would no longer auto connect would not maintain a connection to any wifi broadcast. It seemd OK when no data was moving through it but dropped and reverted to 3G as soon

  • Pulse/Period measurement to control VI

    Hi I am enquiring regarding controlling a vi iterations with an external trigger. Let me summarise my VI first. I have a for loop using single point aquisition i need to run for a specific number of iterations depending on the time base between my ex