Restrict WERKS values in the output of simple ALV(using REUSE_GRID_DISPLAY

Hi ,
I have one  requirement as follows:-
--> I want to restrict WERKS values in the output of simple ALV(using REUSE_GRID_DISPLAY).
currently the values ae displayed from standard search-help.
I want to fields WERKS(MRP Type) values from table T001W with field VKFLZ = 'B'.
Now the fieltered values should be displaeyd in ALV output.
I was thinking of using the event, but i cannot find appropriate event where i can code my changes...please suggest
Thanks in Advance.

Hi Sandeep,
    I have the events in IT_EVENTS table.
    None of them i find suitable event for restrcition of F4 vaues in field werks.
    CALLER_EXIT
USER_COMMAND
TOP_OF_PAGE
TOP_OF_COVERPAGE
END_OF_COVERPAGE
FOREIGN_TOP_OF_PAG
FOREIGN_END_OF_PAG
PF_STATUS_SET
LIST_MODIFY
TOP_OF_LIST
END_OF_PAGE
END_OF_LIST
AFTER_LINE_OUTPUT
BEFORE_LINE_OUTPUT
REPREP_SEL_MODIFY
SUBTOTAL_TEXT
GROUPLEVEL_CHANGE.
Please suggest, what other options we can have on this.
Thanks in Advance.

Similar Messages

  • How to restrict some values in the final report output.

    Hi Experts,
    I have scenario where I dont want to include the values in the output of report.
    If you observe above there are some un assigned cost elements and its the report output. I dont want these to be in the report.
    Please suggest me.
    Thanks,
    Ravi

    Hi Friends,
    Thank you for the reply.
    I tried to exclude the values, but i dont find any chance to exclude them
    If i try the same from characteristic restriction, its allowing me to exclude.
    Is there any other possibility to restrict these? Please suggest

  • How to call a screen /t-code by double clicking on the output of an alv?

    Hi,
    I want to call a screen /  t-code on double clicking on the output of an alv report.
    Suppose we click on a value in the "Pur Req" feild of the ALV output  it should  open the the transaction code and give us  the  details of that particular value. How can I do that?
    Thanx in advance..

    If you displaying ALV using Classes..( CL_GUI_ALV_GRID)... You need to create event receiver and register the double click event handler method dynamically.... Here's the sample code...
    *                            C L A S S E S                             *
    class lcl_event_receiver definition.
      public section.
        methods:  handle_double_click
                  for event double_click
                  of cl_gui_alv_grid
                  importing e_row e_column.
    endclass.
    *       CLASS lcl_event_receiver IMPLEMENTATION
    class lcl_event_receiver implementation.
      method handle_double_click.
        data: l_cc like line of gt_cc.
        data:
        g_row type i,
          g_value(10),
          g_col type i,
          g_row_id type lvc_s_row,
          g_col_id type lvc_s_col,
          g_row_no type lvc_s_roid.
    *  Read the double click cell
        call method gr_grid->get_current_cell
               importing
                 e_row     = g_row
                 e_value   = g_value
                 e_col     = g_col
                 es_row_id = g_row_id
                 es_col_id = g_col_id
                 es_row_no = g_row_no.
        clear wa_itab
        read table gt_itab index g_row_id into wa_itab.
        case g_col_id.
          when 'EBELN'.                   "Show Process Order
            if not wa_itab-ebeln is initial.
              set parameter id 'BES' field wa_cc-ebeln.
              call transaction 'ME22N'  and skip first screen.
            endif.
        call method gr_grid->set_table_for_first_display
            exporting
            i_consistency_check   =  g_consistency_check
            it_toolbar_excluding  =  gt_exclude
            is_variant            =  gs_variant
            i_save                =  g_save
            i_default             =  'X'
            is_layout             =  g_layout
        changing it_outtab        =  gt_cc[]
                 it_fieldcatalog  =  gt_fieldcat[]
                 it_sort          =  gt_sortcat[].
        create object event_receiver.
    *   Register the 'Double Click' event handler method dynamically.
        set handler event_receiver->handle_double_click for gr_grid.

  • How to display the output screen when I use bdc.

    hey expert,
    I want to display the output screen when i use bdc without using mode 'A'.
    thank you.

    Hi,
    You can go for mode 'E'.. it will display the output screen directly and if there is any error in the transaction you would get that particular screen and you can correct and continue after which you will get the final screen if anything goes fine...
    check this sample code....
    I had a program if you execute below program it automatically creates a new zprogram.
    REPORT  zprogram_create_recording.
    PARAMETER:
      p_prog    TYPE sy-repid OBLIGATORY,
      p_shtxt TYPE repti OBLIGATORY,
      p_pack  TYPE devclass DEFAULT '$tmp'.
    DATA:
      t_bdcdata LIKE
       STANDARD TABLE
             OF bdcdata.
    DATA:
      wa_bdcdata LIKE LINE OF t_bdcdata.
    REFRESH t_bdcdata.
    CLEAR wa_bdcdata.
    wa_bdcdata-program    =  'SAPLWBABAP'.
    wa_bdcdata-dynpro     =  '0100'.
    wa_bdcdata-dynbegin   =  'X'.
    wa_bdcdata-fnam       =  'RS38M-PROGRAMM'.
    wa_bdcdata-fval       =  p_prog.
    APPEND wa_bdcdata TO t_bdcdata.
    CLEAR wa_bdcdata.
    wa_bdcdata-fnam       =  'BDC_OKCODE'.
    wa_bdcdata-fval       =  'NEW'.
    APPEND wa_bdcdata TO t_bdcdata.
    CLEAR wa_bdcdata.
    wa_bdcdata-program    =  'SAPLSEDTATTR'.
    wa_bdcdata-dynpro     =  '0200'.
    wa_bdcdata-dynbegin   =  'X'.
    wa_bdcdata-fnam       =  'RS38M-REPTI'.
    wa_bdcdata-fval       =  p_shtxt.
    APPEND wa_bdcdata TO t_bdcdata.
    CLEAR wa_bdcdata.
    wa_bdcdata-fnam       =  'TRDIR-SUBC'.
    wa_bdcdata-fval       =  '1'.
    APPEND wa_bdcdata TO t_bdcdata.
    CLEAR wa_bdcdata.
    wa_bdcdata-fnam       =  'BDC_OKCODE'.
    wa_bdcdata-fval       =  'CONT'.
    APPEND wa_bdcdata TO t_bdcdata.
    IF p_pack EQ '$TMP'.
    *local object
      CLEAR wa_bdcdata.
      wa_bdcdata-program    =  'SAPLSTRD'.
      wa_bdcdata-dynpro     =  '0100'.
      wa_bdcdata-dynbegin   =  'X'.
      wa_bdcdata-fnam       =  'KO007-L_DEVCLASS'.
      wa_bdcdata-fval       =  ' '.
      APPEND wa_bdcdata TO t_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam       =  'BDC_OKCODE'.
      wa_bdcdata-fval       =  'TEMP'.
      APPEND wa_bdcdata TO t_bdcdata.
    ELSE.
    *package assignment with request
      CLEAR wa_bdcdata.
      wa_bdcdata-program    =  'SAPLSTRD'.
      wa_bdcdata-dynpro     =  '0100'.
      wa_bdcdata-dynbegin   =  'X'.
      wa_bdcdata-fnam       =  'KO007-L_DEVCLASS'.
      wa_bdcdata-fval       =  p_pack.
      APPEND wa_bdcdata TO t_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam       =  'BDC_OKCODE'.
      wa_bdcdata-fval       =  'ADD'.
      APPEND wa_bdcdata TO t_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-program    =  'SAPLSTRD'.
      wa_bdcdata-dynpro     =  '0300'.
      wa_bdcdata-dynbegin   =  'X'.
      wa_bdcdata-fnam       =  'KO008-TRKORR'.
      wa_bdcdata-fval       =  ' '.
      APPEND wa_bdcdata TO t_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam       =  'KO008-AS4TEXT'.
      wa_bdcdata-fval       =  ' '.
      APPEND wa_bdcdata TO t_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam       =  'BDC_OKCODE'.
      wa_bdcdata-fval       =  'LOCK'.
      APPEND wa_bdcdata TO t_bdcdata.
    ENDIF.                                 " IF P_PACK EQ '$TMP'
    CALL TRANSACTION 'SE38' USING t_bdcdata MODE 'E'.
    Hope this would help you..
    Regards
    Narin Nandivada

  • Refreshing the Output Table in ALV

    Hi All,
    Please let me know how to refresh the output table using refresh button in ALV.
    Thanks & Regards,
    Priya.
    Edited by: SathyaPriya Neelagaru on Jun 26, 2008 7:00 AM

    Hi,
    We can refresh the output table for ALV by below code :
    CLEAR  : g_wa_outtab.
    REFRESH: g_t_outtab.
    When we append something to output table of ALV we need to clear the workarea for that table.
    APPEND g_wa_outtab TO g_t_outtab.
    CLEAR g_wa_outtab.
    If you are using object oreinted concept we have
    CALL METHOD g_alv_grid_9001->refresh_table_display.
    In case you have to use your own PF Status - Always copy the standard GUI status
    (Program : SAPLSLVC_FULLSCREEN,
    Status : STANDARD_FULLSCREEN )
    For REFRESH - Include parameter for "USER_COMMAND" in the Function module interface.
    Inside the User command subroutine - set
    "RS_SELFIELD-REFRESH" = "X".
    It will automatically refresh the ALV and there is no requirement to call ALV again.
    Or else if u have a Refresh button on screen.
    we can have
    WHEN 'REFRESH'.
          CLEAR : g_wa_outtab.         
          REFRESH : g_t_outtab.
    Hope this helps you.
    Plz reward if useful.
    Thanks,
    Dhanashri
    Edited by: Dhanashri Pawar on Jun 26, 2008 7:08 AM
    Edited by: Dhanashri Pawar on Jun 26, 2008 7:14 AM
    Edited by: Dhanashri Pawar on Jun 26, 2008 7:15 AM

  • Spec for this report not able to get values in the output

    okSection 1: Document information
    Title     PP – Total Component Requirement by Sales Forecast Report     Create Date     5/2/2006
    Author     Ivie Ng     Revision     1.0     Last changed on     
    Program type     ( X ) Report    (   ) Form        (   ) Batch input    (   ) Dialog program
    Priority     (   ) High       ( X ) Medium    (   ) Low
    Frequency      (   ) As require     (X ) Daily     (  ) Weekly       (  ) Monthly         (  ) Yearly
    (   ) Conversion
    Doc-Ref.     
    Section 2: Contact Person
    Task/Responsibility     Name     Signature     Date
    JM Project Manager     Sean Gilgunn          
    ISS Project Manager     YB Cisse          
    JM-Business Team Lead     Sathe          
    Functional Consultant      Ivie          
    ABAP Consultant     Soh          
    User Acceptance Test / Approved by                
    Transport               
    Section 3: Functional Description
    Background (whatever; Ex.Why does this program have to develop?)
    This is to allow materials dept to view and analyze total component requirement base on sales forecast ie. budget forecast, inactive version within specific planning horizon.
    Requirements
    In SOP, material dept will maintain planning data (sales & production plan) in various version.
    1. Active version: A00
    This version is transferred to demand mgmt as active version. MRP will use this planning data to create order proposals (planned orders, purchase requisitions).
    2. Inactive version: 001 – 999
    There are 3 types of inactive version in SOP:
    a) Sales forecast – 000 – 799
    b) Budge forecast – 800 – 820
    c) Forecast report – 821 – 999
    This report should allow to read any version of the sales forecast and return the total component requirements in the planning horizon that specify.
    Section 3.1: Selection screen
    Field name     Technical name     Type of selection field
         (*Please specify Transparent Table and field name)     (X) Single value             (  ) Range             ( ) Required field
              (  ) Single value             (X) Range             (  ) Required field
              (X) Single value             (  ) Range             (  ) Required field
    Section 3.2: Program Logic
    Business Requirement
    This report will allow option to choose to read the source from SOP or COPA.
    Input Selection
    Main Menu:
    o     Total Component Requirement from SOP forecast
    o     Total Component Requirement from COPA forecast
    If SOP is selected, Source = SOP
    If COPA is selected, Source = COPA
    Option 1: SOP
    1.     Input Layout
    Material: _____________    (note: allow multiple materials entry, no entry indicate all materials)
    RM Material Group: __________     (note: allow multiple entry, no entry indicate all Mat Grp)
    Plant:  MY11  (note: default value)
    Standard Price as of : _____________  (YYYYMM)
    Version: ________    (note: allow F4 option with Version and Description)
    Output Type: ____  (Month/Year)
    (If the output type chosen is Month, the below is display)
    Period From:  _________  (YYYYMM)
    Period To:      _________  (YYYYMM)
    (If the output type chosen is Year, the below is display)
    Period From:  __________ (YYYY)
    Period To:      __________ (YYYY)
    2.     Output Layout
    Plant: MY11
    Source:
    Version:
    System Date/Time:
    Output Layout in Month:
    Material     Desc     Component     Desc     UOM     M04.2006     M05.2006     M06.2006     M07.2006     M08.2006     M09.2006     BOM
    TO2368          NGK0003          PC                                   TO2368
              SIN96-015          MG                                   TO2368
              SIN96-066F          MG                                   TO2368
              SIN96-066N          MG                                   TO2368
              SIN96-127          GCL                                   WCS2004
              SIN96-055          G                                   WCS2004
              SIN96-110          G                                   WCS2004
              SIN96-007          G                                   WCS2004
              SIN96-002          GCL                                   WCS1003
              SIN96-001          GCL                                   WCS1003
              SIN96-006          GCL                                   WCS1003
              TO2358/511          PC                                   TO2368
              TO2358/512          PC                                   TO2368
              WCS2004          GCL                                   TO2368
              WCS1003          GCL                                   WCS2004
    Output Layout in Year:
    Material     Desc     Component     Desc     UOM     2006     2007     2008     BOM
    TO2368          NGK0003          PC                    TO2368
              SIN96-015          MG                    TO2368
              SIN96-066F          MG                    TO2368
              SIN96-066N          MG                    TO2368
              SIN96-127          GCL                    WCS2004
              SIN96-055          G                    WCS2004
              SIN96-110          G                    WCS2004
              SIN96-007          G                    WCS2004
              SIN96-002          GCL                    WCS1003
              SIN96-001          GCL                    WCS1003
              SIN96-006          GCL                    WCS1003
              TO2358/511          PC                    TO2368
              TO2358/512          PC                    TO2368
              WCS2004          GCL                    TO2368
              WCS1003          GCL                    WCS2004
    3.     Header Section:
    Header Field: Plant
    Print input field Plant.
    Header Field: Source
    If SOP is selected, Source = SOP
    If COPA is selected, Source = COPA
    Print Source.
    Header Field: Version
    Print input field Version, Print RMCP2-VETXT (version description).
    Header Field: System Date/Time
    Print current system date and time.
    4.     Table: S076 (SOP - Sales & Operations Planning)
    Read S076 rows with input selection of Material, Plant, Year, Month, Version sorted by Material.
          This table provides sales forecast figure.
    Table: MAKT – Material Decription
    Table: MARA - General Material Data
    Table: CDHDR - Change document header
    Table: CDPOS - Change document items
    5.     Details Section: -
    Read S076.PMNUX(Material).                    Note: There will be multiple rows in S076.PMNUX (Material)
    Field: Material
    Print S076.PMNUX(Material).
    Field: Description
    Read MAKT.MATNR(Material), Print MAKT.MAKTX.
    6.     Read L1 (Level 1) BOM Transaction: CS03
                   Where Material = S076.PMNUX (Material), Plant = MY11 (input field), BOM Usage = ’1’, Status = ‘01’
    7.     This is to print BOM component.
    If Input Material Group = ‘ ’
    Read Component (Material), Component Qty from BOM sorted by MARA.MTART (material type) = ‘ZROH’, ‘ZHLB’ , ‘ZRUH’
    If Input Material Group <> ‘ ’
    Read Component (Material), Component Qty from BOM sorted by MARA.MTART (material type) = ‘ZROH’, ‘ZHLB’ , ‘ZRUH’
          Where MARA-MATKL (Material Group) = Input Material Group.
    If MARA.MTART (material type) = ‘ZRUH’,
          Read L1 (Level 1) BOM Transaction: CS03
                  Where Material = S076.PMNUX, Plant = MY11 (input field), BOM Usage = ’1’, Status = ‘02’.
    GET RC29K-BMENG (Base Qty)  ***
    Field: Material Group
    Print MARA-MATKL
    Field: Component
    Print BOM Component.
    Field: Description
    Print MAKT.MAKTX.
    Field: UOM
    Print MARA.MEINS.
    Field: Currency
    Field: Standard Price
    If Input Standard Price Date = ‘’
       Print Currency = ‘ ‘
       Print Standard Price = 0
    Else
    Read CDHDR-OBJECTID (Material), CDHDR-CHANGENR (ChgNo)
    Where CDHDR-OBJECTID (Material) = BOM Component
    And CDHDR-TCODE (Transaction) = ‘MR21’
    And YYYYMM[CDHDR-UDATE (Date)] = Input Standard Price Date
    If NOT Found, look up YYYYMM[CDHDR-UDATE (Date)] – 1  
    I.e.    Input Standard Price Date is 200702, If CDHDR-UDATE (Date) Not Found, look up 200701.
    If Not Found, look up 200612 until the record is found    **
    If row return > 1, select the latest CDHDR-UDATE (Date)
    i.e. If rows return 20070201 and 20070215, Select 20070215    **
    Read CDPOS-CUKY_NEW (Currency), CDPOS-VALUE_NEW (New Value)
    Where CDPOS-OBJECTID (Material) = CDHDR-OBJECTID (Material)
    And CDPOS-CHANGENR (ChgNo) = CDHDR-CHANGENR (ChgNo)
    Print CDPOS-CUKY_NEW (Currency)
    Print CDPOS-VALUE_NEW (New Value)
    8.     If the output type is Year, print Requirement Qty in Yearly bucket.
    Requirement Qty = sum[S076-ABSAT (Sales) for current Year] ie 2006
    Requirement Qty = sum[S076-ABSAT (Sales) for current Year + 1] ie 2007
    Requirement Qty = sum[S076-ABSAT (Sales) for current Year + 2] ie 2008
         If the output type is Month, print Requirement Qty in Monthly bucket.
    Field: Month (ie. M04.2006)
    Requirement Qty = S076-ABSAT (Sales) * Component Qty / RC29K-BMENG (Base Q)
    Print Requirement Qty.
    Field: Total Price (ie. M04.2006)
    Total Price = Requirement Qty * Standard Price
    Print Total Price
    Field: Month (ie. M05.2006)
    Requirement Qty = S076-ABSAT (Sales) * Component Qty / RC29K-BMENG (Base Q)
    Print Requirement Qty.
    Field: Total Price (ie. M05.2006)
    Total Price = Requirement Qty * Standard Price
    Print Total Price
    Field: Month (ie. M06.2006)
    Requirement Qty = S076-ABSAT (Sales) * Component Qty / RC29K-BMENG (Base Q)
    Print Requirement Qty.
    Field: Total Price (ie. M06.2006)
    Total Price = Requirement Qty * Standard Price
    Print Total Price
    Field: Month (ie. M07.2006)
    Requirement Qty = S076-ABSAT (Sales) * Component Qty / RC29K-BMENG (Base Q)
    Print Requirement Qty.
    Field: Total Price (ie. M07.2006)
    Total Price = Requirement Qty * Standard Price
    Print Total Price
    Field: Month (ie. M08.2006)
    Requirement Qty = S076-ABSAT (Sales) * Component Qty / RC29K-BMENG (Base Q)
    Print Requirement Qty.
    Field: Total Price (ie. M08.2006)
    Total Price = Requirement Qty * Standard Price
    Print Total Price
    Note: Repeat the requirement qty display in Monthly bucket base on period specified.
    Field: BOM
    Print L1 BOM which is S076.PMNUX (Material)  from Step 6.
    If Is end of component,
          Repeat Step 5 for next Material in SOP (S076.PMNUX).
    If MARA.MTART (material type) = ‘ZROH’,
    Perform Step 7 to read next L1 BOM Component.
    Perform Step 8 to print Requirement Qty.
    If [MARA.MTART (material type) = ‘ZHLB’] and [MARA.MATKL(material group) = ‘WP0100’, ‘WP0110’, or ‘WP0120’],
          Go Step 9 to read L2 BOM.
    If [MARA.MTART (material type) = ‘ZHLB’] and [MARA.MATKL (material group) <> ‘WP0100’, ‘WP0110’, ‘WP0120’],
          Perform Step 7 to read next BOM Component.
          Perform Step 8 to print Requirement Qty.
    9.     Read L2 (level 2) BOM for the ZHLB at Transaction: CS03
                Where Plant = MY11(input field), BOM Usage= ’1’, Status = ‘01’.
    GET RC29K-BMENG (Base Qty)  ***
    10.     Read Component (Material), Component Qty from BOM sorted by MARA.MTART (material type) = ‘ZROH’, ‘ZHLB’.
    Field: Material Group
    Print MARA-MATKL
    Field: Component
    Print BOM Component.
    Field: Description
    Print MAKT.MAKTX.
    Field: UOM
    Print MARA.MEINS.
    Field: Month (ie. M04.2006)
    Requirement Qty = Requirement Qty from L1 BOM  * Component Qty / RC29K-BMENG (Base Q)
    Print Requirement Qty.
    Field: Total Price (ie. M04.2006)
    Total Price = Requirement Qty * Standard Price
    Print Total Price
    Field: Month (ie. M05.2006)
    Requirement Qty = Requirement Qty from L1 BOM * Component Qty / / RC29K-BMENG (Base Q)
          Print Requirement Qty.
    Field: Total Price (ie. M05.2006)
    Total Price = Requirement Qty * Standard Price
    Print Total Price
          Note: Repeat until end of Period.
    Field: BOM
    Print L2 BOM from Step 9.
    If is end of component, perform Step 7 to read next L1 BOM component, and Step 8 to print Requirement Qty.
    If MARA.MTART (material type) = ‘ZROH’,
    Perform Step 10 to read next L2 BOM Component.
    If MARA.MTART (material type) = ‘ZHLB’ and MARA.MATKL(material group) = ‘WP0100’, ‘WP0110’, or ‘WP0120’,
          Go Step 11 to read L3 BOM.
    If [MARA.MTART (material type) = ‘ZHLB’] and [MARA.MATKL (material group) <> ‘WP0100’, ‘WP0110’, ‘WP0120’],
          Perform Step 10 to read next L2 BOM Component.
    11.     Read L3 (level 3) BOM for the ZHLB at Transaction: CS03 where Plant=MY11(input field), BOM Usage=’1’, Status =‘01’.
    12.     Read Component (Material), Component Qty from BOM sorted by MARA.MTART (material type) = ‘ZROH’, ‘ZHLB’.
    Field: Material Group
    Print MARA-MATKL
    Field: Component
    Print BOM Component.
    Field: Description
    Print MAKT.MAKTX.
    Field: UOM
    Print MARA.MEINS.
    Field: Currency
    Field: Standard Price
    Read CDHDR-OBJECTID (Material), CDHDR-CHANGENR (ChgNo)
    Where CDHDR-OBJECTID (Material) = BOM Component
    And CDHDR-TCODE (Transaction) = ‘MR21’
    And YYYYMM[CDHDR-UDATE (Date)] = Input Standard Price Date
    If NOT Found, look up YYYYMM[CDHDR-UDATE (Date)] – 1  
    I.e.    Input Standard Price Date is 200702, If CDHDR-UDATE (Date) Not Found, look up 200701.
    If Not Found, look up 200612 until the record is found    **
    If row return > 1, select the latest CDHDR-UDATE (Date)
    i.e. If rows return 20070201 and 20070215, Select 20070215    **
    Read CDPOS-CUKY_NEW (Currency), CDPOS-VALUE_NEW (New Value)
    Where CDPOS-OBJECTID (Material) = CDHDR-OBJECTID (Material)
    And CDPOS-CHANGENR (ChgNo) = CDHDR-CHANGENR (ChgNo)
    Print CDPOS-CUKY_NEW (Currency)
    Print CDPOS-VALUE_NEW (New Value)
    Field: Month (ie. M04.2006)
    Requirement Qty = Requirement Qty from L2 BOM  * Component Qty / RC29K-BMENG (Base Q)
    Print Requirement Qty.
    Field: Total Price (ie. M04.2006)
    Total Price = Requirement Qty * Standard Price
    Print Total Price
    Field: Month (ie. M05.2006)
    Requirement Qty = Requirement Qty from L2 BOM * Component Qty / RC29K-BMENG (Base Q)
          Print Requirement Qty.
    Field: Total Price (ie. M05.2006)
    Total Price = Requirement Qty * Standard Price
    Print Total Price
          Note: Repeat until end of Period.
    Field: BOM
    Print L3 BOM from Step 11.
    If is end of component,
          Perform Step 10 to read next L2 BOM Component.
    If MARA.MTART (material type) = ‘ZROH’,
    Perform Step 12 to read next L3 BOM Component.
    If MARA.MTART (material type) = ‘ZHLB’ and MARA.MATKL(material group) = ‘WP0100’, ‘WP0110’, or ‘WP0120’,
          Repeat for next level of BOM reading.      ** for future BOM expansion **
    If [MARA.MTART (material type) = ‘ZHLB’] and [MARA.MATKL (material group) <> ‘WP0100’, ‘WP0110’, ‘WP0120’],
          Perform Step 12 to read next L3 BOM Component.
    13.     The report is ALV format and should allow to export to Excel. See example below:
    Option 2: COPA
    1.     Input Layout
    Company Code:  ________ 
    Plant:  MY11   
    Material: _____________    (note: allow multiple materials entry, no entry indicate all materials)
    Material Group: __________     (note: allow multiple materials entry, no entry indicate all materials)
    Standard Price as of : _____________  (YYYYMM)
    Version: ________    (note: allow F4 option with Version and Description)
    Read  V_TKEVS_CL-VERSI (Version),  V_TKEVS_CL-VTEXT (Version Description)
    Output Type: ____  (Month/Year)
    (If the output type chosen is Month, the below is display)
    Period From:  _________  (YYYYMM)
    Period To:      _________  (YYYYMM)
    (If the output type chosen is Year, the below is display)
    Period From:  __________ (YYYY)
    Period To:      __________ (YYYY)
    2.     Header Section:
    Header Field: Plant
    Print input field Plant.
    Header Field: Source
    If SOP is selected, Source = SOP
    If COPA is selected, Source = COPA
    Print Source.
    Header Field: Version
    Print V_TKEVS_CL-VERSI (Version),  V_TKEVS_CL-VTEXT (Version Description)
    Header Field: System Date/Time
    Print current system date and time.
    3.     Report details: -
    Table: CE2ASIA - JM Operating Concern
    If input selection is Monthly Report:-
    Read CE2ASIA-ARTNR (Product No), Sum[CE2ASIA-ABSMG001 (Sales Qty)]
    Where CE2ASIA-BUKRS (Company Code) = Input Company Code
    And CE2ASIA-WERKS (Plant) = Input Plant
    And CE2ASIA-PALEDGER (Currency Type) = ‘10’
    And [CE2ASIA-PERBL (FI Period) > = Input Period From And CE2ASIA-PERBL (FI Period) < = Input Period To]
    Group by CE2ASIA-ARTNR (Product No)
    If input selection is Yearly Report:-
    Read CE2ASIA-ARTNR (Product No), CE2ASIA-ABSMG001 (Sales Qty)
    Where CE2ASIA-BUKRS (Company Code) = Input Company Code
    And CE2ASIA-WERKS (Plant) = Input Plant
    And CE2ASIA-PALEDGER (Currency Type) = ‘10’
    And [YYYY[CE2ASIA-PERBL (FI Period)] > = Input Period From And CE2ASIA-PERBL (FI Period) < = Input Period To]
    Note: The details similar to Option 1: SOP, refer section (5)  to (13)
    Section 3.3: Report Layout
    Field name     Technical name     Comment
         (Please specify Transparent Table and field name)     (Ex. In case field does not read directly from transparent table but derive from formular or sum or else. Please show the detail how to do that.)
    Section 3.3: Unit Test Criteria
    Section 4: Technical Description
    Section 4.1: Object information
    Development class     
    Transport number     
    Section 4.2: Input/output file layout (In case upload/download file)
    *Please determine structure of  file like as below:
    No.     Field description     Type (Char,Numeric,…)     Length     Note
    Section 4.3: Report/Form information
    Paper size     Inch 11 8” X 11”     Type of printer     ( ) Laser printer     (X) Dot matrix
    Output report / Pre-printed Attach
    Technical Issue

    Hi gurus,actually this program selecion screen is linked to ..as
    First screen is .Sop
                          .copa
    Again for sop is having a selection screen and in this it is divide based on month and year seperately in two more screens.
    same for copa also....
    so pls tell me a correct solution where to correct and get values.
    Priority is very highhhhhhhhhhhhhh,so pls help me in sorting out this.

  • Ref cursor stopped returning values for the output.

    Hi Everyone,
    My DB version is
    BANNER                                                        
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
    PL/SQL Release 10.2.0.1.0 - Production                          
    CORE 10.2.0.1.0 Production                                        
    TNS for Linux: Version 10.2.0.1.0 - Production                  
    NLSRTL Version 10.2.0.1.0 - Production  
    Please do have a look at the code, and let me know where I've gone wrong, because select query is fetching data. Previously procedure was returning values too through ref cursor. Please correct me where I've gone wrong.
    create or replace
    PROCEDURE
    SPL_SPN_MISSING_EMR_AOE_DTL (IN_PATIENT_ID            NUMBER,
                                 IN_FACILITY_ID           NUMBER,
                                 IN_DRAW_DT               DATE,
                                 IN_REQUISITION_NUMBER    ORDER_REQUISITION_HEADER.REQUISITION_NUMBER%TYPE,
                                 IN_CORP_ACRONYM          CORPORATION.CORPORATION_ACRONYM%TYPE,
                                 IN_ABCDEF_MRN           PATIENT.ABCDEF_MRN%TYPE,
                                 IN_ACCOUNT_NUMBER        FACILITY_ACCOUNT_DETAIL.ACCOUNT_NUMBER%TYPE,
                                 IN_HLAB_NUM              FACILITY_ACCOUNT_DETAIL.HLAB_NUM%TYPE,
                                 OV_COMMENTS              OUT   VARCHAR2,
                                 OR_QUES_AND_ANS          OUT   SYS_REFCURSOR) AS                               
    *  Copyright (C) 2013 ABCDEF Laboratories
    *  All Rights Reserved
    *  This Work Contains Trade Secrets And Confidential Material Of
    *  ABCDEF Laboratories., And Its Use Of Disclosure In Whole Or In Part
    *  Without Express Written Permission Of ABCDEF Laboratories Is Prohibited.
    *  Company              : ABCDEF Laboratories
    *  Project              : ABCDEF Scorpion
    *  Name                 : SPL_SPN_MISSING_EMR_AOE_DTL
    * In Parameters         : In_Patient_Id            Number
    *                         In_Facility_Id           Number
    *                         In_Draw_Dt               Date
    *                         In_Requisition_Number    Order_Requisition_Header.Requisition_Number%Type,
    *                         In_Corp_Acronym          Corporation.Corporation_Acronym%Type
    *                         In_ABCDEF_Mrn           Patient.ABCDEF_Mrn%Type
    *                         In_Account_Number        Facility_Account_Detail.Account_Number%Type
    *                         In_Hlab_Num              Facility_Account_Detail.Hlab_Num%Type
    * Out Parameters        : OV_COMMENTS           Out   Varchar2
    *                         OR_QUES_AND_ANS       Out   Sys_Refcursor
    * Description           : This Procedure Will Fetch The Mising Emr Aoe Detail And Provide
    *                         Necessary Comments As Well.
    * Modification History  :
    *   Date       Version No.        Author                 Description
    * 21/01/2014      1.0            ABCDEF               Initial Version  
    * 27/01/2014      1.1            ABCDEF               Restricted the output for duplicate questions
    *                                                     and answers, partially answered AOE. Also renamed
    *                                                     the output variable names.
        CC_PACKAGE_NAME             CONSTANT VARCHAR2(50)  := 'SPL_SPN_MISSING_EMR_AOE_DTL';   
        CC_PROCEDURE_NAME           CONSTANT VARCHAR2(50)  := 'SPL_SPN_MISSING_EMR_AOE_DTL';
        VC_AVL_PAT_QUES             VARCHAR2(1000);
        VC_DUP_PAT_QUES             VARCHAR2(1000);
        VC_ACTUAL_QUES              VARCHAR2(1000);
        VC_ACTUAL_QUES_CNT          NUMBER:= 0;
        VR_QUES_AND_ANS             SYS_REFCURSOR;
        VN_AVL_PAT_QUES_CNT         NUMBER := 0;
        VN_DUP_PAT_QUES_CNT         NUMBER := 0;
        VN_EXACT_PAT_ID_CNT         NUMBER := 0;
        VN_DUPL_PAT_ID              NUMBER := 0;
        VN_EXTERNAL_ID              PATIENT.EXTERNAL_ID%TYPE;
        VC_OBX_QUES                 VARCHAR2(1000);
        VC_OBX_QUES_CNT             NUMBER := 0;
        VN_OBX_QUES_CNT             NUMBER := 0;
        PAT_EXTERNAL_ID             PATIENT.EXTERNAL_ID%TYPE;
        VC_EXACT_BOOLEAN_VAL        VARCHAR2(10) := 'FALSE';
        VC_EXACT_PAR_BOOLEAN_VAL    VARCHAR2(10) := 'FALSE';
        VC_DUPL_BOOLEAN_VAL         VARCHAR2(10) := 'FALSE';
        VC_DUPL_PAR_BOOLEAN_VAL     VARCHAR2(10) := 'FALSE';
        VC_REJECTED_BOOLEAN_VAL     VARCHAR2(10) := 'FALSE';
        VC_REJECTED_PAR_BOOLEAN_VAL VARCHAR2(10) := 'FALSE';
        VC_COMMENTS                 VARCHAR2(100);
        VC_PAR_COMMENTS             VARCHAR2(100);
        VC_RETURN_EXACT_PAT         CHAR(1) := 'N';
        VC_RETURN_DUPL_PAT          CHAR(1) := 'N';
        VC_RETURN_REJECT_PAT        CHAR(1) := 'N';
        VC_CHK_FOR_EXT_ID           CHAR(1) := 'N';
        VN_MAX_MSG_ID               INTERFACE_A04_OBX_SEGMENT.MSG_ID%TYPE;
        VN_MAX_COUNT                NUMBER := 0;
        VN_ITERATION_RUN            NUMBER := 0;
    BEGIN
       SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                      (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                      ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                      ,IN_BATCH_ID        => '100'
                      ,IC_MESSAGE_TEXT    => 'Start of the procedure with Patient_Id:'||IN_PATIENT_ID||' Facility_Id:'||IN_FACILITY_ID||
                                             ' Draw_Dt:'||IN_DRAW_DT||' Requisition_Number:'||IN_REQUISITION_NUMBER||' Corp_Acronym:'||IN_CORP_ACRONYM||
                                             ' ABCDEF_Mrn:'||IN_ABCDEF_MRN||' Account_Number:'||IN_ACCOUNT_NUMBER||' Hlab_Num:'||IN_HLAB_NUM);
        <<AOE_TEST_LOOP>>
        FOR AOE_REC IN (SELECT ORD.TEST_ID
                            FROM ORDER_REQUISITION_DETAIL ORD
                           WHERE ORD.REQUISITION_HDR_ID = (SELECT ORH.REQUISITION_HDR_ID
                                                             FROM ORDER_REQUISITION_HEADER ORH
                                                            WHERE ORH.REQUISITION_NUMBER = IN_REQUISITION_NUMBER)
                            AND ORD.TEST_CODE IN (SELECT TEST_CODE FROM INTERFACE_ADT_AOE_MASTER WHERE SOURCE_SYSTEM = IN_CORP_ACRONYM))
            LOOP
                VN_ITERATION_RUN := VN_ITERATION_RUN + 1;
                SELECT COUNT(DISTINCT PATIENT_ID)
                INTO VN_EXACT_PAT_ID_CNT
                FROM EMR_ADTAOE_DTL
                WHERE PATIENT_ID  = IN_PATIENT_ID
                AND   TEST_ID = AOE_REC.TEST_ID
                AND   FACILITY_ID = IN_FACILITY_ID   
                AND   (DRAW_DATE   = IN_DRAW_DT
                    OR DRAW_DATE   = TO_DATE('2999/12/31','YYYY/MM/DD'))
                AND   SOURCE_SYSTEM = IN_CORP_ACRONYM ;
                --Collecting all questions in interface_adt_aoe_master
                SELECT STRAGG(SUB1.QUESTION_CODE), COUNT(SUB1.QUESTION_CODE)
                INTO VC_ACTUAL_QUES, VC_ACTUAL_QUES_CNT
                FROM (SELECT DISTINCT QUESTION_CODE FROM INTERFACE_ADT_AOE_MASTER
                      WHERE TEST_CODE = (SELECT TEST_CODE FROM TEST WHERE TEST_ID = AOE_REC.TEST_ID)
                      AND   SOURCE_SYSTEM = IN_CORP_ACRONYM
                      ORDER BY QUESTION_CODE) SUB1;
                 SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                              (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                              ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                              ,IN_BATCH_ID        => '100'
                              ,IC_MESSAGE_TEXT    => 'vc_actual_ques:'||VC_ACTUAL_QUES ||
                                                     ' vn_exact_pat_id_cnt:'||VN_EXACT_PAT_ID_CNT||
                                                     ' aoe_rec.test_id:'||AOE_REC.TEST_ID||
                                                     ' VN_ITERATION_RUN:'||VN_ITERATION_RUN);
                <<MAIN_IF_BLOCK>>
                IF
                    VN_EXACT_PAT_ID_CNT = 1 AND
                    VN_ITERATION_RUN    >= 1 THEN               
                    --Collecting avaliable questions in emr_adtaoe_dtl               
                    SELECT STRAGG(SUB.QUESTION_CODE), COUNT(DISTINCT SUB.QUESTION_CODE)
                    INTO VC_AVL_PAT_QUES, VN_AVL_PAT_QUES_CNT
                    FROM (SELECT DISTINCT QUESTION_CODE FROM EMR_ADTAOE_DTL
                          WHERE TEST_ID = AOE_REC.TEST_ID
                          AND   PATIENT_ID  = IN_PATIENT_ID
                          AND   FACILITY_ID = IN_FACILITY_ID
                          AND   (DRAW_DATE   = IN_DRAW_DT
                              OR DRAW_DATE   = TO_DATE('2999/12/31','YYYY/MM/DD'))
                          AND   SOURCE_SYSTEM = IN_CORP_ACRONYM
                          AND   ANSWER IS NOT NULL
                          ORDER BY QUESTION_CODE) SUB;
                    SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                      (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                      ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                      ,IN_BATCH_ID        => '100'
                      ,IC_MESSAGE_TEXT    => 'vc_avl_pat_ques:'||VC_AVL_PAT_QUES||
                                             ' vn_avl_pat_ques_cnt:'||VN_AVL_PAT_QUES_CNT);
                    <<CASE_1_AND_2>>
                    IF
                        VC_AVL_PAT_QUES = VC_ACTUAL_QUES THEN
                        VC_EXACT_BOOLEAN_VAL := 'TRUE';
                        VC_COMMENTS := 'AOE AVAILABLE';
                    ELSIF--<<case_1_and_2>>
                        (VC_AVL_PAT_QUES != VC_ACTUAL_QUES OR VC_AVL_PAT_QUES IS NULL) AND
                        VN_AVL_PAT_QUES_CNT >= 0 THEN
                        VC_EXACT_PAR_BOOLEAN_VAL := 'TRUE';
                        VC_PAR_COMMENTS := 'PARTIAL AOE AVAILABLE';
                    END IF;--<<case_1_and_2>>
                ELSIF
                    VN_EXACT_PAT_ID_CNT = 0 AND
                    VN_ITERATION_RUN    > 1 THEN 
                    VC_EXACT_PAR_BOOLEAN_VAL := 'TRUE';
                    VC_PAR_COMMENTS := 'PARTIAL AOE AVAILABLE';
                ELSIF--<<Main_if_block>>
                    VN_EXACT_PAT_ID_CNT = 0 THEN
                    <<DUPL_PAT_LOOP>>
                    FOR PAT_ID_REC IN(SELECT DISTINCT PATIENT_ID
                                      FROM PATIENT P
                                      WHERE P.ABCDEF_MRN = IN_ABCDEF_MRN
                                      AND EXISTS(SELECT 1 FROM EMR_ADTAOE_DTL EAD
                                                 WHERE EAD.PATIENT_ID  = P.PATIENT_ID
                                                 AND   EAD.TEST_ID     = AOE_REC.TEST_ID
                                                 AND   EAD.FACILITY_ID = IN_FACILITY_ID
                                                 AND  (EAD.DRAW_DATE  = IN_DRAW_DT
                                                    OR EAD.DRAW_DATE  = TO_DATE('2999/12/31','YYYY/MM/DD'))
                                                 AND   EAD.SOURCE_SYSTEM   = IN_CORP_ACRONYM)
                                      AND P.PATIENT_ID != IN_PATIENT_ID)
                    LOOP
                        --Collecting avaliable questions in emr_adtaoe_dtl
                        SELECT STRAGG(SUB.QUESTION_CODE), COUNT(QUESTION_CODE)
                        INTO VC_DUP_PAT_QUES, VN_DUP_PAT_QUES_CNT
                        FROM (SELECT QUESTION_CODE FROM EMR_ADTAOE_DTL   
                               WHERE TEST_ID     = AOE_REC.TEST_ID
                               AND   PATIENT_ID  = PAT_ID_REC.PATIENT_ID
                               AND   FACILITY_ID = IN_FACILITY_ID
                               AND   (DRAW_DATE   = IN_DRAW_DT
                                   OR DRAW_DATE   = TO_DATE('2999/12/31','YYYY/MM/DD'))
                               AND   SOURCE_SYSTEM = IN_CORP_ACRONYM
                               AND   ANSWER IS NOT NULL
                               ORDER BY QUESTION_CODE) SUB;
                        <<CASE_3_AND_4>>
                        IF 
                            VC_DUP_PAT_QUES = VC_ACTUAL_QUES THEN
                            VC_DUPL_BOOLEAN_VAL  := 'TRUE';
                            VC_COMMENTS := 'AOE AVAILABLE FOR DUPLICATE PATIENT';
                        ELSIF
                            VC_DUP_PAT_QUES != VC_ACTUAL_QUES AND
                            VN_DUP_PAT_QUES_CNT >= 0 THEN
                            VC_DUPL_PAR_BOOLEAN_VAL := 'TRUE';
                            VC_PAR_COMMENTS := 'PARTIAL AOE AVAILABLE FOR DUPLICATE PATIENT';
                        END IF;--<<case_3_and_4>>
                        VN_DUPL_PAT_ID := PAT_ID_REC.PATIENT_ID;
                        SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                                  (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                                  ,IC_PROCEDURE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                                  ,IN_BATCH_ID        => '100'
                                  ,IC_MESSAGE_TEXT    => 'vc_dup_pat_ques:'||VC_DUP_PAT_QUES||
                                                         ' vn_dup_pat_ques_cnt:'||VN_DUP_PAT_QUES_CNT||
                                                         ' VC_COMMENTS:'||VC_COMMENTS||
                                                         ' VC_PAR_COMMENTS:'||VC_PAR_COMMENTS);
                    END LOOP DUPL_PAT_LOOP;
                    VC_CHK_FOR_EXT_ID := 'Y';
                    IF
                      VC_CHK_FOR_EXT_ID = 'Y' THEN
                      <<EXTERNAL_ID_LOOP>>
                      FOR P_PAT_EXT_ID_REC IN (SELECT DISTINCT P.EXTERNAL_ID
                                                 FROM PATIENT P
                                                WHERE P.ABCDEF_MRN = IN_ABCDEF_MRN
                                                  AND P.EXTERNAL_ID IS NOT NULL)
                      LOOP 
                          INSERT INTO TT_A04_OBX_QUES_ANS_DTL
                          (SELECT IAOBX.MSG_ID, IAOBX.OBSERVATION_IDENTIFIER, IAOBX.OBSERVATION_VALUE, IAM.UOM
                            FROM INTERFACE_A04_OBX_SEGMENT IAOBX, INTERFACE_ADT_AOE_MASTER IAM
                            WHERE IAOBX.OBSERVATION_IDENTIFIER = IAM.QUESTION_CODE
                            AND   (IAOBX.OBSERVATION_DTM  = TO_CHAR(IN_DRAW_DT,'YYYYMMDD')
                                OR IAOBX.OBSERVATION_DTM = TO_CHAR(TO_DATE('2999/12/31','YYYY/MM/DD'),'YYYYMMDD'))
                            AND   IAOBX.MSG_ID IN (SELECT IPID.MSG_ID
                                                     FROM   INTERFACE_A04_PID_SEGMENT IPID
                                                    WHERE   IPID.PATIENT_ID_EXTERNAL  = P_PAT_EXT_ID_REC.EXTERNAL_ID
                                                      AND   IPID.MSG_ID IN (SELECT IMSH.MSG_ID
                                                                             FROM  INTERFACE_A04_MSH_SEGMENT IMSH
                                                                             WHERE (TRIM('W' FROM SUBSTR(IMSH.SENDING_FACILITY,5,LENGTH(IMSH.SENDING_FACILITY))) = IN_ACCOUNT_NUMBER
                                                                                 OR SUBSTR(IMSH.SENDING_FACILITY,2,LENGTH(IMSH.SENDING_FACILITY))    = IN_HLAB_NUM))));
                          BEGIN
                            SELECT STRAGG(SUB3.OBSERVATION_IDENTIFIER), COUNT(OBSERVATION_IDENTIFIER)
                            INTO VC_OBX_QUES, VC_OBX_QUES_CNT
                            FROM (SELECT DISTINCT OBSERVATION_IDENTIFIER
                                  FROM TT_A04_OBX_QUES_ANS_DTL
                                  ORDER BY OBSERVATION_IDENTIFIER)SUB3;
                             IF
                                VC_OBX_QUES = VC_ACTUAL_QUES THEN
                                VC_COMMENTS := 'AOE RECEIVED IN A REJECTED ADT';
                                VC_REJECTED_BOOLEAN_VAL := 'TRUE';
                             ELSIF
                                VC_OBX_QUES != VC_ACTUAL_QUES AND
                                VC_OBX_QUES_CNT > 0 THEN
                                VC_PAR_COMMENTS := 'PARTIAL AOE RECEIVED IN A REJECTED ADT';
                                VC_REJECTED_PAR_BOOLEAN_VAL := 'TRUE';
                             END IF;
                            VN_EXTERNAL_ID := P_PAT_EXT_ID_REC.EXTERNAL_ID;
                        EXCEPTION
                          WHEN NO_DATA_FOUND THEN
                            VC_REJECTED_BOOLEAN_VAL := 'FALSE';
                            VC_REJECTED_PAR_BOOLEAN_VAL := 'FALSE';
                        END;
                         SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                                    (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                                    ,IC_PROCEDURE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                                    ,IN_BATCH_ID        => '100'
                                    ,IC_MESSAGE_TEXT    => 'vc_obx_ques:'||VC_OBX_QUES||
                                                           ' vc_obx_ques_cnt:'||VC_OBX_QUES_CNT);
                      END LOOP EXTERNAL_ID_LOOP;
                    END IF;
                END IF;--<<Main_if_block>>
          END LOOP AOE_TEST_LOOP;
      --Returning output as per the execution result.
      IF
         VC_EXACT_BOOLEAN_VAL = 'TRUE' AND
         VC_EXACT_PAR_BOOLEAN_VAL = 'FALSE' THEN
         OV_COMMENTS := VC_COMMENTS;
         VC_DUPL_BOOLEAN_VAL         := NULL;
         VC_DUPL_PAR_BOOLEAN_VAL     := NULL;
         VC_REJECTED_BOOLEAN_VAL     := NULL;
         VC_REJECTED_PAR_BOOLEAN_VAL := NULL;
         VC_RETURN_EXACT_PAT := 'Y';
      ELSIF
         --VC_EXACT_BOOLEAN_VAL = 'TRUE' AND
         VC_EXACT_PAR_BOOLEAN_VAL = 'TRUE' THEN
         OV_COMMENTS := VC_PAR_COMMENTS;
         VC_DUPL_BOOLEAN_VAL         := NULL;
         VC_DUPL_PAR_BOOLEAN_VAL     := NULL;
         VC_REJECTED_BOOLEAN_VAL     := NULL;
         VC_REJECTED_PAR_BOOLEAN_VAL := NULL;
         VC_RETURN_EXACT_PAT := 'Y';
      END IF;
      IF
        VC_RETURN_EXACT_PAT = 'Y' THEN
        --Returning result set (OV_COMMENTS,Question and Answer) for the exact patient.(Case 1 (AOE) and 2 (PARTIAL AOE))
        SELECT MAX (SUB.COUNT_QUES_ANS)
        INTO VN_MAX_COUNT FROM (SELECT COUNT(*) OVER (PARTITION BY EAD.QUESTION_CODE, EAD.ANSWER) AS COUNT_QUES_ANS
                                FROM  EMR_ADTAOE_DTL EAD , INTERFACE_ADT_AOE_MASTER IAM, TEST T
                                WHERE T.TEST_ID = EAD.TEST_ID
                                AND   IAM.TEST_CODE = T.TEST_CODE
                                AND   EAD.SOURCE_SYSTEM = IAM.SOURCE_SYSTEM
                                AND   EAD.QUESTION_CODE = IAM.QUESTION_CODE
                                AND   EAD.PATIENT_ID    = IN_PATIENT_ID
                                AND   EAD.FACILITY_ID   = IN_FACILITY_ID
                                AND   (TRUNC(EAD.DRAW_DATE)   = IN_DRAW_DT
                                      OR TRUNC(EAD.DRAW_DATE) = TRUNC(TO_DATE('12-31-2999','mm-dd-yyyy')))
                                AND   EAD.SOURCE_SYSTEM = IN_REQUISITION_NUMBER) SUB;
         IF
            VN_MAX_COUNT > 1 THEN
            SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                                    (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                                    ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                                    ,IN_BATCH_ID        => '100'
                                    ,IC_MESSAGE_TEXT    => 'exact patient duplicate scenario'||' vn_max_count:'||VN_MAX_COUNT);
            OPEN VR_QUES_AND_ANS FOR                                 
            SELECT DISTINCT IAM.QUESTION_CODE,
                  (SELECT DISTINCT CASE
                                   WHEN EAD.ANSWER IS NULL THEN NULL
                                   WHEN LENGTH(TRIM(TRANSLATE(EAD.ANSWER, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', ' '))) IS NULL THEN EAD.ANSWER
                                   ELSE TO_CHAR(TRUNC(EAD.ANSWER *  DECODE(UPPER(IAM.UOM), 'KGS', 2.20462,1),2))
                                   END
                    FROM  EMR_ADTAOE_DTL EAD , TEST T
                    WHERE T.TEST_ID = EAD.TEST_ID
                    AND   IAM.TEST_CODE = T.TEST_CODE
                    AND   EAD.SOURCE_SYSTEM = IAM.SOURCE_SYSTEM
                    AND   EAD.QUESTION_CODE = IAM.QUESTION_CODE
                    AND   EAD.PATIENT_ID    = IN_PATIENT_ID
                    AND   EAD.FACILITY_ID   = IN_FACILITY_ID
                    AND   (TRUNC(EAD.DRAW_DATE)    = IN_DRAW_DT
                            OR TRUNC(EAD.DRAW_DATE) = TRUNC(TO_DATE('12-31-2999','mm-dd-yyyy')))
                    AND   EAD.SOURCE_SYSTEM = IN_CORP_ACRONYM
                    AND   EAD.ANSWER IS NOT NULL
                    AND   EAD.STATUS = DECODE(IAM.MATCH_TYPE, 'AT', EAD.STATUS, 'N')
                    ) AS ANSWER
            FROM INTERFACE_ADT_AOE_MASTER IAM
            WHERE IAM.SOURCE_SYSTEM = IN_CORP_ACRONYM
            AND IAM.TEST_CODE IN  (SELECT ORD.TEST_CODE
                                     FROM ORDER_REQUISITION_DETAIL ORD
                                    WHERE ORD.REQUISITION_HDR_ID = (SELECT ORH.REQUISITION_HDR_ID
                                                                      FROM ORDER_REQUISITION_HEADER ORH
                                                                     WHERE ORH.REQUISITION_NUMBER = IN_REQUISITION_NUMBER)   
                                    AND EXISTS (SELECT 1 FROM EMR_ADTAOE_DTL EAD1, INTERFACE_ADT_AOE_MASTER IAM1, TEST T1
                                                 WHERE  ORD.TEST_ID = EAD1.TEST_ID
                                                  AND   IAM1.TEST_CODE = T1.TEST_CODE
                                                  AND   EAD1.SOURCE_SYSTEM = IAM1.SOURCE_SYSTEM
                                                  AND   EAD1.QUESTION_CODE = IAM1.QUESTION_CODE
                                                  AND   EAD1.PATIENT_ID    = IN_PATIENT_ID
                                                  AND   EAD1.FACILITY_ID   = IN_FACILITY_ID
                                                  AND   (TRUNC(EAD1.DRAW_DATE)    = IN_DRAW_DT
                                                        OR TRUNC(EAD1.DRAW_DATE) = TRUNC(TO_DATE('12-31-2999','mm-dd-yyyy')))
                                                  AND   EAD1.SOURCE_SYSTEM = IN_CORP_ACRONYM
                                                  AND   EAD1.ANSWER IS NOT NULL
                                                  AND   EAD1.STATUS = DECODE(IAM1.MATCH_TYPE, 'AT', EAD1.STATUS, 'N')));
         ELSIF
           VN_MAX_COUNT = 1 THEN
           SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                                    (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                                    ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                                    ,IN_BATCH_ID        => '100'
                                    ,IC_MESSAGE_TEXT    => 'exact patient unique scenario'||' vn_max_count:'||VN_MAX_COUNT);
           OPEN VR_QUES_AND_ANS FOR                                 
           SELECT DISTINCT IAM.QUESTION_CODE,
                  (SELECT DISTINCT CASE
                                   WHEN EAD.ANSWER IS NULL THEN NULL
                                   WHEN LENGTH(TRIM(TRANSLATE(EAD.ANSWER, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', ' '))) IS NULL THEN EAD.ANSWER
                                   ELSE TO_CHAR(TRUNC(EAD.ANSWER *  DECODE(UPPER(IAM.UOM), 'KGS', 2.20462,1),2))
                                   END
                    FROM  EMR_ADTAOE_DTL EAD , TEST T
                    WHERE T.TEST_ID = EAD.TEST_ID
                    AND   IAM.TEST_CODE = T.TEST_CODE
                    AND   EAD.SOURCE_SYSTEM = IAM.SOURCE_SYSTEM
                    AND   EAD.QUESTION_CODE = IAM.QUESTION_CODE
                    AND   EAD.PATIENT_ID    = IN_PATIENT_ID
                    AND   EAD.FACILITY_ID   = IN_FACILITY_ID
                    AND   (TRUNC(EAD.DRAW_DATE)    = IN_DRAW_DT
                            OR TRUNC(EAD.DRAW_DATE) = TRUNC(TO_DATE('12-31-2999','mm-dd-yyyy')))
                    AND   EAD.SOURCE_SYSTEM = IN_CORP_ACRONYM
                    AND   EAD.ANSWER IS NOT NULL
                    AND   EAD.STATUS = DECODE(IAM.MATCH_TYPE, 'AT', EAD.STATUS, 'N')
                    ) AS ANSWER
            FROM INTERFACE_ADT_AOE_MASTER IAM
            WHERE IAM.SOURCE_SYSTEM = IN_CORP_ACRONYM
            AND IAM.TEST_CODE IN  (SELECT ORD.TEST_CODE
                                     FROM ORDER_REQUISITION_DETAIL ORD
                                    WHERE ORD.REQUISITION_HDR_ID = (SELECT ORH.REQUISITION_HDR_ID
                                                                      FROM ORDER_REQUISITION_HEADER ORH
                                                                     WHERE ORH.REQUISITION_NUMBER = IN_REQUISITION_NUMBER));
         END IF;                           
         OR_QUES_AND_ANS := VR_QUES_AND_ANS;
        SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                      (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                      ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                      ,IN_BATCH_ID        => '100'
                      ,IC_MESSAGE_TEXT    => 'vc_exact_boolean_val:'||VC_EXACT_BOOLEAN_VAL||
                                             ' vc_exact_par_boolean_val:'||VC_EXACT_PAR_BOOLEAN_VAL||
                                             ' OV_COMMENTS:'||OV_COMMENTS);
      END IF;               
      IF
          VC_DUPL_BOOLEAN_VAL = 'TRUE' AND
          VC_DUPL_PAR_BOOLEAN_VAL = 'FALSE' THEN
          OV_COMMENTS := VC_COMMENTS;
          VC_EXACT_BOOLEAN_VAL        := NULL;
          VC_EXACT_PAR_BOOLEAN_VAL    := NULL;
          VC_REJECTED_BOOLEAN_VAL     := NULL;
          VC_REJECTED_PAR_BOOLEAN_VAL := NULL;
          VC_RETURN_DUPL_PAT := 'Y';
      ELSIF
         --VC_DUPL_BOOLEAN_VAL = 'TRUE' AND
         VC_DUPL_PAR_BOOLEAN_VAL = 'TRUE' THEN
         OV_COMMENTS := VC_PAR_COMMENTS;
         VC_EXACT_BOOLEAN_VAL        := NULL;
         VC_EXACT_PAR_BOOLEAN_VAL    := NULL;
         VC_REJECTED_BOOLEAN_VAL     := NULL;
         VC_REJECTED_PAR_BOOLEAN_VAL := NULL;
         VC_RETURN_DUPL_PAT := 'Y';
      END IF;
      IF
        VC_RETURN_DUPL_PAT = 'Y' THEN
        --Returning result set (OV_COMMENTS,Question and Answer) for the duplicate patient.(Case 3 (AOE) and 4 (PARTIAL AOE))
        SELECT MAX (SUB.COUNT_QUES_ANS)
        INTO VN_MAX_COUNT FROM (SELECT COUNT(*) OVER (PARTITION BY EAD.QUESTION_CODE, EAD.ANSWER) AS COUNT_QUES_ANS
                                FROM  EMR_ADTAOE_DTL EAD , INTERFACE_ADT_AOE_MASTER IAM, TEST T
                                WHERE T.TEST_ID = EAD.TEST_ID
                                AND   IAM.TEST_CODE = T.TEST_CODE
                                AND   EAD.SOURCE_SYSTEM = IAM.SOURCE_SYSTEM
                                AND   EAD.QUESTION_CODE = IAM.QUESTION_CODE
                                AND   EAD.PATIENT_ID    = VN_DUPL_PAT_ID
                                AND   EAD.FACILITY_ID   = IN_FACILITY_ID
                                AND   (TRUNC(EAD.DRAW_DATE)   = IN_DRAW_DT
                                      OR TRUNC(EAD.DRAW_DATE) = TRUNC(TO_DATE('12-31-2999','mm-dd-yyyy')))
                                AND   EAD.SOURCE_SYSTEM = IN_REQUISITION_NUMBER) SUB;
         IF
            VN_MAX_COUNT > 1 THEN
            SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                                    (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                                    ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                                    ,IN_BATCH_ID        => '100'
                                    ,IC_MESSAGE_TEXT    => 'duplicate patient duplicate scenario'||' vn_max_count:'||VN_MAX_COUNT);
            OPEN VR_QUES_AND_ANS FOR                                 
            SELECT DISTINCT IAM.QUESTION_CODE,
                  (SELECT DISTINCT CASE
                                   WHEN EAD.ANSWER IS NULL THEN NULL
                                   WHEN LENGTH(TRIM(TRANSLATE(EAD.ANSWER, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', ' '))) IS NULL THEN EAD.ANSWER
                                   ELSE TO_CHAR(TRUNC(EAD.ANSWER *  DECODE(UPPER(IAM.UOM), 'KGS', 2.20462,1),2))
                                   END
                    FROM  EMR_ADTAOE_DTL EAD , TEST T
                    WHERE T.TEST_ID = EAD.TEST_ID
                    AND   IAM.TEST_CODE = T.TEST_CODE
                    AND   EAD.SOURCE_SYSTEM = IAM.SOURCE_SYSTEM
                    AND   EAD.QUESTION_CODE = IAM.QUESTION_CODE
                    AND   EAD.PATIENT_ID    = VN_DUPL_PAT_ID
                    AND   EAD.FACILITY_ID   = IN_FACILITY_ID
                    AND   (TRUNC(EAD.DRAW_DATE)    = IN_DRAW_DT
                            OR TRUNC(EAD.DRAW_DATE) = TRUNC(TO_DATE('12-31-2999','mm-dd-yyyy')))
                    AND   EAD.SOURCE_SYSTEM = IN_CORP_ACRONYM
                    AND   EAD.ANSWER IS NOT NULL
                    AND   EAD.STATUS = DECODE(IAM.MATCH_TYPE, 'AT', EAD.STATUS, 'N')
                    ) AS ANSWER
            FROM INTERFACE_ADT_AOE_MASTER IAM
            WHERE IAM.SOURCE_SYSTEM = IN_CORP_ACRONYM
            AND IAM.TEST_CODE IN  (SELECT ORD.TEST_CODE
                                     FROM ORDER_REQUISITION_DETAIL ORD
                                    WHERE ORD.REQUISITION_HDR_ID = (SELECT ORH.REQUISITION_HDR_ID
                                                                      FROM ORDER_REQUISITION_HEADER ORH
                                                                     WHERE ORH.REQUISITION_NUMBER = IN_REQUISITION_NUMBER)   
                                    AND EXISTS (SELECT 1 FROM EMR_ADTAOE_DTL EAD1, INTERFACE_ADT_AOE_MASTER IAM1, TEST T1
                                                 WHERE  ORD.TEST_ID = EAD1.TEST_ID
                                                  AND   IAM1.TEST_CODE = T1.TEST_CODE
                                                  AND   EAD1.SOURCE_SYSTEM = IAM1.SOURCE_SYSTEM
                                                  AND   EAD1.QUESTION_CODE = IAM1.QUESTION_CODE
                                                  AND   EAD1.PATIENT_ID    = VN_DUPL_PAT_ID
                                                  AND   EAD1.FACILITY_ID   = IN_FACILITY_ID
                                                  AND   (TRUNC(EAD1.DRAW_DATE)    = IN_DRAW_DT
                                                        OR TRUNC(EAD1.DRAW_DATE) = TRUNC(TO_DATE('12-31-2999','mm-dd-yyyy')))
                                                  AND   EAD1.SOURCE_SYSTEM = IN_CORP_ACRONYM
                                                  AND   EAD1.ANSWER IS NOT NULL
                                                  AND   EAD1.STATUS = DECODE(IAM1.MATCH_TYPE, 'AT', EAD1.STATUS, 'N')));
         ELSIF
           VN_MAX_COUNT = 1 THEN
            SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                                    (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                                    ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                                    ,IN_BATCH_ID        => '100'
                                    ,IC_MESSAGE_TEXT    => 'duplicate patient unique scenario'||' vn_max_count:'||VN_MAX_COUNT);
            OPEN VR_QUES_AND_ANS FOR                                 
            SELECT DISTINCT IAM.QUESTION_CODE,
                  (SELECT DISTINCT CASE
                                   WHEN EAD.ANSWER IS NULL THEN NULL
                                   WHEN LENGTH(TRIM(TRANSLATE(EAD.ANSWER, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', ' '))) IS NULL THEN EAD.ANSWER
                                   ELSE TO_CHAR(TRUNC(EAD.ANSWER *  DECODE(UPPER(IAM.UOM), 'KGS', 2.20462,1),2))
                                   END
                    FROM  EMR_ADTAOE_DTL EAD , TEST T
                    WHERE T.TEST_ID = EAD.TEST_ID
                    AND   IAM.TEST_CODE = T.TEST_CODE
                    AND   EAD.SOURCE_SYSTEM = IAM.SOURCE_SYSTEM
                    AND   EAD.QUESTION_CODE = IAM.QUESTION_CODE
                    AND   EAD.PATIENT_ID    = VN_DUPL_PAT_ID
                    AND   EAD.FACILITY_ID   = IN_FACILITY_ID
                    AND   (TRUNC(EAD.DRAW_DATE)    = IN_DRAW_DT
                            OR TRUNC(EAD.DRAW_DATE) = TRUNC(TO_DATE('12-31-2999','mm-dd-yyyy')))
                    AND   EAD.SOURCE_SYSTEM = IN_CORP_ACRONYM
                    AND   EAD.ANSWER IS NOT NULL
                    AND   EAD.STATUS = DECODE(IAM.MATCH_TYPE, 'AT', EAD.STATUS, 'N')
                    ) AS ANSWER
            FROM INTERFACE_ADT_AOE_MASTER IAM
            WHERE IAM.SOURCE_SYSTEM = IN_CORP_ACRONYM
            AND IAM.TEST_CODE IN  (SELECT ORD.TEST_CODE
                                     FROM ORDER_REQUISITION_DETAIL ORD
                                    WHERE ORD.REQUISITION_HDR_ID = (SELECT ORH.REQUISITION_HDR_ID
                                                                      FROM ORDER_REQUISITION_HEADER ORH
                                                                     WHERE ORH.REQUISITION_NUMBER = IN_REQUISITION_NUMBER));
         END IF; 
        OR_QUES_AND_ANS := VR_QUES_AND_ANS;
        SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                      (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                      ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                      ,IN_BATCH_ID        => '100'
                      ,IC_MESSAGE_TEXT    => 'vc_dup_pat_ques:'||VC_DUP_PAT_QUES||
                                             ' vc_dupl_boolean_val:'||VC_DUPL_BOOLEAN_VAL||
                                             ' vc_dupl_par_boolean_val:'||VC_DUPL_PAR_BOOLEAN_VAL||
                                             ' OV_COMMENTS:'||OV_COMMENTS);
      END IF;               
      IF
         VC_REJECTED_BOOLEAN_VAL = 'TRUE' AND
         VC_REJECTED_PAR_BOOLEAN_VAL = 'FALSE' THEN
         OV_COMMENTS := VC_COMMENTS;
         VC_EXACT_BOOLEAN_VAL        := NULL;
         VC_EXACT_PAR_BOOLEAN_VAL    := NULL;
         VC_DUPL_BOOLEAN_VAL         := NULL;
         VC_DUPL_PAR_BOOLEAN_VAL     := NULL;
         VC_RETURN_REJECT_PAT := 'Y';
      ELSIF
         --VC_REJECTED_BOOLEAN_VAL = 'FALSE' AND
         VC_REJECTED_PAR_BOOLEAN_VAL = 'TRUE' THEN
         OV_COMMENTS := VC_PAR_COMMENTS;
         VC_EXACT_BOOLEAN_VAL        := NULL;
         VC_EXACT_PAR_BOOLEAN_VAL    := NULL;
         VC_DUPL_BOOLEAN_VAL         := NULL;
         VC_DUPL_PAR_BOOLEAN_VAL     := NULL;
         VC_RETURN_REJECT_PAT := 'Y';
      ELSIF
         VC_REJECTED_BOOLEAN_VAL = 'FALSE' AND
         VC_REJECTED_PAR_BOOLEAN_VAL = 'FALSE' THEN
         --Returning result set (OV_COMMENTS) for the rejected ADT.(Case 7)
         OV_COMMENTS := 'AOE NOT RECEIVED IN ADT';
         OR_QUES_AND_ANS := NULL;
         SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                        (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                        ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                        ,IN_BATCH_ID        => '100'
                        ,IC_MESSAGE_TEXT    => 'vc_obx_ques:'||VC_OBX_QUES||
                                               ' vc_rejected_boolean_val:'||VC_REJECTED_BOOLEAN_VAL||
                                               ' vc_rejected_par_boolean_val:'||VC_REJECTED_PAR_BOOLEAN_VAL||
                                               ' OV_COMMENTS:'||OV_COMMENTS);
         VC_EXACT_BOOLEAN_VAL        := NULL;
         VC_EXACT_PAR_BOOLEAN_VAL    := NULL;
         VC_DUPL_BOOLEAN_VAL         := NULL;
         VC_DUPL_PAR_BOOLEAN_VAL     := NULL;
      END IF;
      IF
        VC_RETURN_REJECT_PAT = 'Y' THEN
        --Returning result set (OV_COMMENTS,Question and Answer) for the rejected ADT.(Case 5 (AOE) and 6 (PARTIAL AOE))
        --In case of multiple external id with same patient, facility and draw date; the lastest record should be picked.
        SELECT MAX(MSG_ID) INTO VN_MAX_MSG_ID FROM TT_A04_OBX_QUES_ANS_DTL;
        OPEN VR_QUES_AND_ANS FOR
        SELECT DISTINCT IAM.QUESTION_CODE,
                       (SELECT DISTINCT
                         CASE
                            WHEN TOBX.OBSERVATION_VALUE IS NULL THEN NULL
                            WHEN LENGTH(TRIM(TRANSLATE(TOBX.OBSERVATION_VALUE, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', ' '))) IS NULL THEN TOBX.OBSERVATION_VALUE
                            ELSE TO_CHAR(TRUNC(TOBX.OBSERVATION_VALUE *  DECODE(UPPER(TOBX.UOM), 'KGS', 2.20462,1),2))
                         END
                         FROM TT_A04_OBX_QUES_ANS_DTL TOBX
                        WHERE TOBX.OBSERVATION_IDENTIFIER = IAM.QUESTION_CODE
                          AND TOBX.MSG_ID = VN_MAX_MSG_ID) AS ANSWER
         FROM INTERFACE_ADT_AOE_MASTER IAM
        WHERE SOURCE_SYSTEM = IN_CORP_ACRONYM;
        OR_QUES_AND_ANS := VR_QUES_AND_ANS;
        SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                        (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                        ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                        ,IN_BATCH_ID        => '100'
                        ,IC_MESSAGE_TEXT    => 'vc_rejected_boolean_val:'||VC_REJECTED_BOOLEAN_VAL||
                                               ' vc_rejected_par_boolean_val:'||VC_REJECTED_PAR_BOOLEAN_VAL||
                                               ' OV_COMMENTS:'||OV_COMMENTS);
      END IF;
       SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                        (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                        ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                        ,IN_BATCH_ID        => '100'
                        ,IC_MESSAGE_TEXT    => 'End of the procedure with Patient_Id:'||IN_PATIENT_ID||' Facility_Id:'||IN_FACILITY_ID||
                                               ' Draw_Dt:'||IN_DRAW_DT||' Requisition_Number:'||IN_REQUISITION_NUMBER||' Corp_Acronym:'||IN_CORP_ACRONYM||
                                               ' ABCDEF_Mrn:'||IN_ABCDEF_MRN||' Account_Number:'||IN_ACCOUNT_NUMBER||' Hlab_Num:'||IN_HLAB_NUM);
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
        SPL_SPN_ERROR_LOGGING_SPK.ERROR_PROC
                        (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                        ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                        ,IN_BATCH_ID        => '100'
                        ,IC_MESSAGE_TEXT    => SQLERRM);
      WHEN OTHERS THEN
        SPL_SPN_ERROR_LOGGING_SPK.ERROR_PROC
                        (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                        ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                        ,IN_BATCH_ID        => '100'
                        ,IC_MESSAGE_TEXT    => SQLERRM);
    END SPL_SPN_MISSING_EMR_AOE_DTL;
    Regards,
    BS2012.

    Hey Guys,
    I'm sorry, that I troubled you all. But I found the issue and solved it.
    The actual problem is residing at that max of that partition by query. I had a misconception that this query will always return a value which is positive number like 1,2 etc.
    But sometimes it's returning null as well. So the ref cursor is fetching nothing. Now I've modified my code and everything is working fine. Thanks for your help and support.
    Regards,
    BS2012.

  • Very urgent please ----repetting values in the output

    I am getting values for acc seq   access seq number and codndition table  repeting values as in the output of the report, please have a look in my code and please do respond immediatley.
    regards always, below is my code and output
    REPORT zmaster_condition LINE-COUNT 80 LINE-SIZE  225.
         D A T A                                                         *
    INCLUDE zmaster_condition_top.
        S E L E C T I O N S                                              *
    SELECTION-SCREEN BEGIN OF BLOCK b01 WITH FRAME TITLE text-b01.
    SELECT-OPTIONS: s_kvewe FOR  t683s-kvewe,
                    s_kappl  FOR  t683s-kappl,
                    s_kalsm  FOR  t683s-kalsm,
                    s_kschl  FOR   t683s-kschl,
                    s_kabnr  FOR  t682i-kotabnr,
                    s_kozgf  FOR  t682i-kozgf.
    SELECTION-SCREEN END OF BLOCK b01.
    *SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE text-s04.
    *PARAMETERS:      p_vari     LIKE   disvariant-variant.
    *SELECTION-SCREEN END OF BLOCK b4.
    **SELECTION-SCREEN BEGIN OF BLOCK b02 WITH FRAME TITLE text-b02.
    *SELECTION-SCREEN BEGIN OF BLOCK b02 WITH FRAME TITLE text-b02.
    PARAMETERS R1 RADIOBUTTON GROUP RADI1 DEFAULT 'X'.
    *SELECTION-SCREEN END OF BLOCK b02.
         A T   S E L E C T I O N - S C R E E N                           *
         M A I N   P R O G R A M                                         *
    START-OF-SELECTION.
    *Initializing the local tables.
      CLEAR:it_t682i,it_t683s,it_t685.
      REFRESH:it_t682i,it_t683s,it_t685.
      clear it_output_report.
      refresh it_output_report.
    *Selection of data from pricing procedure tables
    SELECT kvewe kappl kozgf kolnr kotabnr FROM t682i
                INTO TABLE  it_t682i
                WHERE kvewe = 'B'
                AND  kappl = 'V1'.
      SELECT kvewe kappl kalsm stunr zaehk kschl  FROM t683s
           INTO   TABLE  it_t683s
           WHERE  kvewe = 'B'
           AND    kappl = 'V1'
           and    kschl in s_kschl
           AND    kalsm  IN s_kalsm.
    sort it_t683s by kvewe kappl.
      DELETE   adjacent duplicates  FROM
             it_t683s  .
    SELECT kvewe kappl kschl kozgf FROM t685
        INTO TABLE it_t685
        WHERE kvewe = 'B'
        AND kappl = 'V1'
        AND  kschl IN s_kschl
        AND kozgf IN s_kozgf.
      LOOP AT it_t683s.
        it_output_report-kvewe = it_t683s-kvewe.
        it_output_report-kappl =  it_t683s-kappl.
        it_output_report-kalsm =  it_t683s-kalsm.
        it_output_report-stunr =  it_t683s-stunr.
        it_output_report-zaehk =  it_t683s-zaehk.
        it_output_report-kschl =  it_t683s-kschl.
      SELECT kvewe kappl kozgf kolnr kotabnr FROM t682i
                 INTO TABLE  it_t682i
                 WHERE kvewe = it_t683s-kvewe
                 AND  kappl = it_t683s-kappl
                 and  kozgf   in s_kozgf
                 and  kotabnr in s_kabnr.
                 clear it_t682i.
    loop at it_t682i.
    it_output_report-kozgf = it_t682i-kozgf.
    it_output_report-kozgf = it_t682i-kozgf.
      it_output_report-kolnr = it_t682i-kolnr.
      it_output_report-kotabnr = it_t682i-kotabnr.
       APPEND it_output_report.
       CLEAR it_output_report.
    endloop.
    APPEND it_output_report.
      ENDLOOP.
            E N D - O F - S E L E C T I O N
    END-OF-SELECTION.
    *Output to a list
      FORMAT COLOR 2 .
      WRITE:/2 'Usage',09 'App',17 'Proced',24 'Step',
                37 'Counter',50 'CondType',63 'Description',85 'AccSeq',
               97 'AccSeqNum',108 'ConTable'.
      WRITE:/1(225) sy-uline.
      LOOP AT it_output_report.
        WRITE:/ it_output_report-kvewe UNDER 'Usage',
                it_output_report-kappl UNDER 'App',
                it_output_report-kalsm UNDER 'Procedure',
                it_output_report-stunr UNDER  'Step',
                it_output_report-zaehk UNDER  'Counter',
                it_output_report-kschl UNDER 'CondType',
               it_output_report- UNDER  'Description',
                it_output_report-kozgf UNDER 'AccSeq',
                it_output_report-kolnr UNDER 'AccSeqNum',
                it_output_report-kotabnr UNDER  'ConTable'.
                it_output_report- UNDER  'SalesOrg',
                it_output_report- UNDER  'DocType'.
                it_output_report- UNDER  'Customer'.
      ENDLOOP.
    output of the report:
    Usage  App     Proced   Step   Counter CondType   AccSeq AccqNum  ConTable                                                                               
    B      V1        V10000      220   00           ZCR1        Z200         05           511     
    B      V1 V10000      220          01           ZRAS        Z200        05         511     
    B      V1 V10000      225          00           ZTPT         Z200        05         511     
    B      V1 V10000      230          00           ZOP4         Z200        05         511     
    B      V1 V10001      010          01           RD03         Z200        05         511     
    B      V1 V10002      010          00           ZREP         Z200        05         511     
    B      V1 V10000      200          00           ZOP3          z200        05         511     
    B      V1 V10000      130          00           ZOC3           z200        05         511

    i would like to thanks you for your valuable help.
    i am still getting repeated values for access seq , access number and cond table,last three columns in the output, pls see as it it is very urgent...
    here is the code:
    REPORT zmaster_condition LINE-COUNT 80 LINE-SIZE  225.
         D A T A                                                         *
    INCLUDE zmaster_condition_top.
        S E L E C T I O N S                                              *
    SELECTION-SCREEN BEGIN OF BLOCK b01 WITH FRAME TITLE text-b01.
    SELECT-OPTIONS: s_kvewe FOR  t683s-kvewe,
                    s_kappl  FOR  t683s-kappl,
                    s_kalsm  FOR  t683s-kalsm,
                    s_kschl  FOR   t683s-kschl,
                    s_kabnr  FOR  t682i-kotabnr.
                   s_kozgf  FOR  t682i-kozgf.
    SELECTION-SCREEN END OF BLOCK b01.
    *SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE text-s04.
    *PARAMETERS:      p_vari     LIKE   disvariant-variant.
    *SELECTION-SCREEN END OF BLOCK b4.
    **SELECTION-SCREEN BEGIN OF BLOCK b02 WITH FRAME TITLE text-b02.
    *SELECTION-SCREEN BEGIN OF BLOCK b02 WITH FRAME TITLE text-b02.
    PARAMETERS R1 RADIOBUTTON GROUP RADI1 DEFAULT 'X'.
    *SELECTION-SCREEN END OF BLOCK b02.
         A T   S E L E C T I O N - S C R E E N                           *
         M A I N   P R O G R A M                                         *
    START-OF-SELECTION.
    *Initializing the local tables.
      CLEAR:it_t682i,it_t683s,it_t685.
      REFRESH:it_t682i,it_t683s,it_t685.
      REFRESH it_output_report.
      SELECT kvewe kappl kalsm stunr zaehk kschl  FROM t683s
           INTO   TABLE  it_t683s
           WHERE  kvewe IN s_kvewe
           AND    kappl IN s_kappl
           AND    kalsm  IN s_kalsm
            AND    kschl IN s_kschl.
    *delete adjacent duplicates from it_t683s comparing
                                    kvewe kappl kschl.
    SELECT kvewe kappl kozgf kolnr kotabnr FROM t682i
                     INTO TABLE  it_t682i
                    FOR ALL ENTRIES IN it_t683s
                     WHERE kvewe = it_t683s-kvewe
                     AND  kappl = it_t683s-kappl
                    AND  kozgf   IN s_kozgf
                     AND  kotabnr IN s_kabnr.
      LOOP AT it_t683s.
       it_output_report-kvewe = it_t683s-kvewe.
       it_output_report-kappl =  it_t683s-kappl.
       it_output_report-kalsm =  it_t683s-kalsm.
       it_output_report-stunr =  it_t683s-stunr.
       it_output_report-zaehk =  it_t683s-zaehk.
       it_output_report-kschl =  it_t683s-kschl.
      move-corresponding it_t683s to it_output_report.
    sort it_t683s.
    sort it_t682i.
    READ TABLE it_T682i with KEY KVEWE = it_T683s-KVEWE
                                kappl = it_t683s-kappl.
    LOOP AT it_T682i  WHERE KVEWE = it_T683s-KVEWE
                           AND  kappl = it_t683s-kappl.
                          AND  kotabnr IN s_kabnr.
    IF SY-SUBRC EQ 0.
       move-corresponding it_T682i to it_output_report.
         it_output_report-kozgf = it_t682i-kozgf.
         it_output_report-kolnr = it_t682i-kolnr.
         it_output_report-kotabnr = it_t682i-kotabnr.
    ENDIF.
    APPEND it_output_report.
      ENDLOOP.
    *DATA TAB(4).
    *DATA VKORG LIKE  TAB-VKORG.
    *CONCATENATE it_t683s-kvewe it_t682i-kotabnr INTO TAB .
    *SELECT SINGLE VKORG INTO VKORG FROM  TAB WHERE
    KSCHL = 'ZRC1'.
            E N D - O F - S E L E C T I O N
    END-OF-SELECTION.
    *Output to a list
      FORMAT COLOR 2 .
      WRITE:/2 'Usage',09 'App',15 'Proced',24 'Step',
                37 'Counter',50 'CondType',63 'Description',85 'AccSeq',
               97 'AccSeqNum',108 'ConTable'.
      WRITE:/1(225) sy-uline.
      LOOP AT it_output_report.
        WRITE:/ it_output_report-kvewe UNDER 'Usage',
                it_output_report-kappl UNDER 'App',
                it_output_report-kalsm UNDER 'Proced',
                it_output_report-stunr UNDER  'Step',
                it_output_report-zaehk UNDER  'Counter',
                it_output_report-kschl UNDER 'CondType',
               it_output_report- UNDER  'Description',
                it_output_report-kozgf UNDER 'AccSeq',
                it_output_report-kolnr UNDER 'AccSeqNum',
                it_output_report-kotabnr UNDER  'ConTable'.
                it_output_report- UNDER  'SalesOrg',
                it_output_report- UNDER  'DocType'.
                it_output_report- UNDER  'Customer'.
    here is the output:
    Report to list out all Condition Records for Output and Pricing.                                                                               
    Usage  App   Proced   Step  Counter CondType  AccSeq  AccSeqNum  ConTable
                                                                                    B      V1     V05000   010        01      AF00             Z001        05         551    
    B      V1    V05000   020          02      MAIL           Z001        05         551    
    B      V1    V05000   030          01      ESYM         Z001        05         551    
    B      V1    V06000   010          01      AN00          Z001        05         551    
    B      V1    V06000   020          02       MAIL          Z001        05         551

  • Restricting Null Values in the report

    Hi All,
    I have a aggregated feild displayed in the bottom of the report and sorted on the report on that field to show me top results.
    When I try to run the report, Null values are coming first in the report (Displayed as NaN).
    I want to restrict these null values from the report.
    Please guide me on this.
    Thanks in advance,
    Imtiaz.

    Okay. If you are using sum, you could use the following: <?sum(Petrofac-ECRevenue[.!=''])?>
    ensure that the path to the element is correct. Are you using a syntax like <?sum(current-group()/Petrofac-ECRevenue)?>
    Send me an email to [email protected] with your xml data and RTF if you can't make it work.

  • How to map multiple output values to the output schema in biztalk mapper?

    Hi,
    In my biztalk mapper, I am using a "database lookup" functoid which is linked to a "Value Extractor" functoid. A source schema field is linked to the database lookup functoid which is linked to a "Value Extractor" functoid
    which is linked to the destination schema field. After passing the required parameter values in the database lookup functoid (lookup value, conn string, table, column name), I know that the result set may get multiple rows which are transferred to the "value
    extractor" functoid.
    Now what I want is to create a record in destination schema for each row in the result set. My current mapping is as below:
    1) Source record > looping functoid > destination record
    2) Source record field > Database functoid > Value Extractor functoid > dest record field
    but this mapping is giving me only the first value in result set.
    Please help me in this so that my map creates a destination record for each value in the result set.
    e.g. if query [select * from employees where surname='Brown'] returns five records, then I would like five records in the destination schema.
    Thanks
    manibest

    Hi Muhammad Ehsan,
    Thank you for the useful suggestion. however, I have only one difficulty in building your suggested solution. in my query  (select
    * from employees where surname='Brown'), the value of surname is coming from the source schema field which could be different in each source schema record field.
    lets say that source schema instance has 3 records in it as below:
    <Records>
    <Record><Surname>Brown<Surname></Record>
    <Record><Surname>Atkinson<Surname></Record>
    <Record><Surname>White<Surname></Record>
    </Records>
    For each of above records the database query should run with the relevant surname value. if database has 5 records for "Brown", 3 records for "Atkinson" and 1 record for "White" then the destination schema should create (5+3+1) = 9 records in
    total.
    To create a destination canonical schema that works fine, I have to somehow pass this surname value from source schema as parameter so that it uses this value to poll the database and get records. Is there a way I can pass this surname value as parameter
    to the destination canonical schema? Thank you so much for the help.
    manibest

  • Cannot enter correct values in the SQL server express 2012 using labview

    Hi everyone,
    I am trying to enter the 2D array I get from DAQ into the SQL server express 2012 using Labview. When I am run the software, it connects with the table but doesn't enter the correct values. It only enters the "0" for each column of the table. I have attached the VI as well as the screenshot from the database server. 
    I am also writing the same 2D array data into the text file and I get the correct readins there. 
    Is there something I am doing wrong here. 
    Attachments:
    test.png ‏251 KB
    test3.vi ‏96 KB

    If you had read the QL manuals or reference books, you would be aware SQL Server doesn't do multidimensional arrays.
    I prefer BLOBs or VARCHAR(MAXCHAR) as an alternative. I enter the values in formatted string values delimiter separated.
    But how to deal with multidimensional arrays. Well up to 3-5 you can use simple value for each "dimension". So the lowest dimension
    would be comma delimit. The next set of values and each succeeding set for each 2nd dimension values would have the "set" of values separated
    by a ":" or semicolon. For the third I use the ":" or colon to separate each 2D block of the 3rd dimension. This can all be easily reparsed
    with a multidimensional parser for the application. Should be simple to build. (e.g.. Use string arrays to parse the higher dimensions
    and numeric array for the lowest dimension). The VARCHAR(MAXCHAR) has an upper data bound of 2GB! If you have to save more
    than 3 dimensions for most all applications, you don't understand how best to analyze the test data and may want to give it more 
    thought to optimize the operation as well as the design, so it doesn't get too complex. By the way I use Data Clusters built in the
    data order and type as for SQL Server Data Table. This makes the design of the SQL Server interface easy as pie .

  • How can i display the values in the vector in a jsp using jstl

    in a task i am recieving a vector in a jsp... how can i display those vector values in the jsp using jstl.... plz help me
    thanks in advance

    <%
    here you got vector say; v
    pagecontext.setAttribute("varname",v);
    %>
    <c:forEach var="i" items="${varname}">
    <c:out value="${i}">
    </c:forEach>

  • How to change the ColumnName in the output of an ALV List

    ello Experts,
    Can you please let me know how can I change the column name of a field in an ALV List. For eg: I want to see the 'I_FIELDCAT-MATNR' field's name as 'ITEM NUMBER' in the output.
    Thanks for the help

    Hi Raj,
    Have a look at this file.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/eac1fa0b-0e01-0010-0990-8530de4908a6
    Reward if useful.
    Thanks
    Aneesh.

  • How to control the output fields in ALV

    Hi Pals,
    I have a Z program which outputs around 400 characters length. It is working fine when we run in foreground(online).. But i have the problem with the length of the output of the report when i run in BACKGROUND mode. That is, only 255 characters are being displayed.
    So, i have decided to supress some of the unwanted output fields being diplayed, so that the total output length becomes 255 characters.
    How can i handle this situation in the ALV's?
    Someone please send me some sample code.
    Thanks in advance,
    Ram.

    Hi
       Better create the Layout Variants with the desired columns.
    ALV is providing that functionality.
    Use
    CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
        EXPORTING
          is_variant = alv_variant
          i_save     = 'A'
        IMPORTING
          es_variant = alv_variant
        EXCEPTIONS
          not_found  = 2.
    Regards,
    Kumar

  • How to set the output list in alv

    hai all,
    i have copied the standard alv program into customized and the out put of customized have changed . but the output listy of this customized program is to be changed like standard program . please tell me how to do this i have setting the current layout of it . it will display only for time been whemni come out of that program it will change .

    Hi,
    After changing the layout to desired output. Save the layout and set it as default. Then it will work for every time.
    Thanks
    Chandra

Maybe you are looking for

  • Need help in SQL programming

    hi all , we need a simple query which needed for avoiding the custom code in our Reporter Engine. Existing report : Aggregate Usage by Volume Tables involved: ent_host_disk_usage : (used mb of aggregate and volume mapped to the aggregate are in same

  • Limit on the number of photographs in Photo Layout Creation v5.0?

    Hi, Moving from PSE v4.0 to v5.0 Adobe changed the way Photo Album pages and Photo Layouts are created. In v5.0 and greater the photos are now loaded into Elements Editor and that is where the creation is then made. The problem is that I find the Edi

  • Runtime Errors  SYNTAX_ERROR in SAP Solution Manager 4.0

    Hi every body,      After in install of support packages SAP_BASIS SAP_ABA and ST. When I logon in the SAPGui I received this error: Runtime Errors         SYNTAX_ERROR Short text     Syntax error in program "SAPLSCP2 ". What happened?     Error in t

  • Context Change & Explicit Context Change

    Hi        i need some info about Context Change and Context Handling, explisit context change how can we r defineing Thanks&Regards rajashekar

  • Wireless Adapter (WUSB54G) Driver Issues

    My wireless adapter doesn't automatically connect to the internet. I went under devices and found that it was there but listed as unspecified. I right clicked and troubleshoot'd, but it only claimed to have reinstalled the drivers because there was n