ALV-Need to display total in top/first line!!!

Hi,
  i have 3 numerical fields in my ALV output. I need to display the total in top/first line in output and download the same in excel into local system.if possible send me the sample code to how to do it.
Regards,
Nandha.

TABLES : BSEG , BKPF.
TABLES: SSCRFIELDS.
TABLES: ITCPO.
DATA :FLAG TYPE I, MAINTAIN TYPE I,
      FLAG1 TYPE I,
      FLAG2 TYPE I,
      FLAG3 TYPE I.
DATA :BEGIN OF ITAB_BKPF OCCURS 0,
      BUKRS LIKE BKPF-BUKRS,
      GJAHR LIKE BKPF-GJAHR,
      BELNR LIKE BKPF-BELNR,
      BLART LIKE BKPF-BLART,
      BUDAT LIKE BKPF-BUDAT,
END OF ITAB_BKPF.
DATA :BEGIN OF ITAB_BSEG OCCURS 0,
      BUKRS LIKE BSEG-BUKRS,
      GJAHR LIKE BSEG-GJAHR,
      BELNR LIKE BSEG-BELNR,
      BUZEI LIKE BSEG-BUZEI,
      BSCHL LIKE BSEG-BSCHL,
      HKONT LIKE BSEG-HKONT,
      DMBTR LIKE BSEG-DMBTR,
      MWSKZ LIKE BSEG-MWSKZ,
      ZUONR LIKE BSEG-ZUONR,
      KOSTL LIKE BSEG-KOSTL,
      FISTL LIKE BSEG-FISTL,
      FIPOS LIKE BSEG-FIPOS,
      SGTXT LIKE BSEG-SGTXT,
END OF ITAB_BSEG.
DATA BEGIN OF ITAB_BKPF_BSEG OCCURS 0.
  INCLUDE STRUCTURE ZBKPF_BSEG.
DATA END OF ITAB_BKPF_BSEG.
*DATA ITAB_BKPF_BSEG LIKE TABLE OF ZITAB_BKPF_BSEG WITH HEADER LINE.
DATA i_print LIKE TABLE OF ITCPO WITH HEADER LINE.
TYPE-POOLS : SLIS , kkblo.
DATA:TEXT2(30) VALUE 'Voucher Print',
     GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
     CT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
     IT_SORT TYPE SLIS_T_SORTINFO_ALV,
     WA_SORT TYPE SLIS_SORTINFO_ALV,
     WA_SUBT LIKE SLIS_EV_SUBTOTAL_TEXT,
     WA_I_EVENT TYPE SLIS_ALV_EVENT,
     TEMP_CAT TYPE SLIS_FIELDCAT_ALV
DATA : TEXT2538(16) VALUE 'Voucher Printing'.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS : P_BUKRS LIKE BKPF-BUKRS OBLIGATORY.
"Company code
SELECT-OPTIONS : S_BELNR FOR BKPF-BELNR MODIF ID M01.
"Accounting Doc No
PARAMETERS: P_GJAHR LIKE BKPF-GJAHR MODIF ID M02.
"Fiscal year
SELECT-OPTIONS:  S_BLART FOR BKPF-BLART MODIF ID M03,
                                          "Document type
                 S_BUDAT FOR BKPF-BUDAT MODIF ID M04.
"Posting date
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
  IF S_BELNR IS NOT INITIAL.
    FLAG = 1.
  ENDIF.
  IF S_BLART IS NOT INITIAL.
    FLAG1 = 1.
  ENDIF.
  IF P_GJAHR IS NOT INITIAL.
    FLAG2 = 1.
  ENDIF.
  IF S_BUDAT IS NOT INITIAL.
    FLAG3 = 1.
  ENDIF.
  SELECT
      BUKRS
      GJAHR
      BELNR
    INTO CORRESPONDING FIELDS OF TABLE ITAB_BKPF
    FROM BKPF
    WHERE BUKRS EQ P_BUKRS
  IF SY-SUBRC NE 0.
    MESSAGE E000(ZPROJ).
  ENDIF.
  IF FLAG NE 0.
    DELETE ITAB_BKPF WHERE
    NOT ( BELNR IN S_BELNR AND GJAHR EQ P_GJAHR )
  ENDIF.
  IF FLAG1 NE 0.
    DELETE ITAB_BKPF WHERE
    NOT ( BLART IN S_BLART AND BUDAT IN S_BUDAT )
  ENDIF.
  IF FLAG2 NE 0.
    DELETE ITAB_BKPF WHERE
    NOT ( GJAHR EQ P_GJAHR )
  ENDIF.
  IF FLAG3 NE 0.
    DELETE ITAB_BKPF WHERE
    NOT ( BUDAT IN S_BUDAT )
  ENDIF.
  SELECT
        BUKRS
        GJAHR
        BELNR
        BUZEI
        BSCHL
        HKONT
        DMBTR
        MWSKZ
        ZUONR
        KOSTL
        FISTL
        FIPOS
        SGTXT
     FROM BSEG
     INTO TABLE ITAB_BSEG
     FOR ALL ENTRIES IN ITAB_BKPF
       WHERE
          BUKRS EQ P_BUKRS AND
          BELNR EQ ITAB_BKPF-BELNR AND
          GJAHR EQ ITAB_BKPF-GJAHR
  LOOP AT ITAB_BKPF.
    LOOP AT ITAB_BSEG WHERE BUKRS EQ ITAB_BKPF-BUKRS AND
                          BELNR EQ ITAB_BKPF-BELNR AND
                          GJAHR EQ ITAB_BKPF-GJAHR.
      MOVE-CORRESPONDING ITAB_BSEG TO ITAB_BKPF_BSEG.
*    MOVE-CORRESPONDING ITAB_BKPF TO ITAB_BKPF_BSEG.
      APPEND ITAB_BKPF_BSEG.
    ENDLOOP.
  ENDLOOP.
LOOP AT ITAB_BKPF_BSEG.
  ITAB_BKPF_BSEG-ZMENG = ITAB_BKPF_BSEG-DMBTR.
  MODIFY ITAB_BKPF_BSEG TRANSPORTING zmeng.
ENDLOOP.
  PERFORM CHANGE_CATALOG.
  PERFORM ALV_DISPLAY.
FORM CHANGE_CATALOG .
  CLEAR TEMP_CAT.
  TEMP_CAT-FIELDNAME  = 'BUKRS'.
  TEMP_CAT-SELTEXT_L = 'Company Code'.
  TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
  TEMP_CAT-DDICTXT = 'L'.
  TEMP_CAT-OUTPUTLEN = 30.
  TEMP_CAT-HOTSPOT = 'X'.
  APPEND TEMP_CAT TO CT_FIELDCAT.
  CLEAR TEMP_CAT.
  TEMP_CAT-FIELDNAME  = 'BELNR'.
  TEMP_CAT-SELTEXT_L = 'Document No.'.
  TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
  TEMP_CAT-DDICTXT = 'L'.
  TEMP_CAT-HOTSPOT = 'X'.
  APPEND TEMP_CAT TO CT_FIELDCAT.
  CLEAR TEMP_CAT.
  TEMP_CAT-FIELDNAME  = 'GJAHR'.
  TEMP_CAT-SELTEXT_L = 'Fiscal Year'.
  TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
  TEMP_CAT-DDICTXT = 'L'.
  TEMP_CAT-OUTPUTLEN = 15.
  TEMP_CAT-HOTSPOT = 'X'.
  APPEND TEMP_CAT TO CT_FIELDCAT.
  CLEAR TEMP_CAT.
  TEMP_CAT-FIELDNAME  = 'BUZEI'.
  TEMP_CAT-SELTEXT_L = 'Item'.
  TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
  TEMP_CAT-DDICTXT = 'L'.
  TEMP_CAT-OUTPUTLEN = 5.
  APPEND TEMP_CAT TO CT_FIELDCAT.
  CLEAR TEMP_CAT.
  TEMP_CAT-FIELDNAME  = 'BSCHL'.
  TEMP_CAT-SELTEXT_L = 'Posting Key'.
  TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
  TEMP_CAT-DDICTXT = 'L'.
  TEMP_CAT-OUTPUTLEN = 15.
  APPEND TEMP_CAT TO CT_FIELDCAT.
  CLEAR TEMP_CAT.
  TEMP_CAT-FIELDNAME  = 'HKONT'.
  TEMP_CAT-SELTEXT_L = 'Account'.
  TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
  TEMP_CAT-DDICTXT = 'L'.
  TEMP_CAT-OUTPUTLEN = 15.
  APPEND TEMP_CAT TO CT_FIELDCAT.
  CLEAR TEMP_CAT.
  TEMP_CAT-FIELDNAME  = 'DMBTR'.
  TEMP_CAT-SELTEXT_L = 'Amount'.
  TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
  TEMP_CAT-DDICTXT = 'L'.
  TEMP_CAT-OUTPUTLEN = 15.
  TEMP_CAT-DO_SUM = 'X'.
  APPEND TEMP_CAT TO CT_FIELDCAT.
  CLEAR TEMP_CAT.
  TEMP_CAT-FIELDNAME  = 'MWSKZ'.
  TEMP_CAT-SELTEXT_L = 'Tax'.
  TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
  TEMP_CAT-DDICTXT = 'L'.
  TEMP_CAT-OUTPUTLEN = 15.
  APPEND TEMP_CAT TO CT_FIELDCAT.
  CLEAR TEMP_CAT.
  TEMP_CAT-FIELDNAME  = 'ZUONR'.
  TEMP_CAT-SELTEXT_L = 'Assignment'.
  TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
  TEMP_CAT-DDICTXT = 'L'.
  TEMP_CAT-OUTPUTLEN = 15.
  APPEND TEMP_CAT TO CT_FIELDCAT.
  CLEAR TEMP_CAT.
  TEMP_CAT-FIELDNAME  = 'KOSTL'.
  TEMP_CAT-SELTEXT_L = 'Cost Center'.
  TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
  TEMP_CAT-DDICTXT = 'L'.
  TEMP_CAT-OUTPUTLEN = 15.
  APPEND TEMP_CAT TO CT_FIELDCAT.
  CLEAR TEMP_CAT.
  TEMP_CAT-FIELDNAME  = 'FISTL'.
  TEMP_CAT-SELTEXT_L = 'Fund Center'.
  TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
  TEMP_CAT-DDICTXT = 'L'.
  TEMP_CAT-OUTPUTLEN = 15.
  APPEND TEMP_CAT TO CT_FIELDCAT.
  CLEAR TEMP_CAT.
  TEMP_CAT-FIELDNAME  = 'FIPOS'.
  TEMP_CAT-SELTEXT_L = 'Commitment Item'.
  TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
  TEMP_CAT-DDICTXT = 'L'.
  TEMP_CAT-OUTPUTLEN = 15.
  APPEND TEMP_CAT TO CT_FIELDCAT.
  CLEAR TEMP_CAT.
  TEMP_CAT-FIELDNAME  = 'SGTXT'.
  TEMP_CAT-SELTEXT_L = 'Text'.
  TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
  TEMP_CAT-DDICTXT = 'L'.
  TEMP_CAT-OUTPUTLEN = 15.
  APPEND TEMP_CAT TO CT_FIELDCAT.
  GS_LAYOUT-ZEBRA = 'X'.
<b>GS_LAYOUT-TOTALS_BEFORE_ITEMS = 'X'.</b>
data : text like slis_ev_subtotal_text value 'total'.
gs_layout-subtotals_text = text.
*gs_layout-totals_only = 'X'.
  CLEAR WA_SORT.
  WA_SORT-FIELDNAME = 'BUKRS'.
  WA_SORT-SPOS      = 1.
  WA_SORT-UP = 'X'.
*wa_sort-group = '*'.
  APPEND WA_SORT TO IT_SORT.
  CLEAR WA_SORT.
  WA_SORT-FIELDNAME = 'BELNR'.
  WA_SORT-SPOS      = 2.
  WA_SORT-SUBTOT = 'X'.
  WA_SORT-UP = 'X'.
  APPEND WA_SORT TO IT_SORT.
  CLEAR WA_SORT.
  WA_SORT-FIELDNAME = 'GJAHR'.
  WA_SORT-SPOS      = 3.
  WA_SORT-SUBTOT = 'X'.
  WA_SORT-UP = 'X'.
  APPEND WA_SORT TO IT_SORT.
  CLEAR WA_SORT.
  WA_SORT-FIELDNAME = 'DMBTR'.
  WA_SORT-SPOS      = 4.
  APPEND WA_SORT TO IT_SORT.
  gs_layout-subtotals_text = 'total'.
ENDFORM.
FORM ALV_DISPLAY.
  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
   EXPORTING
*   I_INTERFACE_CHECK              = ' '
*   I_BYPASSING_BUFFER             =
*   I_BUFFER_ACTIVE                = ' '
     I_CALLBACK_PROGRAM             = SY-REPID
*   I_CALLBACK_PF_STATUS_SET       = ' '
    I_CALLBACK_USER_COMMAND        = 'USER_COMMAND'
*   I_STRUCTURE_NAME               =
     IS_LAYOUT                      = GS_LAYOUT
     IT_FIELDCAT                    = CT_FIELDCAT
*   IT_EXCLUDING                   =
*   IT_SPECIAL_GROUPS              =
     IT_SORT                        = IT_SORT[]
*   IT_FILTER                      =
*   IS_SEL_HIDE                    =
*   I_DEFAULT                      = 'X'
     I_SAVE                         = 'A'
*   IS_VARIANT                     =
*   IT_EVENTS                      =
*   IT_EVENT_EXIT                  =
*   IS_PRINT                       =
*   IS_REPREP_ID                   =
*   I_SCREEN_START_COLUMN          = 0
*   I_SCREEN_START_LINE         0   = 0
*   I_SCREEN_END_COLUMN            = 0
*   I_SCREEN_END_LINE              = 0
*   IR_SALV_LIST_ADAPTER           =
*   IT_EXCEPT_QINFO                =
*   I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER        =
*   ES_EXIT_CAUSED_BY_USER         =
    TABLES
      T_OUTTAB                       = ITAB_BKPF_BSEG
* 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.
ENDFORM.                    "ALV_DISPLAY
*i_calLback_user_command = 'USER_COMMAND'.
FORM USER_COMMAND
  USING UCOMM LIKE SY-UCOMM
  SELFIELD TYPE SLIS_SELFIELD.
  DATA wa LIKE LINE OF ITAB_BKPF_BSEG.
  DATA itab LIKE TABLE OF ITAB_BKPF_BSEG WITH HEADER LINE.
  READ TABLE ITAB_BKPF_BSEG index SELFIELD-TABINDEX INTO wa.
  APPEND ITAB_BKPF_BSEG TO ITAB.
    ENDLOOP.
CALL FUNCTION '/1BCDWB/SF00000204'
* EXPORTING
*   ARCHIVE_INDEX              =
*   ARCHIVE_INDEX_TAB          =
*   ARCHIVE_PARAMETERS         =
*   CONTROL_PARAMETERS         = i_ctrl
*   MAIL_APPL_OBJ              =
*   MAIL_RECIPIENT             =
*   MAIL_SENDER                =
*   OUTPUT_OPTIONS             = i_print
*   USER_SETTINGS              = 'X'
* IMPORTING
*   DOCUMENT_OUTPUT_INFO       =
*   JOB_OUTPUT_INFO            =
*   JOB_OUTPUT_OPTIONS         =
  TABLES
    ITAB_BKPF_BSEG             = ITAB
* EXCEPTIONS
*   FORMATTING_ERROR           = 1
*   INTERNAL_ERROR             = 2
*   SEND_ERROR                 = 3
*   USER_CANCELED              = 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.
ENDFORM.                    "user_command

Similar Messages

  • Display totals on the first line in ALV grid and ALV LIST

    Generally we wll display totals at the end..
    bu the requirement is to display it in the first line of the column.
    how to display the totals in the first line?
    I have used ALV GRID and ALV LIST (choice) using function modules.
    Plz help me
    .for example : Po qty : Should display total po qty on the first line of the Po line item.

    IN LAYOUT
    ILAYOUT-totals_before_items = 'X'.
    REGARDS
    SHIBA DUTTA

  • Tree OOPS ALV - Need to display header & items of the sales order in oops

    HI,
        I need to display some of the header fields of the sales order & items in the oops alv, could you please let me know how to achieve this. I know FM - 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' but how to achieve this through oops alv.
    Thanks

    it is not possible with that function in OO .
    you can try with class cl_salv_hierseq_table
    Just check this Rich's article
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b0f03986-046c-2910-a5aa-e5364e96ea2c
    if you don't want that then you may have to use ALV tree.

  • Need to display fields based on first filed selection

    Hi All
    I am useing Apex 4.1 on 11gr2
    I am building an application that needs to have some fields completed based on the selection of the first file that is a LOV pick list.
    I am using the display condition for the edit of existing records, but now need to be able to create a new record.
    I thought I would have the screen redraw but that also resets the first field.
    Any help would be great.
    Edited by: merph on Oct 12, 2011 3:28 PM
    Sorry guys I found the answer,, getting to like apex ;-)
    Edited by: merph on Oct 12, 2011 3:57 PM

    Silly me it's right there

  • Need to display Information message in two lines - Alignment problem

    Hi all,
    In a screen program, I am trying to display an information/Confirmation message to confirm few things from user side. For this I am using POPUP_TO_CONFIRM FM. This FM enables me to display a text question.
    My question would be "'New Price  400 is lesser than particular Product's Regular Price."
                                     "Do you want to continue and save the changes made?".
    I am finding it difficult to align these two lines in the popup window.
    I want to be displayed in two lines. Just like how it appears above.
    Please guide thro this.....
    Thanks,
    Rajan

    Check the following function Module:
    CALL FUNCTION 'POPUP_WITH_2_BUTTONS_TO_CHOOSE'
      EXPORTING
    *   DEFAULTOPTION       = '1'
        diagnosetext1       = 'New Price 400 is lesser than particular Products Regular Price'
       DIAGNOSETEXT2       = 'Do you want to continue and save the changes made?'
    *   DIAGNOSETEXT3       = ' '
        textline1           = ' '
    *   TEXTLINE2           = ' '
    *   TEXTLINE3           = ' '
        text_option1        = 'YES'
        text_option2        = 'NO'
        titel               = 'TEST'
    * IMPORTING
    *   ANSWER              =
    Regards,
    Gurpreet

  • UPTO total need to display for every continue month

    Hi All,
    In one of my report I need two type of columns
    1. Month wise total - Coming correctly
    2. UPTO total- In this column I need to display total of all previous invoices upto month for that column displays for a particular Customer.
        Example :-
    Customer
    Sep-12
    Sep-11
    Aug-12
    Aug-11
    UPTO-Sep-12
    UPTO-Sep-11
    UPTO Aug-12
    ABC
    10
    12
    15
    13
    UPTO Aug 12 + Sep 12
    UP TO Aug11+sep11
    UP TO Jul-12+aug12
    As per above example I need a running sum but in horizontal way and as per customer and Month.
    Please suggest how I can achieve this.
    Thanks in advance
    Ashok K Gupta

    Hi,
    I tried all three function of Time Series but all three are not giving appropriate result.
    Thanks\
    Ashok

  • Problem in displaying total text in total line

    Hi...I am facing problem in displaying total text in first column of total line. Width of first column is sufficient to display text "TOTAL". But somehow its not getting displayed....Please Help...?
    code is as follows:
    ls_layout TYPE  slis_layout_alv .
    ls_layout-totals_text       = 'TOTAL'.
      ls_layout-colwidth_optimize = 'X'.
      ls_layout-no_vline          = 'X'.
      ls_layout-no_hline          = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program     = gv_repid            " Report ID
          i_callback_top_of_page = 'TOP_OF_PAGE'
          is_layout              = ls_layout
          it_fieldcat            = gt_fieldcat         " Field Catlog
        TABLES
          t_outtab               = gt_cost_output      " Output Table

    hi me to i have the same problem
       FORM create_layout .
      data: text(20) TYPE c.
      it_layout-window_titlebar   = text.
      it_layout-colwidth_optimize = 'X'.
      it_layout-totals_text       = text-013."'Totals'(013).
      it_layout-cell_merge        = 'X'.
      it_layout-zebra             = 'X'.
    ENDFORM.         
    but no output total in alv
    also i had another broplem i had unit i wanna show it in total line and calc value in header

  • Need to display grand total text in OOPS ABAP ALV report

    Hi
    I am using OOPS for alv display and need to display grand "total text" in any column in th eoutput display.
    I know the procedure to display in ALV display. but dont have idea in OOPS. Please help.
    Thanks
    Amminesh.

    hi,
    follow this link for alv's with oop's oncept.
    http://abapreports.blogspot.com/2008/06/alv-grid-display-with-oops.html
    for calculating total  to the specific field.....
    while creating the fieldcatalog pass the value 'X' to field do_sum of lvc_t_fcat( field catalog).
    data: fcat type lvc_t_fcat.
    fcat-fieldname = <field-name>.
    fcat-ref_table = <ref-tablename>.
    fcat-ref_field = <ref-fieldname>.
    fcat-do_sum = 'X'.
    regards,
    Ashok

  • To display Title In ALV Grid Display on first line of table

    Hi SAP Experts,
             Here is one Issue..
    I have some check boxes on selection screens,
    When i have selected one,
    The related title should be display on the first line of Itab[]...
    and if once collect is used to suppress the data
    with the same itab can we print normal itab and how...
    Waiting for Your Reply.....
    Thanks In Advance

    Hi Krishna,
    I can't imagine what you want.
    In ALV grid object, you can change the title text for each column displayed. This is done via field catalog or, in SALV, column object methods.
    In ALV fullscreen, you can define a TOP-OF-PAGE area where you may have what ever you want independent from the grid table content. I think you can not use this because you have the grid in a container.
    You may define it as a docking or splitter container and place the grid in lower and the title in upper area. But this will need some experience with container controls and a certain level of coding abilities.
    Regards,
    Clemens

  • Total of numeric fields in the first line of ALV output

    Hi All,
    i have a problem it is like i have created ALV list display and total is dipalyed of numeric column  for each page. my requirement is total should be diaplyed at the end of page plus toal should be diaplyed on the first line of second page also .
    please suggest me some solution .
    thanks
    praveen

    Hi
    one thing you can do is capture the totals into variables and display then in each top-of-page except first page.
    it will work as SORT and all dont have effect on top-of-page data. If you append that to internal table once we hit SORT data will chnage and it will give errorneous effects.

  • Need to display the first 5 values of a Multi value parameter in SSRS report

    Hi All,
    I have SSRS report with multi value parameter. I need to display the parameter selection values in a text box. I've more than 50 records in the multi value parameter list. I've included the code to display "All" if I choose "select
    all" option otherwise it will show the selected values. But, I need to change the logic. I have to show only the 1st 5 records if I choose more than 5 records.
    How can I implement this?
    I have used the below code
    =iif(
    Parameters!Country.Count = Count(Fields!Country.Value,
    "Country")
    ,"All"
    ,iif(Parameters!Country.Count>5
    ,"Display the 1st 5 values"
    ,Join(Parameters!Country.Value,",")
    Regards,
    Julie

    Hi Julie,
    Per my understanding that you want to always show the first values from the param country to a textbox when you have select more then five values from the dropdown list, if you checked "select all", textbox will display "All", if
    you select <=5 amount of values. it will display the selected values, right?
    I have tested on my local environment and that you can create an hide parameter(Param2) to display just the first five values from the Country and when you select more then five values from country you will get the Join(Parameters!Param2.Value,",")
    to display.
    Details information below for your reference:
    Create an new DataSet2 which the Param2 will get the values from:
    SELECT     TOP (5) Country
    FROM        tablename
    Create an new param2 and hide this parameter, Set the "Available values" and "Default values" by select the "Get the values from a query"(DataSet2)
    You can also Specify first five value for the "Available values" and "Default values", thus you will not need to follow the step1 to create the dataset2
    Modify the expression you have provided as below:
    =iif(Parameters!Country.Count = Count(Fields!Country.Value, "DataSet1"),"All" ,iif(Parameters!Country.Count>5 ,Join(Parameters!Param2.Value,","),Join(Parameters!Country.Value,",")))
    Preview like below
    If you still have any problem, please feel free to ask.
    Thanks, 
    Vicky Liu
    If you have any feedback on our support, please click
    here.
    Vicky Liu
    TechNet Community Support

  • Problem displaying 'Total' text in ALV grid

    My ALV works and displays correct output. However, I am struggling to display the text 'Total' on position in the last row of the grid. The total is for the salary. My code is below..
    I have looked on numerous sites and forums for assistance.
    *& Report  ZALV
    REPORT  ZALV.
    TABLES: ZCONTACT.
    TYPE-POOLS: slis. "slis contains all of the ALV data types.
    DATA: "fieldcatALOG TYPE slis_t_fieldcat_alv WITH HEADER LINE,
           it_zcontact TYPE TABLE OF zcontact,"declares an internal table of type ZCONTACT
           alv_prog_name LIKE sy-repid,
           g_variant TYPE disvariant,
           gx_variant TYPE disvariant,
           g_save TYPE c VALUE 'X',
           it_fieldcat TYPE slis_t_fieldcat_alv,"declares field catalog table of line type alv
           wa_fieldcat TYPE slis_fieldcat_alv, "declares the work area of the field catalog
           it_list_top_of_page TYPE slis_t_listheader,
           izontact TYPE TABLE OF zcontact,
           h1(10) TYPE c VALUE 'Toatall',
            "i_logo TYPE OT.
           gt_events     TYPE slis_t_event,
           gd_prntparams TYPE slis_print_alv,
           text(40) type c,
           wa_layout TYPE slis_layout_alv.
    **Selection Screen details
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
    PARAMETERS: variant like disvariant-variant.
    SELECTION-SCREEN END OF BLOCK B1.
    **Getting default variant
    INITIALIZATION.
    gx_variant-report = sy-repid.
    CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
       I_SAVE = G_SAVE
       CHANGING
         CS_VARIANT = GX_VARIANT
       EXCEPTIONS
         NOT_FOUND = 2.
    IF SY-SUBRC = 0.
       VARIANT = GX_VARIANT-VARIANT.
       ENDIF.
    START-OF-SELECTION.
      PERFORM DATA_RETRIEVAL.
      PERFORM BUILD_FIELDCATALOG.
      PERFORM DISPLAY_ALV_REPORT.
      "PERFORM build_alv_header
    FORM BUILD_FIELDCATALOG.
    *Build field catalog
    wa_fieldcat-fieldname = 'ID'.
    wa_fieldcat-seltext_m = 'ID'.
    wa_fieldcat-col_pos   = 0.
    wa_fieldcat-outputlen = 10.
    wa_fieldcat-emphasize  = 'X'.
    wa_fieldcat-key       = 'X'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'LASTNAME'.
    wa_fieldcat-seltext_m = 'LASTNAME'.
    wa_fieldcat-col_pos   = 1.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'FIRSTNAME'.
    wa_fieldcat-seltext_m = 'FIRSTNAME'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'DOB'.
    wa_fieldcat-seltext_m = 'DOB'.
    wa_fieldcat-col_pos = 3.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'TEL'.
    wa_fieldcat-seltext_m = 'Tel'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'ADDRESS'.
    wa_fieldcat-seltext_m = 'ADDRESS'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'OCCUPATION'.
    wa_fieldcat-seltext_m = 'OCCUPATION'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'WEIGHT'.
    wa_fieldcat-seltext_m = 'WEIGHT'.
    wa_fieldcat-do_sum    = 'X'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'AGE'.
    wa_fieldcat-seltext_m = 'AGE'.
    wa_fieldcat-do_sum   = 'X'.        "Display column total
    APPEND wa_fieldcat TO it_fieldcat.
    "CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'SALARY'.
    wa_fieldcat-seltext_m = 'SALARY'.
    wa_fieldcat-do_sum    = 'X'.
    wa_fieldcat-cfieldname = 'CURRENCYKEY'.
    APPEND wa_fieldcat TO it_fieldcat.
    wa_fieldcat-fieldname = 'CURRENCY'.
    wa_fieldcat-seltext_s = 'CURRENCY'.
    APPEND wa_fieldcat TO it_fieldcat.
    "CLEAR wa_fieldcat.
    ENDFORM. "BUILDING THE FIELD CATALOG
    **FORM layout.
    *wa_layout-colwidth_optimize = 'X'.
    *wa_layout-totals_text ='TOTAL'.
    *wa_layout-zebra = 'X'.
    *ENDFORM.
    "ls_layout-cell_merge = 'X'.
    FORM DISPLAY_ALV_REPORT.
    alv_prog_name = sy-repid.
    *Pass data and field catalog to ALV function module to display ALV list
       CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
         EXPORTING
           it_fieldcat            = it_fieldcat[]
           i_callback_program     = alv_prog_name
           is_layout              = wa_layout
           i_callback_top_of_page =  'TOP_OF_PAGE'
           i_callback_user_command =  'USER_COMMAND'
           i_structure_name       =  'ZCONTACT'
           i_save                 = 'X'
           it_events               = gt_events
           is_print                = gd_prntparams
           is_variant             = g_variant
           "is_layout     = ls_layout
    TABLES
           t_outtab      = it_zcontact
    EXCEPTIONS
           program_error = 1
           OTHERS        = 2.
    WRITE: H1 UNDER 'SALARY'.
    ENDFORM.
    **Fetch data from the database
    FORM DATA_RETRIEVAL.
    SELECT * FROM zcontact INTO TABLE it_zcontact.
    ENDFORM.
    FORM top_of_page.
    *ALV Header declarations
       DATA: it_listheader TYPE slis_t_listheader,
             wa_listheader TYPE slis_listheader,
             t_line like wa_listheader-info,
             ld_lines TYPE I,
             ld_linesc(10) TYPE C.
    wa_listheader-typ = 'H'.
    wa_listheader-info = 'Contact Details'.
    APPEND wa_listheader TO it_listheader.
    CLEAR wa_listheader.
    wa_listheader-typ = 'S'.
    wa_listheader-info = sy-repid.
    wa_listheader-key = 'Program Name:'.
    APPEND wa_listheader TO it_listheader.
    CLEAR wa_listheader.
    wa_listheader-typ = 'S'.
    wa_listheader-info = sy-uname.
    wa_listheader-key = 'User Name:'.
    APPEND wa_listheader TO it_listheader.
    CLEAR wa_listheader.
    wa_listheader-typ = 'S'.
    wa_listheader-key = 'Run Date :'.
    CONCATENATE sy-datum+6(2)
                 sy-datum+4(2)
                 sy-datum(4)
                 INTO wa_listheader-info
                 SEPARATED BY '/'.
    APPEND wa_listheader TO it_listheader.
    CLEAR wa_listheader.
    wa_listheader-typ = 'S'.
    wa_listheader-key = 'Time :'.
    CONCATENATE sy-uzeit(2)
                 sy-uzeit+2(2)
                 sy-uzeit+4(2)
                 INTO wa_listheader-info
                 SEPARATED BY ':'.
    APPEND wa_listheader TO it_listheader.
    CLEAR wa_listheader.
       CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
         EXPORTING
           it_list_commentary = it_listheader[]
           i_logo = 'KLOGO'.
    ENDFORM.                    "top_of_page

    I did this but still i cant display the total text..I have reposted my code. please assist. Im only missing that total label
    *& Report  ZALV
    REPORT  ZALV.
    TABLES: ZCONTACT.
    TYPE-POOLS: slis. "slis contains all of the ALV data types.
    TYPES: BEGIN OF t_zcontact,
         text(40) TYPE c, "storing the total text
       mandt TYPE mandt,
       id TYPE zcontactid,
       lastname type zcontactlname,
       firstname TYPE zcontactfname,
       dob TYPE zdateofbirth,
       tel TYPE ztel,
       address TYPE zaddress,
       occupation TYPE zoccup,
       weight type zweight,
       age TYPE zage,
       salary TYPE zsalary,
       ecurrency TYPE curcy,
       END OF t_zcontact.
    TYPES: BEGIN OF wa_zcontact,
       mandt TYPE mandt,
       id TYPE zcontactid,
       lastname type zcontactlname,
       firstname TYPE zcontactfname,
       dob TYPE zdateofbirth,
       tel TYPE ztel,
       address TYPE zaddress,
       occupation TYPE zoccup,
       weight type zweight,
       age TYPE zage,
       salary TYPE zsalary,
       ecurrency TYPE curcy,
       END OF wa_zcontact.
    TYPES:
    i_zcontact TYPE STANDARD TABLE OF t_zcontact." INITIAL SIZE 0.
       DATA: itt_zcontact TYPE STANDARD TABLE OF wa_zcontact INITIAL SIZE 0,
             wat_zcontact TYPE wa_zcontact.
    DATA: "it_zcontact TYPE TABLE OF zcontact,"declares an internal table of type ZCONTACT
           gd_repid LIKE sy-repid,
           g_variant TYPE disvariant,
           gx_variant TYPE disvariant,
           g_save TYPE c VALUE 'X',
           fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,"declares field catalog table of line type alv
            gd_tab_group type slis_t_sp_group_alv,
            gd_prntparams TYPE slis_print_alv,
           fieldcat TYPE slis_fieldcat_alv, "declares the work area of the field catalog
           it_list_top_of_page TYPE slis_t_listheader,
           i_zcontact TYPE TABLE OF zcontact,
           "h1(10) TYPE c VALUE 'Toatall',
            "i_logo TYPE OT.
           gt_events TYPE slis_t_event,
           gd_layout TYPE slis_layout_alv."work area for the alv layout
    data: it_sortcat type slis_sortinfo_alv occurs 1,
             wa_sort LIKE LINE OF it_sortcat.
    START-OF-SELECTION.
      PERFORM DATA_RETRIEVAL.
      PERFORM BUILD_FIELDCATALOG.
      PERFORM DISPLAY_ALV_REPORT.
      PERFORM BUILD_LAYOUT.
      perform build_sortcat.
      PERFORM sub_add_text.
      "PERFORM build_events.
      PERFORM top-of-page.
      "PERFORM build_alv_header.
      END-OF-SELECTION.
    *DATA: gd_layout TYPE slis_layout_alv.
    *      gd_layout-totals_text = 'TOTAL'.
    **Selection Screen details
    *SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
    *PARAMETERS: variant like disvariant-variant.
    *SELECTION-SCREEN END OF BLOCK B1.
    ***Getting default variant
    *INITIALIZATION.
    *gx_variant-report = sy-repid.
    *CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    *EXPORTING
    *  I_SAVE = G_SAVE
    *  CHANGING
    *    CS_VARIANT = GX_VARIANT
    *  EXCEPTIONS
    *    NOT_FOUND = 2.
    *IF SY-SUBRC = 0.
    *  VARIANT = GX_VARIANT-VARIANT.
    *  ENDIF.
    FORM BUILD_FIELDCATALOG.
    *Build field catalog
    fieldcatalog-fieldname = 'ID'.
    fieldcatalog-seltext_m = 'ID'.
    fieldcatalog-col_pos   = 2.
    fieldcatalog-outputlen = 10.
    fieldcatalog-datatype = 'CHAR'.
      "fieldcatalog-do_sum      = 'X'.
    fieldcatalog-no_zero     = 'X'.
    fieldcatalog-emphasize  = 'X'.
    fieldcatalog-key       = 'X'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'LASTNAME'.
    fieldcatalog-seltext_m = 'LASTNAME'.
    fieldcatalog-col_pos   = 3.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'FIRSTNAME'.
    fieldcatalog-seltext_m = 'FIRSTNAME'.
      fieldcatalog-col_pos = 4.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'DOB'.
    fieldcatalog-seltext_m = 'DOB'.
    fieldcatalog-col_pos = 5.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'TEL'.
    fieldcatalog-seltext_m = 'Tel'.
      fieldcatalog-col_pos = 6.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'ADDRESS'.
    fieldcatalog-seltext_m = 'ADDRESS'.
      fieldcatalog-col_pos = 7.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'OCCUPATION'.
    fieldcatalog-seltext_m = 'OCCUPATION'.
      fieldcatalog-col_pos = 8.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'WEIGHT'.
    fieldcatalog-seltext_m = 'WEIGHT'.
    "fieldcatalog-do_sum    = 'X'.
      fieldcatalog-col_pos = 9.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'AGE'.
    fieldcatalog-seltext_m = 'AGE'.
    "fieldcatalog-do_sum   = 'X'.        "Display column total
      fieldcatalog-col_pos = 10.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'SALARY'.
    fieldcatalog-seltext_m = 'SALARY'.
    fieldcatalog-do_sum    = 'X'.
    fieldcatalog-outputlen = 15.
    fieldcatalog-datatype ='CURR'.
      fieldcatalog-col_pos = 11.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    "fieldcatalog-fieldname = 'ECURRENCY'.
    "fieldcatalog-seltext_s = 'ECURRENCY'.
    "APPEND fieldcatalog TO fieldcatalog.
    "CLEAR fieldcatalog.
       fieldcatalog-fieldname   = 'TEXT'.
       fieldcatalog-col_pos = 0.
       "fieldcatalog-seltext_m   = 'TEXT'.
       fieldcatalog-tech        = 'X'.
       fieldcatalog-no_out      = 'X'.
       append fieldcatalog to fieldcatalog.
       clear  fieldcatalog.
    ENDFORM.
    *&      Form  build_sortcat
    *       Build Sort catalog
    FORM build_sortcat .
       "wa_sort-spos      = 1.
       wa_sort-fieldname = 'TEXT'.
       "wa_sort-SUBTOT    = 'X'. "subtotals any totals column by this field
       wa_sort-up        = 'X'.
       APPEND wa_sort TO it_sortcat.
       CLEAR wa_sort.
    ENDFORM.                    " build_sortcat
    FORM BUILD_LAYOUT.
    *gd_layout-no_input = 'X'.
    *gd_layout-colwidth_optimize = 'X'.
    *gd_layout-totals_text  =  'Totals'(201).
    *"gd_LAYOUT-coltab_fieldname = 'SALARY'.
    gd_layout-no_totalline = 'X'.
    ENDFORM.
    *IF sy-subrc = 0.
    *      LOOP AT fieldcatalog INTO fieldcat.
    *        IF fieldcat-fieldname = 'WEIGHT' OR
    *          fieldcat-fieldname = 'AGE'.
    **         Summation for WEIGHT & AGE
    *          fieldcat-do_sum = 'X'.
    *          MODIFY fieldcatalog FROM fieldcat TRANSPORTING do_sum.
    *        ENDIF.
    *        IF fieldcat-fieldname = 'TEXT'.
    **         Hide this field so that it can display it's content i.e.
    **         Total text in Subtotal level
    *          fieldcat-tech = 'X'.
    *          fieldcat-no_out = 'X'.
    *          MODIFY fieldcatalog FROM fieldcat TRANSPORTING tech no_out.
    *        ENDIF.
    *        CLEAR fieldcat.
    *      ENDLOOP.
    *    ENDIF.
    *ENDFORM. "BUILDING THE FIELD CATALOG
    *form build_events.
    *  data: ls_event type slis_alv_event.
    *  call function 'REUSE_ALV_EVENTS_GET'
    *       exporting
    *            i_list_type = 0
    *       importing
    *            et_events   = gt_events[].
    *  read table gt_events with key name =  slis_ev_top_of_page
    *                           into ls_event.
    *  if sy-subrc = 0.
    *    move 'TOP-OF-PAGE' to ls_event-form.
    *    append ls_event to gt_events.
    *  endif.
    *    read table gt_events with key name =  slis_ev_end_of_list
    *                           into ls_event.
    *  if sy-subrc = 0.
    *    move 'END_OF_LIST' to ls_event-form.
    *    append ls_event to gt_events.
    *  endif.
    *endform.                    " BUILD_EVENTS
    "ls_layout-cell_merge = 'X'.
    FORM DISPLAY_ALV_REPORT.
    gd_repid = sy-repid.
    *Pass data and field catalog to ALV function module to display ALV list
       CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
         EXPORTING
           it_fieldcat         = fieldcatalog[]
           it_sort  =  it_sortcat
           i_callback_program     = gd_repid
           is_layout              = gd_layout
           i_callback_top_of_page =  'TOP-OF-PAGE'
           i_callback_user_command =  'USER_COMMAND'
           i_structure_name       =  'ZCONTACT'
           i_save                 = 'X'
           it_events               = gt_events
           is_print                = gd_prntparams
           is_variant             = g_variant
           "is_layout     = ls_layout
    TABLES
           t_outtab      = itt_zcontact
    EXCEPTIONS
           program_error = 1
           OTHERS        = 2.
    "WRITE: 'TOTAL' UNDER 'ID'.
    ENDFORM.
    **Fetch data from the database
    FORM DATA_RETRIEVAL.
    "DATA: ld_subtot(1) type c.
    SELECT * FROM zcontact INTO TABLE itt_zcontact UP TO 10 ROWS.
    ENDFORM.
    FORM sub_add_text.
    *Populate field with text value
       DATA:
       wt_zcontact TYPE t_zcontact,
       last TYPE zcontact-ID,
       l_text(40) type c,
       num type n.
    loop at itt_zcontact into wat_zcontact.
    * Populate final table
       wt_zcontact-TEXT = 'Total salary:  '.
       "ld_subtot = ld_subtot + 1.
       "wat_zcontact-text = ld_subtot.
         modify itt_zcontact FROM wat_zcontact.
         clear wat_zcontact.
       "APPEND wat_zcontact TO itt_zcontact.
    endloop.
    ENDFORM.
    FORM top-of-page.
    *ALV Header declarations
       DATA: it_listheader TYPE slis_t_listheader,
             wa_listheader TYPE slis_listheader,
             t_line like wa_listheader-info,
             ld_lines TYPE I,
             ld_linesc(10) TYPE C.
    wa_listheader-typ = 'H'.
    wa_listheader-info = 'Contact Details'.
    APPEND wa_listheader TO it_listheader.
    CLEAR wa_listheader.
    wa_listheader-typ = 'S'.
    wa_listheader-info = sy-repid.
    wa_listheader-key = 'Program Name:'.
    APPEND wa_listheader TO it_listheader.
    CLEAR wa_listheader.
    wa_listheader-typ = 'S'.
    wa_listheader-info = sy-uname.
    wa_listheader-key = 'User Name:'.
    APPEND wa_listheader TO it_listheader.
    CLEAR wa_listheader.
    wa_listheader-typ = 'S'.
    wa_listheader-key = 'Run Date :'.
    CONCATENATE sy-datum+6(2)
                 sy-datum+4(2)
                 sy-datum(4)
                 INTO wa_listheader-info
                 SEPARATED BY '/'.
    APPEND wa_listheader TO it_listheader.
    CLEAR wa_listheader.
    wa_listheader-typ = 'S'.
    wa_listheader-key = 'Time :'.
    CONCATENATE sy-uzeit(2)
                 sy-uzeit+2(2)
                 sy-uzeit+4(2)
                 INTO wa_listheader-info
                 SEPARATED BY ':'.
    APPEND wa_listheader TO it_listheader.
    CLEAR wa_listheader.
       CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
         EXPORTING
           it_list_commentary = it_listheader[]
           i_logo = 'KLOGO'.
    ENDFORM.                    "top_of_page

  • Total on First Line in ALV...........

    Hi Experts,
    I was written a ALV report and it works fine but the user want the total should be appear on first line.
    How to bring All Totals on First Line in ALV default...?
    Thanks,
    Yusuf

    Hi,
    Use do_sum in the field catlog .
    For displaying the summ u want for the field, Use do_sum.
    Regards,
    Jagadish

  • Need ALV LIST for displaying Dynamic Internal Tables

    Hi Guys,
                     I have some thing like 2 Dynamic internal tables.
    Say 1st Internal table will be filled based on some condition.
    say 2nd table will be filled based on some condition.
    When appending the 1st Internal table, if that internal table is filled it creates another internal table of same kind and continues so on until some condition.
    In the same way when appending the 2nd Internal table, if that internal table is filled it creates another internal table of same kind and continues so on until some condition.
    My requirement is I need to display all these Internal tables in the output.
    The output should look something like
    1st Internal Table
    some gap
    2nd Internal Table
    some gap
    so on...................
    Is there any standard ALV List, to display all these Internal Tables in such a way.
    Thanks,
    Prasad.

    Hi.
    One thing more here is code which get 10 records from 2 tables and then show them in ALV.
    first when u execute it will show data from ist table.
    when u go back (F3) then it will sow data from 2nd table.
    But if u want to show both ALV on the same screen then u will have to use screen programin and using class u will have to create container and then have to do it.
    But as i above mentioned. that sample code is as below.
    REPORT ztn_test LINE-COUNT 100.
      data: itab_ref type ref to data.
      data: hstr type lvc_title.
    data: tabname like DD02T-TABNAME.
       tabname = 'MARA'. " First Table
      create data itab_ref type standard table of (tabname).
      field-symbols: <itab> type standard table.
      assign itab_ref->* to <itab>.
      select * UP TO 10 ROWS from (tabname) into corresponding fields of table <itab>.
      perform showalv.
       tabname = 'KNA1'. " 2nd Table
      create data itab_ref type standard table of (tabname).
      "field-symbols: <itab> type standard table.
      assign itab_ref->* to <itab>.
      select * UP TO 10 ROWS from (tabname) into corresponding fields of table <itab>.
      perform showalv.
    form showalv.
    " to show that data in alv
      type-pools: slis.
      data: myalv type ref to cl_gui_alv_grid,    "ALV Grid
            fieldcat type slis_t_fieldcat_alv,    "Field Catalog Table
            ls_fcat type slis_fieldcat_alv,       "Line of Field catalog.
            ls_heading type slis_listheader,      "Line of Heading.
            layout type slis_layout_alv,          "layout of ALV for Heading and Logo.
            event type slis_t_event,              "Event Raising to Display Heading.
            event_str type slis_alv_event.        "Event String.
    type-pools: slis.
    data: heading type slis_t_listheader.       "List Heading.
      if heading[] is initial.
        ls_heading-typ = 'H'.
        ls_heading-info = 'HR: Master Data Change History'.
        append ls_heading to heading.
      endif.
    *  ls_heading-typ = 'A'.
    *  ls_heading-info = ''.
    *  APPEND ls_heading TO heading.
    *                          ALV DISPLAY                        *
    *******Making Layout of ALV
      layout-zebra = 'X'.
      layout-colwidth_optimize = 'X'.
    *Calling function to raise event to display heading and icon above ALV
      call function 'REUSE_ALV_EVENTS_GET'
       exporting
         i_list_type           = 0
       importing
         et_events             = event[]
    * EXCEPTIONS
    *   LIST_TYPE_WRONG       = 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.
    ******calling TOP_OF_PAGE Event
      read table event with key name = 'TOP_OF_PAGE' into event_str.
      if sy-subrc = 0.
        move: 'TOP_OF_PAGE' to event_str-form.
        modify event from event_str index sy-tabix.
      endif.
    **** Now use this Fuction to display ALV without any Screen Programming.
      call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
         i_callback_program                = 'SAPLZFSL_HR_UTILS' "sy-cprog
    *   I_CALLBACK_PF_STATUS_SET          = ' '
    *   I_CALLBACK_USER_COMMAND           = ' '
    *   I_CALLBACK_TOP_OF_PAGE            = ' '
    *   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *   I_CALLBACK_HTML_END_OF_LIST       = ' '
         i_structure_name                  = tabname
    *   I_BACKGROUND_ID                   = ' '
         i_grid_title                      = hstr   "Heading of ALV Grid.
    *   I_GRID_SETTINGS                   =
         is_layout                         = layout
    *   it_fieldcat                       = fieldcat[]
    *   IT_EXCLUDING                      =
    *   IT_SPECIAL_GROUPS                 =
    *   IT_SORT                           =
    *   IT_FILTER                         =
    *   IS_SEL_HIDE                       =
         i_default                         = 'X'
         i_save                            = 'X'
    *   IS_VARIANT                        =
         it_events                         = event[]
    *   IT_EVENT_EXIT                     =
    *   IS_PRINT                          =
    *   IS_REPREP_ID                      =
    *   I_SCREEN_START_COLUMN             = 0
    *   I_SCREEN_START_LINE               = 0
    *   I_SCREEN_END_COLUMN               = 0
    *   I_SCREEN_END_LINE                 = 0
    *   I_HTML_HEIGHT_TOP                 = 0
    *   I_HTML_HEIGHT_END                 = 0
    *   IT_ALV_GRAPHICS                   =
    *   IT_HYPERLINK                      =
    *   IT_ADD_FIELDCAT                   =
    *   IT_EXCEPT_QINFO                   =
    *   IR_SALV_FULLSCREEN_ADAPTER        =
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER           =
    *   ES_EXIT_CAUSED_BY_USER            =
        tables
          t_outtab                          = <itab>
    * 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.
    endform.

  • Hi, coding to display popup window after first alv grid display

    hi
    can anybody please send coding to display popup window after first alv grid display i.e.  first the prog shows grid display and from grid display the user select the field and on the basis of field value i need to show pop up window in the first secondary window and then third popup window.
    thanx
    rocky

    Hi rocky,
    here is the sample code .hope this helps you.
    TYPE-POOLS : SLIS.
    DATA : GT_OUTTAB TYPE VBAK OCCURS 0,
           GS_PRIVATE TYPE SLIS_DATA_CALLER_EXIT,
           GS_SELFIELD TYPE SLIS_SELFIELD.
    DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
           WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA : ITAB TYPE TABLE OF SLIS_SELFIELD,
           WA_ITAB LIKE LINE OF ITAB.
    START-OF-SELECTION.
    PERFORM POPULATE_GT_OUTTAB.
    PERFORM GET_POPUP.
    PERFORM POPULATE_ITAB.
    PERFORM FIELDCAT.
    PERFORM DISPLAY_DETAILS.
    *&      Form  FIELDCAT
          text
    -->  p1        text
    <--  p2        text
    FORM FIELDCAT .
    LOOP AT ITAB INTO WA_ITAB.
    WA_FIELDCAT-FIELDNAME = 'TABINDEX'.
    WA_FIELDCAT-TABNAME = 'WA_ITAB'.
    WA_FIELDCAT-COL_POS = 1.
    WA_FIELDCAT-SELTEXT_L = 'TABLE INDEX'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'SEL_TAB_FIELD'.
    WA_FIELDCAT-TABNAME = 'WA_ITAB'.
    WA_FIELDCAT-COL_POS = 2.
    WA_FIELDCAT-OUTPUTLEN = 20.
    WA_FIELDCAT-SELTEXT_L = 'FIELD NAME'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'VALUE'.
    WA_FIELDCAT-TABNAME = 'WA_ITAB'.
    WA_FIELDCAT-COL_POS = 3.
    WA_FIELDCAT-SELTEXT_L = 'FIELD VALUE'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    ENDLOOP.
    ENDFORM.                    " FIELDCAT
    *&      Form  POPULATE_GT_OUTTAB
          text
    -->  p1        text
    <--  p2        text
    FORM POPULATE_GT_OUTTAB .
    SELECT * FROM VBAK
           UP TO 10 ROWS
           INTO TABLE GT_OUTTAB.
    ENDFORM.                    " POPULATE_GT_OUTTAB
    *&      Form  GET_POPUP
          text
    -->  p1        text
    <--  p2        text
    FORM GET_POPUP .
    CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
      EXPORTING
       I_TITLE                       = 'SALES ORDER'
      I_SELECTION                   = 'X'
      I_ALLOW_NO_SELECTION          =
       I_ZEBRA                       = 'X'
      I_SCREEN_START_COLUMN         = 0
      I_SCREEN_START_LINE           = 0
      I_SCREEN_END_COLUMN           = 0
      I_SCREEN_END_LINE             = 0
      I_CHECKBOX_FIELDNAME          =
      I_LINEMARK_FIELDNAME          =
      I_SCROLL_TO_SEL_LINE          = 'X'
        I_TABNAME                     = 'SALES ORDER'
        I_STRUCTURE_NAME              = 'VBAK'
      IT_FIELDCAT                   =
      IT_EXCLUDING                  =
      I_CALLBACK_PROGRAM            =
      I_CALLBACK_USER_COMMAND       =
       IS_PRIVATE                    = GS_PRIVATE
    IMPORTING
       ES_SELFIELD                   = GS_SELFIELD
      E_EXIT                        = G_EXIT
      TABLES
        T_OUTTAB                      = GT_OUTTAB
    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.
    ENDFORM.                    " GET_POPUP
    *&      Form  POPULATE_ITAB
          text
    -->  p1        text
    <--  p2        text
    FORM POPULATE_ITAB .
    WA_ITAB-TABNAME = GS_SELFIELD-TABNAME.
    WA_ITAB-TABINDEX = GS_SELFIELD-TABINDEX.
    WA_ITAB-SEL_TAB_FIELD = GS_SELFIELD-SEL_TAB_FIELD.
    WA_ITAB-VALUE = GS_SELFIELD-VALUE.
    APPEND WA_ITAB TO ITAB.
    ENDFORM.                    " POPULATE_ITAB
    *&      Form  DISPLAY_DETAILS
          text
    -->  p1        text
    <--  p2        text
    FORM DISPLAY_DETAILS .
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
      I_CALLBACK_PROGRAM             = ' '
      I_CALLBACK_PF_STATUS_SET       = ' '
      I_CALLBACK_USER_COMMAND        = ' '
      I_STRUCTURE_NAME               =
      IS_LAYOUT                      =
       IT_FIELDCAT                    = IT_FIELDCAT
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
      IT_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                       = ITAB
    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.
    ENDFORM.                    " DISPLAY_DETAILS
    award points if helpful.
    regards,
    deepthi reddy

Maybe you are looking for

  • Xml publisher report using RTF in Excel is coming as wrap text?

    Hi, I am working on XML publisher report, I have converted standard report to xml publisher , to generate the report in excel. But the output is coming as Wrap text, is there a way to get the output directly without wrap ? Thanks Dev

  • Posting Unplanned Depreciation when asset net book value is zero

    We recently transferred some assets from one company code to another.  However, when they transferred, the depreciation all reversed out YTD. We are now trying to post the YTD depreciation back in under the original company code, but when we try post

  • Namespace resolution with applets

    We have a situation where two browser-based applications running concurrently on a machine employ applets that make use of certain Weblogic libraries. The catch is that the applications run off different versions of the Weblogic Application server(6.

  • Setting up a new raid and preserving disk contents

    I have a Maxtor 250GB drive full of data. I just purchased a Maxtor 300GB drive that I am going to use as a RAID 1. Is it possible to set up the raid without formatting the 250GB and immediately have it mirrored to the 300? If so, what steps would I

  • Quick time 7.1.6 freezes

    I installed Quick Time 7.1.6 (forgive me, I am a brand new MAC user). About 2 minutes into the video, the video stops, however, the time keeps running as well as the "little glass like figure". When I try and "drag" the figure, the word "unauthorized