List Output in Screen

Hi,
I call an old style Report (not ALV ) from a Dialog Screen. I would like to display the list on the same screen, in a separate area. Subscreens don't seem to work for this purpose. Is it possible to use a custom control for this? If yes, how would I implement that?
Thanks,
Thomas

yes u can do that by using custom control..
go to sap help  ALV GRID CONTROL there u will find a sample program ... u just copy and paste that and analyse..
i never tried that but i know , for this u can use custom control...

Similar Messages

  • Can I export the list output to screen.

    HI,
    My concept is I want to export the output of the list into a screen.
    Can anybody help
    regards
    Mave

    Hi Mave,
    If yours is an ALV list, you can create your own custom button in the application toolbar for Export and using ALV event handling, you can implement the functionality to be incorporated in the custom export button. In the implementation, you can create a screen with table control and then the same internal table data used to display the list can be used to transfer data into the table control.
    Cheers
    sharmistha

  • Can we call a selection screen from List output

    Hi Folks,
    Can we call a selection screen from the list output?
    I mean for ex:-
    i am getting the data from MAKT and displaying it in the list output having a button EMAIL.
    When I press that button it should call a selection screen asking the user to enter EMAIL id .
    Thanks,
    K.Kiran.

    Hi
    U can create a dynpro as SELECTION SCREEN and call it using CALL SELECTION-SCREEN statament:
    SELECTION-SCREEN BEGIN OF SCREEN 100.
    PARAMETERS: P_MAIL(80) TYPE C.
    SELECTION-SCREEN END    OF SCREEN  100.
    AT USER-COMMAND.
       CASE SY-UCOMM.
          WHEN 'MAIL'.
              CALL SELECTION-SCREEN 100.
              IF SY-SUBRC = 0. "User press F8
              ELSE.
                " User press exit or back
              ENDIF.
    U can use the addition STARTING AT ..... ENDING AT ..... if you need to show the selection-screen as popup
    Max

  • Problem in screen list output

    HI Friends,
    I am modifying one of the module program, where I have internal table with 3 fields and now as per requirement I added fourth field. At output it is showing data for all four fields but in header it is showing 3 fields only.
    I tried to find out where this header is coming, so that I can change there and add fourth column, but there is no syntax like top-of-page, or any write statement in program.
    Any idea how to find where this header data is coming.
    Thanks
    Priyank

    Hi Guys,
    Any Idea, May be if you have faced this type of problem,
    I have module pool program, and there is no code for top-of-page in my module pool, and all PBO,PAI modules. But still it is getting header when first LIST statement is executed, like in my case is SKIP.
    Here is my code if it helps to you finding a problem solution.
    MODULE PROGRAM ZABC.
    INCLUDE ZINC1. " global Data
    INCLUDE ZINC2.  " modules
    INCLUDE ZINC3. " forms
    *in one of the routine I am retrieving data and displaying as list output.
    FORm DISPLAY_OUTPUT.
      LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 10.
      PERFORM DISPLAY-LIST_PROCESS.
    ENDFORM.
    FORM DISPLAY-LIST_PROCESS.
      SET PF-STATUS 'LIST'.
      SET TITLEBAR 'LIST' WITH HEADER_DATE HEADER_TIME.
      NEW-PAGE LINE-SIZE 80.
      LOOP AT IDATA.
        SKIP. " When this syntax is executing it has header with material,batch . I added plant as new req. but *               how to add in header that is my question,I coudlnt find any top-of-page in this program.
        AT NEW IDATA-MATNR.
          WRITE: 5(24) IDATA-MATNR.
        ENDAT.
        WRITE: 32(4) IDATA-WERKS.
        WRITE: 39(5) ICROSS-BATCH.
      ENDLOOP.
    ENDFORM.
    So in module program where we are defining header syntax.
    It looks simple but I tried all ways like searching text TOP-of-PAGE in main program, also used RS_ABAP_SCAN_PROGRAM to scan TOP-OF-pAGE in relevant Z program but no-luck.
    Any Idea where I can find TOP-OF-PAGE syntax.
    Pls. Help me.
    Thanks
    PP

  • I wnat to add new fieldtext in the alv list output plz tell me

    hi,
    i whant add new fieldtext in the list output, plz tell me where can i modify it.
    CORRECTIONS
    DATE       CORRECTION NOTE    AUTHOR DESCRIPTION
    09.03.2001 L9CK045451 0388404 XSC    Wrong list output for multiple Os
    05.06.2001 AL0K023393 0410219 Lud    Wrong keydate for search with
                                         Pchbegda and pchendda.
    22.04.2004 S6BK024775 730486  PS     Too many selection parameters in
                                         header
    19.06.2006 S6BK035494 956731  JF     No sorting by qualification
    REPORT RHPK_FIND_PERS_WITH_EXPIRED_QU MESSAGE-ID PQ.
    DATA  AUFRUF(8).
    TABLES : OBJEC, GDSET.
    DATA  LIST.
    DATA  MARKFIELD(1) TYPE C.
    ALV_POOL
    TYPE-POOLS SLIS.
    INCLUDES
    INCLUDE .
    INCLUDE RHPEINI0.
    TABLES
    DATA: orgeh_BUFFER like hrobject OCCURS 1 WITH HEADER LINE.
    DATA: OBJECTS    LIKE HRSOBID    OCCURS 1 WITH HEADER LINE.
    DATA: h_OBJEC    LIKE objec    OCCURS 0 WITH HEADER LINE.
    DATA: pers_objects LIKE HRSOBID    OCCURS 1 WITH HEADER LINE.
    DATA: QUALI_TAB LIKE QUALI_PROF OCCURS 1 WITH HEADER LINE.
    DATA: PERSONS LIKE PERSQ_PROF OCCURS 1 WITH HEADER LINE.
    DATA: H_PERSONS LIKE HRPE_PROFL OCCURS 1 WITH HEADER LINE.
    DATA: LIST_OUTPUT LIKE PERSQ_PROF OCCURS 1 WITH HEADER LINE.
    DATA: BOOK_EVENT_TAB LIKE PERSQ_PROF OCCURS 1 WITH HEADER LINE.
    DATA: PLAN_EVENT_TAB LIKE PERSQ_PROF OCCURS 1 WITH HEADER LINE.
    DATA H_SUITED LIKE DYNP_PCRIT-SUITED.
    DATA: O_COLOR LIKE STREEATTR-COLOR.
    DATA: O_INTENSIV LIKE STREEATTR-INTENSIV.
    DATA  SHOW_KEY.
    DATA EVENT.
    DATA: HTEXT LIKE P1000-STEXT.
    DATA: EVENT_TAB LIKE PERSQ_PROF OCCURS 1 WITH HEADER LINE.
    DATA: COLLECTED_EVENTS LIKE PERSQ_PROF OCCURS 1 WITH HEADER LINE.
    DATA: SUBTY_TAB LIKE HRPE_OTYPE_SUBTY OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF  HIDE_STRU,
            PERSTYPE LIKE HROTYPE-OTYPE,
            PERSOBID LIKE HRSOBID-SOBID,
            PERSTXT LIKE PERSQ_PROF-STEXT,
            SCALE_ID LIKE HRPE_PROFQ-SCALE_ID,
            TRAININGTYPE LIKE HRP1000-OTYPE,
            TRAININGID   LIKE HRP1000-OBJID,
            TRAININGSTXT LIKE HRP1000-STEXT,
            QUALID LIKE QUALI_PROF-QUALID,
            QUALTEXT LIKE QUALI_PROF-QUALSTXT,
          END OF HIDE_STRU.
    DATA: BEGIN OF EXTAB OCCURS 10,
             FCODE LIKE RSMPE-FUNC,
          END OF EXTAB.
    DATA:  CURRENT_QUALID LIKE QUALI_PROF-QUALID.
    DATA:  CURRENT_TRAININGSID LIKE HRP1000-OBJID.
    DATA:  CURRENT_TRAININGTYPE LIKE HRP1000-OTYPE.
    DATA: SUBRC LIKE SY-SUBRC.
    VARIABLES
    DATA: OBJID LIKE P1000-OBJID.
    DATA: H_LINE_COUNT TYPE I.
    DATA: H_TABIX1 LIKE SY-TABIX.
    ALV-Variables
    DATA: alv_events_line    TYPE slis_alv_event.         "header line
    DATA ALV_EVENTS TYPE SLIS_T_EVENT.
    DATA GT_ALV_LIST_TOP_OF_LIST TYPE SLIS_T_LISTHEADER.
    DATA: gt_events TYPE SLIS_T_EVENT.
    DATA G_REPID LIKE SY-REPID.
    DATA G_VARIANT LIKE DISVARIANT.
    DATA ALV_USERCOMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.
    DATA G_USERCOMMAND_FOR_RANKINGLIST TYPE SLIS_FORMNAME VALUE
    'USER_COMMAND_FOR_RANKINGLIST'.
    DATA ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
    DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA: ALV_OUTPUT  LIKE HRPDV_EXPIRED_Q OCCURS 0 WITH HEADER LINE.
    DATA: Help_OUTPUT LIKE HRPDV_EXPIRED_Q OCCURS 0 WITH HEADER LINE.
    begin of Dynpro 5020 - POPUP: WEITER
    DATA: OK_CODE_5020   LIKE SY-UCOMM.
    DATA: NO_ORG.                          "if no org selected
    DATA: H_TABIX LIKE SY-TABIX.
    begin of Dynpro 20nn - Header
    TABLES: DYNP_RHPP.
    SELECTION SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-005.
    PARAMETERS:
       H_EVENTS LIKE DYNP_RHPP-GEN_TRAIN,  "with training sugg
       H_QUAL   LIKE DYNP_RHPP-EXPIRED_QUAL. "with Qual
    SELECTION-SCREEN END OF BLOCK B3.
    INITIALIZATION
    INITIALIZATION.
      PERFORM READ_T77S0_PARAMETERS_FOR_PE.
    get user parameters/Planvariante und Beginndatum setzen:
      PCHOTYPE = $ORGEH.
      CALL FUNCTION 'RHP0_USER_PARAMETERS_GET'
           EXPORTING
                FILL_IF_INITIAL = 'X'
           IMPORTING
                PLVAR           = PCHPLVAR
                BEGDA           = PCHBEGDA
                endda           = Pchendda    "Correction 0410219
                WITH_KEY        = SHOW_KEY
              SUBSTITUTE      =
              ESSENTIAL       = only_essential
                ORG_UNIT        = PCHOBJID-LOW
          EXCEPTIONS
                OTHERS     = 0.
    PCHBEGDA = LOW_DATE.   "Correction note: 0410219 / AL0K023393
    get menu text for key on/off
      PERFORM USER_MENU_TEXT_KEY(SAPLRHP0) USING G_MENU_TEXT_KEY.
    start-of-selection
    START-OF-SELECTION.
    terminate the selection if objid isn't given
      READ TABLE PCHOBJID INDEX 1 TRANSPORTING NO FIELDS.
      IF SY-SUBRC <> 0
      AND PCHOBJID IS INITIAL.
        PCHOBJID-SIGN   = 'I'.
        PCHOBJID-OPTION = 'EQ'.
        PCHOBJID-LOW    = '00000001'.
        APPEND PCHOBJID.
        NO_ORG = TRUE.
      ELSE.
        NO_ORG = FALSE.
      ENDIF.
    GET OBJEC.
    terminate the selection if objid isn't given
      IF NO_ORG = TRUE.
        EXIT.
      ENDIF.
      OBJECTS-PLVAR = PCHPLVAR.
      OBJECTS-OTYPE = PCHOTYPE.
      OBJECTS-SOBID = OBJEC-REALO.
      APPEND OBJECTS.
    Für das lesen der Organisationseinheit
      h_OBJEC-PLVAR = OBJEC-PLVAR.
      h_OBJEC-OTYPE = OBJEC-OTYPE.
      h_OBJEC-OBJID = OBJEC-objid.
      append h_objec.
      Read table h_objec index 1 transporting no fields.
      if sy-subrc = 0.
    Fill Buffer
        orgeh_BUFFER = h_OBJEC.
        orgeh_BUFFER[] = h_OBJEC[].
        CALL FUNCTION 'RH_TEXT_BUFFER_FILL'
          TABLES
            OBJECTS = orgeh_BUFFER.
        Loop at h_OBJEC.
          H_TABIX = SY-TABIX.
    Read text of organisation
          CALL FUNCTION 'RH_READ_OBJECT'
               EXPORTING
                    PLVAR     = h_OBJEC-plvar
                    OTYPE     = h_OBJEC-otype
                    OBJID     = h_OBJEC-OBJID
               IMPORTING
                  OBEG      = h_objec-begda
                  OEND      = h_objec-endda
                   SHORT     = short
                    STEXT     = h_OBJEC-stext
              EXCEPTIONS
                    NOT_FOUND = 1
                    OTHERS    = 2.
          IF SY-SUBRC = 0.
            modify h_OBJEC index H_TABIX.
          ENDIF.
        endloop.
      endif.
    end-of-selection
    END-OF-SELECTION.
    read objects of the organizational unit
      OBJID = OBJECTS-SOBID.
      CALL FUNCTION 'RHPH_PICK_UP_PERSONS'
          EXPORTING
               BEGDA      = PCHBEGDA    "Correction 0410219
               ENDDA      = PCHENDDA    "Correction 0410219
             STATUS     = '1'
               WITH_STEXT = 'X'
           TABLES
                OBJECTS    = OBJECTS
                PERSONS    = H_PERSONS
          EXCEPTIONS
               UNDEFINED  = 1
               OTHERS     = 2.
      IF SY-SUBRC = 0.
    prepare objects !
        objects-otype = h_persons-ttype.
        objects-sobid = h_persons-tobid.
        append objects.
      ELSE.
        EXIT.
      ENDIF.
    CLEAR OBJECTS. REFRESH OBJECTS.
    prepare sel_objects !
      pers_objects-PLVAR = PCHPLVAR.
      LOOP AT H_PERSONS.
        pers_objects-OTYPE = H_PERSONS-TTYPE.
        pers_objects-SOBID = H_PERSONS-TOBID.
        APPEND pers_objects.
      ENDLOOP.
    sort objects and delete adjacent duplicates
      SORT Pers_OBJECTS BY PLVAR OTYPE SOBID.
      DELETE ADJACENT DUPLICATES FROM Pers_OBJECTS COMPARING PLVAR OTYPE
    SOBID.
      CALL FUNCTION 'RHPK_FIND_PERS_WITH_EXPIRED_Q'
           EXPORTING
               PLVAR            = PCHPLVAR
               CHECK_BEGDA      = PCHBEGDA
               CHECK_ENDDA      = PCHENDDA
               SUBTY            = $ownsb                        "'B032'
             only_essential   =
             target_otype     =
             target_ap_iea    =
           TABLES
                IMP_PER_TAB     = pers_objects
                QUALI_TAB       = QUALI_TAB
                PERSONS         = LIST_OUTPUT
            altq_tab          =
          EXCEPTIONS
               NO_QUALIFICATION = 1
               NO_PERSON_FOUND  = 2
               OTHERS           = 3.
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    100% case
      READ TABLE pers_objects INDEX 1 TRANSPORTING NO FIELDS.
      IF SY-SUBRC = 0.
        sort pers_objects by otype sobid.
      check the selected persons: if org.unit was selected !
        Loop at pers_objects.
          H_TABIX = SY-TABIX.
          READ TABLE LIST_OUTPUT WITH KEY  OTYPE = pers_objects-OTYPE
                                           SOBID = pers_objects-SOBID
                                           BINARY SEARCH.
          IF SY-SUBRC <> 0.
          person doesn't belong to the selected org.unit
          DELETE LIST_OUTPUT INDEX H_TABIX.
          ENDIF.
        ENDLOOP.
      ENDIF.                               "org.unit check needed ?
    end-of-selection.
      sort h_objec by otype objid.
      sort list_output by otype sobid.
      sort h_persons by ttype tobid.
    ALV-Liste aufbauen
      loop at h_objec.
        loop at h_persons where otype = h_objec-otype     "XSC
                          and   sobid = h_objec-objid.    "XSC
          Read table list_output with key
                                 otype = h_persons-ttype
                                 sobid = h_persons-tobid
                                 binary search.
          if sy-subrc = 0.
            h_tabix1 = sy-tabix.
            while sy-subrc = 0.
              clear alv_output.                            "XSC
              ALV_OUTPUT-otype    = h_objec-otype.
              ALV_OUTPUT-sobid    = h_objec-objid.
              ALV_OUTPUT-stext    = h_objec-stext.
              ALV_OUTPUT-Ptype    = LIST_OUTPUT-otype.
              ALV_OUTPUT-pobid    = LIST_OUTPUT-sobid.
              ALV_OUTPUT-pshort   = LIST_OUTPUT-short.
              ALV_OUTPUT-ptext    = LIST_OUTPUT-stext.
              ALV_OUTPUT-qualid   = LIST_OUTPUT-qualid.
              ALV_OUTPUT-qualstxt = LIST_OUTPUT-qualstxt.
              ALV_OUTPUT-expbegda = LIST_OUTPUT-vbegda.
              ALV_OUTPUT-expendda = LIST_OUTPUT-vendda.
          PERFORM FIND_TRAINING TABLES QUALI_TAB EVENT_TAB COLLECTED_EVENTS
                    USING $PLVAR $GDATE H_EVENTS H_QUAL.
              IF NOT EVENT_TAB[] IS INITIAL.
                READ TABLE COLLECTED_EVENTS WITH KEY
                                     QUALID = LIST_OUTPUT-QUALID.
                IF SY-SUBRC = 0.
                  ALV_OUTPUT-ICON_S_EVENTS = ICON_BOOKEVENT.
                endif.
              ENDIF.
              Append ALV_OUTPUT.
              h_tabix1 = h_tabix1 + 1.
              READ TABLE list_output INDEX h_tabix1
                         COMPARING otype sobid.
            endwhile.
          endif.
        endloop.
      endloop.
    check if indicator for qualification view is set
      IF h_qual = 'X'.                                          "note 956731
        SORT alv_output by qualid OTYPE SOBID ptype pobid       "note 956731
        expbegda expendda.                                      "note 956731
      ELSE.                                                     "note 956731
        SORT alv_output by OTYPE SOBID ptype pobid qualid expbegda expendda.
      ENDIF.                                                    "note 956731
      DELETE ADJACENT DUPLICATES FROM ALV_OUTPUT COMPARING OTYPE SOBID ptype
        pobid qualid expbegda expendda.
    stext_AQ und icon-Feld noch nicht gefüllt
        perform PREPARE_TOP_OF_LIST.
        perform Build_FIELDCAT using GT_FIELDCAT[] H_EVENTS.
        perform ALV_LAYOUT USING alv_layout.
        G_REPID          = SY-REPID.
        G_VARIANT-REPORT = G_REPID.
        PERFORM EVENTTAB_BUILD USING GT_EVENTS.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
            EXPORTING
        I_INTERFACE_CHECK        = 'X'
            I_CALLBACK_PROGRAM       = G_REPID
        I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
            I_CALLBACK_USER_COMMAND  = ALV_USERCOMMAND
            I_STRUCTURE_NAME         = 'HRPDV_EXPIRED_Q'
            IS_LAYOUT                = ALV_LAYOUT
            IT_FIELDCAT              = GT_FIELDCAT[]
        IT_EXCLUDING             =
        IT_SPECIAL_GROUPS        =
        IT_SORT                  =
        IT_FILTER                =
        IS_SEL_HIDE              =
            I_DEFAULT                = 'X'
            I_SAVE                   = 'A'
            IS_VARIANT               = G_VARIANT
            IT_EVENTS                = GT_EVENTS
        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
        IMPORTING
          E_EXIT_CAUSED_BY_CALLER  =
          ES_EXIT_CAUSED_BY_USER   =
          TABLES
            T_OUTTAB                 = ALV_OUTPUT
          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  FIND_TRAINING
          text
         -->P_QUALI_TAB  text
         -->P_EVENT_TAB  text
         -->P_$PLVAR  text
         -->P_GDATE  text
         -->P_H_EVENT  text
         -->P_H_QUAL  text
    FORM FIND_TRAINING TABLES  P_QUALI_TAB STRUCTURE QUALI_TAB
                               P_EVENT_TAB STRUCTURE EVENT_TAB
                               P_COLLECTED_EVENTS STRUCTURE COLLECTED_EVENTS
                       USING   VALUE(P_$PLVAR) LIKE P1000-PLVAR
                               VALUE(P_GDATE) LIKE P1000-GDATE
                               VALUE(P_H_EVENT) TYPE ANY
                               VALUE(P_H_QUAL) TYPE ANY.
      IF NOT P_H_EVENT IS INITIAL.
        READ TABLE EVENT_TAB INDEX 1 TRANSPORTING NO FIELDS.
        IF SY-SUBRC <> 0.
          CLEAR P_EVENT_TAB. REFRESH EVENT_TAB.
          CLEAR P_COLLECTED_EVENTS. REFRESH P_COLLECTED_EVENTS.
          IF EVENT = FALSE.
            EVENT = TRUE.
          ELSE.
            EVENT = FALSE.
          ENDIF.
          CALL FUNCTION 'RHPH_FIND_TRAINING_FOR_QUAL'
               EXPORTING
                    PLVAR            = PCHPLVAR
                    GDATE            = SY-DATUM
                  GET_NAME         = 'X'
               TABLES
                    QUALI_TAB        = QUALI_TAB
                    TO_Q_TAB         = EVENT_TAB
              EXCEPTIONS
                   NO_QUALIFICATION = 1
                   NO_OBJECT_FOUND  = 2
                   TECHNICAL_ERROR  = 3
                   OTHERS           = 4.
          IF SY-SUBRC = 0.
    the found qualifications are picked up into table event_tab
          ENDIF.
          IF SY-SUBRC = 1.
            MESSAGE S015.   "Zu den Eingaben wurden keine Daten gefunden
          ENDIF.
          IF SY-SUBRC > 2.
            EXIT.
          ENDIF.
    collect events when there are double.
    Veranstaltungen kollektieren, Können mehrfach auftauchen, da
    verschiedenen Qualifikationen von gleichen Veranstaltungen vermittelt
          LOOP AT P_EVENT_TAB INTO P_COLLECTED_EVENTS.
            APPEND P_COLLECTED_EVENTS.
          ENDLOOP.
          SORT P_COLLECTED_EVENTS BY QUALID STEXT.
        ENDIF.
      ENDIF.
    ENDFORM.                               " FIND_TRAINING
    *&      Form  PREPARE_TOP_OF_LIST
          text
    -->  p1        text
    <--  p2        text
    FORM PREPARE_TOP_OF_LIST.
      DATA ALV_TOP_OF_LIST TYPE SLIS_LISTHEADER.  "typ, key, info
      DATA STEXT LIKE HRPDV_SUCCESSOR_VIEW-TTEXT.
      DATA P_SUBRC LIKE SY-SUBRC.
      DATA P_STEXT LIKE T777O-OTEXT.
      DATA l_tabix like sy-tabix value 0.
      DATA: h_counter TYPE i.                             "note 730486
      ALV_TOP_OF_LIST-TYP = 'H'.
      ALV_TOP_OF_LIST-INFO = TEXT-REQ.
      APPEND ALV_TOP_OF_LIST TO GT_ALV_LIST_TOP_OF_LIST.
    Organisationseinheit
      ALV_TOP_OF_LIST-typ = 'S'.
    Read text for organisationunit
      PERFORM READ_TEXT_OTYPE_T777O(SAPLRHP0) USING SY-LANGU $ORGEH
                                                    P_STEXT P_SUBRC.
      ALV_TOP_OF_LIST-key = P_STEXT.
    fill buffer for read organisation-text
      CALL FUNCTION 'RH_TEXT_BUFFER_FILL'
         EXPORTING
              CHECK_STRU_AUTH = 'X'
              WITH_EXTINT     = ' '
           TABLES
                OBJECTS         = OBJECTS.
    loop at objects for multipleselection
      clear h_counter.                          "note 730486
      LOOP AT OBJECTS.
        $OBJID = OBJECTS-SOBID.
        CALL FUNCTION 'RH_READ_OBJECT'
             EXPORTING
                PLVAR           = OBJECTS-PLVAR
                OTYPE           = OBJECTS-OTYPE
                OBJID           = $OBJID
             IMPORTING
              SHORT           = short
                STEXT           = STEXT
             EXCEPTIONS
                NOT_FOUND       = 1
                OTHERS          = 2.
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        IF h_counter >= 15.                               "note 730486
          MOVE '( ... )' TO ALV_TOP_OF_LIST-INFO.         "note 730486
          APPEND ALV_TOP_OF_LIST TO gt_alv_list_top_of_list.
          "note 730486
          EXIT.                                           "note 730486
        ENDIF.                                            "note 730486
        CONCATENATE $ORGEH OBJECTS-SOBID STEXT INTO
        ALV_TOP_OF_LIST-INFO SEPARATED BY SPACE.
        APPEND ALV_TOP_OF_LIST TO GT_ALV_LIST_TOP_OF_LIST.
        CLEAR ALV_TOP_OF_LIST.
        ALV_TOP_OF_LIST-typ = 'S'.
        l_tabix = l_tabix + 1.
        ADD 1 TO h_counter.                         "note 730486
      ENDLOOP.
    CLEAR ALV_TOP_OF_LIST.
      ALV_TOP_OF_LIST-TYP  = 'S'.
      ALV_TOP_OF_LIST-key = TEXT-003.
      WRITE PCHBEGDA TO ALV_TOP_OF_LIST-INFO.
      APPEND ALV_TOP_OF_LIST TO GT_ALV_LIST_TOP_OF_LIST.
      clear ALV_TOP_OF_LIST-INFO.
      ALV_TOP_OF_LIST-key = TEXT-004.
      WRITE PCHENDDA TO ALV_TOP_OF_LIST-INFO.
      Append ALV_TOP_OF_LIST TO GT_ALV_LIST_TOP_OF_LIST.
    ENDFORM.                               " PREPARE_TOP_OF_LIST
    *&      Form  BUILD_FIELDCAT
          text
         -->P_GT_FIELDCAT[]  text
    FORM BUILD_FIELDCAT USING  P_GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV
                               P_H_EVENTS.
      DATA: WA_FIELDCAT LIKE LINE OF P_GT_FIELDCAT.
      DATA: P_REPNAME LIKE SY-REPID,
            L_TABIX LIKE SY-TABIX.         "local variable for sy-tabix.
      P_REPNAME = SY-REPID.
    Erstellen des Feldkataloges
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
         EXPORTING
               I_PROGRAM_NAME         = P_REPNAME
               I_INTERNAL_TABNAME     =
               I_STRUCTURE_NAME       = 'HRPDV_EXPIRED_Q'
               I_CLIENT_NEVER_DISPLAY = 'X'
               I_INCLNAME             = PRONAME
         CHANGING
               CT_FIELDCAT            = P_GT_FIELDCAT
         EXCEPTIONS
               INCONSISTENT_INTERFACE = 0
               PROGRAM_ERROR          = 0
               OTHERS                 = 0.
      LOOP AT P_GT_FIELDCAT INTO WA_FIELDCAT.
        l_tabix = sy-tabix.
        CASE WA_FIELDCAT-FIELDNAME.
          when 'OTYPE'.
            WA_FIELDCAT-DDICTXT = 'L'.
          when 'SOBID'.
            WA_FIELDCAT-DDICTXT = 'L'.
          WHEN 'STEXT'.
            WA_FIELDCAT-DDICTXT = 'L'.
          when 'PTYPE'.
            WA_FIELDCAT-DDICTXT = 'L'.
          when 'POBID'.
            WA_FIELDCAT-DDICTXT = 'L'.
          when 'PSHORT'.
            WA_FIELDCAT-DDICTXT = 'L'.
          WHEN 'PTEXT'.
            WA_FIELDCAT-DDICTXT = 'L'.
          WHEN 'QUALID'.
            WA_FIELDCAT-DDICTXT = 'L'.
          WHEN 'QUALSTXT'.
            WA_FIELDCAT-DDICTXT = 'L'.
          WHEN 'EXPBEGDA'.
            WA_FIELDCAT-DDICTXT = 'L'.
          WHEN 'EXPENDDA'.
            WA_FIELDCAT-DDICTXT = 'L'.
          WHEN 'ICON_S_EVENTS'.
            IF P_H_EVENTS IS INITIAL.
              WA_FIELDCAT-NO_OUT = 'X'.
            else.
              WA_FIELDCAT-DDICTXT = 'X'.
            endif.
        ENDCASE.
        MODIFY P_GT_FIELDCAT FROM WA_FIELDCAT INDEX l_tabix.
      ENDLOOP.
    ENDFORM.                               " BUILD_FIELDCAT
    *&      Form  ALV_LAYOUT
          text
         -->P_L_ALV_LAYOUT  text
    FORM ALV_LAYOUT USING    P_ALV_LAYOUT  TYPE slis_layout_alv.
    build layout
    P_LAYOUT-BOX_FIELDNAME = 'MARK_X'.   "fieldname for checkbox
      P_ALV_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
      P_ALV_LAYOUT-BOX_TABNAME   =  ALV_OUTPUT.   "tabname for checkbox
      p_ALV_layout-info_fieldname = 'ALV_COLOR'.
    ENDFORM.                               " ALV_LAYOUT
    FORM eventtab_build USING
    FORM EVENTTAB_BUILD USING RT_EVENTS TYPE SLIS_T_EVENT.
      DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
      MOVE 'TOP_OF_PAGE' TO LS_EVENT-NAME.
      MOVE 'TOP_OF_PAGE' TO LS_EVENT-FORM.
      APPEND LS_EVENT TO RT_EVENTS.
    ENDFORM.                    "EVENTTAB_BUILD
    *FORM TOP_OF_PAGE
    FORM TOP_OF_PAGE.                                           "#EC CALLED
      NEW-PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = GT_ALV_LIST_TOP_OF_LIST[].
    ENDFORM.                    "TOP_OF_PAGE
          FORM USER_COMMAND                                             *
    USER_COMMAND for the list of successor view                         *
    -->  r_ucomm                                                       *
    -->  rs_selfield                                                   *
    FORM USER_COMMAND USING ALV_UCOMM LIKE SY-UCOMM
          RS_SELFIELD TYPE SLIS_SELFIELD.                       "#EC CALLED
      DATA: SELECTED_LINE LIKE HRPDV_expired_q.
      DATA: SOBID_QUA LIKE P1000-OBJID.
      DATA: LT_PERS_TAB LIKE HRSOBID OCCURS 0 WITH HEADER LINE.
      CASE ALV_UCOMM.
        WHEN '&IC1'.                       "per Doppelklick auswählen
          READ TABLE ALV_OUTPUT INDEX
          RS_SELFIELD-TABINDEX INTO SELECTED_LINE.
          CASE RS_SELFIELD-FIELDNAME.
            WHEN 'POTYPE' or 'POBID' or 'PTEXT' or 'OTYPE' or 'SOBID' or
    'STEXT' or 'QUALID' or 'QUALSTXT' or 'EXPBEGDA' or 'EXPENDDA'.
              READ TABLE ALV_OUTPUT INDEX RS_SELFIELD-TABINDEX INTO
                    Help_output.
              IF SY-SUBRC <> 0.
                MESSAGE S027.               "Bitte gültige Zeile auswählen
                EXIT.
              Endif.
         IF ALV_OUTPUT-SOBID IS INITIAL.
           MESSAGE S015.  "Zu den Eingaben wurden keine Daten gefunden
         ELSE.
         converte the variable because of the different types
         SOBID_QUA = SELECTED_LINE-SOBID_QUA.
              CALL FUNCTION 'RHPP_SHOW_PROFILE'
                EXPORTING
                  PLVAR        = pchplvar
                  OTYPE        = SELECTED_LINE-PTYPE       "XSC
                  OBJID        = SELECTED_LINE-POBID       "XSC
                  BEGDA        = PCHBEGDA
                  ENDDA        = PCHENDDA
                  MAINTAIN     = ' '
                EXCEPTIONS
                  NO_AUTHORITY = 1
                  NOT_FOUND    = 2
                  OTHERS       = 3.
              CASE SY-SUBRC.
                WHEN 0.
                All right.
                WHEN 1.
                  MESSAGE S015.
                Zu Ihren Eingaben konnten keine Daten gefunden werden!
                WHEN 2.
                  MESSAGE E000.
                Dazu haben sie keine berechtigung!
                WHEN OTHERS.
                  MESSAGE E008.
                Es ist ein unvorhergesehener Fehler aufgetreten.
              ENDCASE.                     "sy-subrc.
              CLEAR ALV_OUTPUT.
       ENDIF.    "IF ALV_OUTPUT-SOBID IS INITIAL.
       CLEAR ALV_OUTPUT-SOBID.
            when 'ICON_S_EVENTS'.
              IF SELECTED_LINE-ICON_S_EVENTS IS INITIAL.
                MESSAGE S027.              "Bitte gültige Zeile auswählen
                EXIT.
              ENDIF.
              CLEAR LT_PERS_TAB.
              REFRESH LT_PERS_TAB.
              LT_PERS_TAB-PLVAR = pchPLVAR.
              LT_PERS_TAB-OTYPE = SELECTED_LINE-PTYPE.          "XSC
              LT_PERS_TAB-SOBID = SELECTED_LINE-POBID.          "XSC
              APPEND LT_PERS_TAB.
              SOBID_QUA = SELECTED_LINE-QUALID.
              CALL FUNCTION 'RHPP_SHOW_SUGGEST_EVENTS'
              EXPORTING
                P_PLVAR      = pchPLVAR
                P_SOBID_QUA  = SOBID_QUA
              P_PROFCY_REQ = SELECTED_LINE-RATING_REQ
                P_GDATE      = sy-datum
              TABLES
              EVENT_TAB    =
                PERS_TAB     = LT_PERS_TAB.
          endcase.
          CLEAR SELECTED_LINE.
      ENDCASE.                             "case sy-ucomm
    CLEAR SY-UCOMM.
    ENDFORM.                    "USER_COMMAND

    Pls be more specific in your question. If you want to include an extra field in your alv output, then read the field catalog table you created through "Reuse_alv_fieldcatalog_merge" and then add an extra entry in it giving the details of the field you want to add.. and then call the "resuse_alv_grid_display",
    Hope this helps. To be able to help you in a better way, kindly revert with any specific issue.
    Reward if helpful,
    Karan

  • To download a list output to excel sheet

    Hi All,
    I am running the transaction MD47 for Product Group Planning.
    I get a list output with as many as 90 columns.
    When I try to download the output into an excel (System > List > Save > Local File ) only the columns which appear on the screen are being downloaded. Does any one have pointers on how can I download the whole list into an excel?
    Regards,
    Karthik

    Hey Gabriel,
    I am doing good. How are you today?
    How do I do that?
    This is a list output not an ALV. I dint find any option to choose an ALV layout.
    Regards,
    Karthik

  • Regarding Downloading of Report[List] output into Excel Sheet

    Hi All,
    Hi i have written one Classical report. I got the output Correctly.
    Now i want to download that data into Excel Sheet in excatly the way it displayed in List[Report] output.
    I had followed the path <b>System->List->Save->LocalFile->Spread Sheet</b> and tried to download the same.
    Though it is downloaded it has not come in exact format.
    Now what i want is to add a button above that report & write a program in that to download that data into Excel Sheet.
    Can anybody tell me how can solve this issue. If i follow above procedure will the data[List Output] be downloaded into exact format into excel.
    If anybody knows other way please sujjest.
    Thanks in advance.
    Thanks & Regards,
    Prasad.

    Hi Prasad,
    I have done a program which downloads the output in the excel sheet in the correct format.
    Just check the program. The code given in bold is what you have to use.
    REPORT zexp MESSAGE-ID f4  LINE-SIZE 195.
        Tables Used    ***********************************
    TABLES : bseg, bkpf, bsak, lfa1, payr .
    Declaring Internal Tables  **************************
    DATA :
    Internal table to hold header data  *************
    BEGIN OF header OCCURS 0,
          ext_date(10) TYPE c,
          delimit(1)   TYPE c,
          ext_time(8)  TYPE c,
    END OF header,
    Internal table to hold detail info  **************
    BEGIN OF i_data OCCURS 0,
        belnr LIKE bsak-belnr,
        gjahr LIKE bsak-gjahr,
        bukrs LIKE bsak-bukrs,
        bldat LIKE bsak-bldat,
        xblnr LIKE bsak-xblnr,
        blart LIKE bsak-blart,
        augdt LIKE bsak-augdt,
        augbl LIKE bsak-augbl,
        wrbtr LIKE bsak-wrbtr,
        shkzg LIKE bsak-shkzg,
        lifnr LIKE bsak-lifnr,
        name1 LIKE lfa1-name1,
        chect LIKE payr-chect,
        status(1) TYPE c,
    END OF i_data,
    Internal table to to collect  *****************
    BEGIN OF i_data1 OCCURS 0,
         belnr LIKE bsak-belnr,
         gjahr LIKE bsak-gjahr,
         bukrs LIKE bsak-bukrs,
         bldat LIKE bsak-bldat,
         xblnr LIKE bsak-xblnr,
         blart LIKE bsak-blart,
         augdt LIKE bsak-augdt,
         augbl LIKE bsak-augbl,
         wrbtr LIKE bsak-wrbtr,
       shkzg LIKE bsak-shkzg,
         lifnr LIKE bsak-lifnr,
         name1 LIKE lfa1-name1,
         sortl LIKE lfa1-sortl,
         chect LIKE payr-chect,
         status(1) TYPE c,
    END OF i_data1,
    String variables for formatting file data *************
        fidoc_year   TYPE string,
        comp_code    TYPE string,
        check_numbr  TYPE string,
        vendor       TYPE string,
        inv_date     TYPE string,
        inv_nbr      TYPE string,
        paid_dat     TYPE string,
        inv_amt      TYPE string,
        status       TYPE string,
        ref_doc      TYPE string,
    ************Internal table to store the file contents **************
    BEGIN OF i_final_file OCCURS 0,
        record(300) TYPE c,
    END OF i_final_file,
    Internal table to store the list of allowed document types ****
      BEGIN OF i_doctype OCCURS 0,
             blart LIKE bsak-blart,
      END OF i_doctype,
    Internal table to hold vendor information ************
      BEGIN OF i_lfa1 OCCURS 0,
         lifnr LIKE lfa1-lifnr,
         name1 LIKE lfa1-name1,
         sortl LIKE lfa1-sortl,
      END OF i_lfa1,
    Internal table to hold check information *************
      BEGIN OF i_payr OCCURS 0,
         chect LIKE payr-chect,
         vblnr LIKE payr-vblnr,
         gjahr LIKE payr-gjahr,
         zbukr LIKE payr-zbukr,
      END OF i_payr.
      Data declarations  **************************
    DATA : ws_stblg     TYPE bkpf-stblg,
           todate       TYPE bsak-augdt,
           fromdate     TYPE bsak-augdt,
           w_day        LIKE dtresr-weekday,
           day          LIKE scal-indicator,
           d            TYPE n,
           e_date       LIKE sy-datum,
           e_time       LIKE sy-uzeit,
           dd(2)        TYPE c,
           mm(2)        TYPE c,
           yy(4)        TYPE c,
           hh(2)        TYPE c,
           min(2)       TYPE c,
           sec(2)       TYPE c.
    DATA : wa_filepath(50)    TYPE c,
           wa_filename(50)    TYPE c,
           wa_c_filename(100) TYPE c,
           arch_path(50)      TYPE c.
    <b>* Data for downloading to list
    DATA : list LIKE TABLE OF abaplist WITH HEADER LINE.
    DATA : BEGIN OF list_asc OCCURS 0,
    msg(300) TYPE c,
    END OF list_asc.
    DATA: BEGIN OF i_invoiceheader OCCURS 0,
    name(30) TYPE c,
    END OF i_invoiceheader.
    RANGES dates FOR bkpf-budat.</b>
      Selection Screen  ************************
    SELECTION-SCREEN SKIP 2.
    SELECT-OPTIONS:
             s_bukrs     FOR  bkpf-bukrs ,
             s_blart     FOR  bkpf-blart ,
             s_augdt     FOR  bsak-augdt. " memory id todat TO fromdat.
    PARAMETERS :submit  AS CHECKBOX DEFAULT ' '  .
    <b>* Download list to file.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'LIST'.
          PERFORM download.
        WHEN 'BACK'.
          EXIT.
      ENDCASE.</b>
    <b>----
          FORM download                                                 *
    FORM download.
    if s_augdt is initial.
    dates-sign = 'I'.
    dates-option = 'BT'.
    dates-low = '20050901'.
    dates-high = '20050920'.
    APPEND dates.
    else.
      dates = s_augdt.
      append dates.
    endif.
    /* Submit the same program .
      SUBMIT zexp WITH s_augdt IN dates
       EXPORTING LIST TO MEMORY
       AND RETURN.
      CALL FUNCTION 'LIST_FROM_MEMORY'
           TABLES
                listobject = list
           EXCEPTIONS
                not_found  = 1.
      CALL FUNCTION 'LIST_TO_ASCI'
    EXPORTING
    LIST_INDEX = -1 "LIST_INDEX SY-LSIND.
      TABLES
      listasci = list_asc
      listobject = list.
      PERFORM download_file.
    ENDFORM.
          FORM download_file                                            *
    FORM download_file.
      DATA fname TYPE rlgrap-filename VALUE 'c:\audit_report.xls'.
      DATA ftype TYPE rlgrap-filetype VALUE 'DAT'.
      DATA numeric_data(10) TYPE c VALUE '0123456789'.
    *Table structure should match with list output.
      DATA : BEGIN OF i_data1 OCCURS 0,
           belnr(12) TYPE c,
           gjahr(6) TYPE c,
           bukrs(8) TYPE c,
           chect(13) TYPE c,
           lifnr(12) TYPE c,
           name1(37) TYPE c,
           bldat(14) TYPE c,
           xblnr(18) TYPE c,
           augdt(14) TYPE c,
           wrbtr(17) TYPE c,
           status(4) TYPE c,
           augbl(18) TYPE c,
           sortl(17) TYPE c,
       END OF i_data1.
    Header record of the excel sheet.
      PERFORM fill_header.
      LOOP AT list_asc.
    Reads lines starting from the first record in the report. All informatory statements in the report are not read.
        IF list_asc+1(10) CO numeric_data.
          i_data1 = list_asc .
          APPEND i_data1.
        ENDIF.
      ENDLOOP.
    Call the download function.
    CALL FUNCTION 'DOWNLOAD'
           EXPORTING
                filename = fname
                filetype = ftype
           TABLES
                data_tab = i_data1
                FIELDNAMES = i_invoiceheader.
    ENDFORM.
          FORM fill_header                                              *
    FORM fill_header.
      i_invoiceheader-name = 'Doc Number'.
      APPEND i_invoiceheader.
      i_invoiceheader-name = 'Fsc Year'.
      APPEND i_invoiceheader.
      i_invoiceheader-name = 'Cmp Code'.
      APPEND i_invoiceheader.
      i_invoiceheader-name = 'Check No'.
      APPEND i_invoiceheader.
      i_invoiceheader-name = 'Vendor No'.
      APPEND i_invoiceheader.
      i_invoiceheader-name = 'Entered by'.
      APPEND i_invoiceheader.
      i_invoiceheader-name = 'Doc Date'.
      APPEND i_invoiceheader.
      i_invoiceheader-name = 'Ref Doc No'.
      APPEND i_invoiceheader.
      i_invoiceheader-name = 'Clearing Date'.
      APPEND i_invoiceheader.
      i_invoiceheader-name = 'Amount'.
      APPEND i_invoiceheader.
      i_invoiceheader-name = 'Status'.
      APPEND i_invoiceheader.
      i_invoiceheader-name = 'Clearing Doc No'.
      APPEND i_invoiceheader.
      i_invoiceheader-name = 'Sort field'.
      APPEND i_invoiceheader.
    ENDFORM.                    " fill_header</b>
       Initialization   *************************
    INITIALIZATION.
    To initialize the date parameter on the selection screen.
    The date by default ranges from previous Monday to Sunday.
      todate = sy-datum.
      CALL FUNCTION 'DATE_COMPUTE_DAY'
           EXPORTING
                date = todate
           IMPORTING
                day  = day.
      d = day.
      if d < 4.
        todate = sy-datum - d - 4 .
      else.
        todate = sy-datum - d + 3 .
      endif.
      fromdate = todate - 6.
      MOVE: 'BT'       TO s_augdt-option,
            fromdate   TO s_augdt-low,
            todate     TO s_augdt-high.
      APPEND s_augdt.
    Start of Selection  **************************
    START-OF-SELECTION.
    Checking the validity of the inputted dates ****************
      IF s_augdt-low > sy-datum OR s_augdt-high > sy-datum.
        MESSAGE i999 WITH 'You cannot input future date'.
        EXIT.
      ENDIF.
      IF NOT s_bukrs IS INITIAL.
    MESSAGE i999 WITH 'Program will run with input parameters in screen!!'.
      ENDIF.
    Initialize the header data ***********************
      e_time = sy-uzeit.
      MOVE e_time+0(2) TO hh.
      MOVE e_time+2(2) TO min.
      MOVE e_time+4(2) TO sec.
      CONCATENATE hh min sec INTO header-ext_time SEPARATED BY ':'.
      e_date = sy-datum.
      MOVE e_date+0(4) TO yy.
      MOVE e_date+4(2) TO mm.
      MOVE e_date+6(2) TO dd.
      CONCATENATE mm dd yy INTO header-ext_date SEPARATED BY '/'.
      header-delimit = '~'.
      APPEND header.
    List allowed document types **********************
      PERFORM fill_doc_types.
    **To select the documents within the range of week or as inputted **
      IF s_augdt IS INITIAL.
        MOVE: 'I' TO s_augdt-sign,
              'BT'       TO s_augdt-option,
              fromdate   TO s_augdt-low,
              todate     TO s_augdt-high.
        APPEND s_augdt.
      ENDIF.
    Selecting the records from the database ****************
      IF s_bukrs IS INITIAL AND s_blart IS INITIAL.
      Select all documents of company code 1000, *********
      4200 and 8000, and allowed document types  *********
        SELECT belnr gjahr augdt augbl bukrs
            blart bldat xblnr lifnr wrbtr shkzg
            FROM bsak INTO CORRESPONDING FIELDS OF TABLE i_data
            FOR ALL ENTRIES IN i_doctype
            WHERE blart EQ i_doctype-blart
            AND augdt IN s_augdt
            AND ( bukrs = '1000' OR bukrs ='4200'  OR
                ( bukrs = '8000' AND blart NE 'ZP' ) ).
       loop at i_data.
    Exclude reversed documents
          select single stblg into ws_stblg
                 from   bkpf
                 where  bukrs = i_data-bukrs
                   and  gjahr = i_data-gjahr
                   and  belnr = i_data-belnr.
          if not ws_stblg is initial.
             delete i_data.
          endif.
       endloop.
      ELSEIF s_blart IS INITIAL.
      Select all documents of allowed document types ******
           and inputted company code           ************
        SELECT belnr gjahr augdt augbl bukrs
           blart bldat xblnr lifnr wrbtr shkzg
           FROM bsak INTO CORRESPONDING FIELDS OF TABLE i_data
           FOR ALL ENTRIES IN i_doctype
           WHERE blart EQ i_doctype-blart
             AND augdt IN s_augdt
             AND bukrs IN s_bukrs .
        LOOP AT i_data.
    Exclude documents of type ZP
    for company code 8000.
          IF i_data-bukrs = '8000' AND i_data-blart = 'ZP'.
            DELETE i_data.
            continue.
          ENDIF.
      Exclude reversed documents
          select single stblg into ws_stblg
                 from   bkpf
                 where  bukrs = i_data-bukrs
                   and  gjahr = i_data-gjahr
                   and  belnr = i_data-belnr.
          if not ws_stblg is initial.
             delete i_data.
             continue.
          endif.
        ENDLOOP.
        READ TABLE i_data INDEX 1.
        IF sy-subrc NE 0.
          MESSAGE i999 WITH 'No records have been selected'.
          EXIT.
        ENDIF.
      ELSE.
      Select the documents matching the company codes  *****
    and document types inputted in the selection screen ****
        SELECT belnr gjahr augdt augbl bukrs bldat xblnr
           blart lifnr  wrbtr shkzg
           FROM bsak INTO CORRESPONDING FIELDS OF TABLE i_data
           WHERE bukrs IN s_bukrs AND blart IN s_blart
             AND augdt IN s_augdt.
        SORT i_data BY blart.
        LOOP AT i_data.
      Filtering the records selected
      based on the document type
          READ TABLE i_doctype WITH KEY blart = i_data-blart.
          IF sy-subrc NE 0.
            DELETE i_data.
            continue.
          ENDIF.
      Exclude documents of type ZP
      for company code 8000.
          IF i_data-bukrs = '8000' AND i_data-blart = 'ZP'.
            DELETE i_data.
            continue.
          ENDIF.
      Exclude reversed documents.
          select single stblg into ws_stblg
                 from   bkpf
                 where  bukrs = i_data-bukrs
                   and  gjahr = i_data-gjahr
                   and  belnr = i_data-belnr.
          if not ws_stblg is initial.
             delete i_data.
             continue.
          endif.
        ENDLOOP.
        READ TABLE i_data INDEX 1.
        IF sy-subrc NE 0.
          MESSAGE i999 WITH 'No records have been selected'.
          EXIT.
        ENDIF.
      ENDIF.
      IF sy-subrc NE 0.
        MESSAGE i999 WITH 'No records have been selected'.
        EXIT.
      ENDIF.
    credit/debit identification ***********************
      LOOP AT i_data.
        IF i_data-shkzg EQ 'H'.
          i_data-wrbtr = i_data-wrbtr * 1.
        ELSEIF i_data-shkzg EQ 'S'.
          i_data-wrbtr = i_data-wrbtr * -1.
        ENDIF.
        MODIFY i_data.
      ENDLOOP.
    for summarizing ******************************
      LOOP AT i_data.
        MOVE-CORRESPONDING  i_data TO i_data1.
        COLLECT i_data1.
      ENDLOOP.
    Vendor informations and Check Informations *****************
      SELECT lifnr name1 sortl
             FROM lfa1
             APPENDING CORRESPONDING FIELDS OF TABLE i_lfa1
             FOR ALL ENTRIES IN i_data1
             WHERE lifnr = i_data1-lifnr.
      SELECT chect vblnr gjahr zbukr FROM payr APPENDING CORRESPONDING
                                FIELDS OF TABLE i_payr FOR ALL ENTRIES
                                IN  i_data1   WHERE vblnr = i_data1-augbl
                                AND gjahr = i_data1-augdt(4)
                                AND zbukr = i_data1-bukrs.
      SORT i_data1 BY augbl gjahr bukrs lifnr.
      SORT i_payr  BY vblnr gjahr zbukr.
      SORT i_lfa1  BY lifnr.
      LOOP AT i_data1.
        READ TABLE i_payr WITH KEY vblnr = i_data1-augbl
                                   gjahr = i_data1-gjahr
                                   zbukr = i_data1-bukrs.
        IF sy-subrc EQ 0.
          i_data1-chect = i_payr-chect.
        ENDIF.
        READ TABLE i_lfa1 WITH KEY lifnr = i_data1-lifnr.
        IF sy-subrc EQ 0.
          i_data1-name1 = i_lfa1-name1.
          i_data1-sortl = i_lfa1-sortl.
        ENDIF.
        i_data1-status = 'X'.
        MODIFY i_data1.
      ENDLOOP.
    **The records are sorted by clearing date, check number and doc type**
      SORT i_data1 BY augdt chect blart.
    **********The header record is outputted on the screen****************
      PERFORM write_header.
    ********Data is moved to internal table in the file format *************
      PERFORM move_data.
    Line items are outputted on the screen *********************
      PERFORM write_output.
    *&                   Form  write_header                             &*
    *&        This outputs the header information to screen             &*
    FORM write_header.
      SKIP.
       SET PF-STATUS 'LIST'.
    Outputting the header information *********************
      WRITE : / 'Extraction Date : ' , header-ext_date.
      WRITE : / 'Extraction Time : ' , header-ext_time.
      FORMAT COLOR 1." INTENSIFIED.
      SKIP.
      ULINE AT 0(190) NO-GAP.
    Outputting line level information **********************
      WRITE:/  sy-vline NO-GAP,
            (10) 'DOC NUMBER',
              sy-vline NO-GAP,
             (4) 'F-YR',
               sy-vline NO-GAP,
             (6) 'C-CODE',
              sy-vline NO-GAP,
             (10) 'CHECK NUM',
              sy-vline NO-GAP,
             (10) 'VENDOR NUM',
              sy-vline NO-GAP,
             (35) 'VENDOR NAME',
               sy-vline NO-GAP,
             (12) 'INVOICE DATE',
              sy-vline NO-GAP,
             (16) 'INVOICE NUMBER',
              sy-vline NO-GAP,
             (12) 'PAID DATE',
               sy-vline NO-GAP,
             (15) 'INVOICE AMOUNT',
              sy-vline NO-GAP,
             (2) 'SC',
              sy-vline NO-GAP,
             (16) 'REFERENCE FI DOC',
               sy-vline NO-GAP,
             (15) 'SORT FIELD',
               sy-vline NO-GAP.
      ULINE AT 0(190) NO-GAP.
    ENDFORM.                    " write_header
    *&                      FORM  MOVE_DATA                             &*
    *&    Formats data in internal table as is required in the file     &*
    FORM move_data.
      LOOP AT i_data1.
    Document number and fiscal year should be separted by '|' *****
        CONCATENATE i_data1-belnr i_data1-gjahr INTO fidoc_year
                    SEPARATED BY '|'.
        MOVE i_data1-bukrs TO comp_code.
        MOVE i_data1-chect TO check_numbr.
    Vendor number and vendor name should be separted by '|' *****
        CONCATENATE i_data1-lifnr i_data1-name1 INTO vendor
          SEPARATED BY '|'.
        SHIFT vendor LEFT DELETING LEADING '0'.
        SHIFT vendor RIGHT DELETING TRAILING space.
    Date fields converted to MM/DD/YYYY format ****************
        MOVE i_data1-bldat+0(4) TO yy.
        MOVE i_data1-bldat+4(2) TO mm.
        MOVE i_data1-bldat+6(2) TO dd.
        CONCATENATE mm dd yy INTO inv_date SEPARATED BY '/'.
        MOVE i_data1-xblnr TO inv_nbr.
        SHIFT inv_nbr RIGHT DELETING TRAILING space.
        MOVE i_data1-augdt+0(4) TO yy.
        MOVE i_data1-augdt+4(2) TO mm.
        MOVE i_data1-augdt+6(2) TO dd.
        CONCATENATE mm dd yy INTO paid_dat SEPARATED BY '/'.
        MOVE i_data1-wrbtr TO inv_amt.
        CONDENSE inv_amt.
       SHIFT inv_amt RIGHT DELETING TRAILING space.
        MOVE i_data1-status TO status.
        MOVE i_data1-augbl TO ref_doc.
        CONCATENATE fidoc_year
                    comp_code
                    check_numbr
                    vendor
                    inv_date
                    inv_nbr
                    paid_dat
                    inv_amt
                    status
                    ref_doc
           INTO i_final_file-record SEPARATED BY '~'.
        APPEND i_final_file.
      ENDLOOP.
    ENDFORM.                    " MOVE_DATA
    *&                      Form  write_output                          &*
    *&                  Outputs all data to screen                      &*
    FORM write_output.
      LOOP AT i_data1.
        FORMAT COLOR 2 INTENSIFIED.
    Outputting line level information *******************
        WRITE :  /  sy-vline NO-GAP,
                 (10) i_data1-belnr,
                   sy-vline NO-GAP,
                (4) i_data1-gjahr,
                   sy-vline NO-GAP,
                 (6) i_data1-bukrs,
                   sy-vline NO-GAP,
                (10) i_data1-chect,
                  sy-vline NO-GAP,
                  (10) i_data1-lifnr,
                 sy-vline NO-GAP,
                 (35) i_data1-name1,
                   sy-vline NO-GAP,
                 (12) i_data1-bldat MM/DD/YYYY,
                   sy-vline NO-GAP,
                 (16)  i_data1-xblnr,
                   sy-vline NO-GAP,
                 (12) i_data1-augdt MM/DD/YYYY,
                   sy-vline NO-GAP,
                 (15) i_data1-wrbtr,
                   sy-vline NO-GAP,
                 (2) i_data1-status,
                   sy-vline NO-GAP,
                 (16) i_data1-augbl,
                   sy-vline NO-GAP,
                 (15) i_data1-sortl,
                 sy-vline NO-GAP.
      ENDLOOP.
      ULINE AT 0(190) NO-GAP.
    ENDFORM.                    " write_output
    In the program, I am downloading only the list.. The description of report outputted in the beginning of the report is not downloaded to excel.
    What has to be taken into consideration is that, the structure of the table i_data1 which contains the data to be downloaded to the table.
    I hope that this will help you.
    Regards,
    Susmitha

  • Export Simple list output to Excel sheet.

    Hi gurus,
    I have a list output as follows.
    A main header
    Sub header 1
    table entries.
    sub header 2.
    table entries ,......etc.
    now i want to export the same format to an excel sheet which need to sent as a mail attachment.
    Is there any FM for this ? i dont want the format to be disturbed.
    can headers and other entries defferentiated with colors ?
    kindly help on this.
    Edited by: deepan adhi on Oct 4, 2009 9:52 AM

    write the list to memory,
    and the read this memory into an internal table.  this will be exactly the same way as its printed on your screen. download it.
    or
    create an internal table of type string, add pass data from your final internal table in the exact way you are putting it in the output.
    and download this string internal table.

  • Clarifications in pick list output type EK00

    Hello ,
    Have any one of you used the pick list output EK00 . I have
    tried this and I do have some issues with
    We are using SAP R/3 4.7 x 200 version .
    Output type EK00 is not available in the application V2 (
    Shipping ) . Its available in application V4 (Shipping special
    case).
    1. I have assigned the shipping points through T code VOK2 as I
    am not able to find the output EK00 through customization menu.
    2. I have maintained the printers details through VP01SHP ( correct me if I am wrong) . I am using the standard program RVADEK01 and form
    SD_PICK_SINGLE in the output EK00.
    After doing the above setting when I am creating delivery in
    VL01N , the output type EK00 is not assigned automatically and
    when I try to assign it manually , it gives an error message
    "Processing program missing for output EK00 (medium 1)in
    application V2" . I dont know why the system is looking for
    application V2 when it is not available in V2 and only available
    in V4 .
    Am I missing anything in my process . Can some one help me in this .
    With regards,
    Joseph Anand.B

    Dear Joseph,
    Have you done the following setting in transaction v/38:
    1.On the Display View "Output Types": Overview screen, in the Output type group box, select EK00. (Application V4)
    2.In the left frame, under Dialog Structure, double-click on the Processing routines folder.
    3.On the Change View "Processing Routines": Overview screen, choose  .
    4.In the first medium, for Print output, enter the Smart Form print program /SMB40/RVADEK01 under Program and Smart Form /SMB40/SDPIK_L under SmartForm.
    Document Types        Picking List
    Output Types          EK00
    Transaction Code      v/38
    Smart Form Program    /SMB40/RVADEK01
    Smart Form            /SMB40/SDPIK_L
                          /SMB40/SDPIK_A
    5. Save the changes.
    Regards,
    Naveen.

  • List output to PDF download

    Hi experts,
    Is there other way that a list output screen can be saved in PDF without using spool ?
    I am working on the report that using the code "write: " , and the report output in list. 
    I am searching the solution to save the output list in PDF format to a assigned local or server file, and I don't want to use the spool, bc it needs the program executing is finished, and i want the output list and saving in PDF at the same.
    Maybe like set a button, when clicking the butten, then save the output list screen in PDF to a file. Or just writing in the program, when the list show out , then save to a file in PDF format.
    I am not sure that ABAP supports the function.
    Can anyone help me~~
    Thanks anyway!!   
    Regards
    Claire

    Thanks for your reply, Satyesh.
    I have tried the solution, but I get some trouble.
    Here is my code:
    case sy-ucomm.
          when 'DOWNLOAD'.
             call function 'GUI_DOWNLOAD'
               exporting
                  FILENAME  = p_fname
                  FILETYPE  = 'BIN'
               tables
                 DATA_TAB   = it
             exceptions
                  file_write_error        = 1
                  gui_refuse_filetransfer = 2
                  others                  = 3.
        endcase.
    p_fname = 'C:\test.pdf'.
    I assign the filetype to 'ASC' and 'BIN', but both of them bring the error message and interrupt the program.
    Here is the error analysis:
    The call to the function module "GUI_DOWNLOAD" is incorrect:
    The function module interface allows you to specify only fields
    of a particular type under "FILENAME". The field "P_FNAME" specified here
    has a different field type.
    I am still stuck with it.
    Please suggest me if i am wrong at any point.
    Regards
    Claire

  • LIST output and event handling in OO ALV and

    Hi,
    I am creating an ALV Report.
    How can i Display the Grid as a List. I am abke to change the view from the first grid that is created. but i need to show it as a list output from beginning.
    Also i have created a hotspot in and it works when the ALV is displayed in Grid Format but it does not work when i switch the view to list output.
    Any suggestions.
    Regards,
    Tarun Bahal

    *& Report  ZFI_TRIAL_BALANCE
    REPORT  zfi_trial_balance LINE-SIZE 275 LINE-COUNT 3(2) NO STANDARD PAGE HEADING.
    TABLES: bseg.
    TYPES: BEGIN OF ty_bkpf ,
      bukrs TYPE bkpf-bukrs,
      belnr TYPE bkpf-belnr,
      gjahr TYPE bkpf-gjahr,
      budat TYPE bkpf-budat,
      END OF ty_bkpf.
    TYPES: BEGIN OF ty_bseg ,
      bukrs TYPE bseg-bukrs,
      belnr TYPE bseg-belnr,
      gjahr TYPE bseg-gjahr,
      hkont TYPE bseg-hkont,
      END OF ty_bseg.
    TYPES: BEGIN OF ty_bank,
      hkont TYPE bseg-hkont,
      txt50 TYPE skat-txt50,
      open_dmbtr_dr TYPE p,
      open_dmbtr_cr TYPE p,
      trans_dmbtr_dr TYPE p,
      trans_dmbtr_cr TYPE p,
      close_dmbtr_dr TYPE p,
      close_dmbtr_cr TYPE p,
      END OF ty_bank.
    TYPES: BEGIN OF ty_breakup,
      bukrs TYPE bseg-bukrs,
      blart TYPE bkpf-blart,
      belnr TYPE bseg-belnr,
      budat TYPE bkpf-budat,
      umskz TYPE bseg-umskz,
      rebzg TYPE bseg-rebzg,
      lifnr TYPE  bseg-lifnr,
      kunnr TYPE bseg-kunnr,
      name1 TYPE lfa1-name1,
      dmbtr TYPE p,
      END OF ty_breakup.
    INITIALIZATION.
    *       CLASS handler DEFINITION
    CLASS handler DEFINITION.
      PUBLIC SECTION .
        METHODS:handle_hotspot_click                              "handler definition for hotspot_click
        FOR EVENT hotspot_click OF cl_gui_alv_grid
        IMPORTING e_row_id
                  e_column_id
                  es_row_no,
                 handle_top_of_page
        FOR EVENT print_top_of_page OF cl_gui_alv_grid
        IMPORTING table_index,
                handle_subtotal_text
        FOR EVENT subtotal_text OF cl_gui_alv_grid
        IMPORTING es_subtottxt_info
                  ep_subtot_line
                  e_event_data.
    ENDCLASS.                    "handler DEFINITION
    *       CLASS handler IMPLEMENTATION
    CLASS handler IMPLEMENTATION.
      METHOD handle_hotspot_click.                              "handler implementation for hotspot_click
        PERFORM handle_hotspot_click USING e_row_id
                                           e_column_id
                                           es_row_no .
      ENDMETHOD.                    "handle_hotspot_click
      METHOD handle_top_of_page.
        PERFORM handle_print_top_of_page.
      ENDMETHOD.                    "handle_hotspot_click
      METHOD handle_subtotal_text.
        PERFORM handle_subtotal_text USING es_subtottxt_info
                                           ep_subtot_line
                                           e_event_data.
      ENDMETHOD.                    "Subtotal_text
    ENDCLASS.                    "handler IMPLEMENTATION
    DATA: i_set_values TYPE TABLE OF rgsb4,
          wa_set_values LIKE LINE OF i_set_values,
          l_dmbtr TYPE dmbtr,
          l_dmbtr2 TYPE dmbtr,
          l_dmbtr3 TYPE dmbtr,
          l_dmbtr4 TYPE dmbtr,
          l_dmbtr_total TYPE dmbtr,
          l_shkzg TYPE shkzg,
          i_bkpf TYPE STANDARD TABLE OF ty_bkpf,
          i_bseg TYPE STANDARD TABLE OF ty_bseg,
          i_bank TYPE STANDARD TABLE OF ty_bank,
          i_breakup TYPE STANDARD TABLE OF ty_breakup,
          wa_bkpf LIKE LINE OF i_bkpf,
          wa_bseg LIKE LINE OF i_bseg,
          wa_bank LIKE LINE OF i_bank,
          wa_breakup LIKE LINE OF i_breakup,
          ok_code TYPE sy-ucomm,
          save_ok TYPE sy-ucomm,
          l_ktopl TYPE ktopl.
    DATA: gr_alvgrid TYPE REF TO cl_gui_alv_grid,
          gr_alvgrid_0200 TYPE REF TO cl_gui_alv_grid,
          gr_ccontainer TYPE REF TO cl_gui_custom_container,
          gr_ccontainer_0200 TYPE REF TO cl_gui_custom_container,
          gt_fieldcat TYPE lvc_t_fcat,
          gs_layout TYPE lvc_s_layo,
          gt_sort TYPE lvc_t_sort,
          gt_roid TYPE lvc_t_roid,
          gt_exclude TYPE ui_functions,
          g_scrstatus TYPE i,
          gs_variant TYPE disvariant,
          o_handler TYPE REF TO handler.
    CONSTANTS: c_doctype(22) TYPE c VALUE 'ZINFITR01_TRIALBALANCE'.
    DATA gs_stbl TYPE lvc_s_stbl.
    SELECTION-SCREEN: BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: l_date FOR sy-datum.
    PARAMETERS : l_bukrs TYPE bukrs,
                 l_segent TYPE fb_segment.
    SELECTION-SCREEN: END OF BLOCK block1.
    START-OF-SELECTION.
      gs_stbl-row = 'X'.
      gs_stbl-col = 'X'.
      CALL FUNCTION 'G_SET_GET_ALL_VALUES'
        EXPORTING
          setnr         = c_doctype
          table         = 'SKA1'
          class         = '0000'
        TABLES
          set_values    = i_set_values
        EXCEPTIONS
          set_not_found = 1
          OTHERS        = 2.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CLEAR i_bank.
      LOOP AT i_set_values INTO wa_set_values.
        CLEAR: l_dmbtr, l_dmbtr2, l_dmbtr3, l_dmbtr4, i_bkpf, i_bseg.
        wa_bank-hkont = wa_set_values-from.
        SELECT bukrs belnr budat gjahr FROM bkpf
          INTO CORRESPONDING FIELDS OF TABLE i_bkpf
          WHERE bukrs = l_bukrs
            AND budat < l_date-low.
        LOOP AT i_bkpf INTO wa_bkpf.
          SELECT dmbtr shkzg FROM bseg INTO (l_dmbtr, l_shkzg)
            WHERE bukrs = wa_bkpf-bukrs
              AND belnr = wa_bkpf-belnr
              AND gjahr = wa_bkpf-gjahr
              AND hkont = wa_set_values-from.
            IF l_shkzg = 'S'.
              l_dmbtr2 = l_dmbtr2 + l_dmbtr.
            ELSE.
              l_dmbtr2 = l_dmbtr2 - l_dmbtr.
            ENDIF.
            CLEAR: l_dmbtr, l_shkzg.
          ENDSELECT.
        ENDLOOP.
        IF l_dmbtr2 > 0.
          wa_bank-open_dmbtr_dr = l_dmbtr2.
        ELSE.
          wa_bank-open_dmbtr_cr = l_dmbtr2.
        ENDIF.
        CLEAR: l_dmbtr, i_bkpf, i_bseg.
        SELECT bukrs belnr budat gjahr FROM bkpf
          INTO CORRESPONDING FIELDS OF TABLE i_bkpf
          WHERE bukrs = l_bukrs
            AND budat IN l_date.
        LOOP AT i_bkpf INTO wa_bkpf.
          SELECT dmbtr shkzg FROM bseg INTO (l_dmbtr, l_shkzg)
            WHERE bukrs = wa_bkpf-bukrs
              AND belnr = wa_bkpf-belnr
              AND gjahr = wa_bkpf-gjahr
              AND hkont = wa_set_values-from.
            IF l_shkzg = 'S'.
              l_dmbtr3 = l_dmbtr3 + l_dmbtr.
            ELSE.
              l_dmbtr4 = l_dmbtr4 - l_dmbtr.
            ENDIF.
            CLEAR: l_dmbtr, l_shkzg.
          ENDSELECT.
        ENDLOOP.
    *    IF l_dmbtr3 > 0.
        wa_bank-trans_dmbtr_dr = l_dmbtr3.
    *    ELSE.
        wa_bank-trans_dmbtr_cr = l_dmbtr4.
    *    ENDIF.
        l_dmbtr = l_dmbtr2 + l_dmbtr3 + l_dmbtr4.
        IF l_dmbtr > 0.
          wa_bank-close_dmbtr_dr = l_dmbtr.
        ELSE.
          wa_bank-close_dmbtr_cr = l_dmbtr.
        ENDIF.
        CLEAR: l_dmbtr.
        SELECT SINGLE ktopl FROM t001 INTO l_ktopl WHERE bukrs = l_bukrs.
        SELECT SINGLE txt50 FROM skat INTO wa_bank-txt50
          WHERE spras = sy-langu "( SELECT spras FROM t002 WHERE laiso = sy-langu )
          AND ktopl = l_ktopl
          AND saknr = wa_set_values-from.
        APPEND wa_bank TO i_bank.
        CLEAR wa_bank.
      ENDLOOP.
      LOOP AT i_bank INTO wa_bank.
    *    IF wa_bank-open_dmbtr_cr < 0.
        wa_bank-open_dmbtr_cr = wa_bank-open_dmbtr_cr * -1.
    *    ENDIF.
    *    IF wa_bank-trans_dmbtr_cr < 0.
        wa_bank-trans_dmbtr_cr = wa_bank-trans_dmbtr_cr * -1.
    *    ENDIF.
    *    IF wa_bank-close_dmbtr_cr < 0.
        wa_bank-close_dmbtr_cr = wa_bank-close_dmbtr_cr * -1.
    *    ENDIF.
        MODIFY i_bank FROM wa_bank.
      ENDLOOP.
      SORT i_bank ASCENDING BY hkont.
    END-OF-SELECTION.
    *  SET SCREEN 100.
      CALL SCREEN 100.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS01'.
      SET TITLEBAR 'TITLE1'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  save_ok  INPUT
    *       text
    MODULE save_ok INPUT.
      save_ok = ok_code.
      CLEAR ok_code.
    ENDMODULE.                 " save_ok  INPUT
    *&      Module  create_alv  OUTPUT
    *       text
    MODULE create_alv OUTPUT.
      IF gr_alvgrid IS INITIAL.
        CREATE OBJECT gr_ccontainer
          EXPORTING
    *    PARENT                      =
            container_name              = 'CUSTOM_CONTAINER'
            repid                       = sy-repid
            dynnr                       = '0100'
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            OTHERS                      = 6.
        IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        CREATE OBJECT gr_alvgrid
          EXPORTING
            i_parent          = gr_ccontainer
          EXCEPTIONS
            error_cntl_create = 1
            error_cntl_init   = 2
            error_cntl_link   = 3
            error_dp_create   = 4
            OTHERS            = 5.
        IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        PERFORM prepare_field_catalog CHANGING gt_fieldcat .
        PERFORM prepare_layout CHANGING gs_layout .
        PERFORM prepare_sort CHANGING gt_sort.
        gs_variant-report = sy-repid.
        gs_variant-variant = 'ABC'.
        gs_variant-handle = '1'.
    *    IF sy-dynnr = '0100'.
        CALL METHOD gr_alvgrid->set_table_for_first_display
          EXPORTING
    *      I_BUFFER_ACTIVE               =
    *      I_BYPASSING_BUFFER            =
    *      I_CONSISTENCY_CHECK           =
    *      I_STRUCTURE_NAME              =
    *      is_variant                    = gs_variant
    *      i_save                        = 'A'
    *      i_default                     = 'X'
            is_layout                     = gs_layout
    *      IS_PRINT                      =
    *      IT_SPECIAL_GROUPS             =
    *      IT_TOOLBAR_EXCLUDING          =
    *      IT_HYPERLINK                  =
    *      IT_ALV_GRAPHICS               =
    *      IT_EXCEPT_QINFO               =
    *      IR_SALV_ADAPTER               =
          CHANGING
            it_outtab                     = i_bank
            it_fieldcatalog               = gt_fieldcat
    *    it_sort                       = gt_sort
    *      IT_FILTER                     =
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          OTHERS                        = 4
        IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ELSE.
        CALL METHOD gr_alvgrid->refresh_table_display
          EXPORTING
            is_stable      = gs_stbl
    *        i_soft_refresh = 'X'
          EXCEPTIONS
            finished       = 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.
      ENDIF.
      CREATE OBJECT o_handler.
      SET HANDLER o_handler->handle_hotspot_click FOR gr_alvgrid.
      SET HANDLER o_handler->handle_top_of_page FOR gr_alvgrid.
      SET HANDLER o_handler->handle_subtotal_text FOR gr_alvgrid.
    *  ENDIF.
    ENDMODULE.                 " create_alv  OUTPUT
    *&      Form  prepare_field_catalog
    *       text
    *      <--P_GT_FIELDCAT  text
    FORM prepare_field_catalog  CHANGING pt_fieldcat TYPE lvc_t_fcat.
      DATA: ls_fcat TYPE lvc_s_fcat.
      CLEAR pt_fieldcat.
      CLEAR gt_fieldcat.
    *  IF sy-dynnr = '0100'.
      ls_fcat-fieldname = 'HKONT' .
      ls_fcat-ref_field = 'HKONT'.
      ls_fcat-inttype = 'C' .
      ls_fcat-outputlen = '15' .
      ls_fcat-ref_table = 'BSEG' .
      ls_fcat-coltext = 'G/L Account' .
      ls_fcat-seltext = 'G/L Account' .
      ls_fcat-hotspot = 'X'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
      ls_fcat-fieldname = 'TXT50' .
      ls_fcat-ref_field = 'TXT50'.
      ls_fcat-inttype = 'C' .
      ls_fcat-outputlen = '20' .
      ls_fcat-ref_table = 'SKAT' .
      ls_fcat-coltext = 'Description' .
      ls_fcat-seltext = 'Description' .
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
      ls_fcat-fieldname = 'OPEN_DMBTR_DR' .
      ls_fcat-ref_field = 'DMBTR'.
      ls_fcat-inttype = 'NUMC' .
      ls_fcat-outputlen = '20' .
      ls_fcat-ref_table = 'BSEG'.
      ls_fcat-coltext = 'Opening Balance: Debit' .
      ls_fcat-seltext = 'Opening Balance: Debit'.
      ls_fcat-no_sign = 'X'.
      ls_fcat-do_sum = 'X'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
      ls_fcat-fieldname = 'OPEN_DMBTR_CR' .
      ls_fcat-ref_field = 'DMBTR'.
      ls_fcat-inttype = 'NUMC' .
      ls_fcat-outputlen = '20' .
      ls_fcat-ref_table = 'BSEG'.
      ls_fcat-coltext = 'Opening Balance: Credit' .
      ls_fcat-seltext = 'Opening Balance: Credit'.
      ls_fcat-no_sign = 'X'.
      ls_fcat-do_sum = 'X'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
      ls_fcat-fieldname = 'TRANS_DMBTR_DR' .
      ls_fcat-ref_field = 'DMBTR'.
      ls_fcat-inttype = 'NUMC' .
      ls_fcat-outputlen = '20' .
      ls_fcat-ref_table = 'BSEG'.
      ls_fcat-coltext = 'Trans Balance: Debit' .
      ls_fcat-seltext = 'Trans Balance: Debit'.
      ls_fcat-no_sign = 'X'.
      ls_fcat-do_sum = 'X'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
      ls_fcat-fieldname = 'TRANS_DMBTR_CR' .
      ls_fcat-ref_field = 'DMBTR'.
      ls_fcat-inttype = 'NUMC' .
      ls_fcat-outputlen = '20' .
      ls_fcat-ref_table = 'BSEG'.
      ls_fcat-coltext = 'Trans Balance: Credit' .
      ls_fcat-seltext = 'Trans Balance: Credit'.
      ls_fcat-no_sign = 'X'.
      ls_fcat-do_sum = 'X'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
      ls_fcat-fieldname = 'CLOSE_DMBTR_DR' .
      ls_fcat-ref_field = 'DMBTR'.
      ls_fcat-inttype = 'NUMC' .
      ls_fcat-outputlen = '20' .
      ls_fcat-ref_table = 'BSEG'.
      ls_fcat-coltext = 'Closing Balance: Debit' .
      ls_fcat-seltext = 'Closing Balance: Debit'.
      ls_fcat-no_sign = 'X'.
      ls_fcat-do_sum = 'X'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
      ls_fcat-fieldname = 'CLOSE_DMBTR_CR' .
      ls_fcat-ref_field = 'DMBTR'.
      ls_fcat-inttype = 'NUMC' .
      ls_fcat-outputlen = '20' .
      ls_fcat-ref_table = 'BSEG'.
      ls_fcat-coltext = 'Closing Balance: Credit' .
      ls_fcat-seltext = 'Closing Balance: Credit'.
      ls_fcat-no_sign = 'X'.
      ls_fcat-do_sum = 'X'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
    *  ELSE.
    *  ENDIF.
    ENDFORM.                    " prepare_field_catalog
    *&      Form  prepare_layout
    *       text
    *      <--P_GS_LAYOUT  text
    FORM prepare_layout  CHANGING ps_layout TYPE lvc_s_layo.
      DATA l_title(50) TYPE c.
      CONCATENATE 'Trial Balance: ' l_date-low+6(2) '-' l_date-low+4(2) '-'l_date-low(4) ' to ' l_date-high+6(2) '-' l_date-high+4(2) '-'l_date-high(4) INTO l_title RESPECTING BLANKS.
    *  ps_layout-zebra = 'X' .
      ps_layout-grid_title = l_title.
      ps_layout-cwidth_opt = 'X' .
      ps_layout-sel_mode = 'A'.
    *  ps_layout-no_toolbar = 'X'.
      ps_layout-no_headers = 'X'.
      ps_layout-frontend = 'L'.
    ENDFORM.                    " prepare_layout
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE save_ok.
        WHEN 'BACK'.
          SET SCREEN 0.
          LEAVE SCREEN.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  prepare_sort
    *       text
    *      <--P_GT_SORT  text
    FORM prepare_sort  CHANGING pt_sort TYPE lvc_t_sort.
      CLEAR: pt_sort, gt_sort.
      DATA ls_sort TYPE lvc_s_sort .
      IF sy-dynnr = '0100'.
        ls_sort-spos = '1' .
        ls_sort-fieldname = 'HKONT' .
        ls_sort-up = 'X' . "A to Z
        ls_sort-down = space .
        APPEND ls_sort TO pt_sort .
      ELSE.
        ls_sort-spos = '1' .
        ls_sort-fieldname = 'BELNR' .
        ls_sort-up = 'X' . "A to Z
        ls_sort-down = space .
        APPEND ls_sort TO pt_sort .
    *    ls_sort-spos = '2' .
    *    ls_sort-fieldname = 'BELNR' .
    **    ls_sort-up = 'X' . "A to Z
    **    ls_sort-down = space .
    *    ls_sort-subtot = 'X'.
    *    APPEND ls_sort TO pt_sort .
      ENDIF.
    ENDFORM.                    " prepare_sort
    *&      Form  handle_hotspot_click
    *       text
    *      -->P_E_ROW_ID  text
    *      -->P_E_COLUMN_ID  text
    *      -->P_ES_ROW_NO  text
    FORM handle_hotspot_click  USING i_row_id TYPE lvc_s_row
                                     i_column_id TYPE lvc_s_col
                                     is_row_no TYPE lvc_s_roid.
      CLEAR: wa_bank, i_breakup.
      READ TABLE i_bank INTO wa_bank INDEX is_row_no-row_id.
    *TYPES: BEGIN OF ty_breakup,
    *  bukrs TYPE bseg-bukrs,
    *  blart TYPE bkpf-blart,
    *  belnr TYPE bseg-belnr,
    *  budat TYPE bkpf-budat,
    *  umskz TYPE bseg-umskz,
    *  rebzg TYPE bseg-rebzg,
    *  lifnr TYPE  bseg-lifnr,
    *  name1 TYPE lfa1-name1,
    *  dmbtr TYPE p,
    *  END OF ty_breakup.
      SELECT bukrs belnr budat gjahr FROM bkpf
            INTO CORRESPONDING FIELDS OF TABLE i_bkpf
            WHERE bukrs = l_bukrs
              AND budat IN l_date.
      LOOP AT i_bkpf INTO wa_bkpf.
        SELECT bukrs belnr umskz rebzg lifnr kunnr dmbtr shkzg FROM bseg
          INTO (wa_breakup-bukrs, wa_breakup-belnr, wa_breakup-umskz, wa_breakup-rebzg, wa_breakup-lifnr, wa_breakup-kunnr, wa_breakup-dmbtr, l_shkzg)
          WHERE bukrs = l_bukrs
                  AND belnr = wa_bkpf-belnr
                  AND gjahr = wa_bkpf-gjahr
                  AND hkont = wa_bank-hkont.
          SELECT SINGLE blart budat FROM bkpf INTO (wa_breakup-blart, wa_breakup-budat)
            WHERE bukrs = l_bukrs
                  AND belnr = wa_bkpf-belnr
                  AND gjahr = wa_bkpf-gjahr.
          IF wa_breakup-lifnr IS NOT INITIAL.
            SELECT SINGLE name1 FROM lfa1 INTO wa_breakup-name1
              WHERE lifnr = wa_breakup-lifnr.
          ELSE.
            SELECT SINGLE name1 FROM kna1 INTO wa_breakup-name1
            WHERE lifnr = wa_breakup-kunnr.
            wa_breakup-lifnr = wa_breakup-kunnr.
          ENDIF.
        ENDSELECT.
        IF l_shkzg = 'H'.
          wa_breakup-dmbtr = wa_breakup-dmbtr * -1.
        ENDIF.
        IF wa_breakup IS NOT INITIAL.
          APPEND wa_breakup TO i_breakup.
        ENDIF.
        CLEAR wa_breakup.
      ENDLOOP.
      SET SCREEN 200.
      LEAVE SCREEN.
    ENDFORM.                    " handle_hotspot_click
    *&      Module  STATUS_0200  OUTPUT
    *       text
    MODULE status_0200 OUTPUT.
      SET PF-STATUS 'STATUS01'.
      SET TITLEBAR 'TITLE2'.
    ENDMODULE.                 " STATUS_0200  OUTPUT
    *&      Module  USER_COMMAND_0200  INPUT
    *       text
    MODULE user_command_0200 INPUT.
      CASE save_ok.
        WHEN 'BACK'.
    *      CLEAR: gr_alvgrid, gr_ccontainer.
          SET SCREEN 100.
          LEAVE SCREEN .
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0200  INPUT
    *&      Module  create_alv_0200  OUTPUT
    *       text
    MODULE create_alv_0200 OUTPUT.
      IF gr_alvgrid_0200 IS INITIAL.
        CREATE OBJECT gr_ccontainer_0200
              EXPORTING
    *    PARENT                      =
                container_name              = 'CUSTOM_CONTAINER'
                repid                       = sy-repid
                dynnr                       = '0200'
              EXCEPTIONS
                cntl_error                  = 1
                cntl_system_error           = 2
                create_error                = 3
                lifetime_error              = 4
                lifetime_dynpro_dynpro_link = 5
                OTHERS                      = 6.
        IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        CREATE OBJECT gr_alvgrid_0200
          EXPORTING
            i_parent          = gr_ccontainer_0200
          EXCEPTIONS
            error_cntl_create = 1
            error_cntl_init   = 2
            error_cntl_link   = 3
            error_dp_create   = 4
            OTHERS            = 5.
        IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        PERFORM prepare_field_catalog_0200 CHANGING gt_fieldcat .
    *  PERFORM prepare_layout CHANGING gs_layout .
        PERFORM prepare_sort CHANGING gt_sort.
        CALL METHOD gr_alvgrid_0200->set_table_for_first_display
          EXPORTING
    *      I_BUFFER_ACTIVE               =
    *      I_BYPASSING_BUFFER            =
    *      I_CONSISTENCY_CHECK           =
    *      I_STRUCTURE_NAME              =
    *      IS_VARIANT                    =
    *      I_SAVE                        =
    *      I_DEFAULT                     = 'X'
            is_layout                     = gs_layout
    *      IS_PRINT                      =
    *      IT_SPECIAL_GROUPS             =
    *      IT_TOOLBAR_EXCLUDING          =
    *      IT_HYPERLINK                  =
    *      IT_ALV_GRAPHICS               =
    *      IT_EXCEPT_QINFO               =
    *      IR_SALV_ADAPTER               =
          CHANGING
            it_outtab                     = i_breakup
            it_fieldcatalog               = gt_fieldcat
          it_sort                       = gt_sort
    *      IT_FILTER                     =
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          OTHERS                        = 4
        IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ELSE.
        CALL METHOD gr_alvgrid_0200->refresh_table_display
          EXPORTING
            is_stable      = gs_stbl
    *        i_soft_refresh = 'X'
          EXCEPTIONS
            finished       = 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.
      ENDIF.
    *  SET SCREEN 100.
    ENDMODULE.                 " create_alv_0200  OUTPUT
    *&      Form  prepare_field_catalog_0200
    *       text
    *      <--P_GT_FIELDCAT  text
    FORM prepare_field_catalog_0200  CHANGING pt_fieldcat TYPE lvc_t_fcat.
      DATA: ls_fcat TYPE lvc_s_fcat.
      CLEAR: pt_fieldcat, gs_layout.
      ls_fcat-fieldname = 'BUKRS' .
      ls_fcat-ref_field = 'BUKRS'.
      ls_fcat-inttype = 'c' .
      ls_fcat-outputlen = '5' .
      ls_fcat-ref_table = 'BSEG'.
      ls_fcat-coltext = 'Co' .
      ls_fcat-seltext = 'Company Code'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
      ls_fcat-fieldname = 'BLART' .
      ls_fcat-ref_field = 'BLART'.
      ls_fcat-inttype = 'c' .
      ls_fcat-outputlen = '5' .
      ls_fcat-ref_table = 'BKPF'.
      ls_fcat-coltext = 'Doc Typ' .
      ls_fcat-seltext = 'Document Type'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
      ls_fcat-fieldname = 'BELNR' .
      ls_fcat-ref_field = 'BELNR'.
      ls_fcat-inttype = 'NUMC' .
      ls_fcat-outputlen = '12' .
      ls_fcat-ref_table = 'BSEG'.
      ls_fcat-coltext = 'Doc Num' .
      ls_fcat-seltext = 'Document Number'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
      ls_fcat-fieldname = 'BUDAT' .
      ls_fcat-ref_field = 'BUDAT'.
      ls_fcat-inttype = 'DATS' .
      ls_fcat-outputlen = '13' .
      ls_fcat-ref_table = 'BKPF'.
      ls_fcat-coltext = 'G/L Date' .
      ls_fcat-seltext = 'G/L Posting Date'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
      ls_fcat-fieldname = 'UMSKZ' .
      ls_fcat-ref_field = 'UMSKZ'.
      ls_fcat-inttype = 'C' .
      ls_fcat-outputlen = '5' .
      ls_fcat-ref_table = 'BSEG'.
      ls_fcat-coltext = 'G/L Indicator' .
      ls_fcat-seltext = 'Special G/L Indicator'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
      ls_fcat-fieldname = 'REBZG' .
      ls_fcat-ref_field = 'REBZG'.
      ls_fcat-inttype = 'C' .
      ls_fcat-outputlen = '13' .
      ls_fcat-ref_table = 'BSEG'.
      ls_fcat-coltext = 'Reference' .
      ls_fcat-seltext = 'Invoice Number'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
      ls_fcat-fieldname = 'LIFNR' .
      ls_fcat-ref_field = 'LIFNR'.
      ls_fcat-inttype = 'NUMC' .
      ls_fcat-outputlen = '13' .
      ls_fcat-ref_table = 'LFA1'.
      ls_fcat-coltext = 'Vendor/Customer' .
      ls_fcat-seltext = 'Vendor/Customer Number'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
      ls_fcat-fieldname = 'NAME1' .
      ls_fcat-ref_field = 'NAME1'.
      ls_fcat-inttype = 'C' .
      ls_fcat-outputlen = '50' .
      ls_fcat-ref_table = 'LFA1'.
      ls_fcat-coltext = 'Description' .
      ls_fcat-seltext = 'Description'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
      ls_fcat-fieldname = 'DMBTR' .
      ls_fcat-ref_field = 'DMBTR'.
      ls_fcat-inttype = 'NUMC' .
      ls_fcat-outputlen = '25' .
      ls_fcat-ref_table = 'BSEG'.
      ls_fcat-coltext = 'Amount' .
      ls_fcat-seltext = 'Amount'.
      ls_fcat-no_sign = 'X'.
      ls_fcat-do_sum = 'X'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
    ENDFORM.                    " prepare_field_catalog_0200
    *&      Form  handle_print_top_of_page
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM handle_print_top_of_page .
      WRITE: sy-uline.
      WRITE: /(255)'Tecnimont ICB' CENTERED.
      WRITE: /(255)'Trial Balance' CENTERED.
      WRITE: 'Trial Balance for ', l_bukrs, ':  From Period - ', l_date-low, 'To Period - ', l_date-high. "LEFT-JUSTIFIED .
      WRITE: /.
      WRITE: / sy-uline.
      FORMAT COLOR 1.
      WRITE: sy-vline, AT 2(59)'Account Code and Name'CENTERED, AT 60 sy-vline, AT 61(45) 'Opening Balance' CENTERED, AT 107 sy-vline, AT 108(41) 'Transactions' CENTERED , AT 150 sy-vline, AT 155(41) 'Closing Balance' CENTERED,  AT 197 sy-vline.
      FORMAT COLOR 4.
      WRITE: sy-vline,'GL Account'LEFT-JUSTIFIED, AT 16(50)'Description'CENTERED, AT 60 sy-vline, AT 61(23) 'Debits'CENTERED, AT 85(23) 'Credits.'CENTERED, AT 107 sy-vline, AT 108(23) 'Debits'CENTERED, AT 128(23)'Credits'CENTERED, AT 150 sy-vline, AT 151(23)
      'Debits'CENTERED, AT 174(23) 'Credits'CENTERED, AT 197 sy-vline.
      FORMAT COLOR OFF.
    *  WRITE: sy-uline.
    ENDFORM.                    " handle_print_top_of_page
    *&      Form  handle_subtotal_text
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM handle_subtotal_text USING es_subtottxt_info TYPE lvc_s_stxt
                                   ep_subtot_line TYPE REF TO data
                                   e_event_data TYPE REF TO
                                   cl_alv_event_data.
      DATA l_bank LIKE wa_bank.
      FIELD-SYMBOLS: <fs1> STRUCTURE wa_bank DEFAULT l_bank,
                   <fs2>.
      IF es_subtottxt_info-criteria = 'TXT50'.
        ASSIGN ep_subtot_line->* TO <fs1>.
        ASSIGN e_event_data->m_data->* TO <fs2>.
        CONCATENATE es_subtottxt_info-keyword 'Grand Summary: '
                     INTO <fs2>.
      ENDIF.
    ENDFORM.                    " handle_subtotal_text
    This  is the Code............... this code creates a Grid and not list and hotspot event wors on grid and not on list.
    Regards,
    Tarun Bahal

  • List output in Module pool programming

    Hi Gurus.,
            I need to use write statement to display output using Call Screen xxx starting at xx ending at xx as dialog box .. How can i achieve this ...I tried the following in PBO of the screen but only a blank screen comes as output ...
    *&      Module  STATUS_0102  OUTPUT
          text
    MODULE STATUS_0102 OUTPUT.
      SET PF-STATUS 'MENU1' OF PROGRAM 'ZHM053C_MB01_J1IFQ_J1IF13'.
    SET TITLEBAR 'xxx'.
      ULINE.
      WRITE: / '                                                *************EXECUTION SUMMARY*************                                               ' COLOR 4.  ULINE.
      WRITE / ''.
      SKIP 1.
      LOOP AT IT_MESS.
        IF IT_MESS-MSGTYP EQ 'E'.
          FORMAT COLOR 7 .
          WRITE :  IT_MESS-MESSAGE.
        ELSE.
          FORMAT COLOR 2 .
          WRITE :  IT_MESS-MESSAGE.
        ENDIF.
        AT END OF TCODE.
          WRITE / SY-ULINE.
        ENDAT.
      ENDLOOP.
    ENDMODULE.                 " STATUS_0102  OUTPUT
    please help me its very urgent
    Regards.,
    S.Sivakumar

    Hi,
    REPORT demo_leave_to_list_processing .
    TABLES sdyn_conn.
    DATA: wa_spfli TYPE spfli,
          flightdate TYPE sflight-fldate.
    CALL SCREEN 100.
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'SCREEN_100'.
    ENDMODULE.
    MODULE cancel INPUT.
      LEAVE PROGRAM.
    ENDMODULE.
    MODULE user_command_0100.
      CALL SCREEN 500.
      SET SCREEN 100.
    ENDMODULE.
    MODULE call_list_500 OUTPUT.
      LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
      SET PF-STATUS space.
      SUPPRESS DIALOG.
      SELECT  carrid connid cityfrom cityto
        FROM  spfli
        INTO  CORRESPONDING FIELDS OF wa_spfli
        WHERE carrid = sdyn_conn-carrid.
        WRITE: / wa_spfli-carrid, wa_spfli-connid,
                 wa_spfli-cityfrom, wa_spfli-cityto.
        HIDE: wa_spfli-carrid, wa_spfli-connid.
      ENDSELECT.
      CLEAR: wa_spfli-carrid.
    ENDMODULE.
    TOP-OF-PAGE.
      WRITE text-001 COLOR COL_HEADING.
      ULINE.
    TOP-OF-PAGE DURING LINE-SELECTION.
      WRITE sy-lisel COLOR COL_HEADING.
      ULINE.
    AT LINE-SELECTION.
      CHECK not wa_spfli-carrid is initial.
      SELECT  fldate
        FROM  sflight
        INTO  flightdate
        WHERE carrid = wa_spfli-carrid AND
              connid = wa_spfli-connid.
         WRITE / flightdate.
      ENDSELECT.
      CLEAR: wa_spfli-carrid.
    This example switches to list processing during the screen processing for screen 100. Screen 100 has a single input field - the component CARRID from the ABAP Dictionary structure SDYN_CONN.
    The flow logic of screen 100 is:
    PROCESS BEFORE OUTPUT.
      MODULE status_0100.
    PROCESS AFTER INPUT.
      MODULE cancel AT EXIT-COMMAND.
      MODULE user_command_0100.
    The PAI module user_command_0100 calls screen 500 using the CALL SCREEN statement. This screen encapsulates a basic list. It has the following flow logic:
    PROCESS BEFORE OUTPUT.
      MODULE call_list_500.
    PROCESS AFTER INPUT.
    The module call_list_500 defines the basic list and switches to list processing. Since the next screen after list processing is screen 0, screen 500 is a one-screen screen chain. After list processing, control returns to the position in user_command_0100 from which screen 500 was called.
    If the user selects a line on the basic list, a detail list appears. This is achieved through the event block AT LINE-SELECTION. The program also contains event blocks for TOP-OF-PAGE and TOP-OF-PAGE DURING LINE-SELECTION, which define page headers for both the basic list and detail list.
    Since there is only one list system in this program, there is no need for case distinctions within the list events.
    With thanks & regards,
    Sravani yendru.

  • Table / FM which stores element list for a screen number

    Hi everyone,
    I have a module pool program, with a few screens. I want to make a list of all screen fields used in my program. Is there a table or Function Module which maps this? Say progname-dynpro-fieldname?
    For example, my module pool program is SAPMZPROG, and my screens are 9001 and 9002. In 9001, my fields are ZTAB1-ZFIELD1 and ZTAB1-ZFIELD2. In 9002, fields are ZTAB2-ZFIELD1, ZTAB2-ZFIELD2 and ZTAB2-ZFIELD3. Then my output will be something like:
    "9001"  "ZTAB1-ZFIELD1"
    "9001"  "ZTAB1-ZFIELD2"
    "9002"  "ZTAB2-ZFIELD1"
    "9002"  "ZTAB2-ZFIELD2"
    "9002"  "ZTAB2-ZFIELD3".
    (the output does not give field values, they are actual screen numbers and field names)
    Thanks,
    Shailesh.
    Edited by: Shailesh S Kamath on Jul 8, 2009 8:11 AM
    Edited by: Shailesh S Kamath on Jul 8, 2009 8:12 AM

    Hi,
    You can achieve this by using the SCREEN internal table...
    in your screen 9001 loop at this screen internal tabel and move its 'NAME' field to another internal table.. Do the same for your other screen.. And then merge the two... Hope this is clear...

  • Printing report list output in A4 paper

    Hi!
    Is it possible to fit the list output of a report having a line-size of 240 into an A4 paper ?...when I was trying to print the output is being cut. Some columns at the right were not printed since all columns do not fit on the paper even on landscape. The system defaults format is X_65_255 which has 65 rows and 255 lines. How can I make it fit an A4 paper?
    Thanks in advance!

    Hi Mervin,
    To make printing possible on A4 paper you'll need to define a new output format.
    For this use transaction SPAD.
    Press the button "Full Administration" (F7).
    Select the tab "Device Types".
    Press the button "Page formats".
    Set the screen in Change Mode (press Change button or F8).
    Press the Create button (Shift+F1).
    Give a name (starting with Z, like Z_LAND).
    Select Orientation "Landscape".
    Set papersize width/unit to 255 CH
    Set papersize height/unit to 65 LN
    Save your work.
    Go back to tha SPAD tabpages.
    Press the button "Format Types".
    Set the screen in Change Mode (press Change button or F8).
    Press the Create button (Shift+F1).
    Enter in the screen a format name (starting with Z or Y).
    Set the format type to type L (Format type for ABAP lists).
    Set the page format to your created format (like Z_LAND).
    Enter the number of lines that can be printed on A4 (e.g. 65)
    Enter the number characters (columns) that can be printed on one row on A4 (e.g. 255).
    Give a comprehensive comment.
    Save your work.
    Go back to tha SPAD tabpages.
    Select tab "Devices / servers".
    Press the button "Output devices".
    Select your printer.
    Set the screen in Change Mode (press Change button or F8).
    Go to tabpage "Tray info".
    Choose the right tray for your selected printer and fill in the previously created page format.
    Save your work.
    Leave transaction SPAD.
    This format can be used to print your reports.
    Remove your own printerdefault (Via menu System --> User profile --> Own data, tabpage Defaults).
    When printing a dialog appears where you now can choose the modified printer (with modified page settings).
    As you can see, this is more of a job the the admin guys.
    As a remark: The default page formax X_65_255 should print 255 columns on paper (landscape). Most likely a small character set is used for this. The character size can also be modified (in the same transaction) to fit an entire row.
    Hope this gives you a clue where you can influence the way lists are printed.
    Regards,
    Rob.

  • Printing the list output.

    Hi All,
    I want to print the output of the report. I am printing it using NEW-PAGE PRINT ON . and concluded by NEW-PAGE PRINT OFF. I am doing this under the usercommand.  The problem is,, when I say print,(user command), I can print the output but the it is leading to the previous screen. I want to be in the same screen after my printing. I am pasting the code also. Can any one suggest me, where I am doing the mistake.
    <b><REMOVED BY MODERATOR></b>
    CASE P_UCOMM1.
        WHEN 'PRINT11'.
          CALL FUNCTION 'GET_PRINT_PARAMETERS'
            EXPORTING
              COPIES         = '1'
              DESTINATION    = 'LOCL'
              IMMEDIATELY    = 'X'
              LINE_COUNT     = 25
              LINE_SIZE      = 132
              NO_DIALOG      = 'X'
              USER           = SY-UNAME
              ABAP_LIST      = 'X'
            IMPORTING
              OUT_PARAMETERS = L_PARAMS
              VALID          = L_VALID.
    &--'REUSE_ALV_HIERSEQ_LIST_DISPLAY'--
          DATA:FLAG(1).
          CLEAR FLAG.
          IF L_VALID <> SPACE.
            NEW-PAGE PRINT ON PARAMETERS L_PARAMS NO DIALOG.
            CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
              EXPORTING
                I_CALLBACK_PROGRAM       = GD_REPID
               I_CALLBACK_PF_STATUS_SET = 'PF_STATUS_SET1'
               I_CALLBACK_USER_COMMAND  = 'EXEC'
                IS_LAYOUT                = M_LAYOUT
                IT_FIELDCAT              = I_FLDCATALOG
                IT_EVENTS                = I_EVENTS
                I_TABNAME_HEADER         = 'I_MHEAD'
                I_TABNAME_ITEM           = 'I_MITEM'
                IS_KEYINFO               = M_KEYINFO
              TABLES
                T_OUTTAB_HEADER          = I_MHEAD
                T_OUTTAB_ITEM            = I_MITEM.
            REFRESH I_FLDCATALOG.
            CLEAR M_LAYOUT.
            CLEAR M_KEYINFO.
            NEW-PAGE PRINT OFF.
            CLEAR L_PARAMS.
            CLEAR L_VALID.
          ENDIF.
          LOOP AT I_HITEM INTO W_HITEM.
            IF W_HITEM-CHECK = 'X'.
              W_HITEM-PFLAG = 'PRINTED'.
              MODIFY I_HITEM FROM W_HITEM INDEX SY-TABIX TRANSPORTING PFLAG
            ENDIF.
          ENDLOOP.
          IF SY-SUBRC = 0.
            LOOP AT I_PFLAG INTO W_PFLAG.
              UPDATE RESB SET WEMPF = 'X'
                          WHERE AUFNR = W_PFLAG-AUFNR
                            AND MATNR = W_PFLAG-MATNR
                            AND DUMPS = 'X'.
              COMMIT WORK.
              WAIT UP TO 1 SECONDS.
            ENDLOOP.
          ENDIF.
      ENDCASE.
    Thanks
    Ramesh.
    Message was edited by:
            Alvaro Tejada Galindo

    Hi,
    When you get the list output .
    click on print button to print it. A dialog box will come.
    In that dialog box, there will be settings button . when you click on this button, you will get many options and the value of those options that can be set defualt for that report output.
    In that there is s option of printer , select that option  and enter a value and then set that as default.
    I hope this will solve your problem.
    For any more help, please revert back.
    Thanks and regards
    Gurpreet Singh

Maybe you are looking for

  • Safari shuts down when trying to open a link in a second tab or window.

    If I try to open a link from a web site in a seperate tab or window safari shuts down then the "Report ot Apple" comes up. Does not matter what web site, even if I try to open another tab or window it shuts down. Have tried to reset permissions twice

  • Replace keyboard for Macbook Pro

    Hi, I need a new keyboard for my Macbook Pro 15" with back lighting. It works fine, but I dropped my cigarette and it burned the "esc" key. Again the esc key works, but I have to push it hard, so I think I think that I need to replace the keyboard. I

  • Schema level and table level supplemental logging

    Hello, I'm setting up bi- directional DML replication between two oracle databases. I have enabled supplemental logging database level by running this command- SQL>alter database add supplemental log data (primary key) columns; Database altered. SQL>

  • Cannot open or use templates in OpenOffice & Star Office with FF7

    I have Open Office & Star Office downloaded but now with FF7 I cannot open the templates on either one so I cannot use them. There used to be a FF extension for Open Office but it doesn't work with FF7... Help

  • Error in NewItemHandler - Business Partner

    Hello! I do have the following error since 2 days: Error in NewItemHandler: Invalid object name '@'. [Form=683 Item=3 Pane=0 Column=1 Row=1 Variable=72] This shows up when opening business partner. Can someone tell me where to find Form 683? Thanks M