***** in the output AT END stmt

I am getting ***** in the output, if I use the at end stmt. Can anybody tell me the reason and teh solution??

Hello,
When using AT END ENDAT all fields to the right of the current control key(Matnr in your case) will be filled with ****s.  This means that you can do things like SUM on an amount or quantity field.  If you need some of the character type fields at the  AT END you will have to code around that.
eg (please note this is not syntactically accurate or complete code)
data ls_tmp like ls_itab.
loop at it_itab into ls_itab.
   ls_tmp = ls_itab.       " save current line of itab
   at end matnr
    do something ie sum or whatever your requirements are
      write ls_tmp-charfield.
   endat.
endloop.
Regards
Greg Kern

Similar Messages

  • DATAEXPORT - Can the output to the file be changed

    Hi,
    I have a working DATAEXPORT calc. However I was wondering if there is a way to change the output that ends up in the file? Currently it is putting the dimensions in an order that does not coincide with my fix statement. I assume Essbase just knows the optimal output order or something. I basically want to change the output order and then maybe eliminate some columns and possibly concatenate two together with a '_'. Is this possible within the calc itself?
    //ESS_LOCALE English_UnitedStates.Latin1@Binary
    SET DATAEXPORTOPTIONS
    DataExportDECIMAL 4;
    DataExportRELATIONALFILE ON;
    DataExportOVERWRITEFILE ON ;
    DataExportDynamicCalc OFF;
    DataExportDimHeader ON;
    DataExportCOLHEADER "PERIOD";
    /* Exports zero level data to specified directory */
    FIX (
    @Descendants("NU_Consolidated",0),
    @Descendants("TOTCO_FERC",0),
    @Descendants("NU_Actv",0),
    @Children("YEARS"),
    "NU_RESC",
    "TOT_SCCC",
    "TOT_CCCC",
    "Charge_Type_Total",
    "Final",
    "Budget"
    DATAEXPORT "File" "|" "/essbase111/cfa_test_090909.txt";
    ENDFIX

    Sorry Sam,
    Dataexport does things in the most efficient way possible so it dies not allow you to order the dimensions. It also does not let you drop columns. The two options you have are:
    1. Export to a relationsal table where you can then have a sql (dts or otherwise) reorder the columns, remove unwanted columns, concatinate columns, etc
    2. write a perl or vb or other program to post process the file to be what you want
    I would have offered using the jExport cdf as an alternative since it will do what you want, but I know you are not allowed it in your environment

  • SELECT stmt required to retrieve the output data as specified.

    source table:
    Origin      Destination      Miles
    Sydney           Melbourne      1000
    Perth           Adelaide      3000
    Canberra      Melbounre      700
    Melbourne      Sydney      1000
    Brisbane      Sydney      1000
    Perth      Darwin      4000
    Sydney      Brisbane      1000
    Duplicate routes are to be ignored so the output is
    out put:
    Origin           Destination      Miles
    Sydney           Melbourne      1000
    Perth           Adelaide      3000
    Canberra      Melbounre      700
    Brisbane      Sydney           1000
    Perth           Darwin           4000
    Please suggest a select query / sub query with out using any subprograms or functions/pkgs to get the out put table.

    Hi Pawan,
    Try this document
    <b>https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0de1eb8-0b98-2910-7996-8a3c2fcf6785</b>
    Regards,
    ABY

  • Are You All Able to get the Output In EXCEL Format

    Hi All,
    I have one question. Are You All Able to get the Output In EXCEL Format?? I am working on Oracle Apllication 11.5.10.2 and my XML builder is 5.0.1. Problem which i m facing is this...... Whenever i am submitting a concurrent program with format type different from PDF i could not able to view the ouput in desired format. When i am pressing view output it gives me a file in XML and when i save that file with extention 'xls' or 'rtf' then i could able to see the saved file in desired format.
    Can anyone tell me where is the problem??? Is it a bug?
    I am using microsoft world 2000 sp-3.
    Please give your valuable comments. May be your comments can solve my problem..
    Thanks
    Ravi

    Hi I got Same issue
    When I change Format to EXCEL from
    Submit request>> Option>> Format = EXCEL
    In window I am getting something HTML code and
    when I try to copy it to Browser from Tools>> Copy File in to Browser I am getting following message
    The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    End tag 'p' does not match the start tag 'a'. Error processing resource 'http://our url.com:8000/OA_CGI...
    <p class="c0"><a name="Text4" id="Text4"><a name="Text1_1" id="Text1_1"><span class="c1">Dept No <...
    But I can see the output when Format is PDF
    Pls suggest solution ,I am using EBS 11.5.10.2.
    Thanks
    Rahul
    Message was edited by: Rahul
    user576181

  • XSLT Mapping: URI appearing in each field entry in the output

    Hi there,
    I am mapping a custome build Invoice to xCBL structure in Stylus Studio. The output look ok, but in each field URI value appear as well, as shown below.
    --Start
    <p:msgDetails xmlns:p="http://localhost/webs/msgDetails.xsd">
    <p:sender xmlns:p="http://localhost/webs/msgDetails.xsd"><p:senderId xmlns:p="http://localhost/webs/msgDetails.xsd">SCA HA</p:senderId><p:senderName xmlns:p="http://localhost/webs/msgDetails.xsd">SCA HA</p:senderName></p:sender><p:receiver xmlns:p="http://localhost/webs/msgDetails.xsd"><p:receiverId xmlns:p="http://localhost/webs/msgDetails.xsd">PEL</p:receiverId><p:receiverName xmlns:p="http://localhost/webs/msgDetails.xsd">Progressive Enterprise</p:receiverName></p:receiver><p:docType xmlns:p="http://localhost/webs/msgDetails.xsd">invoice</p:docType><p:docFormat xmlns:p="http://localhost/webs/msgDetails.xsd">xcbl40</p:docFormat><p:transmissionDetails xmlns:p="http://localhost/webs/msgDetails.xsd"><p:testMsg xmlns:p="http://localhost/webs/msgDetails.xsd">true</p:testMsg><p:transmissionDate xmlns:p="http://localhost/webs/msgDetails.xsd">2005-05-23 14:20:20</p:transmissionDate><p:messageId xmlns:p="http://localhost/webs/msgDetails.xsd">2005-05-23 14:20:20</p:messageId><p:username xmlns:p="http://localhost/webs/msgDetails.xsd"/><p:password xmlns:p="http://localhost/webs/msgDetails.xsd"/></p:transmissionDetails></p:msgDetails>
    ---End
    The expected output is,
    - Start
    <p:msgDetails xmlns:p="http://localhost/webs/msgDetails.xsd">
      <p:sender>
        <p:senderId>SCA HA</p:senderId>
        <p:senderName>SCA HA</p:senderName>
      </p:sender>
      <p:receiver>
        <p:receiverId>PEL</p:receiverId>
        <p:receiverName>Progressive Enterprises</p:receiverName>
      </p:receiver>
      <p:docType>invoice</p:docType>
      <p:docFormat>xcbl40</p:docFormat>
      <p:transmissionDetails>
        <p:environmentFrom>dev</p:environmentFrom>
        <p:testMsg>true</p:testMsg>
        <p:transmissionDate>2005-05-18T11:14:06</p:transmissionDate>
        <p:messageId>104435_2005-05-18T11:14:06</p:messageId>
        <p:username></p:username>
        <p:password></p:password>
      </p:transmissionDetails>
    </p:msgDetails>
    --end
    Its happening in the body area as well. Can somebody please suggest.
    Thank you.
    Warm Regards,
    Ranjan

    Hi Ranjan,
    You can resolve this in this way.
    In ur xsl, delete the namespaces appearing. Then hardcode with ur hand the namespace like <p:msgDetails xmlns:p="http://localhost/webs/msgDetails.xsd">.
    Make sure that the template match is coming before the
    <p:msgDetails ..
    Hope this helps out.
    Rgds,
    Deno

  • Reg : data is not getting in the output

    hi team,
                 data is not getting in the  output, but it is getting in the debug mode
    REPORT ZSAPP10 .
    *tables : pernr.
    TABLES : PA0001.
    type-pools : slis.
    types : begin of itab,
            pernr type pernr,
            orgeh type orgeh,
            abkrs type abkrs,
            end of itab,
            begin of itab2,
            pernr type pernr,
            vorna type pad_vorna,
            nachn type pad_nachn,
            end of itab2.
    parameter : p_pernr like pa0001-pernr.
    *DATA:  g_cprog  tYPE SY-CPROG.
    data : i_itab1 type table of itab initial size 0,
           i_itab2 type table of itab2 initial size 0.
    data : w_itab type itab,
           w_itab2 type itab2.
    data : t_fieldcat type slis_t_fieldcat_alv,
            w_fieldcat type slis_fieldcat_alv.
    data : t_event type slis_t_event,
            w_event type slis_alv_event.
    data : t_listheader type slis_t_listheader,
           w_listheader type slis_listheader.
    *get pernr.
    w_event-form = 'TOP_OF_PAGE'.
    w_event-form = 'sub1'.
    append w_event to t_event.
    w_listheader-typ = 'H'.
    w_listheader-info = 'this is new top of page'.
    append w_listheader to t_listheader.
    select pernr
           orgeh
           abkrs from pa0001 into table i_itab1 where pernr = p_pernr.
    w_fieldcat-col_pos = 1.
    w_fieldcat-seltext_m = 'personnal no'.
    w_fieldcat-fieldname = 'pernr'.
    w_fieldcat-tabname = 'i_itab1'.
    w_fieldcat-outputlen = '20'.
    append w_fieldcat to t_fieldcat.
    w_fieldcat-col_pos = 2.
    w_fieldcat-seltext_m = 'org. unit'.
    w_fieldcat-tabname = 'i_itab1'.
    w_fieldcat-fieldname = 'orgeh'.
    w_fieldcat-outputlen = '20'.
    append w_fieldcat to t_fieldcat.
    w_fieldcat-col_pos = 3.
    w_fieldcat-seltext_m = 'payroll area'.
    w_fieldcat-tabname = 'i_itab1'.
    w_fieldcat-fieldname = 'abkrs'.
    w_fieldcat-outputlen = '20'.
    append w_fieldcat to t_fieldcat.
    *g_cprog = SY-CPROG.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
               I_INTERFACE_CHECK                 = ' '
               I_BYPASSING_BUFFER                =
               I_BUFFER_ACTIVE                   = ' '
                 I_CALLBACK_PROGRAM                = SY-CPROG
               I_CALLBACK_PF_STATUS_SET          = ' '
               I_CALLBACK_USER_COMMAND           = ' '
               I_CALLBACK_TOP_OF_PAGE            = ' '
               I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
               I_CALLBACK_HTML_END_OF_LIST       = ' '
               I_STRUCTURE_NAME                  =
               I_BACKGROUND_ID                   = ' '
               I_GRID_TITLE                      =
               I_GRID_SETTINGS                   =
               IS_LAYOUT                         =
                 IT_FIELDCAT                       = T_FIELDCAT
               IT_EXCLUDING                      =
               IT_SPECIAL_GROUPS                 =
               IT_SORT                           =
               IT_FILTER                         =
               IS_SEL_HIDE                       =
               I_DEFAULT                         = 'X'
               I_SAVE                            = ' '
               IS_VARIANT                        =
                 IT_EVENTS                         = T_EVENT
               IT_EVENT_EXIT                     =
               IS_PRINT                          =
               IS_REPREP_ID                      =
               I_SCREEN_START_COLUMN             = 0
               I_SCREEN_START_LINE               = 0
               I_SCREEN_END_COLUMN               = 0
               I_SCREEN_END_LINE                 = 0
               IT_ALV_GRAPHICS                   =
               IT_ADD_FIELDCAT                   =
               IT_HYPERLINK                      =
               I_HTML_HEIGHT_TOP                 =
               I_HTML_HEIGHT_END                 =
               IT_EXCEPT_QINFO                   =
             IMPORTING
               E_EXIT_CAUSED_BY_CALLER           =
               ES_EXIT_CAUSED_BY_USER            =
                 TABLES
                 T_OUTTAB                          = I_ITAB1[]
              EXCEPTIONS
                PROGRAM_ERROR                     = 1
                OTHERS                            = 2
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
          FORM sub1                                                     *
    FORM sub1.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = t_listheader
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
    ENDFORM.                                                    " sub1

    write this way...
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
            EXPORTING
            i_callback_program                = w_repid
            is_layout                = wa_layout
            i_callback_user_command  = 'USER_COMMAND_ACCT'
            i_grid_title             = 'Document Status Report'
             it_fieldcat                       = it_fcat[]
         IT_SORT                        = IT_SORT[]
             it_events                = it_events
             TABLES
               t_outtab                        = it_final_data[]
          EXCEPTIONS
            program_error                     = 1
            OTHERS                            = 2.

  • Adding Field to the output of the Report

    Hello experts
    I have a program like following, I would like to add a field (Customer purchase order from order header)vbkd-bstkd to the output, I tried to add some code(check the highlightened portion) but it doesnt work(no values) can anyone help in correcting the code so that i can execute directly,
    Iam not full time ABAPer so could you please highlight the code you corrected(added),
    Thanks
    SP
    Global structure of list
    TYPE-POOLS: slis.
    TABLES: likp,
            lips,
            vbfa,
            kssk,
            klah,
            ausp,
            cabn,
            vbak,
            mara,
            vbrk,
            ser01,
            vbpa,
            vbrp,
            nast,
            zseri,
            ltap,
            pa0001,
            kna1,
            objk,
            viqmel,
            viqmma.
    TYPES:  BEGIN OF i_delivery,
                 vbeln LIKE likp-vbeln,
                 posnr  LIKE lips-posnr,
                 kunnr LIKE likp-kunnr,
                 kunag LIKE likp-kunag,
                 vkorg  LIKE vbak-vkorg,
                 matnr  LIKE lips-matnr,
                 lfart  LIKE likp-lfart,
                 arktx  LIKE vbap-arktx,
                 vgbel  LIKE lips-vgbel,
                 vgpos  LIKE lips-vgpos,
                 pstyv   LIKE lips-pstyv,
                 wadat TYPE likp-wadat_ist,
                 lfdat TYPE likp-lfdat,
                 prodh TYPE lips-prodh,
                 lfimg TYPE lips-lfimg,
                 vkbur TYPE lips-vkbur,
                 werks TYPE lips-werks,
                 vkgrp TYPE lips-vkgrp,
                 mvgr1 TYPE lips-mvgr1,
                 sernr LIKE equi-sernr,
                 sernp LIKE equi-sernr,
                 equnr LIKE equi-equnr,
                 kttxt LIKE qpct-kurztext,
                 fkimg LIKE vbrp-fkimg,
                 bstnk  LIKE vbak-bstnk,
                 vbelv  LIKE lips-vgbel,
                 posnv  LIKE lips-posnv,
                 uecha  LIKE lips-uecha,
                 ernam  LIKE vbak-ernam,
                 erdat LIKE vbak-erdat,
                 serail LIKE lips-serail,
                 anzsn LIKE lips-anzsn,
                 auart LIKE vbak-auart ,
                 netwr LIKE vbap-netwr,
                 fstno LIKE vbpa-pernr,
                 fstnm LIKE pa0001-ename,
                 ename LIKE pa0001-ename,
                 qname LIKE ltap-qname,
                 name1 LIKE kna1-name1,
                 name3 LIKE kna1-name2,
                 pernr LIKE vbpa-pernr,
                 aufnr LIKE viqmel-aufnr,
                 qmnum LIKE viqmel-qmnum,
                 mngrp LIKE viqmma-mngrp,
                 qmcod LIKE viqmel-qmcod,
                 qmcol LIKE viqmma-mncod,
                 cotxt(20),
                 invvalue LIKE vbrp-netwr,
                 posnn LIKE vbfa-posnn,
                 bstkd LIKE vbkd-bstkd,
             END OF i_delivery.
    Global structure of list
    */ Selection and Input Parameters
    SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME TITLE text-003.
    SELECT-OPTIONS: s_vkorg FOR likp-vkorg NO INTERVALS.
    SELECT-OPTIONS: s_vbeln  FOR likp-vbeln,
                    s_lfart  FOR likp-lfart,
                    s_kunnr  FOR likp-kunnr,
                    s_erdat  FOR likp-erdat,
                    s_wadat  FOR likp-wadat_ist,
                    s_werks  FOR lips-werks,
                    s_matnr  FOR lips-matnr,
                    s_prodh  FOR lips-prodh,
                    s_qmnum FOR viqmel-qmnum.
    SELECTION-SCREEN END OF BLOCK block2.
    SELECTION-SCREEN BEGIN OF BLOCK block4 WITH FRAME TITLE text-002.
    SELECT-OPTIONS:  s_vbelv FOR vbak-vbeln,
                     s_auart FOR vbak-auart.
    SELECTION-SCREEN END OF BLOCK block4.
    PARAMETERS: p_vari LIKE disvariant-variant.
    RANGES: r_vbeln FOR likp-vbeln.
    DATA:   gt_fieldcat TYPE slis_t_fieldcat_alv.
    DATA:   gt_outtab TYPE i_delivery OCCURS 0 WITH HEADER LINE,
            rt_outtab1 TYPE i_delivery OCCURS 0 WITH HEADER LINE,
            i_nast TYPE nast OCCURS 0 WITH HEADER LINE,
            gt_list_top_of_page TYPE slis_t_listheader,
            gt_events   TYPE slis_t_event,
            gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
    DATA:   g_repid LIKE sy-repid,
             g_count LIKE sy-tabix.
    DATA: BEGIN OF i_serial OCCURS 0,
            obknr TYPE ser01-obknr,
            lief_nr TYPE ser01-lief_nr,
            posnr TYPE ser01-posnr,
            anzsn TYPE ser01-anzsn,
          END OF i_serial.
    DATA: BEGIN OF i_object_numbers OCCURS 0,
            obknr TYPE objk-obknr,
            obzae TYPE objk-obzae,
            sernr TYPE objk-sernr,
            equnr TYPE objk-equnr,
            matnr TYPE objk-matnr,
            taser TYPE objk-taser,
          END OF i_object_numbers.
    DATA:   g_save(1) TYPE c,
           g_default(1) TYPE c,
            g_exit(1) TYPE c,
            gx_variant LIKE disvariant,
            g_variant LIKE disvariant.
    DATA:  g_mnkat LIKE viqmma-mnkat,
           g_mngrp LIKE viqmma-mngrp,
           g_atinn LIKE ausp-atinn.
    DATA: gt_vbkd TYPE TABLE OF vbkd WITH HEADER LINE.
    Initialization fieldcatalog
    INITIALIZATION.
      g_repid = sy-repid.
      PERFORM fieldcat_init USING gt_fieldcat[].
      MOVE: 'I' TO  s_vkorg-sign,
            'EQ' TO  s_vkorg-option,
            '5090' TO s_vkorg-low.
      APPEND  s_vkorg.
      MOVE: 'I' TO  s_lfart-sign,
           'EQ' TO s_lfart-option,
           'LF' TO s_lfart-low.
      APPEND  s_lfart.
      g_save = 'A'.
      PERFORM variant_init.
    Get default variant
      gx_variant = g_variant.
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
           EXPORTING
                i_save     = g_save
           CHANGING
                cs_variant = gx_variant
           EXCEPTIONS
                not_found  = 2.
      IF sy-subrc = 0.
        p_vari = gx_variant-variant.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
      PERFORM f4_for_variant.
    AT SELECTION-SCREEN.
      PERFORM pai_of_selection_screen.
    Start of Selection
    START-OF-SELECTION.
      PERFORM e03_eventtab_build USING gt_events[].
      PERFORM select_data TABLES gt_outtab.
    Display list
    END-OF-SELECTION.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_background_id         = 'ALV_BACKGROUND'
                i_callback_user_command = 'USER_COMMAND'
                is_variant              = g_variant
                i_save                  = g_save
                i_callback_program      = g_repid
                it_fieldcat             = gt_fieldcat[]
           TABLES
                t_outtab                = gt_outtab.
       Forms
    Initialization fieldcatalog
    FORM fieldcat_init
          USING rt_fieldcat TYPE slis_t_fieldcat_alv.
      DATA: ls_fieldcat TYPE slis_fieldcat_alv.
      DATA: pos TYPE i VALUE 1.
      CLEAR ls_fieldcat.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'VBELN'.
      ls_fieldcat-seltext_s     = 'Delivery'.
      ls_fieldcat-seltext_m     = 'Delivery'.
      ls_fieldcat-key           = 'X'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'BSTKD'.
      ls_fieldcat-seltext_s     = 'PO Number'.
      ls_fieldcat-seltext_m     = 'PO Number'.
      ls_fieldcat-key           = 'X'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'POSNR'.
      ls_fieldcat-key           = 'X'.
      ls_fieldcat-seltext_s     = 'Item'.
      ls_fieldcat-seltext_m     = 'Item'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'LFART'.
      ls_fieldcat-seltext_s     = 'Del Type'.
      ls_fieldcat-seltext_m     = 'Delivery Type'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'VGBEL'.
      ls_fieldcat-seltext_s     = 'Source Doc'.
      ls_fieldcat-seltext_m     = 'Source Doc'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'AUART'.
      ls_fieldcat-seltext_s     = 'Type'.
      ls_fieldcat-seltext_m     = 'Type'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'KUNNR'.
      ls_fieldcat-seltext_s     = 'Customer'.
      ls_fieldcat-seltext_m     = 'Customer'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'NAME1'.
      ls_fieldcat-seltext_s     = 'Name'.
      ls_fieldcat-seltext_m     = 'Name1'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'WERKS'.
      ls_fieldcat-seltext_s     = 'Plant'.
      ls_fieldcat-seltext_m     = 'Plant'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'MATNR'.
      ls_fieldcat-seltext_s     = 'Material'.
      ls_fieldcat-seltext_m     = 'Material'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'MVGR1'.
      ls_fieldcat-seltext_s     = 'Speciality'.
      ls_fieldcat-seltext_m     = 'Speciality'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'PRODH'.
      ls_fieldcat-seltext_s     = 'Hierarchy'.
      ls_fieldcat-seltext_m     = 'Prod Hierarchy'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'ARKTX'.
      ls_fieldcat-seltext_s     = 'Description'.
      ls_fieldcat-seltext_m     = 'Description'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'ERNAM'.
      ls_fieldcat-seltext_s     = 'Created By'.
      ls_fieldcat-seltext_m     = 'Created By'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'ERDAT'.
      ls_fieldcat-seltext_s     = 'Created On'.
      ls_fieldcat-seltext_m     = 'Created On'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'WADAT_IST'.
      ls_fieldcat-seltext_s     = 'GoodsMvt.Date'.
      ls_fieldcat-seltext_m     = 'Goods Mvt Date'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'SERNR'.
      ls_fieldcat-seltext_s     = 'Serial Shipped'.
      ls_fieldcat-seltext_m     = 'Serial Shipped'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'SERNP'.
      ls_fieldcat-seltext_s     = 'Old Serial'.
      ls_fieldcat-seltext_m     = 'Old Serial'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'VBELV'.
      ls_fieldcat-seltext_s     = 'Invoice'.
      ls_fieldcat-seltext_m     = 'Invoice'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'INVVALUE'.
      ls_fieldcat-seltext_s     = 'Invoice Amt'.
      ls_fieldcat-seltext_m     = 'Invoice Value'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'QMNUM'.
      ls_fieldcat-seltext_s     = 'Notification'.
      ls_fieldcat-seltext_m     = 'Notification'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'QMCOD'.
      ls_fieldcat-seltext_s     = 'Rep LevKST'.
      ls_fieldcat-seltext_m     = 'Repair Level KST'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'COTXT'.
      ls_fieldcat-seltext_s     = 'CdTXT KST'.
      ls_fieldcat-seltext_m     = 'Repair Level Text KST'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'QMCOL'.
      ls_fieldcat-seltext_s     = 'Rep LevKSE'.
      ls_fieldcat-seltext_m     = 'Repair Level KSE'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'KTTXT'.
      ls_fieldcat-seltext_s     = 'CdTXT KSE'.
      ls_fieldcat-seltext_m     = 'Repair Level Text KSE'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
    ENDFORM.   "fieldcat_init
    Data selection
    FORM select_data TABLES rt_outtab LIKE gt_outtab[].
      CLEAR: r_vbeln[].
    Read all Invoices for the Selection
      SELECT DISTINCT h~vbeln  h~kunnr h~kunag
                     d~posnr  d~matnr d~anzsn
                     d~serail d~vgbel d~vgpos
                     d~posnv  d~lfimg d~arktx
                     d~uecha  h~lfart h~erdat
                     h~ernam  h~lfdat d~prodh
                     h~vkorg  d~vkbur d~vkgrp
                     d~mvgr1  h~wadat_ist d~pstyv
                     d~werks
             INTO (rt_outtab-vbeln, rt_outtab-kunnr,
                    rt_outtab-kunag, rt_outtab-posnr,
                    rt_outtab-matnr, rt_outtab-anzsn,
                    rt_outtab-serail, rt_outtab-vgbel,
                    rt_outtab-vgpos,  rt_outtab-posnv,
                    rt_outtab-lfimg,  rt_outtab-arktx,
                    rt_outtab-uecha, rt_outtab-lfart,
                    rt_outtab-erdat, rt_outtab-ernam,
                    rt_outtab-lfdat, rt_outtab-prodh,
                    rt_outtab-vkorg, rt_outtab-vkbur,
                    rt_outtab-vkgrp, rt_outtab-mvgr1,
                    rt_outtab-wadat, rt_outtab-pstyv,
                    rt_outtab-werks)
            FROM likp AS h INNER JOIN lips AS d
                     ON h~vbeln = d~vbeln
                    WHERE h~vbeln IN s_vbeln
                    AND  h~vkorg IN s_vkorg
                    AND  h~lfart IN s_lfart
                     AND  h~kunnr IN s_kunnr
                     AND  h~wadat IN s_wadat
                     AND  d~matnr IN s_matnr
                     AND  d~werks IN s_werks
                     AND  d~prodh IN s_prodh
                     AND  d~vgbel IN s_vbelv
                     AND  d~matnr LIKE 'S%'.
        SELECT SINGLE * FROM vbak WHERE vbeln = rt_outtab-vgbel.
        IF: sy-subrc EQ 0.
          MOVE vbak-vbeln TO rt_outtab-vgbel.
          MOVE vbak-auart TO rt_outtab-auart.
        ENDIF.
        SELECT SINGLE * FROM mara WHERE matnr = rt_outtab-matnr
                                    AND  mtart EQ 'FERT'.
        CHECK sy-subrc EQ 0.
        IF NOT rt_outtab-posnv IS INITIAL.
          rt_outtab-vgpos = rt_outtab-posnv.
        ENDIF.
        CLEAR: vbfa.
        SELECT SINGLE vbeln posnn rfwrt INTO
        (rt_outtab-vbelv,  rt_outtab-posnn, rt_outtab-netwr)
        FROM vbfa  WHERE vbelv EQ rt_outtab-vbeln
                                  AND   posnv EQ rt_outtab-posnr
                                  AND   vbtyp_n EQ 'M'.
        CLEAR : rt_outtab-invvalue.
        SELECT SINGLE * FROM vbrp WHERE vbeln = rt_outtab-vbelv
          AND posnr = rt_outtab-posnn.
        rt_outtab-fkimg = vbrp-fkimg.
        IF rt_outtab-fkimg NE 0.
          rt_outtab-invvalue = rt_outtab-netwr / rt_outtab-fkimg.
        ENDIF.
        APPEND rt_outtab.
        IF NOT  r_vbeln-low IS INITIAL.
          IF r_vbeln-low GT rt_outtab-vbeln.
            r_vbeln-low =  rt_outtab-vbeln.
          ENDIF.
          IF r_vbeln-high LT rt_outtab-vbeln.
            r_vbeln-high =  rt_outtab-vbeln.
          ENDIF.
        ELSE.
          r_vbeln-low  =  rt_outtab-vbeln.
          r_vbeln-high =  rt_outtab-vbeln.
        ENDIF.
        CLEAR: rt_outtab.
      ENDSELECT.
    IF NOT rt_outtab[] IS INITIAL.
       SELECT vbeln posnr bstkd INTO CORRESPONDING FIELDS OF TABLE gt_vbkd
       FROM vbkd
         FOR ALL ENTRIES IN rt_outtab
         WHERE vbeln = rt_outtab-vgbel
         AND posnr = rt_outtab-vgpos.
       IF NOT gt_vbkd[] IS INITIAL.
         SORT gt_vbkd BY vbeln posnr.
         LOOP AT rt_outtab.
           READ TABLE gt_vbkd WITH KEY vbeln = rt_outtab-vgbel
           posnr = rt_outtab-vgpos
           BINARY SEARCH.
           IF sy-subrc = 0.
             rt_outtab-bstkd = gt_vbkd-bstkd.
             MODIFY rt_outtab.
           ENDIF.
         ENDLOOP.
       ENDIF.
    ENDIF.
    *select bstkd INTO CORRESPONDING FIELDS OF TABLE gt_vbkd
       from vbkd   where vbeln = gt_outtab-vbeln
                  and posnr = '000000'.
                 rt_outtab-bstkd = vbkd-bstkd .
       <i><b> select single bstkd into gt_vbkd
        from vbkd  where vbeln = rt_outtab-vbeln
                   and posnr = '000000'.
                   rt_outtab-bstkd = gt_vbkd-bstkd.
                  APPEND rt_outtab .</b></i>
      IF NOT r_vbeln IS INITIAL.
        MOVE: 'I' TO  r_vbeln-sign,
               'BT' TO  r_vbeln-option.
        APPEND r_vbeln.
        SELECT * INTO CORRESPONDING FIELDS OF TABLE i_serial
                                  FROM   ser01 WHERE lief_nr IN r_vbeln.
      ENDIF.
      SORT i_serial.
      IF NOT i_serial[] IS INITIAL.
        SELECT * INTO CORRESPONDING FIELDS OF TABLE i_object_numbers
                                   FROM   objk
                                   FOR ALL ENTRIES IN i_serial
                                   WHERE obknr EQ i_serial-obknr
                                   AND  taser EQ 'SER01'.
      ENDIF.
      SORT i_object_numbers BY  obknr obzae.
      LOOP AT rt_outtab.
        CLEAR: rt_outtab-name1, rt_outtab-sernr, rt_outtab-lfimg,
         rt_outtab-sernp, rt_outtab-kttxt.
    Read the Sold To Name
        SELECT SINGLE name1 INTO rt_outtab-name1
                          FROM kna1 WHERE kunnr EQ rt_outtab-kunnr.
    Read Ship-to Customer
        CLEAR: objk.
        IF NOT rt_outtab-serail IS INITIAL.
          READ TABLE i_serial WITH KEY lief_nr = rt_outtab-vbeln
                                        posnr = rt_outtab-posnr.
          IF sy-subrc EQ 0.
            DO i_serial-anzsn TIMES.
              CLEAR: rt_outtab-sernr, rt_outtab-sernp.
              READ TABLE i_object_numbers  WITH KEY obknr = i_serial-obknr
                                                    matnr = rt_outtab-matnr
                                                BINARY SEARCH.
              IF sy-subrc EQ 0.
                rt_outtab-sernr = i_object_numbers-sernr.
                DELETE i_object_numbers INDEX sy-tabix.
                MOVE '1'   TO rt_outtab-lfimg.
                CLEAR: rt_outtab-aufnr, rt_outtab-qmnum,
                         rt_outtab-equnr, rt_outtab-qmcod, g_mngrp, g_mnkat.
                SELECT SINGLE aufnr qmnum equnr qmcod qmgrp qmkat
                                     INTO (rt_outtab-aufnr, rt_outtab-qmnum,
                        rt_outtab-equnr, rt_outtab-qmcod, g_mngrp, g_mnkat)
                                 FROM viqmel  WHERE matnr = rt_outtab-matnr
                                        AND serialnr = rt_outtab-sernr
                                        AND qmart  EQ 'S4'
                                        AND qmnum IN s_qmnum.
                CLEAR: rt_outtab-cotxt.
                SELECT SINGLE kurztext INTO rt_outtab-cotxt
                                      FROM qpct WHERE katalogart EQ g_mnkat
                                         AND codegruppe EQ  g_mngrp
                                         AND code EQ rt_outtab-qmcod
                                         AND sprache EQ sy-langu.
    Read Serial Number from Name Plate Data.
                CLEAR: klah, kssk, ausp, cabn, g_atinn.
                SELECT SINGLE atinn INTO (g_atinn) FROM cabn
                                    WHERE atnam = 'SBANK_SERIAL_NUMBER'.
                SELECT SINGLE  atwrt
                      INTO  (rt_outtab-sernp)
                      FROM  ( klah AS a INNER JOIN kssk AS k
                               ON aclint = kclint )
                          JOIN ausp AS p
                                ON kobjek = pobjek
                                AND p~atinn = g_atinn
                                AND pklart = aklart
                      WHERE a~klart = '002'
                       AND  a~class = 'KSE_SN_ENDOSCOPES'
                        AND  k~objek = rt_outtab-equnr.
    *KSE Repair level (activity code text from KSE-SM07 code group)
                CLEAR: rt_outtab-qmcol, g_mngrp, g_mnkat.
                CLEAR: rt_outtab-qmcol.
                CLEAR:   g_mnkat, g_mngrp.
                SELECT SINGLE mnkat mngrp mncod INTO
                                    (g_mnkat, g_mngrp, rt_outtab-qmcol)
                              FROM viqmma WHERE qmnum = rt_outtab-qmnum
                                    AND  mngrp EQ 'KSE-SM07'
                                    AND kzloesch EQ space.
                CLEAR: rt_outtab-kttxt.
                SELECT SINGLE kurztext INTO rt_outtab-kttxt
                             FROM qpct WHERE katalogart EQ g_mnkat
                                    AND codegruppe EQ  g_mngrp
                                    AND code EQ rt_outtab-qmcol
                                    AND sprache EQ sy-langu.
                rt_outtab1 = rt_outtab.
                APPEND rt_outtab1.
              ENDIF.
            ENDDO.
          ENDIF.
        ENDIF.
      ENDLOOP.
      CLEAR: rt_outtab[].
      rt_outtab[] = rt_outtab1[].
      SORT rt_outtab BY vbeln posnr.
    ENDFORM.
          FORM get_repname                                              *
    -->  P_VBELN                                                       *
    -->  P_POSNR                                                       *
    -->  P_PERNR                                                       *
    -->  P_ENAME                                                       *
    FORM get_repname USING  p_vbeln
                              p_posnr
                     CHANGING  p_pernr
                              p_ename. "
      DATA: i_vbpa LIKE vbpa OCCURS 0 WITH HEADER LINE.
      CLEAR: i_vbpa[].
      CALL FUNCTION 'Z_DETERMINE_ACTIVE_SALES_REP'
           EXPORTING
                g_salesdocument = p_vbeln
                g_sales_item    = p_posnr
           TABLES
                st_vbpa         = i_vbpa.
      READ TABLE i_vbpa INDEX 1.
      IF sy-subrc = 0.
        p_pernr = i_vbpa-pernr.
        SELECT SINGLE ename INTO p_ename
          FROM pa0001
         WHERE pernr = i_vbpa-pernr.
      ENDIF.
    ENDFORM.                    " get_repname
          FORM E03_EVENTTAB_BUILD                                       *
    -->  E03_LT_EVENTS                                                 *
    FORM e03_eventtab_build USING e03_lt_events TYPE slis_t_event.
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                i_list_type = 0
           IMPORTING
                et_events   = e03_lt_events.
      READ TABLE e03_lt_events WITH KEY name =  slis_ev_top_of_page
                               INTO ls_event.
      IF sy-subrc = 0.
        MOVE gc_formname_top_of_page TO ls_event-form.
        APPEND ls_event TO e03_lt_events.
      ENDIF.
    ENDFORM.
          FORM TOP_OF_PAGE                                              *
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                it_list_commentary = gt_list_top_of_page.
    ENDFORM.
    *&      Form  USER_COMMAND
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
      CASE r_ucomm.
        WHEN '&IC1'.
          PERFORM display_delivery USING r_ucomm
                                        rs_selfield.
      ENDCASE.
    ENDFORM.
    *&      Form  display_delivery
    FORM display_delivery
    USING r_ucomm LIKE sy-ucomm
                                 rs_selfield TYPE slis_selfield.
      CASE rs_selfield-sel_tab_field.
        WHEN '1-VBELN'.
          SET PARAMETER ID 'VL' FIELD rs_selfield-value.
          CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
        WHEN '1-VBELV'.
          SET PARAMETER ID 'VF' FIELD rs_selfield-value.
          CALL TRANSACTION 'VF03N' AND SKIP FIRST SCREEN.
      ENDCASE.
    ENDFORM.
    *&      Form  VARIANT_INIT
          text
    -->  p1        text
    <--  p2        text
    FORM variant_init.
      CLEAR g_variant.
      g_variant-report = g_repid.
    ENDFORM.                               " VARIANT_INIT
    *&      Form  F4_FOR_VARIANT
          text
    -->  p1        text
    <--  p2        text
    FORM f4_for_variant.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
           EXPORTING
                is_variant          = g_variant
                i_save              = g_save
              it_default_fieldcat =
           IMPORTING
                e_exit              = g_exit
                es_variant          = gx_variant
           EXCEPTIONS
                not_found = 2.
      IF sy-subrc = 2.
        MESSAGE ID sy-msgid TYPE 'S'      NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSE.
        IF g_exit = space.
          p_vari = gx_variant-variant.
        ENDIF.
      ENDIF.
    ENDFORM.
    *&      Form  PAI_OF_SELECTION_SCREEN
          text
    FORM pai_of_selection_screen.
      IF NOT p_vari IS INITIAL.
        MOVE g_variant TO gx_variant.
        MOVE p_vari TO gx_variant-variant.
        CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
             EXPORTING
                  i_save     = g_save
             CHANGING
                  cs_variant = gx_variant.
        g_variant = gx_variant.
      ELSE.
        PERFORM variant_init.
      ENDIF.
    ENDFORM.

    naren this is the program
    Global structure of list
    TYPE-POOLS: slis.
    TABLES: likp,
            lips,
            vbfa,
            kssk,
            klah,
            ausp,
            cabn,
            vbak,
            mara,
            vbrk,
            ser01,
            vbpa,
            vbrp,
            nast,
            zseri,
            ltap,
            pa0001,
            kna1,
            objk,
            viqmel,
            viqmma.
    TYPES:  BEGIN OF i_delivery,
                 vbeln LIKE likp-vbeln,
                 posnr  LIKE lips-posnr,
                 kunnr LIKE likp-kunnr,
                 kunag LIKE likp-kunag,
                 vkorg  LIKE vbak-vkorg,
                 matnr  LIKE lips-matnr,
                 lfart  LIKE likp-lfart,
                 arktx  LIKE vbap-arktx,
                 vgbel  LIKE lips-vgbel,
                 vgpos  LIKE lips-vgpos,
                 pstyv   LIKE lips-pstyv,
                 wadat TYPE likp-wadat_ist,
                 lfdat TYPE likp-lfdat,
                 prodh TYPE lips-prodh,
                 lfimg TYPE lips-lfimg,
                 vkbur TYPE lips-vkbur,
                 werks TYPE lips-werks,
                 vkgrp TYPE lips-vkgrp,
                 mvgr1 TYPE lips-mvgr1,
                 sernr LIKE equi-sernr,
                 sernp LIKE equi-sernr,
                 equnr LIKE equi-equnr,
                 kttxt LIKE qpct-kurztext,
                 fkimg LIKE vbrp-fkimg,
                 bstnk  LIKE vbak-bstnk,
                 vbelv  LIKE lips-vgbel,
                 posnv  LIKE lips-posnv,
                 uecha  LIKE lips-uecha,
                 ernam  LIKE vbak-ernam,
                 erdat LIKE vbak-erdat,
                 serail LIKE lips-serail,
                 anzsn LIKE lips-anzsn,
                 auart LIKE vbak-auart ,
                 netwr LIKE vbap-netwr,
                 fstno LIKE vbpa-pernr,
                 fstnm LIKE pa0001-ename,
                 ename LIKE pa0001-ename,
                 qname LIKE ltap-qname,
                 name1 LIKE kna1-name1,
                 name3 LIKE kna1-name2,
                 pernr LIKE vbpa-pernr,
                 aufnr LIKE viqmel-aufnr,
                 qmnum LIKE viqmel-qmnum,
                 mngrp LIKE viqmma-mngrp,
                 qmcod LIKE viqmel-qmcod,
                 qmcol LIKE viqmma-mncod,
                 cotxt(20),
                 invvalue LIKE vbrp-netwr,
                 posnn LIKE vbfa-posnn,
                 bstkd LIKE vbkd-bstkd,
             END OF i_delivery.
    Global structure of list
    */ Selection and Input Parameters
    SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME TITLE text-003.
    SELECT-OPTIONS: s_vkorg FOR likp-vkorg NO INTERVALS.
    SELECT-OPTIONS: s_vbeln  FOR likp-vbeln,
                    s_lfart  FOR likp-lfart,
                    s_kunnr  FOR likp-kunnr,
                    s_erdat  FOR likp-erdat,
                    s_wadat  FOR likp-wadat_ist,
                    s_werks  FOR lips-werks,
                    s_matnr  FOR lips-matnr,
                    s_prodh  FOR lips-prodh,
                    s_qmnum FOR viqmel-qmnum.
    SELECTION-SCREEN END OF BLOCK block2.
    SELECTION-SCREEN BEGIN OF BLOCK block4 WITH FRAME TITLE text-002.
    SELECT-OPTIONS:  s_vbelv FOR vbak-vbeln,
                     s_auart FOR vbak-auart.
    SELECTION-SCREEN END OF BLOCK block4.
    PARAMETERS: p_vari LIKE disvariant-variant.
    RANGES: r_vbeln FOR likp-vbeln.
    DATA:   gt_fieldcat TYPE slis_t_fieldcat_alv.
    DATA:   gt_outtab TYPE i_delivery OCCURS 0 WITH HEADER LINE,
            rt_outtab1 TYPE i_delivery OCCURS 0 WITH HEADER LINE,
            i_nast TYPE nast OCCURS 0 WITH HEADER LINE,
            gt_list_top_of_page TYPE slis_t_listheader,
            gt_events   TYPE slis_t_event,
            gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
    DATA:   g_repid LIKE sy-repid,
             g_count LIKE sy-tabix.
    DATA: BEGIN OF i_serial OCCURS 0,
            obknr TYPE ser01-obknr,
            lief_nr TYPE ser01-lief_nr,
            posnr TYPE ser01-posnr,
            anzsn TYPE ser01-anzsn,
          END OF i_serial.
    DATA: BEGIN OF i_object_numbers OCCURS 0,
            obknr TYPE objk-obknr,
            obzae TYPE objk-obzae,
            sernr TYPE objk-sernr,
            equnr TYPE objk-equnr,
            matnr TYPE objk-matnr,
            taser TYPE objk-taser,
          END OF i_object_numbers.
    DATA:   g_save(1) TYPE c,
           g_default(1) TYPE c,
            g_exit(1) TYPE c,
            gx_variant LIKE disvariant,
            g_variant LIKE disvariant.
    DATA:  g_mnkat LIKE viqmma-mnkat,
           g_mngrp LIKE viqmma-mngrp,
           g_atinn LIKE ausp-atinn.
    DATA: gt_vbkd TYPE TABLE OF vbkd WITH HEADER LINE.
    Initialization fieldcatalog
    INITIALIZATION.
      g_repid = sy-repid.
      PERFORM fieldcat_init USING gt_fieldcat[].
      MOVE: 'I' TO  s_vkorg-sign,
            'EQ' TO  s_vkorg-option,
            '5090' TO s_vkorg-low.
      APPEND  s_vkorg.
      MOVE: 'I' TO  s_lfart-sign,
           'EQ' TO s_lfart-option,
           'LF' TO s_lfart-low.
      APPEND  s_lfart.
      g_save = 'A'.
      PERFORM variant_init.
    Get default variant
      gx_variant = g_variant.
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
           EXPORTING
                i_save     = g_save
           CHANGING
                cs_variant = gx_variant
           EXCEPTIONS
                not_found  = 2.
      IF sy-subrc = 0.
        p_vari = gx_variant-variant.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
      PERFORM f4_for_variant.
    AT SELECTION-SCREEN.
      PERFORM pai_of_selection_screen.
    Start of Selection
    START-OF-SELECTION.
      PERFORM e03_eventtab_build USING gt_events[].
      PERFORM select_data TABLES gt_outtab.
    Display list
    END-OF-SELECTION.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_background_id         = 'ALV_BACKGROUND'
                i_callback_user_command = 'USER_COMMAND'
                is_variant              = g_variant
                i_save                  = g_save
                i_callback_program      = g_repid
                it_fieldcat             = gt_fieldcat[]
           TABLES
                t_outtab                = gt_outtab.
       Forms
    Initialization fieldcatalog
    FORM fieldcat_init
          USING rt_fieldcat TYPE slis_t_fieldcat_alv.
      DATA: ls_fieldcat TYPE slis_fieldcat_alv.
      DATA: pos TYPE i VALUE 1.
      CLEAR ls_fieldcat.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'VBELN'.
      ls_fieldcat-seltext_s     = 'Delivery'.
      ls_fieldcat-seltext_m     = 'Delivery'.
      ls_fieldcat-key           = 'X'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'BSTKD'.
      ls_fieldcat-seltext_s     = 'PO Number'.
      ls_fieldcat-seltext_m     = 'PO Number'.
      ls_fieldcat-key           = 'X'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'POSNR'.
      ls_fieldcat-key           = 'X'.
      ls_fieldcat-seltext_s     = 'Item'.
      ls_fieldcat-seltext_m     = 'Item'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'LFART'.
      ls_fieldcat-seltext_s     = 'Del Type'.
      ls_fieldcat-seltext_m     = 'Delivery Type'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'VGBEL'.
      ls_fieldcat-seltext_s     = 'Source Doc'.
      ls_fieldcat-seltext_m     = 'Source Doc'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'AUART'.
      ls_fieldcat-seltext_s     = 'Type'.
      ls_fieldcat-seltext_m     = 'Type'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'KUNNR'.
      ls_fieldcat-seltext_s     = 'Customer'.
      ls_fieldcat-seltext_m     = 'Customer'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'NAME1'.
      ls_fieldcat-seltext_s     = 'Name'.
      ls_fieldcat-seltext_m     = 'Name1'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'WERKS'.
      ls_fieldcat-seltext_s     = 'Plant'.
      ls_fieldcat-seltext_m     = 'Plant'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'MATNR'.
      ls_fieldcat-seltext_s     = 'Material'.
      ls_fieldcat-seltext_m     = 'Material'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'MVGR1'.
      ls_fieldcat-seltext_s     = 'Speciality'.
      ls_fieldcat-seltext_m     = 'Speciality'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'PRODH'.
      ls_fieldcat-seltext_s     = 'Hierarchy'.
      ls_fieldcat-seltext_m     = 'Prod Hierarchy'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'ARKTX'.
      ls_fieldcat-seltext_s     = 'Description'.
      ls_fieldcat-seltext_m     = 'Description'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'ERNAM'.
      ls_fieldcat-seltext_s     = 'Created By'.
      ls_fieldcat-seltext_m     = 'Created By'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'ERDAT'.
      ls_fieldcat-seltext_s     = 'Created On'.
      ls_fieldcat-seltext_m     = 'Created On'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'WADAT_IST'.
      ls_fieldcat-seltext_s     = 'GoodsMvt.Date'.
      ls_fieldcat-seltext_m     = 'Goods Mvt Date'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'SERNR'.
      ls_fieldcat-seltext_s     = 'Serial Shipped'.
      ls_fieldcat-seltext_m     = 'Serial Shipped'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'SERNP'.
      ls_fieldcat-seltext_s     = 'Old Serial'.
      ls_fieldcat-seltext_m     = 'Old Serial'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'VBELV'.
      ls_fieldcat-seltext_s     = 'Invoice'.
      ls_fieldcat-seltext_m     = 'Invoice'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'INVVALUE'.
      ls_fieldcat-seltext_s     = 'Invoice Amt'.
      ls_fieldcat-seltext_m     = 'Invoice Value'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'QMNUM'.
      ls_fieldcat-seltext_s     = 'Notification'.
      ls_fieldcat-seltext_m     = 'Notification'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'QMCOD'.
      ls_fieldcat-seltext_s     = 'Rep LevKST'.
      ls_fieldcat-seltext_m     = 'Repair Level KST'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'COTXT'.
      ls_fieldcat-seltext_s     = 'CdTXT KST'.
      ls_fieldcat-seltext_m     = 'Repair Level Text KST'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'QMCOL'.
      ls_fieldcat-seltext_s     = 'Rep LevKSE'.
      ls_fieldcat-seltext_m     = 'Repair Level KSE'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'KTTXT'.
      ls_fieldcat-seltext_s     = 'CdTXT KSE'.
      ls_fieldcat-seltext_m     = 'Repair Level Text KSE'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
    ENDFORM.   "fieldcat_init
    Data selection
    FORM select_data TABLES rt_outtab LIKE gt_outtab[].
      CLEAR: r_vbeln[].
    Read all Invoices for the Selection
      SELECT DISTINCT h~vbeln  h~kunnr h~kunag
                     d~posnr  d~matnr d~anzsn
                     d~serail d~vgbel d~vgpos
                     d~posnv  d~lfimg d~arktx
                     d~uecha  h~lfart h~erdat
                     h~ernam  h~lfdat d~prodh
                     h~vkorg  d~vkbur d~vkgrp
                     d~mvgr1  h~wadat_ist d~pstyv
                     d~werks
             INTO (rt_outtab-vbeln, rt_outtab-kunnr,
                    rt_outtab-kunag, rt_outtab-posnr,
                    rt_outtab-matnr, rt_outtab-anzsn,
                    rt_outtab-serail, rt_outtab-vgbel,
                    rt_outtab-vgpos,  rt_outtab-posnv,
                    rt_outtab-lfimg,  rt_outtab-arktx,
                    rt_outtab-uecha, rt_outtab-lfart,
                    rt_outtab-erdat, rt_outtab-ernam,
                    rt_outtab-lfdat, rt_outtab-prodh,
                    rt_outtab-vkorg, rt_outtab-vkbur,
                    rt_outtab-vkgrp, rt_outtab-mvgr1,
                    rt_outtab-wadat, rt_outtab-pstyv,
                    rt_outtab-werks)
            FROM likp AS h INNER JOIN lips AS d
                     ON h~vbeln = d~vbeln
                    WHERE h~vbeln IN s_vbeln
                    AND  h~vkorg IN s_vkorg
                    AND  h~lfart IN s_lfart
                     AND  h~kunnr IN s_kunnr
                     AND  h~wadat IN s_wadat
                     AND  d~matnr IN s_matnr
                     AND  d~werks IN s_werks
                     AND  d~prodh IN s_prodh
                     AND  d~vgbel IN s_vbelv
                     AND  d~matnr LIKE 'S%'.
        SELECT SINGLE * FROM vbak WHERE vbeln = rt_outtab-vgbel.
        IF: sy-subrc EQ 0.
          MOVE vbak-vbeln TO rt_outtab-vgbel.
          MOVE vbak-auart TO rt_outtab-auart.
        ENDIF.
        SELECT SINGLE * FROM mara WHERE matnr = rt_outtab-matnr
                                    AND  mtart EQ 'FERT'.
        CHECK sy-subrc EQ 0.
        IF NOT rt_outtab-posnv IS INITIAL.
          rt_outtab-vgpos = rt_outtab-posnv.
        ENDIF.
        CLEAR: vbfa.
        SELECT SINGLE vbeln posnn rfwrt INTO
        (rt_outtab-vbelv,  rt_outtab-posnn, rt_outtab-netwr)
        FROM vbfa  WHERE vbelv EQ rt_outtab-vbeln
                                  AND   posnv EQ rt_outtab-posnr
                                  AND   vbtyp_n EQ 'M'.
        CLEAR : rt_outtab-invvalue.
        SELECT SINGLE * FROM vbrp WHERE vbeln = rt_outtab-vbelv
          AND posnr = rt_outtab-posnn.
        rt_outtab-fkimg = vbrp-fkimg.
        IF rt_outtab-fkimg NE 0.
          rt_outtab-invvalue = rt_outtab-netwr / rt_outtab-fkimg.
        ENDIF.
        APPEND rt_outtab.
        IF NOT  r_vbeln-low IS INITIAL.
          IF r_vbeln-low GT rt_outtab-vbeln.
            r_vbeln-low =  rt_outtab-vbeln.
          ENDIF.
          IF r_vbeln-high LT rt_outtab-vbeln.
            r_vbeln-high =  rt_outtab-vbeln.
          ENDIF.
        ELSE.
          r_vbeln-low  =  rt_outtab-vbeln.
          r_vbeln-high =  rt_outtab-vbeln.
        ENDIF.
        CLEAR: rt_outtab.
      ENDSELECT.
    IF NOT rt_outtab[] IS INITIAL.
       SELECT vbeln posnr bstkd INTO CORRESPONDING FIELDS OF TABLE gt_vbkd
       FROM vbkd
         FOR ALL ENTRIES IN rt_outtab
         WHERE vbeln = rt_outtab-vgbel
         AND posnr = rt_outtab-vgpos.
       IF NOT gt_vbkd[] IS INITIAL.
         SORT gt_vbkd BY vbeln posnr.
         LOOP AT rt_outtab.
           READ TABLE gt_vbkd WITH KEY vbeln = rt_outtab-vgbel
           posnr = rt_outtab-vgpos
           BINARY SEARCH.
           IF sy-subrc = 0.
             rt_outtab-bstkd = gt_vbkd-bstkd.
             MODIFY rt_outtab.
           ENDIF.
         ENDLOOP.
       ENDIF.
    ENDIF.
    *select bstkd INTO CORRESPONDING FIELDS OF TABLE gt_vbkd
       from vbkd   where vbeln = gt_outtab-vbeln
                  and posnr = '000000'.
                 rt_outtab-bstkd = vbkd-bstkd .
      SELECT single bstkd INTO CORRESPONDING FIELDS OF gt_vbkd
      FROM vbkd WHERE vbeln = gt_vbkd-vbeln
      AND posnr = '000000'.
      rt_outtab-bstkd = gt_vbkd-bstkd.
      APPEND rt_outtab.
      IF NOT r_vbeln IS INITIAL.
        MOVE: 'I' TO  r_vbeln-sign,
               'BT' TO  r_vbeln-option.
        APPEND r_vbeln.
        SELECT * INTO CORRESPONDING FIELDS OF TABLE i_serial
                                  FROM   ser01 WHERE lief_nr IN r_vbeln.
      ENDIF.
      SORT i_serial.
      IF NOT i_serial[] IS INITIAL.
        SELECT * INTO CORRESPONDING FIELDS OF TABLE i_object_numbers
                                   FROM   objk
                                   FOR ALL ENTRIES IN i_serial
                                   WHERE obknr EQ i_serial-obknr
                                   AND  taser EQ 'SER01'.
      ENDIF.
      SORT i_object_numbers BY  obknr obzae.
      LOOP AT rt_outtab.
        CLEAR: rt_outtab-name1, rt_outtab-sernr, rt_outtab-lfimg,
         rt_outtab-sernp, rt_outtab-kttxt.
    Read the Sold To Name
        SELECT SINGLE name1 INTO rt_outtab-name1
                          FROM kna1 WHERE kunnr EQ rt_outtab-kunnr.
    Read Ship-to Customer
        CLEAR: objk.
        IF NOT rt_outtab-serail IS INITIAL.
          READ TABLE i_serial WITH KEY lief_nr = rt_outtab-vbeln
                                        posnr = rt_outtab-posnr.
          IF sy-subrc EQ 0.
            DO i_serial-anzsn TIMES.
              CLEAR: rt_outtab-sernr, rt_outtab-sernp.
              READ TABLE i_object_numbers  WITH KEY obknr = i_serial-obknr
                                                    matnr = rt_outtab-matnr
                                                BINARY SEARCH.
              IF sy-subrc EQ 0.
                rt_outtab-sernr = i_object_numbers-sernr.
                DELETE i_object_numbers INDEX sy-tabix.
                MOVE '1'   TO rt_outtab-lfimg.
                CLEAR: rt_outtab-aufnr, rt_outtab-qmnum,
                         rt_outtab-equnr, rt_outtab-qmcod, g_mngrp, g_mnkat.
                SELECT SINGLE aufnr qmnum equnr qmcod qmgrp qmkat
                                     INTO (rt_outtab-aufnr, rt_outtab-qmnum,
                        rt_outtab-equnr, rt_outtab-qmcod, g_mngrp, g_mnkat)
                                 FROM viqmel  WHERE matnr = rt_outtab-matnr
                                        AND serialnr = rt_outtab-sernr
                                        AND qmart  EQ 'S4'
                                        AND qmnum IN s_qmnum.
                CLEAR: rt_outtab-cotxt.
                SELECT SINGLE kurztext INTO rt_outtab-cotxt
                                      FROM qpct WHERE katalogart EQ g_mnkat
                                         AND codegruppe EQ  g_mngrp
                                         AND code EQ rt_outtab-qmcod
                                         AND sprache EQ sy-langu.
    Read Serial Number from Name Plate Data.
                CLEAR: klah, kssk, ausp, cabn, g_atinn.
                SELECT SINGLE atinn INTO (g_atinn) FROM cabn
                                    WHERE atnam = 'SBANK_SERIAL_NUMBER'.
                SELECT SINGLE  atwrt
                      INTO  (rt_outtab-sernp)
                      FROM  ( klah AS a INNER JOIN kssk AS k
                               ON aclint = kclint )
                          JOIN ausp AS p
                                ON kobjek = pobjek
                                AND p~atinn = g_atinn
                                AND pklart = aklart
                      WHERE a~klart = '002'
                       AND  a~class = 'KSE_SN_ENDOSCOPES'
                        AND  k~objek = rt_outtab-equnr.
    *KSE Repair level (activity code text from KSE-SM07 code group)
                CLEAR: rt_outtab-qmcol, g_mngrp, g_mnkat.
                CLEAR: rt_outtab-qmcol.
                CLEAR:   g_mnkat, g_mngrp.
                SELECT SINGLE mnkat mngrp mncod INTO
                                    (g_mnkat, g_mngrp, rt_outtab-qmcol)
                              FROM viqmma WHERE qmnum = rt_outtab-qmnum
                                    AND  mngrp EQ 'KSE-SM07'
                                    AND kzloesch EQ space.
                CLEAR: rt_outtab-kttxt.
                SELECT SINGLE kurztext INTO rt_outtab-kttxt
                             FROM qpct WHERE katalogart EQ g_mnkat
                                    AND codegruppe EQ  g_mngrp
                                    AND code EQ rt_outtab-qmcol
                                    AND sprache EQ sy-langu.
                rt_outtab1 = rt_outtab.
                APPEND rt_outtab1.
              ENDIF.
            ENDDO.
          ENDIF.
        ENDIF.
      ENDLOOP.
      CLEAR: rt_outtab[].
      rt_outtab[] = rt_outtab1[].
      SORT rt_outtab BY vbeln posnr.
    ENDFORM.
          FORM get_repname                                              *
    -->  P_VBELN                                                       *
    -->  P_POSNR                                                       *
    -->  P_PERNR                                                       *
    -->  P_ENAME                                                       *
    FORM get_repname USING  p_vbeln
                              p_posnr
                     CHANGING  p_pernr
                              p_ename. "
      DATA: i_vbpa LIKE vbpa OCCURS 0 WITH HEADER LINE.
      CLEAR: i_vbpa[].
      CALL FUNCTION 'Z_DETERMINE_ACTIVE_SALES_REP'
           EXPORTING
                g_salesdocument = p_vbeln
                g_sales_item    = p_posnr
           TABLES
                st_vbpa         = i_vbpa.
      READ TABLE i_vbpa INDEX 1.
      IF sy-subrc = 0.
        p_pernr = i_vbpa-pernr.
        SELECT SINGLE ename INTO p_ename
          FROM pa0001
         WHERE pernr = i_vbpa-pernr.
      ENDIF.
    ENDFORM.                    " get_repname
          FORM E03_EVENTTAB_BUILD                                       *
    -->  E03_LT_EVENTS                                                 *
    FORM e03_eventtab_build USING e03_lt_events TYPE slis_t_event.
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                i_list_type = 0
           IMPORTING
                et_events   = e03_lt_events.
      READ TABLE e03_lt_events WITH KEY name =  slis_ev_top_of_page
                               INTO ls_event.
      IF sy-subrc = 0.
        MOVE gc_formname_top_of_page TO ls_event-form.
        APPEND ls_event TO e03_lt_events.
      ENDIF.
    ENDFORM.
          FORM TOP_OF_PAGE                                              *
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                it_list_commentary = gt_list_top_of_page.
    ENDFORM.
    *&      Form  USER_COMMAND
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
      CASE r_ucomm.
        WHEN '&IC1'.
          PERFORM display_delivery USING r_ucomm
                                        rs_selfield.
      ENDCASE.
    ENDFORM.
    *&      Form  display_delivery
    FORM display_delivery
    USING r_ucomm LIKE sy-ucomm
                                 rs_selfield TYPE slis_selfield.
      CASE rs_selfield-sel_tab_field.
        WHEN '1-VBELN'.
          SET PARAMETER ID 'VL' FIELD rs_selfield-value.
          CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
        WHEN '1-VBELV'.
          SET PARAMETER ID 'VF' FIELD rs_selfield-value.
          CALL TRANSACTION 'VF03N' AND SKIP FIRST SCREEN.
      ENDCASE.
    ENDFORM.
    *&      Form  VARIANT_INIT
          text
    -->  p1        text
    <--  p2        text
    FORM variant_init.
      CLEAR g_variant.
      g_variant-report = g_repid.
    ENDFORM.                               " VARIANT_INIT
    *&      Form  F4_FOR_VARIANT
          text
    -->  p1        text
    <--  p2        text
    FORM f4_for_variant.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
           EXPORTING
                is_variant          = g_variant
                i_save              = g_save
              it_default_fieldcat =
           IMPORTING
                e_exit              = g_exit
                es_variant          = gx_variant
           EXCEPTIONS
                not_found = 2.
      IF sy-subrc = 2.
        MESSAGE ID sy-msgid TYPE 'S'      NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSE.
        IF g_exit = space.
          p_vari = gx_variant-variant.
        ENDIF.
      ENDIF.
    ENDFORM.
    *&      Form  PAI_OF_SELECTION_SCREEN
          text
    FORM pai_of_selection_screen.
      IF NOT p_vari IS INITIAL.
        MOVE g_variant TO gx_variant.
        MOVE p_vari TO gx_variant-variant.
        CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
             EXPORTING
                  i_save     = g_save
             CHANGING
                  cs_variant = gx_variant.
        g_variant = gx_variant.
      ELSE.
        PERFORM variant_init.
      ENDIF.
    ENDFORM.

  • 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.

  • Unable to generate the output for S_ALR_87012048

    Dear All,
    We are trying to execute the report  S_ALR_87012048 for the first period in 2015.  We have tried execute this report with report date 25.01.2015 (which is the last day in period 01), but it is giving no data was selected.
    Can anybody suggest whether I need to give any further inputs to generate the output apart from the below.
    Co.code : 9000
    Reporting date : 25.01.2015 (which is the last day in our fiscal period 01 /2015)
    Dep area : 01
    Sort Variant : 03 (co.code / bs  accounts / asset class)
    User able to execute this report in the last month successfully.
    We have completed all year ending process as well.
    I have tried execute this report in our quality system with reporting date as 31.12.2014 and 31.12.2015.
    Do we need to give reporting date as year ending date ? or last date of current period.
    Thanks in Advance.
    Prasad

    Hi Prasad,
    I do believe that you should consider the authorization side of the matter carefully as pointed out by Mahmoud on Feb 6th. Please check again the mentioned SAP Notes in that thread.
    For example, I just tested in my system, I can trigger a report even in a closed fiscal year with a report date end of each period. The only difference is that I get a information message:
    Report date is in a closed fiscal year
    Message no. AU172
    Diagnosis
    The report date is in the past.
    Here the report date is allowed to be the end of the year as well as any
    period end during the fiscal year.
    System Response
    In an asset report during the fiscal year (report date for a period end
    within the year) in a closed fiscal year, it can be the case that the results
    for depreciation or the net book value are different between the historical
    calculation and the current calculation for the report date. The reason for this
    are any changes to asset-related depreciation terms, such as the depreciation
    key, useful life, and so on. In the case of such changes, the asset values are
    recalculated with the currently entered depreciation terms.
    In an open fiscal year and a report date end of period I do not get AU172 and get an output.
    Beside above provided SAP Notes, also see another couple of SAP Notes with some interesting information are also:
    1566099  Reporting in Asset Accounting
    1491612  Authorization concept in FI-AA
    1394450  Reporting: Authorization check for report assignment
    929732    Authorization checks: Correction Note 856248
    856248   Authorization checks in asset reporting
    Regards,
    Brigitte

  • Is it possible to display a tag at the selection screen in the output.

    Hi all,
       When you go to se38 and in the program editor screen, at the bottom right end of the screen you find a value called NUM and when you place your cursor on that it displays a tag that says "Num Lock Mode. Double click to toggle."
       My query is, when i execute a report it takes me to the output screen that has a parameter, here i want to display a tag, say "enter the record as it is in the database". Is it possible to have such an option.
       If you'll are wondering why I'm looking for such an option it is just to make a report that can be understood by many.
    P.S: Not only on the NUM field the tag is available. Even on tools like activate display and so on.
    Regards,
    Narayanan Chandran.

    If it's a report program, use a comment in the selcetion screen for information of the user as shown below.
    * Information
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-003.
    SELECTION-SCREEN COMMENT /1(60) text-004. "Text containing the information message
    SELECTION-SCREEN END OF BLOCK b1.
    If you are using a module pool, you can create a tooltip for the element as suggested.

  • Scheduling a Report from outside Scheduler but viewing the output in Plus

    We are using Discoverer 10.1.2
    I know that we can schedule a report within Discoverer Plus and the resulting out put can be seen in Discoverer under scheduled work books
    I am also aware that we put Discoverer command line commands in a DOS script and then schedule that script to run using an Enterprise scheduler and automatically export that report Excel.
    What I want is to schedule reports using our enterprise scheduler but view the resulting output in Discoverer under scheulded work books
    I was thinking that when we schedule a report Discoverer creates a package, something like EUL5_BATCH_PACKAGE080314170249.RUN;.
    Once that package is created, if I copy it and rename it and then schedule to run from our enterprise scheduler, would I be able to view the output from Discoverer ?
    ----- Added on 03/15/2008-------
    I did try running the above package EUL5_BATCH_PACKAGE080314170249.RUN from SQL Plus as I had indicated above. The settings on the report schedule were -
    - Run immediately
    - Never repeate
    - Delete the results after 9999 days ( maximum allowed )
    Now the first time the report ran automatically using DBMS_JOBS since I had set the report to run immediately.
    After that when I tried running EUL5_BATCH_PACKAGE080314170249.RUN from SQL Plus, the procedure completed but when I looked at the Discoverer front end, it indicated the run was in error with Unique constraint violation on EUL5_BQ_TABLES.EUL5_BQT_UK_1 index. However when I looked at the table it did not have any data in it.
    I the ran the procedure again from SQL Plus and this time it completed and when I looked at the Discoverer Plus front end, the results were ready for me to view.
    When I tried running the procedure again, it failed again with unique constraint violation and when the procedure was executed after that it again ran and i was able to view the results.
    So, ever alternate run from SQL Plus was successful. I would continue to try out different combinations of schedule parameters to see if I can get it to work.
    However, any one has already tried this before please let me know if what I am trying Is this possible ?
    Any help would be appreciated
    Thank you
    Message was edited by:
    manav_purohit
    Message was edited by:
    manav_purohit

    Thanks for the suggestion Rod. However, if I use DBMS_JOB.CHANGE, the report will still run using DBMS_JOB. What I would prefer is to not use DBMS_JOB.
    Running anything in DBMS_JOB means, the job is not visible in the enterprise scheduler that we use. Our enterprise scheduler is being monitored at a data center and if any jobs fail, appropriate on call individuals are contacted. Records are kept of failures and root cause is analyzed. So I want to take advantage of these procedures for scheduled reports as well.
    I am still looking for some alternative method.

  • How to remove the extra space in the output pdf file?

    Hi All
    In our RTF layout template we have both static content and dynamic content.
    In RTF template we have used many if-else,choose,For each loops.
    On the account of that,In the output pdf file, we are getting lot of empty space in the place of that coding(if-else,choose,For each loops).
    Is there anyway to reduce the space in the output pdf file?
    Please suggest some ideas.
    Thanks in Advance.

    White space is NOT your friend!
    Make sure you don't have any unwanted whitespace between commands and especially tagged on the end of lines. Chain your commands together with no whitespace and let them wrap, do not enter carriage returns.
    Cheers,
    Dave

  • How to parse the output of a JSP?

    Hi,
    I need to parse the generated contents of a JSP file from within the web application (i.e. another JSP). Any ideas how this might work? It seems that XPath will not parse a file which doesn't end in .xml, and even if it did, I get the feeling it would parse the source file rather than the output.
    Cheers,
    Catalin

    It is a javascript bit taken directly from the XPath example at W3Schools ( [Example Page|http://www.w3schools.com/XPath/xpath_examples.asp], or [Code|http://www.w3schools.com/XPath/tryit.asp?filename=try_xpath_select_pricenodes_text] ).
    Edited by: K-tutzah on May 19, 2008 5:05 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to check the output of a recordset in Stored Procedure.

    Hello,
    I need to check the output of below code:
    create or replace PROCEDURE GETUSERINFO (p_recordset OUT Types.cursor_type) AS
    BEGIN
    OPEN p_recordset FOR
    SELECT userid,
    username,
    password,
    role,
    assignrole,
    emailid
    FROM tbl_users
    WHERE userid=18;
    END GETUSERINFO;
    Kindly help me.

    user12631197 wrote:
    Hello,
    I need to check the output of below code:
    create or replace PROCEDURE GETUSERINFO (p_recordset OUT Types.cursor_type) AS
    BEGIN
    OPEN p_recordset FOR
    SELECT userid,
    username,
    password,
    role,
    assignrole,
    emailid
    FROM   tbl_users
    WHERE  userid=18;
    END GETUSERINFO;Kindly help me.in sqlplus do this
    var rc refcursor
    exec getuserinfo(:rc)
    print rcNote: Use {noformat}.. your code here ..{noformat} tags to preserve your code format.

  • How to assign the output of a function to a text area: a PLSQL challenge

    I have a function that returns a PLSQL table of varchar4(4000)
    Here is its signature in a package:
    create or replace package researcher_request_pk
    is
    TYPE query_table_type is table of varchar2(4000) index by binary_integer;
    FUNCTION RequestSQL(P_RRQ_ID in number) return query_table_type;
    end;
    I use this to get around the 32k limit on clobs and varchar2 variables
    I want to assign the output of the function to a text area. I've tried the following PLSQL in a dynamic action and also as the source attribute of the Text Area but it doesn't populate the text area.
    Here is the code i'm using
    declare
    v_table researcher_request_pk.query_table_type;
    begin
    v_table:=researcher_request_pk.RequestSQL(:P64_RRQ_ID);
    for i in 1..v_table.count loop
    htp.prn(v_table(i));
    end loop;
    end;
    Any ideas on the correct syntax to do this?
    thanks in advance
    PaulP

    Thanks for your reply
    The function does populate the PLSQL table with data. e.g. If I place that exact code in a PLSQL region it generates the output on the screen with no problems. The problem is just generating the output into the text area.
    I want the text area to display the output of the PLSQL table (-a dynamic select SQL statement) which I then plan to execute to return records.( i.e. I've build my own runtime query builder)
    My plan is to allow the user to edit the SQL output first before sending the statement for execution.
    Funnily enough I do get the very first word of the first cell appearing, namely 'SELECT' but nothing else. Maybe the "||" that follows has something to do with the rest of it not appearing?? hmmm... will experiment more.
    thanks
    PaulP

Maybe you are looking for