ALV Heading format problem

Hi Sap Experts,
                      I have used ALV_REUSE_DISPLAY Function Module. But in Display Output, in the Menu Bar ??? marks.
                     Please help me........!

Hello Sankar Jee,
                         I didn't use any PF_STATUS in that Function Module.But Application ToolBars  are coming correctly. Instead of Menu Bar it replace ???????? Marks.
                        Please try to tell me,what was the problem?

Similar Messages

  • ALV Report  Format Problem

    Hi Experts
    I am writing an ALV report for the following report below , I am not getting the output in the internal table
    can anyone correct please
    regards
    Piroz
    REPORT Z_ROLE LINE-SIZE  220 LINE-COUNT 75
             NO STANDARD PAGE HEADING.
    TABLES : agr_tcodes,
             agr_users,
             tstct.
    TYPE-POOLS : slis.        
    DATA: repid LIKE sy-repid, "Report ID
    is_layout TYPE slis_layout_alv, "Layout For ALV
    it_fieldcat TYPE slis_t_fieldcat_alv, "ITAB for field
    it_events TYPE slis_t_event, "ITAB for event
    it_sub TYPE slis_layout_alv_spec1, "subtotals
    i_header TYPE slis_t_listheader, "Itab for listheader
    lt_sort TYPE slis_t_sortinfo_alv, "itab for sorting
    wa_sort LIKE LINE OF lt_sort." slis_t_sortinfo_alv.        
    DATA:  BEGIN OF itab OCCURS 0  ,
             agr_tcodes type agr_tcodes-tcode ,        " Transaction code     A
             agr_name   type agr_tcodes-agr_name,      " Role Name            B
           END OF itab .
    DATA:  BEGIN of it_disp Occurs 0 ,
             agr_tcodes type agr_tcodes-tcode ,        " Transaction code     A
             agr_name   type agr_tcodes-agr_name,      " Role Name            B
             agr_uname  type agr_users-uname,          "  Short User Name     B
             ttext      type tstct-ttext,              "  Description Name    C
             sprsl      type tstct-sprsl ,             "  Language            c
           END OF it_disp.
    *DATA: i_data TYPE TABLE OF ty_data, " internal table
    *wa_data TYPE ty_data. " work area
    SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME.
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: p_tcode FOR agr_tcodes-tcode OBLIGATORY, "no-extension no intervals,
                    u_name  for agr_users-uname,
                    r_name for agr_users-uname .
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
    SELECTION-SCREEN END OF BLOCK blk2.
    SELECTION-SCREEN END OF BLOCK blk.
    START-OF-SELECTION.
    PERFORM get_data.
    PERFORM modify_data.
    PERFORM disp_data .
    END-OF-SELECTION.
    *& Form get_data
    text
    --> p1 text
    <-- p2 text
    FORM get_data .
    select agr_tcodestcode agr_tcodesagr_name agr_usersuname  tstctttext tstct~sprsl
    into table it_disp
    from agr_tcodes
    inner join agr_users
    on agr_tcodesagr_name = agr_usersagr_name
    inner join tstct
    on agr_tcodestcode = tstcttcode
    and
    tstct~sprsl eq 'E'.
    ENDFORM. "get_data
    *& Form modify_data
    text
    --> p1 text
    <-- p2 text
    FORM modify_data .
    MOVE-CORRESPONDING itab TO it_disp.
    APPEND it_disp.
    CLEAR it_disp.
    ENDFORM. " modify_data
    *& Form Disp_data
    text
    --> p1 text
    <-- p2 text
    FORM disp_data .
    PERFORM fill_layout_structure.
    PERFORM fill_field_catalog_table.
    PERFORM alv_header USING i_header.
    PERFORM call_alv_function.
    ENDFORM. " Disp_data
    *& Form fill_layout_structure
    text
    --> p1 text
    <-- p2 text
    FORM fill_layout_structure .
    CLEAR is_layout.
    is_layout-colwidth_optimize = 'X'.
    is_layout-zebra = 'X'.
    is_layout-no_input = 'X'.
    is_layout-colwidth_optimize = 'X'.
    is_layout-totals_text = 'Totals'(201).
    is_layout-totals_only = 'X'.
    is_layout-zebra = 'X'.
    is_layout-group_change_edit = 'X'.
    is_layout-header_text = 'Wagners Users Transaction Code'.
    ENDFORM. " fill_layout_structure
    *& Form fill_field_catalog_table
    text
    --> p1 text
    <-- p2 text
    FORM fill_field_catalog_table .
    DATA : gls1(10).
    BREAK-POINT.
    PERFORM fill_field_catalog USING :
    'agr_tcode' 'Trans Code .' '10' 'IT_DISP' space space 'C11' ' ' ' ',
    'agr_name' 'Name' '40' 'IT_FINAL' space space 'C11' ' ' ' ' ,
    'agr_uname' 'Role' '60' 'IT_FINAL' space space 'C11' 'X' ' ',
    'ttext' 'Descript' '80' 'IT_FINAL' space space 'C11' ' ' ' '.
    ENDFORM. " fill_field_catalog_table
    *& Form fill_field_catalog
    text
    FORM fill_field_catalog USING f d l t s z y a b.
    DATA t_fld TYPE slis_fieldcat_alv.
    STATICS pos LIKE sy-index VALUE 0.
    pos = pos + 1. 
    CLEAR t_fld.
    MOVE 1 TO t_fld-row_pos.
    MOVE pos TO t_fld-col_pos.
    MOVE f TO t_fld-fieldname.
    MOVE d TO t_fld-seltext_m.
    MOVE l TO t_fld-outputlen.
    MOVE t TO t_fld-tabname.
    MOVE s TO t_fld-do_sum.
    MOVE z TO t_fld-no_zero.
    MOVE y TO t_fld-emphasize.
    MOVE a TO t_fld-no_out.
    MOVE b TO t_fld-no_sum.
    APPEND t_fld TO it_fieldcat.
    ENDFORM. " fill_field_catalog
    *& Form alv_header
    text
    -->P_I_HEADER text
    FORM alv_header USING p_i_header.
    DATA: wa_line TYPE slis_listheader.
    CLEAR wa_line.
    wa_line-typ = 'H'.
    wa_line-info = 'Wagners Investment'.
    APPEND wa_line TO i_header.
    ENDFORM. " alv_header
    *& Form call_alv_function
    text
    --> p1 text
    <-- p2 text
    FORM call_alv_function .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    IS_LAYOUT = IS_LAYOUT
    IT_FIELDCAT = IT_FIELDCAT
    TABLES
    t_outtab = IT_DISP.
    IF sy-subrc eq 0.
    ENDIF.
    ENDFORM. " call_alv_function

    Hi Venkat
    Thanks a lot for correcting and sending me the format , Now I can manage to change the other reports too.
    I have one more report which is bashing my head like anything , This is basically a fuel calculation report for managment , I want to change this too in ALV FORMAT, I did all my efforts to correct but it is looping inside as i close the report.
    Thanks in Advanced
    REPORT Z_ESLP_ZFCR1 LINE-SIZE  220 LINE-COUNT 75
             NO STANDARD PAGE HEADING.
    TABLES : equi,
    equz,
    imptt,
    imrg,
    eqkt,
    iloa.
    type-pools: slis. "ALV Declarations
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
    gd_tab_group type slis_t_sp_group_alv,
    gd_layout type slis_layout_alv,
    gd_repid like sy-repid.
    TYPES: BEGIN OF ty_data ,
    equnr type equnr, " Euipment no
    eqktx type eqkt-eqktx, " Equipment Text
    eqfnr type iloa-eqfnr, " Equipment Sort field
    idate type imrg-idate, " Measuring Date
    recdu type imrg-recdu, " Unit of measuring ='KM','L','H'
    recdv type imrg-recdv, " Counter reading data
    cancl type imrg-cancl,
    END OF ty_data.
    TYPES: BEGIN OF ty_final,
    equnr type equnr, " Equipment no
    eqktx type eqkt-eqktx, " Equipment Text
    eqfnr type iloa-eqfnr, " Equipment Sort field
    idate type imrg-idate, " Measuring Date
    min_date_km type imrg-idate, " Min Date
    min_km type P DECIMALS 2, " Max Km
    max_date_km type imrg-idate,
    max_km type P DECIMALS 2, " Min km
    t_max_min_km type P DECIMALS 2, " Total min_km-max_km
    min_date_hr type imrg-idate, " Max Date
    min_hr type P DECIMALS 2, " Max hr
    max_date_hr type imrg-idate,
    max_hr type P DECIMALS 2, " Min hr
    t_max_min_hr type P DECIMALS 2, " Total min_hr-max_hr
    min_date_lit type imrg-idate,
    min_lit type P DECIMALS 2, " Min lit
    max_date_lit type imrg-idate,
    max_lit type P DECIMALS 2, " Max lit
    fuel_con type imrg-recdv, " Total_hrs / t_max_min_hr
    fuel_con2 type P DECIMALS 2, " Total_hrs / t_max_min_hr
    km_l type P DECIMALS 2, " t max_min_km / t_max_min_lit
    l_p type P DECIMALS 2 , " t_max_min_lit / t_max_min_hr
    l_p2 type P DECIMALS 2 ,
    END OF ty_final.
    DATA: i_data TYPE TABLE OF ty_data, " internal table
    wa_data TYPE ty_data, " work area
    i_final TYPE TABLE OF ty_final, " internal table
    wa_final TYPE ty_final. " work area
    SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME.
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: p_equnr FOR equi-equnr OBLIGATORY, "no-extension no intervals,
    p_idate FOR imrg-idate. "NO-EXTENSION NO INTERVALS OBLIGATORY,
    "p_recdu FOR imrg-recdu." NO-EXTENSION NO INTERVALS ."default 'M3'" OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
    SELECTION-SCREEN END OF BLOCK blk2.
    SELECTION-SCREEN END OF BLOCK blk.
    TOP-OF-PAGE.
    FORMAT INTENSIFIED ON.
    WRITE:/55(40) ' WAGNERS INVESTMENT LIMITED '.
    WRITE:/50(40) ' VEHICLE FUEL CONSUMPTION REPORT ' CENTERED ,
    2 'Page', sy-pagno.
    FORMAT INTENSIFIED OFF.
    WRITE:/50(40) '----
    ' CENTERED .
    FORMAT INTENSIFIED ON.
    WRITE:/2 sy-datum COLOR 3, sy-uzeit .
    "WRITE:/1 S903-SPMON ."p_yearf.
    ULINE.
    "CENTERED.
    write: /2 'Equipment No :'left-justified,p_equnr-low color 2 , ' to ' , p_equnr-high color 2.
    write: /2 'Date From :', p_idate-low color 2 , ' to ' , p_idate-high color 2.
    END-OF-PAGE.
    START-OF-SELECTION.
    select aequnr deqktx feqfnr eidate erecdu erecdv
    into table i_data
    from equi AS a
    inner join equz as b
    on aequnr = bequnr
    inner join iloa as f
    on biloan = filoan
    inner join imptt as c
    on aobjnr = cmpobj
    inner join eqkt as d
    on aequnr = dequnr
    inner join imrg as e
    on epoint = cpoint
    where a~equnr in p_equnr
    and
    e~idate in p_idate and
    e~cancl ne 'X'.
    loop at i_data into wa_data.
    CLEAR: wa_final.
    READ TABLE i_final into wa_final
    with key equnr = wa_data-equnr." BINARY SEARCH.
    if sy-subrc EQ 0.
    PERFORM F_GET_MAX_DATA.
    PERFORM F_GET_MAX_HOURS.
    PERFORM F_GET_MAX_LIT.
    PERFORM prepare_final_rec USING'M'. " Modify Existing Record
    perform build_fieldcatalog.
    perform build_layout.
    perform display_alv_report.
    ElSE.
    PERFORM prepare_final_rec USING'A'. " Append New Record.
    ENDIF.
    ENDLOOP.
    LOOP AT i_final into wa_final.
    on change of wa_final-equnr.
    perform build_fieldcatalog.
    endon.
    uline.
    endloop.
    refresh i_final.
    clear i_final.
    FORM F_GET_MAX_DATA.
    select single MAX( eidate ) Min( eidate ) MAX( erecdv ) MIN( erecdv )
    into corresponding fields of (wa_final-max_date_km,wa_final-min_date_km,wa_final-max_km ,wa_final-min_km)
    from equi AS a
    inner join equz as b
    on aequnr = bequnr
    inner join iloa as f
    on biloan = filoan
    inner join imptt as c
    on aobjnr = cmpobj
    inner join eqkt as d
    on aequnr = dequnr
    inner join imrg as e
    on epoint = cpoint
    where a~equnr in p_equnr
    and
    e~idate in p_idate
    and
    e~cancl ne 'X' and
    e~recdu = 'KM'
    AND a~equnr = wa_data-equnr.
    ENDFORM.
    FORM F_GET_MAX_HOURS.
    select single MAX( erecdv ) MIN( erecdv )
    into corresponding fields of (wa_final-max_hr, wa_final-min_hr)
    from equi AS a
    inner join equz as b
    on aequnr = bequnr
    inner join iloa as f
    on biloan = filoan
    inner join imptt as c
    on aobjnr = cmpobj
    inner join eqkt as d
    on aequnr = dequnr
    inner join imrg as e
    on epoint = cpoint
    where a~equnr in p_equnr
    and
    e~idate in p_idate
    and
    e~cancl ne 'X' and
    e~recdu = 'H'
    AND a~equnr = wa_data-equnr .
    ENDFORM.
    FORM F_GET_MAX_LIT.
    select SUM( e~recdv )
    into corresponding fields of (wa_final-fuel_con2)
    from equi AS a
    inner join eqkt as b
    on bequnr = aequnr
    inner join imptt as c
    on cmpobj = aobjnr
    inner join imrg as e
    on epoint = cpoint
    where a~equnr in p_equnr
    and
    e~idate in p_idate
    and
    e~cancl ne 'X' and
    e~recdu = 'L'
    AND a~equnr = wa_data-equnr.
    ENDFORM.
    FORM prepare_final_rec USING p_mode TYPE char1.
    wa_final-t_max_min_km = wa_final-max_km - wa_final-min_km .
    wa_final-t_max_min_hr = wa_final-max_hr - wa_final-min_hr.
    if wa_final-t_max_min_km eq 0 .
    wa_final-km_l = ( wa_final-max_km - wa_final-min_km ) / ( wa_final-fuel_con2 ) .
    ELSE.
    wa_final-km_l = 0.
    endif.
    if wa_final-t_max_min_hr eq 0 .
    wa_final-l_p2 = ( wa_final-fuel_con2 ) / ( wa_final-t_max_min_hr ) .
    ELSE.
    wa_final-l_p2 = 0.
    endif.
    IF p_mode = 'A'.
    wa_final-equnr = wa_data-equnr.
    wa_final-eqktx = wa_data-eqktx.
    wa_final-eqfnr = wa_data-eqfnr.
    wa_final-t_max_min_km = wa_final-min_km - wa_final-max_km .
    wa_final-t_max_min_hr = wa_final-max_hr - wa_final-min_hr.
    wa_final-km_l = ( wa_final-max_km - wa_final-min_km ) / ( wa_final-fuel_con2 ).
    wa_final-l_p2 = ( wa_final-fuel_con2 ) / ( wa_final-t_max_min_hr ) .
    APPEND wa_final TO i_final .
    ELSE.
    MODIFY i_final FROM wa_final
    TRANSPORTING
    eqfnr
    max_date_km
    min_date_km
    max_date_lit
    min_date_lit
    max_date_hr
    min_date_hr
    max_km
    min_km
    max_hr
    min_hr
    t_max_min_km
    t_max_min_hr
    fuel_con2
    km_l
    l_p2
    where equnr = wa_data-equnr.
    ENDIF.
    ENDFORM. " PREPARE_FINAL_REC
    *& Form BUILD_FIELDCATALOG
    Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    I.e. Field type may be required in-order for
    the 'TOTAL' function to work.
    fieldcatalog-fieldname = 'EQUNR'.
    fieldcatalog-seltext_m = 'Equip no'.
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-col_pos = 0.
    fieldcatalog-outputlen = 10.
    fieldcatalog-emphasize = 'X'.
    fieldcatalog-key = 'X'.
    fieldcatalog-do_sum = 'X'.
    fieldcatalog-no_zero = 'X'.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'EQKTX'.
    fieldcatalog-seltext_m = 'Description'.
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-col_pos = 1.
    fieldcatalog-outputlen = 40.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'EQFNR'.
    fieldcatalog-seltext_m = 'Sortfield'.
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-col_pos = 2.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MIN_DATE_KM'.
    fieldcatalog-seltext_m = 'Min Date'.
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-col_pos = 3.
    fieldcatalog-outputlen = 12.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MAX_DATE_KM'.
    fieldcatalog-seltext_m = 'Max Date'.
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-col_pos = 4.
    fieldcatalog-outputlen = 12.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MIN_KM' .
    fieldcatalog-seltext_m = 'Min KM'.
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-col_pos = 5.
    fieldcatalog-outputlen = 12.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MAX_KM' .
    fieldcatalog-seltext_m = 'Max KM'.
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-col_pos = 6.
    fieldcatalog-outputlen = 12.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'T_MAX_MIN_KM' .
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-seltext_m = 'Total KM'.
    fieldcatalog-col_pos = 7.
    fieldcatalog-outputlen = 12.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MIN_HR' .
    fieldcatalog-seltext_m = 'Min Hr'.
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-col_pos = 8.
    fieldcatalog-outputlen = 12.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MAX_HR' .
    fieldcatalog-seltext_m = 'Max Hr'.
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-col_pos = 9.
    fieldcatalog-outputlen = 12.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'T_MAX_MIN_HR' .
    fieldcatalog-seltext_m = 'Total HR'.
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-col_pos = 10.
    fieldcatalog-outputlen = 12.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'FUEL_CON2' .
    fieldcatalog-seltext_m = 'Fuel'.
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-col_pos = 11.
    fieldcatalog-outputlen = 12.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'KM_L' .
    fieldcatalog-seltext_m = 'Km/L'.
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-col_pos = 12.
    fieldcatalog-outputlen = 12.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'L_P2' .
    fieldcatalog-seltext_m = 'Lit/HR'.
    fieldcatalog-tabname = 'i_final'.
    fieldcatalog-col_pos = 13.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    endform. " BUILD_FIELDCATALOG
    *& Form BUILD_LAYOUT
    Build layout for ALV grid report
    form build_layout.
    gd_layout-no_input = 'X'.
    gd_layout-colwidth_optimize = 'X'.
    gd_layout-totals_text = 'Totals'(201).
    gd_layout-totals_only = 'X'.
    gd_layout-f2code = 'DISP'. "Sets fcode for when double
    "click(press f2)
    gd_layout-zebra = 'X'.
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text = 'helllllo'.
    endform. " BUILD_LAYOUT
    *& Form DISPLAY_ALV_REPORT
    Display report using ALV grid
    form display_alv_report.
    gd_repid = sy-repid.
    call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
    i_callback_program = gd_repid
    i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
    i_callback_user_command = 'USER_COMMAND'
    i_grid_title = outtext
    is_layout = gd_layout
    it_fieldcat = fieldcatalog[]
    it_special_groups = gd_tabgroup
    IT_EVENTS = GT_XEVENTS
    i_save = 'X'
    is_variant = z_template
    tables
    t_outtab = i_final
    exceptions
    program_error = 1
    others = 2.
    if sy-subrc eq 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    endform. " DISPLAY_ALV_REPORT

  • ALV XLS format problem

    In some of the reports when we view the ALV output in xls format(in GUI) the totals are not showing.The  total are coming properly in theALV grid format and it is also showing correct when we download it into local file in xls format. Anyone please help me with this problem.
    Thx to all in advance

    Any filters set, sort criteria, totals calculated and subtotals are not  taken into account for the transfer to the spreadsheet.
    When you transfer to as local file then file is not generating as excel file its simple TXT only difference is extension will show as XLS, you can open this file in notepad also

  • Workbook Header Format Problem

    Dear all,
    I have a workbook in BI 7.0, What i need is to add a logo and make headers of the query bold.
    as i save my workbook and run again, i can see the logo, however my format changes in query (that is  header color change font change) disappears.
    In bw3.0 there used to be a format change button in bex tool bar apart form excel  format change. Where it is or how can i  change my formats at query header ?
    thanks,
    jmq

    >
    john mcquade wrote:
    >
    > In bw3.0 there used to be a format change button in bex tool bar apart form excel  format change. Where it is or how can i  change my formats at query header ?
    >
    > thanks,
    >
    > jmq
    The concept is a bit different in BI 7, you need to change using the excel
    Format --->Styles. Here you will find SAPBEX***** styles which you can change based on your requirement.

  • ALV date format problem

    Hi ,
    I Created an ALV report in that I am getting the sales order details... and once I get the list I am moving to excel sheet ...
    Once I moved to excel sheet by creating the layout , I am getting DAT colums as 00.00.0000 if the cell is empty.. how to avoide this ....

    Try with NO_ZERO = 'X'. for the Date field in the fieldcatalog.
    I am not sure of this , Give a try once.

  • Problems with ALV header

    Hi there,
    i've got a little problem with my ALV header. every time when i run my program and want to go back to the selection screen with the BACK-button i see my header again. so i've got to push the BACK-button again to get to the selection screen.
    here's my alv-code
    FORM TOP_OF_PAGE.
      REFRESH header_itab[].
      CLEAR wa_header.
      wa_header-typ = 'H'.
    *  wa_header-key = 'ausw1'.
      wa_header-info = text-001.
      APPEND wa_header TO header_itab.
      CLEAR wa_header.
      IF radio1 = 'X'.
        wa_header-typ = 'S'.
        wa_header-key = 'Radiobutton1'.
        wa_header-info = text-002.
        APPEND wa_header TO header_itab.
        CLEAR wa_header.
      ELSEIF radio2 = 'X'.
        wa_header-typ = 'S'.
        wa_header-key = 'Radiobutton2'.
        wa_header-info = text-003.
        APPEND wa_header TO header_itab.
        CLEAR wa_header.
      ELSEIF radio3 = 'X'.
        wa_header-typ = 'S'.
        wa_header-key = 'Radiobutton3'.
        wa_header-info = text-004.
        APPEND wa_header TO header_itab.
        CLEAR wa_header.
      ELSEIF radio4 = 'X'.
        wa_header-typ = 'S'.
        wa_header-key = 'Radiobutton4'.
        wa_header-info = text-005.
        APPEND wa_header TO header_itab.
        CLEAR wa_header.
      ELSE.
        wa_header-typ = 'S'.
        wa_header-key = 'Radiobutton5'.
        wa_header-info = text-006.
        APPEND wa_header TO header_itab.
        CLEAR wa_header.
      ENDIF.
      wa_header-typ = 'S'.
      wa_header-key = 'Benutzer:'.
      wa_header-info = sy-uname.
      APPEND wa_header TO header_itab.
      CLEAR wa_header.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                it_list_commentary = header_itab.
    ENDFORM.
    *       FORM alv_füllen                                               *
    FORM alv_fuellen .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_callback_program     = my_repid
                i_callback_top_of_page = 'TOP_OF_PAGE'
    *            i_grid_title           = my_title
                it_fieldcat            = feldkatalog_itab
                is_layout              = gs_layout
    *            it_events              = event_itab
           TABLES
                t_outtab               = itab
           EXCEPTIONS
                program_error          = 1
                OTHERS                 = 2.
    ENDFORM.
    *       FORM layout_allg_build                                        *
    FORM layout_allg_build.
           gs_layout-zebra  = 'X'.
           gs_layout-colwidth_optimize = 'X'.
    ENDFORM.
    hope someone can help me.
    regards tobias

    hi,
    i tried some of your ideas but none helped my.
    so here's my complete code
    maybe this is helpful.
    *& Report  z_cd_tool_awdimaiob
    REPORT z_cd_tool_awdimaiob.
    * G L O B A L   I N T E R N  A L   T A B L E S
    DATA: BEGIN OF itab OCCURS 100,
          status TYPE dimaiobpar-zstatus,
          rtyp TYPE  dimaiobpar-zrtyp,
          zahlweg TYPE dimaiobpar-ezawe_x,
          a_status TYPE i,
          a_rtyp TYPE i,
          a_partner TYPE i,
          a_vertraege TYPE i,
          END OF itab .
    * G L O B A L   D A T A
    DATA: ok_code LIKE sy-ucomm,
          wa_test_tab LIKE dimaiobpar,
          my_title TYPE lvc_title,
          my_repid LIKE sy-repid.
    TYPE-POOLS: slis.
    DATA:     feldkatalog_itab  TYPE   slis_t_fieldcat_alv,
         wa_feldkatalog    TYPE   slis_fieldcat_alv,
           event_itab        TYPE   slis_t_event,
           header_itab       TYPE   slis_t_listheader,
           gs_layout         TYPE   slis_layout_alv,
           alv_event         TYPE   slis_alv_event,
           wa_header         TYPE   slis_listheader.
    DATA: t_tab LIKE dimaiobpar.
    *selection-screen
    SELECTION-SCREEN: SKIP, BEGIN OF BLOCK test WITH FRAME TITLE text-010.
    SELECT-OPTIONS: partner FOR  t_tab-partner,
                    astatus FOR  t_tab-zstatus.
    SELECTION-SCREEN END OF BLOCK test.
    *Radiobutton
    SELECTION-SCREEN: SKIP, BEGIN OF BLOCK test2 WITH FRAME TITLE text-020.
    PARAMETERS: radio1 RADIOBUTTON GROUP test DEFAULT 'X',
                radio2 RADIOBUTTON GROUP test,
                radio3 RADIOBUTTON GROUP test,
                radio4 RADIOBUTTON GROUP test,
                radio5 RADIOBUTTON GROUP test.
    SELECTION-SCREEN END OF BLOCK test2.
    * S T A R T - O F - S E L E C T I O N.
    START-OF-SELECTION.
    * Select-Abfrage
      PERFORM select_data.
    *END-OF-SELECTION.
    * Feldkatalog fuellen.
      PERFORM feldkatalog_fuellen .
    * Feldkatalog übergeben
      PERFORM alv_feldkatalog.
    * ALV-Event
      perform alv_event.
    * Layout bestimmen.
      PERFORM layout_allg_build.
    * header aufbau
      PERFORM top_of_page.
      SORT itab.
      my_title = 'Auswertung Dimaiobpar'.
      my_repid = sy-repid.
      PERFORM exit_program.
    END-OF-SELECTION.
    * ALV mit daten füllen
      PERFORM alv_fuellen.
    *       FORM alv_event                                                *
    FORM alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                i_list_type = 0
           IMPORTING
                et_events   = event_itab.
      READ TABLE event_itab
      WITH KEY name = 'TOP_OF_PAGE'
      INTO alv_event.
      IF sy-subrc EQ 0.
        MOVE 'TOP_OF_PAGE' TO alv_event-form.
        APPEND alv_event TO event_itab.
        ENDIF.
    ENDFORM.
    *       FORM alv_feldkatalog                                          *
    FORM alv_feldkatalog.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                i_program_name     = my_repid
                i_internal_tabname = 'ITAB'
                i_inclname         = my_repid
    *            i_bypassing_buffer = 'X'
           CHANGING
                ct_fieldcat        = feldkatalog_itab
           EXCEPTIONS
                program_error      = 1
                OTHERS             = 2.
    ENDFORM.
    *       FORM header                                                   *
    FORM top_of_page.
      CLEAR wa_header.
      wa_header-typ = 'H'.
    *  wa_header-key = 'ausw1'.
      wa_header-info = text-001.
      APPEND wa_header TO header_itab.
      CLEAR wa_header.
      IF radio1 = 'X'.
        wa_header-typ = 'S'.
        wa_header-key = 'Radiobutton1'.
        wa_header-info = text-002.
        APPEND wa_header TO header_itab.
        CLEAR wa_header.
      ELSEIF radio2 = 'X'.
        wa_header-typ = 'S'.
        wa_header-key = 'Radiobutton2'.
        wa_header-info = text-003.
        APPEND wa_header TO header_itab.
        CLEAR wa_header.
      ELSEIF radio3 = 'X'.
        wa_header-typ = 'S'.
        wa_header-key = 'Radiobutton3'.
        wa_header-info = text-004.
        APPEND wa_header TO header_itab.
        CLEAR wa_header.
      ELSEIF radio4 = 'X'.
        wa_header-typ = 'S'.
        wa_header-key = 'Radiobutton4'.
        wa_header-info = text-005.
        APPEND wa_header TO header_itab.
        CLEAR wa_header.
      ELSE.
        wa_header-typ = 'S'.
        wa_header-key = 'Radiobutton5'.
        wa_header-info = text-006.
        APPEND wa_header TO header_itab.
        CLEAR wa_header.
      ENDIF.
      wa_header-typ = 'S'.
      wa_header-key = 'Benutzer:'.
      wa_header-info = sy-uname.
      APPEND wa_header TO header_itab.
      CLEAR wa_header.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                it_list_commentary = header_itab.
      REFRESH header_itab.
    ENDFORM.
    *       FORM alv_füllen                                               *
    FORM alv_fuellen .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_callback_program     = my_repid
                i_callback_top_of_page = 'TOP_OF_PAGE'
    *            i_grid_title           = my_title
                it_fieldcat            = feldkatalog_itab[]
                is_layout              = gs_layout
    *            it_events              = event_itab
           TABLES
                t_outtab               = itab
           EXCEPTIONS
                program_error          = 1
                OTHERS                 = 2.
    ENDFORM.
    *       FORM layout_allg_build                                        *
    FORM layout_allg_build.
           gs_layout-zebra  = 'X'.
           gs_layout-colwidth_optimize = 'X'.
    ENDFORM.
    *       FORM feldkatalog_fuellen                                      *
    FORM feldkatalog_fuellen.
    *Feldkatalog erstellen/füllen mit hilfe der if-schleife anhand des
    *gewählten Radiobuttons
    IF radio1 = 'X'.
      CLEAR wa_feldkatalog.
           wa_feldkatalog-fieldname     = 'STATUS'.
           wa_feldkatalog-seltext_m     = 'Status'.
      APPEND wa_feldkatalog TO feldkatalog_itab.
      CLEAR wa_feldkatalog.
           wa_feldkatalog-fieldname     = 'RTYP'.
           wa_feldkatalog-seltext_m     = 'Rechungstyp'.
      APPEND wa_feldkatalog TO feldkatalog_itab.
      CLEAR wa_feldkatalog.
           wa_feldkatalog-fieldname     = 'A_RTYP'.
           wa_feldkatalog-seltext_m     = 'Anzahl Rechungstyp'.
      APPEND wa_feldkatalog TO feldkatalog_itab.
    ELSEIF radio2 = 'X'.
      CLEAR wa_feldkatalog.
           wa_feldkatalog-fieldname     = 'RTYP'.
           wa_feldkatalog-seltext_m     = 'Rechungstyp'.
      APPEND wa_feldkatalog TO feldkatalog_itab.
      CLEAR wa_feldkatalog.
           wa_feldkatalog-fieldname     = 'A_STATUS'.
           wa_feldkatalog-seltext_m     = 'Anzahl Status'.
      APPEND wa_feldkatalog TO feldkatalog_itab.
    ELSEIF radio3 = 'X'.
      CLEAR wa_feldkatalog.
           wa_feldkatalog-fieldname     = 'STATUS'.
           wa_feldkatalog-seltext_m     = 'Status'.
      APPEND wa_feldkatalog TO feldkatalog_itab.
      CLEAR wa_feldkatalog.
           wa_feldkatalog-fieldname     = 'RTYP'.
           wa_feldkatalog-seltext_m     = 'Rechungstyp'.
      APPEND wa_feldkatalog TO feldkatalog_itab.
      CLEAR wa_feldkatalog.
           wa_feldkatalog-fieldname     = 'A_VERTRAEGE'.
           wa_feldkatalog-seltext_m     = 'Anzahl Verträge'.
      APPEND wa_feldkatalog TO feldkatalog_itab.
    ELSEIF radio4 = 'X'.
      CLEAR wa_feldkatalog.
           wa_feldkatalog-fieldname     = 'STATUS'.
           wa_feldkatalog-seltext_m     = 'Status'.
      APPEND wa_feldkatalog TO feldkatalog_itab.
      CLEAR wa_feldkatalog.
           wa_feldkatalog-fieldname     = 'RTYP'.
           wa_feldkatalog-seltext_m     = 'Rechungstyp'.
      APPEND wa_feldkatalog TO feldkatalog_itab.
      CLEAR wa_feldkatalog.
           wa_feldkatalog-fieldname     = 'A_PARTNER'.
           wa_feldkatalog-seltext_m     = 'Anzahl GPartner'.
      APPEND wa_feldkatalog TO feldkatalog_itab.
    ELSE.
      CLEAR wa_feldkatalog.
           wa_feldkatalog-fieldname     = 'STATUS'.
           wa_feldkatalog-seltext_m     = 'Status'.
      APPEND wa_feldkatalog TO feldkatalog_itab.
      CLEAR wa_feldkatalog.
           wa_feldkatalog-fieldname     = 'RTYP'.
           wa_feldkatalog-seltext_m     = 'Rechungstyp'.
      APPEND wa_feldkatalog TO feldkatalog_itab.
      CLEAR wa_feldkatalog.
           wa_feldkatalog-fieldname     = 'ZAHLWEG'.
           wa_feldkatalog-seltext_m     = 'Zahlweg'.
      APPEND wa_feldkatalog TO feldkatalog_itab.
      CLEAR wa_feldkatalog.
           wa_feldkatalog-fieldname     = 'A_PARTNER'.
           wa_feldkatalog-seltext_m     = 'Anzahl GPartner'.
      APPEND wa_feldkatalog TO feldkatalog_itab.
    ENDIF.
    ENDFORM.
    *       FORM select_data                                              *
    FORM select_data.
    *select-abfrage mit hilfe der if-schleife, analog zum Feldkatalog
      IF radio1 = 'X'.
    *   Radiobutton1: Rechungstypen je Satus
        SELECT
           zstatus AS status
           zrtyp AS rtyp
           COUNT( DISTINCT zrtyp ) AS a_rtyp
           INTO CORRESPONDING FIELDS OF itab
           FROM dimaiobpar
           WHERE
           insobject LIKE 'V%' AND
           partner IN partner AND
           zstatus IN astatus
           GROUP BY ZSTATUS zrtyp
           ORDER BY zstatus.
          APPEND itab.
        ENDSELECT.
      ELSEIF radio2 = 'X'.
    * Radiobutton2: Status je Rechungstyp.
        SELECT
               zrtyp AS rtyp
               COUNT( DISTINCT zstatus ) AS a_status
               INTO CORRESPONDING FIELDS OF itab
               FROM dimaiobpar
               WHERE
               insobject LIKE 'V%' AND
               partner IN partner AND
               zstatus IN astatus
               GROUP BY  ZRTYP
               ORDER BY zrtyp.
          APPEND itab.
        ENDSELECT.
      ELSEIF radio3 = 'X'.
    * Radiobutton3: Anzahl Verträge je Status und Rtyp.
        SELECT
             zstatus AS status
             zrtyp AS rtyp
             COUNT( DISTINCT insobject ) AS a_vertraege
             INTO CORRESPONDING FIELDS OF itab
             FROM dimaiobpar
             WHERE
             insobject LIKE 'V%' AND
             partner IN partner AND
             zstatus IN astatus
             GROUP BY ZSTATUS zrtyp
             ORDER BY zstatus.
          APPEND itab.
        ENDSELECT.
      ELSEIF radio4 ='X'.
    *  Radiobutton4: Anzahl GPartner je Status und RTyp.
        SELECT
               zstatus AS status
               zrtyp AS rtyp
               COUNT( DISTINCT partner ) AS a_partner
               INTO CORRESPONDING FIELDS OF itab
               FROM dimaiobpar
               WHERE
               insobject LIKE 'V%' AND
               partner IN partner AND
               zstatus IN astatus
               GROUP BY ZSTATUS zrtyp
               ORDER BY zstatus zrtyp.
          APPEND itab.
        ENDSELECT.
      ELSE.
    * Radiobutton5: Anzahl Kunden nach Zahlweg.
        SELECT
             zstatus AS status
             zrtyp AS rtyp
             ezawe_x AS zahlweg
             COUNT( DISTINCT partner ) AS a_partner
             INTO CORRESPONDING FIELDS OF itab
             FROM dimaiobpar
             WHERE
             insobject LIKE 'V%' AND
             partner IN partner AND
             zstatus IN astatus AND
             ezawe_x IN ('E', 'F', space)
             GROUP BY ZSTATUS zrtyp EZAWE_X
             ORDER BY zstatus zrtyp.
          APPEND itab.
        ENDSELECT.
      ENDIF.
    ENDFORM.
    *       FORM EXIT_PROGRAM                                             *
    FORM exit_program.
    IF sy-ucomm = 'BACK' OR
       sy-ucomm = 'EXIT' OR
       sy-ucomm = 'CANCEL'.
      LEAVE PROGRAM.
      endif.
    ENDFORM.

  • ALV Heading Problem

    Hi Friends,
    In ALV GRID i need to display the output header like below.
    SHIP
    SOLD
    |----
    NUM
    NAME
    NUM
    NAME
    It's not dots and pipes. But like the box with above design.
    Can any one please give me your valuable inputs regarding this.
    I want to use it in ALV GRID . i.e: By using ALV FM or OOPS also.
    Thanks
    Srinivas.

    Hi
    REPORT znnr_nnr LINE-SIZE 125.
    TABLES: ekko.
    type-pools: slis. "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
    ebeln TYPE ekpo-ebeln,
    ebelp TYPE ekpo-ebelp,
    statu TYPE ekpo-statu,
    aedat TYPE ekpo-aedat,
    matnr TYPE ekpo-matnr,
    menge TYPE ekpo-menge,
    meins TYPE ekpo-meins,
    netpr TYPE ekpo-netpr,
    peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
    wa_ekko TYPE t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
    gd_tab_group type slis_t_sp_group_alv,
    gd_layout type slis_layout_alv,
    gd_repid like sy-repid,
    gt_events type slis_t_event,
    gd_prntparams type slis_print_alv.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform build_events.
    perform build_print_params.
    perform display_alv_report.
    *& Form BUILD_FIELDCATALOG
    Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    There are a number of ways to create a fieldcat.
    For the purpose of this example i will build the fieldcatalog manualy
    by populating the internal table fields individually and then
    appending the rows. This method can be the most time consuming but can
    also allow you more control of the final product.
    Beware though, you need to ensure that all fields required are
    populated. When using some of functionality available via ALV, such as
    total. You may need to provide more information than if you were
    simply displaying the result
    I.e. Field type may be required in-order for
    the 'TOTAL' function to work.
    fieldcatalog-fieldname = 'EBELN'.
    fieldcatalog-seltext_m = 'Purchase Order'.
    fieldcatalog-col_pos = 0.
    fieldcatalog-outputlen = 10.
    fieldcatalog-emphasize = 'X'.
    fieldcatalog-key = 'X'.
    fieldcatalog-do_sum = 'X'.
    fieldcatalog-no_zero = 'X'.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'EBELP'.
    fieldcatalog-seltext_m = 'PO Item'.
    fieldcatalog-col_pos = 1.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'STATU'.
    fieldcatalog-seltext_m = 'Status'.
    fieldcatalog-col_pos = 2.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'AEDAT'.
    fieldcatalog-seltext_m = 'Item change date'.
    fieldcatalog-col_pos = 3.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MATNR'.
    fieldcatalog-seltext_m = 'Material Number'.
    fieldcatalog-col_pos = 4.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MENGE'.
    fieldcatalog-seltext_m = 'PO quantity'.
    fieldcatalog-col_pos = 5.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MEINS'.
    fieldcatalog-seltext_m = 'Order Unit'.
    fieldcatalog-col_pos = 6.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'NETPR'.
    fieldcatalog-seltext_m = 'Net Price'.
    fieldcatalog-col_pos = 7.
    fieldcatalog-outputlen = 15.
    fieldcatalog-datatype = 'CURR'.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'PEINH'.
    fieldcatalog-seltext_m = 'Price Unit'.
    fieldcatalog-col_pos = 8.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    endform. " BUILD_FIELDCATALOG
    *& Form BUILD_LAYOUT
    Build layout for ALV grid report
    form build_layout.
    gd_layout-no_input = 'X'.
    gd_layout-colwidth_optimize = 'X'.
    gd_layout-totals_text = 'Totals'(201).
    gd_layout-totals_only = 'X'.
    gd_layout-f2code = 'DISP'. "Sets fcode for when double
    "click(press f2)
    gd_layout-zebra = 'X'.
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text = 'helllllo'.
    endform. " BUILD_LAYOUT
    *& Form DISPLAY_ALV_REPORT
    Display report using ALV grid
    form display_alv_report.
    gd_repid = sy-repid.
    call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
    i_callback_program = gd_repid
    i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
    i_callback_user_command = 'USER_COMMAND'
    i_grid_title = outtext
    is_layout = gd_layout
    it_fieldcat = fieldcatalog[]
    it_special_groups = gd_tabgroup
    it_events = gt_events
    is_print = gd_prntparams
    i_save = 'X'
    is_variant = z_template
    tables
    t_outtab = it_ekko
    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_ALV_REPORT
    *& Form DATA_RETRIEVAL
    Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    up to 10 rows
    from ekpo
    into table it_ekko.
    endform. " DATA_RETRIEVAL
    Form TOP-OF-PAGE *
    ALV Report Header *
    Form top-of-page.
    *ALV Header declarations
    data: t_header type slis_t_listheader,
    wa_header type slis_listheader,
    t_line like wa_header-info,
    ld_lines type i,
    ld_linesc(10) type c.
    Title
    wa_header-typ = 'H'.
    wa_header-info = 'EKKO Table Report'.
    append wa_header to t_header.
    clear wa_header.
    Date
    wa_header-typ = 'S'.
    wa_header-key = 'Date: '.
    CONCATENATE sy-datum+6(2) '.'
    sy-datum+4(2) '.'
    sy-datum(4) INTO wa_header-info. "todays date
    append wa_header to t_header.
    clear: wa_header.
    Total No. of Records Selected
    describe table it_ekko lines ld_lines.
    ld_linesc = ld_lines.
    concatenate 'Total No. of Records Selected: ' ld_linesc
    into t_line separated by space.
    wa_header-typ = 'A'.
    wa_header-info = t_line.
    append wa_header to t_header.
    clear: wa_header, t_line.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = t_header.
    i_logo = 'Z_LOGO'.
    endform.
    FORM USER_COMMAND *
    --> R_UCOMM *
    --> RS_SELFIELD *
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
    Check function code
    CASE r_ucomm.
    WHEN '&IC1'.
    Check field clicked on within ALVgrid report
    IF rs_selfield-fieldname = 'EBELN'.
    Read data table, using index of row user clicked on
    READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
    Set parameter ID for transaction screen field
    SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
    Sxecute transaction ME23N, and skip initial data entry screen
    CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
    ENDIF.
    ENDCASE.
    ENDFORM.
    *& Form BUILD_EVENTS
    Build events table
    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_end_of_page
    into ls_event.
    if sy-subrc = 0.
    move 'END_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
    *& Form BUILD_PRINT_PARAMS
    Setup print parameters
    form build_print_params.
    gd_prntparams-reserve_lines = '3'. "Lines reserved for footer
    gd_prntparams-no_coverpage = 'X'.
    endform. " BUILD_PRINT_PARAMS
    *& Form END_OF_PAGE
    form END_OF_PAGE.
    data: listwidth type i,
    ld_pagepos(10) type c,
    ld_page(10) type c.
    write: sy-uline(50).
    skip.
    write:/40 'Page:', sy-pagno .
    endform.
    *& Form END_OF_LIST
    form END_OF_LIST.
    data: listwidth type i,
    ld_pagepos(10) type c,
    ld_page(10) type c.
    endform.

  • Problem with aligning values in ALV header???????

    I am supposed to show  some values in ALV header some thing like this
    PGMID:      xxxxx
    Material:    p_Matnr-low    to   p_Matnr high
    Plant:        p_werks-low    to  p_werks-high
       ALV Reoport
    For this i wrote code something like this.
    Fieldcatalog-status='s'.
    Fieldcatalog-key = 'PGMID:'.
    FieldCatalog-info = 'xxxxxxxx'
    append field catlalog.
    Fieldcatalog-status='s'.
    Fieldcatalog-key = 'Material:'.
    Concatenate p_Matnr-low
                       'to'
                        p_Matnr-high into FieldCatalog-info. 
    append field catlalog.
    etc................
    Now output shown is like this
    PGMID:      xxxxx
    Material:    p_Matnr-low  to p_Matnr high
    Plant:        p_werks-low  to p_werks-high
    I am not able to give a good gap in between the 'to' as shown initially. Any idea on this??
    Rakesh

    Hi,
    Please find attached below code :
      IF NOT so_bukrs-low IS INITIAL AND NOT so_bukrs-high IS INITIAL.
        CLEAR: gs_line.
        gs_line-typ  = gc_s.
        gs_line-key  = 'Company Code'(015).
        CONCATENATE so_bukrs-low 'to' so_bukrs-high INTO gs_line-info
        SEPARATED BY space.
        APPEND gs_line TO lt_top_of_page.
      ELSEIF so_bukrs-low IS INITIAL AND so_bukrs-high IS INITIAL.
        CLEAR: gs_line.
        gs_line-typ  = gc_s.
        gs_line-key  = 'Company Code'(015).
        gs_line-info = 'ALL Values'(012).
        APPEND gs_line TO lt_top_of_page.
      ELSEIF so_bukrs-high IS INITIAL.
        CLEAR: gs_line.
        gs_line-typ  = gc_s.
        gs_line-key  = 'Company Code'(015).
        gs_line-info = so_bukrs-low.
        APPEND gs_line TO lt_top_of_page.
      ENDIF.
    *Fiscal Year
      CLEAR gs_line.
      gs_line-typ = gc_s.
      gs_line-key = 'Year'(014).
      MOVE sp_gjahr TO gs_line-info.
      APPEND gs_line TO lt_top_of_page.
    *Period
      CLEAR gs_line.
      gs_line-typ = gc_s.
      gs_line-key = 'Period'(013).
      MOVE sp_monat TO gs_line-info.
      APPEND gs_line TO lt_top_of_page.
    *Currency Key
      IF NOT so_waers-low IS INITIAL AND NOT so_waers-high IS INITIAL.
        CLEAR: gs_line.
        gs_line-typ  = gc_s.
        gs_line-key  = 'Currency'(011).
        CONCATENATE so_waers-low 'to' so_waers-high INTO gs_line-info
        SEPARATED BY space.
        APPEND gs_line TO lt_top_of_page.
      ELSEIF so_waers-low IS INITIAL AND so_waers-high IS INITIAL.
        CLEAR: gs_line.
        gs_line-typ  = gc_s.
        gs_line-key  = 'Currency'(011).
        gs_line-info = 'ALL Values'(012).
        APPEND gs_line TO lt_top_of_page.
      ELSEIF so_waers-high IS INITIAL.
        CLEAR: gs_line.
        gs_line-typ  = gc_s.
        gs_line-key  = 'Currency'(011).
        gs_line-info = so_waers-low.
        APPEND gs_line TO lt_top_of_page.
      ENDIF.
    *Clearing Doc
      IF NOT so_augbl-low IS INITIAL AND NOT so_augbl-high IS INITIAL.
        CLEAR: gs_line.
        gs_line-typ  = gc_s.
        gs_line-key  = 'Clearing Doc'(020).
        CONCATENATE so_augbl-low 'to' so_augbl-high INTO gs_line-info
        SEPARATED BY space.
        APPEND gs_line TO lt_top_of_page.
      ELSEIF so_augbl-low IS INITIAL AND so_augbl-high IS INITIAL.
        CLEAR: gs_line.
        gs_line-typ  = gc_s.
        gs_line-key  = 'Clearing Doc'(020).
        gs_line-info = 'ALL Values'(012).
        APPEND gs_line TO lt_top_of_page.
      ELSEIF so_augbl-high IS INITIAL.
        CLEAR: gs_line.
        gs_line-typ  = gc_s.
        gs_line-key  = 'Clearing Doc'(020).
        gs_line-info = so_augbl-low.
        APPEND gs_line TO lt_top_of_page.
      ENDIF.
    *User ID
      IF NOT so_usrid-low IS INITIAL AND NOT so_usrid-high IS INITIAL.
        CLEAR: gs_line.
        gs_line-typ  = gc_s.
        gs_line-key  = 'User ID'(021).
        CONCATENATE so_usrid-low 'to' so_usrid-high INTO gs_line-info
        SEPARATED BY space.
        APPEND gs_line TO lt_top_of_page.
      ELSEIF so_usrid-low IS INITIAL AND so_usrid-high IS INITIAL.
        CLEAR: gs_line.
        gs_line-typ  = gc_s.
        gs_line-key  = 'User ID'(021).
        gs_line-info = 'ALL Values'(012).
        APPEND gs_line TO lt_top_of_page.
      ELSEIF so_usrid-high IS INITIAL.
        CLEAR: gs_line.
        gs_line-typ  = gc_s.
        gs_line-key  = 'User ID'(021).
        gs_line-info = so_usrid-low.
        APPEND gs_line TO lt_top_of_page.
      ENDIF.
    *GL Account
      IF NOT so_hkont-low IS INITIAL AND NOT so_hkont-high IS INITIAL.
        SHIFT so_hkont-low LEFT DELETING LEADING '0'.
        SHIFT so_hkont-high LEFT DELETING LEADING '0'.
        CLEAR: gs_line.
        gs_line-typ  = gc_s.
        gs_line-key  = 'GL Account'(004).
        CONCATENATE so_hkont-low 'to' so_hkont-high INTO gs_line-info
        SEPARATED BY space.
        APPEND gs_line TO lt_top_of_page.
      ELSEIF so_hkont-low IS INITIAL AND so_hkont-high IS INITIAL.
        CLEAR: gs_line.
        gs_line-typ  = gc_s.
        gs_line-key  = 'GL Account'(004).
        gs_line-info = 'ALL Values'(012).
        APPEND gs_line TO lt_top_of_page.
      ELSEIF so_hkont-high IS INITIAL.
        SHIFT so_hkont-low LEFT DELETING LEADING '0'.
        CLEAR: gs_line.
        gs_line-typ  = gc_s.
        gs_line-key  = 'GL Account'(004).
        gs_line-info = so_hkont-low.
        APPEND gs_line TO lt_top_of_page.
      ENDIF.
    Thanks,
    Sriram Ponna.

  • Out put in ALV grid format

    Hi,
      i need a help from you my dear friend I'm providing you the following information in which i have extract some of the fields from two internal tables and i have to display it in the alv grid format. All the work was done successfully but the problem is the values from internal table are moved but the values are not coming in output in ALV grid format. so pleease try to solve my problem.
    Thanking you
    TABLES: J_1IEXCHDR, J_1IEXCDTL.
    type-pools: slis.
    DATA: ITAB1 TYPE J_1IEXCHDR OCCURS 0 WITH HEADER LINE.
    DATA: ITAB2 TYPE J_1IEXCHDR OCCURS 0 WITH HEADER LINE.
    DATA: ITAB3 TYPE J_1IEXCHDR OCCURS 0 WITH HEADER LINE.
    DATA: OK_CODE LIKE SY-UCOMM,
          GT_SFLIGHT TYPE TABLE OF itab,
          G_CONTAINER TYPE  SCRFNAME VALUE 'BCALV_GRID_DEMO_0100_CONT1',
          GRID1  TYPE REF TO CL_GUI_ALV_GRID,
          G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    DATA:   LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA:   GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
    DATA:    G_TABNAME TYPE SLIS_TABNAME VALUE 'RTAB_ALV'.
    data: fieldcat  type slis_t_fieldcat_alv.
    data: begin of itab occurs 0,
         lifnr type j_1iexchdr-lifnr,
         docno type j_1iexchdr-docno,
         exyear type j_1iexchdr-exyear,
         budat type j_1iexchdr-budat,
         exbed type j_1iexcDTL-exbed,
         rdoc1 type j_1iexcDTL-rdoc1,
         ecs type j_1iexcDTL-ecs,
         exbas type j_1iexcDTL-exbas,
         end of itab.
    start-of-selection.
    perform get_data.
    perform call_alv.
    form get_data.
    select * into corresponding fields of table itab
             from  J_1IEXCHDR
                     inner join  J_1IEXCDTL
                        on  J_1IEXCDTLlifnr =  J_1IEXCHDRlifnr
                     where  J_1IEXCHDr~status = 'P'.
    append itab.
    endform.
    CALL_ALV
    form call_alv.
    perform build_field_catalog.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
        i_callback_program = i_repid
    IT_SORT               = gt_sort
         it_fieldcat        = fieldcat[]
       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.
    Call ABAP List Viewer (ALV)
    call function 'REUSE_ALV_GRID_DISPLAY'
      exporting
        it_fieldcat  = fieldcat
      tables
         t_outtab     = itab.
    endform.
    form build_field_catalog.
    clear: fieldcat. refresh: fieldcat.
    data: tmp_fc type slis_fieldcat_alv.
    tmp_fc-reptext_ddic = 'Vendor No'.
    tmp_fc-fieldname    = 'lifnr'.
    tmp_fc-tabname      = 'itab'.
    tmp_fc-outputlen    = '10'.
    append tmp_fc to fieldcat.
    tmp_fc-reptext_ddic = 'docno'.
    tmp_fc-fieldname    = 'docno'.
    tmp_fc-tabname      = 'itab'.
    tmp_fc-outputlen    = '10'.
    append tmp_fc to fieldcat.
      tmp_fc-reptext_ddic = 'exyear'.
    tmp_fc-fieldname    = 'exyear'.
    tmp_fc-tabname      = 'itab'.
    tmp_fc-outputlen    = '10'.
    append tmp_fc to fieldcat.
    tmp_fc-reptext_ddic = 'budat'.
    tmp_fc-fieldname    = 'budat'.
    tmp_fc-tabname      = 'itab'.
    tmp_fc-outputlen    = '10'.
    append tmp_fc to fieldcat.
    tmp_fc-reptext_ddic = 'exbas'.
    tmp_fc-fieldname    = 'exbas'.
    tmp_fc-tabname      = 'itab'.
    tmp_fc-outputlen    = '10'.
    append tmp_fc to fieldcat.
      tmp_fc-reptext_ddic = 'exbed'.
    tmp_fc-fieldname    = 'exbed'.
    tmp_fc-tabname      = 'itab'.
    tmp_fc-outputlen    = '10'.
    append tmp_fc to fieldcat.
    tmp_fc-reptext_ddic = 'rdoc1'.
    tmp_fc-fieldname    = 'rdoc1'.
    tmp_fc-tabname      = 'itab'.
    tmp_fc-outputlen    = '10'.
    append tmp_fc to fieldcat.
    tmp_fc-reptext_ddic = 'ecs'.
    tmp_fc-fieldname    = 'ecs'.
    tmp_fc-tabname      = 'itab'.
    tmp_fc-outputlen    = '10'.
    append tmp_fc to fieldcat.
    endform.
    *loop at itab.
    *WRITE: /  ITAB-LIFNR,
             ITAB-DOCNO,
             ITAB-EXYEAR,
             ITAB-BUDAT,
             ITAB-EXBAS,
             ITAB-EXBED,
             ITAB-RDOC1,
             ITAB-ECS.
    *endloop.

    Hi Praveen,
    In the field cat internal tabel for fieldname you have to pass the values in caps.look at the followig eg:
    tmp_fc-fieldname = 'LIFNR'.
    let me know if you still have a problem after this change.
    regards,
    Raju

  • Space in Top of page on alv header

    Hi Experts,
    I do have a query on ALV , Can you please help me in solving my problem.
    Here goes my query...
    I have to develop a ALV where on the top of page i have to display two fields as shown in below which was highlighted in the screen
    http://img410.imageshack.us/my.php?image=op2sn9.jpg
    But i'm getting output as shown below screen
    http://img410.imageshack.us/my.php?image=op1ut4.jpg
    I have tried with space and all other alternatives but i'm unable to get the desired output.
    Can i have any sample code for the same
    Regards
    Nanda

    Hi,
    TABLES:     ekko.
    type-pools: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
    ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid,
          gt_events     type slis_t_event,
          gd_prntparams type slis_print_alv.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform build_events.
    perform build_print_params.
    perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
    *       Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    * There are a number of ways to create a fieldcat.
    * For the purpose of this example i will build the fieldcatalog manualy
    * by populating the internal table fields individually and then
    * appending the rows. This method can be the most time consuming but can
    * also allow you  more control of the final product.
    * Beware though, you need to ensure that all fields required are
    * populated. When using some of functionality available via ALV, such as
    * total. You may need to provide more information than if you were
    * simply displaying the result
    *               I.e. Field type may be required in-order for
    *                    the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    *  fieldcatalog-do_sum      = 'X'.
    *  fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material No'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
    *       Build layout for ALV grid report
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    *  gd_layout-totals_only        = 'X'.
    *  gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
    *                                         "click(press f2)
    *  gd_layout-zebra             = 'X'.
    *  gd_layout-group_change_edit = 'X'.
    *  gd_layout-header_text       = 'helllllo'.
    endform.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
    *       Display report using ALV grid
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
                i_callback_user_command = 'USER_COMMAND'
    *            i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
    *            it_special_groups       = gd_tabgroup
                it_events               = gt_events
                is_print                = gd_prntparams
                i_save                  = 'X'
    *            is_variant              = z_template
           tables
                t_outtab                = it_ekko
           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_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
    *       Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    * up to 10 rows
      from ekpo
      into table it_ekko.
    endform.                    " DATA_RETRIEVAL
    * Form  TOP-OF-PAGE                                                 *
    * ALV Report Header                                                 *
    Form top-of-page.
    *ALV Header declarations
    data: t_header type slis_t_listheader,
          wa_header type slis_listheader,
          t_line like wa_header-info,
          ld_lines type i,
          ld_linesc(10) type c.
    * Title
      wa_header-typ  = 'H'.
      wa_header-info = 'EKKO Table Report'.
      append wa_header to t_header.
      clear wa_header.
    * Date
      wa_header-typ  = 'S'.
      wa_header-key = 'Date: '.
      CONCATENATE  sy-datum+6(2) '.'
                   sy-datum+4(2) '.'
                   sy-datum(4) INTO wa_header-info.   "todays date
      append wa_header to t_header.
      clear: wa_header.
    * Total No. of Records Selected
      describe table it_ekko lines ld_lines.
      ld_linesc = ld_lines.
    concatenate 'Total No. of Records Selected:' ld_linesc
                        into t_line separated by space.
      wa_header-typ  = 'A'.
      wa_header-info = t_line.
      append wa_header to t_header.
      clear: wa_header, t_line.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                it_list_commentary = t_header.
    *            i_logo             = 'Z_LOGO'.
    endform.
    *       FORM USER_COMMAND                                          *
    *       --> R_UCOMM                                                *
    *       --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    * Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
    *   Check field clicked on within ALVgrid report
        IF rs_selfield-fieldname = 'EBELN'.
    *     Read data table, using index of row user clicked on
          READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
    *     Set parameter ID for transaction screen field
          SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
    *     Sxecute transaction ME23N, and skip initial data entry screen
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDCASE.
    ENDFORM.
    *&      Form  BUILD_EVENTS
    *       Build events table
    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_end_of_page
                               into ls_event.
      if sy-subrc = 0.
        move 'END_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
    *&      Form  BUILD_PRINT_PARAMS
    *       Setup print parameters
    form build_print_params.
      gd_prntparams-reserve_lines = '3'.   "Lines reserved for footer
      gd_prntparams-no_coverpage = 'X'.
    endform.                    " BUILD_PRINT_PARAMS
    *&      Form  END_OF_PAGE
    form END_OF_PAGE.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      write: sy-uline(50).
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    *&      Form  END_OF_LIST
    form END_OF_LIST.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    Try with this sample
    Regards
    Krishna

  • Alv heading to display in excel

    Hi
    i have a problem ,
    i want 2 take print of body of alv with ALV header.
    while printing , only body is comin for print-out, not a header.
    guide me.
    points vil be rewarded

    write the header under the event top-fo-page and use listheader structure and also use FM ALV_commentary _write
    see following code for example
    http://sapprograms.blogspot.com/2008/04/alv-grid-display-report.html

  • Regarding downlaod the output from ALV grid format

    Hi 
    i want to download the output ALV grid format into excel sheet .
    but condition is when ever user press the button (&ZDL) the should be downloaded.
    and also how to convert the output into CSV format.

    hi,
    when '&ZDL'.
    use this condition
    check this one for down loading
    try to download an ALV report in excel format using (list ->export -> local file-> soread sheet )
    Re: advantages of alv reports
    Excel Download to ALV report
    hi this is full program
    REPORT ZCR_BOMPLANT_DOWNLOAD.
    TABLES : MAST , "Material to BOM Link
    STKO , "BOM Header
    MARA . "General Material Data
    TYPES : BEGIN OF TY_MASTER ,
    MATNR TYPE MAST-MATNR , "Material Number
    WERKS TYPE MAST-WERKS , "Plant
    STLAN TYPE MAST-STLAN , "BOM Usage
    STLNR TYPE MAST-STLNR , "Bill of material
    STLAL TYPE MAST-STLAL , "Alternative BOM
    ANDAT TYPE MAST-ANDAT , "Date record created on
    AEDAT TYPE MAST-AEDAT , "Date of Last Change
    AENAM TYPE MAST-AENAM , "Name of Person Who Changed Object
    STLST TYPE STKO-STLST , "BOM status
    ZPLP1 TYPE MBEW-ZPLP1 , "Future Planned Price 1
    DWERK TYPE MVKE-DWERK , "Delivering Plant (Own or External)
    END OF TY_MASTER .
    TYPES : MY_TYPE(20) TYPE C.
    DATA : IT_MASTER TYPE STANDARD TABLE OF TY_MASTER,
    WA_MASTER TYPE TY_MASTER .
    DATA : IT_HEADER TYPE TABLE OF MY_TYPE.
    DATA : W_PTH TYPE RLGRAP-FILENAME.
    DATA : W_FILE TYPE RLGRAP-FILENAME.
    *--- Add Header Fields to Header Table ---
    APPEND 'Material Number' TO IT_HEADER .
    APPEND 'Plant' TO IT_HEADER .
    APPEND 'BOM Usage' TO IT_HEADER .
    APPEND 'Bill Code' TO IT_HEADER .
    APPEND 'Alternative BOM' TO IT_HEADER .
    APPEND 'Created On' TO IT_HEADER .
    APPEND 'Changed On' TO IT_HEADER .
    APPEND 'Changed By' TO IT_HEADER .
    APPEND 'BOM Status' TO IT_HEADER .
    APPEND 'Planned Price' TO IT_HEADER .
    APPEND 'Delivery Plant' TO IT_HEADER .
    IF SY-MANDT = '700'.
    W_PTH = '
    lkdb01\ISD\IS\Software Developments\Developments\Data Files\SAP Dumps\BOM_Available\'.
    ELSE.
    W_PTH = 'C:\'.
    ENDIF.
    START-OF-SELECTION.
    *--- Load Data to Internal Table ---
    SELECT MASTMATNR MASTWERKS MASTSTLAN MASTSTLNR MASTSTLAL MASTANDAT MASTAEDAT MASTAENAM STKO~STLST
    INTO TABLE IT_MASTER
    FROM MAST
    INNER JOIN STKO ON STKOSTLNR EQ MASTSTLNR
    AND STKOSTLAL EQ MASTSTLAL
    INNER JOIN MARA ON MARAMATNR EQ MASTMATNR
    WHERE MARA~MTART LIKE 'ZFG%'
    AND STKO~LKENZ NE 'X'
    AND STKO~LOEKZ NE 'X'
    AND STKO~STLST EQ '1'.
    SELECT MAST~MATNR MAST~WERKS MAST~STLAN MAST~STLNR MAST~STLAL MAST~ANDAT MAST~AEDAT MAST~AENAM STKO~STLST MBEW~ZPLP1 MVKE~DWERK
    INTO TABLE IT_MASTER
    FROM MAST
    INNER JOIN STKO ON STKO~STLNR EQ MAST~STLNR
    AND STKO~STLAL EQ MAST~STLAL
    INNER JOIN MARA ON MARA~MATNR EQ MAST~MATNR
    INNER JOIN MBEW ON MBEW~MATNR EQ MAST~MATNR
    AND MBEW~BWKEY EQ MAST~WERKS
    INNER JOIN MVKE ON MVKE~MATNR EQ MAST~MATNR
    WHERE MARA~MTART LIKE 'ZFG%'
    AND STKO~LKENZ NE 'X'
    AND STKO~LOEKZ NE 'X'
    AND STKO~STLST EQ '1'.
    IF SY-SUBRC <> 0.
    MESSAGE I014(ZLOAD).
    ENDIF.
    *--- Set Path to Function Module ---
    CONCATENATE W_PTH SY-DATUM ' - ' 'BOM_AVAILABLE_PLANT.XLS' INTO W_FILE.
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
    FILENAME = W_FILE
    FILETYPE = 'DAT'
    TABLES
    DATA_TAB = IT_MASTER
    FIELDNAMES = IT_HEADER
    EXCEPTIONS
    FILE_OPEN_ERROR = 1
    FILE_WRITE_ERROR = 2
    INVALID_FILESIZE = 3
    INVALID_TYPE = 4
    NO_BATCH = 5
    UNKNOWN_ERROR = 6
    INVALID_TABLE_EIDTH = 7
    GUI_REFUSE_FILETRANSFER = 8
    CUSTOMER_ERROR = 9
    OTHERS = 10.
    IF SY-SUBRC = 0.
    SUBMIT ZI005_MARA_DUMP_SOLIDEAL_N.
    MESSAGE I023(ZLOAD) WITH text-001.
    ELSE.
    MESSAGE I022(ZLOAD) WITH W_FILE. "Errors while downloading.
    ENDIF.
    END-OF-SELECTION.
    SUBMIT ZI005_MARA_DUMP_SOLIDEAL_N.

  • Format problem when export to RTF

    Hi,
    Iam creating a RTF template, when export to pdf everything working fine. However, when i export to RTF(word) alot of document properties got lost such as :
    font size default to 12 when it's blank line; page number are not re-start for multi sections; table properties not holding, header, footer and edge margin are not holding, etc...... Is there any way to fix these. I tried to create a word macro to fix some of the format problems, but the macro have to run manually instead of initialized form a text field option on exit. Any idea on how to fix or work around would be appreciated.
    Thanks,
    Tam

    im2famous4u wrote:
    Do you know if and when Pages will provide support for tables in rtf format? (My school requires that I send all assignments rtf format.)
    As Yvan points out, no one here can write what they know about it, and the vast majority of us know nothing about it.
    You cannot take any decision based on the assumption that Pages will one day support tables in RTFs, because it may never happen. If you need both RTF and tables, the only option is another tool (like NeoOffice, TextEdit, MS Office and so on).

  • Help on - ALV Heading

    Hi friends,
    I want the heading of an ALV report in the format given as below ..... Is that possible ???
    In the 1st line :-
    123 ( Left corner ) ..... ABC (Center).... date (right corner)
    In the second line also :- something like the first line .....
    Is that possible ???
    If yes ... How can i do this ???
    Expecting your answers
    thanks in advance
    Cheers
    R.Kripa

    refer the links:
    http://www.sap-img.com/abap/test-alv-display-with-header-footer.htm
    or
    http://www.sap-img.com/abap/sample-alv-heading-in-alv.htm
    or
    ALV LIST Header
    how to display header in alv list
    The last two would address your question more precisely.
    Regards,
    Ravi

  • Regarding ALV Header

    Hi Abapers,
    I am having one Problem regarding ALV Header on the report. Requirement is to get the data it into this order on ALV Header using Simple ABAP.
    Summary
    "Building No       Room No          Comments
    111                   AA                   Over Allocated.
    545                   XX                    Space Free
    787                   YY                   No Space
    I have Tried to enter it into the header table but the data is not coming correctly.
    Problem is It is coming in this way which is wrong..
    Summary
    "Building No  Room No  Comments
    111   AA   Over Allocated.
    545   XX    Space Free
    787   YY   No Space
    Can Any body solve my Problem to get the header information it into the below .
    Summary
    "Building No       Room No          Comments
    111                   AA                   Over Allocated.
    545                   XX                    Space Free
    787                   YY                   No Space

    Hi ,
    I have tried but couldn't succeded. Can you Please provide me the solution.

Maybe you are looking for