How to obtain the alv reports in the dilog programing.

how to obtain the alv reports in the dialog programming, that is when the push button in the screen in clicked it must be directed to the report, where to write the code for the report.

Hi
Use LEAVE TO LIST PROCESSING and develop your normal ALV dispaly as usual. System automatically takes care of this.
I tried for normal report but try above even in the case of ALV reports
Cheerz
Ram

Similar Messages

  • How to truncate the decimals in the ALV report for the quantity field

    Hi All,
    I have to display a quantity field and units of measure in the ALV output. If the units of measure eq 'PC' i should not display the decimal places for quantity in the alv output, otherwise i have to display the decimals in the output. How to do this....any help would be highly rewarded. I knew that for this type of cases decimal_o will not work.

    Hi,
    Declare one more Internal table same as output table. In that intead of that quantity field, declare field_name(15) type c.
    data temp type i.
    Loop at itab.
    if field = 'PC'.
    temp = qunantity field.
    field_name =temp.
    else.
    field_name = quantity field.
    endif.
    endif.
    endloop.

  • Dump for the ALV report for the excel.

    HI,
    We are having a ALV report.
    We are using REUSE_ALV_FIELDCATALOG_MERGE and REUSE_ALV_GRID_DISPLAY.
    After we run the report we get the output on the screen properly.
    When we choose the "Local File" button it goes to the dump.
    The following messages comes.
    Runtime Errors " OBJECTS_NOT_CHARLIKE"
    "The current statement requires a character-type data object.".
    Could you pls advise where is the problem.
    Rohita

    change the TABNAME to uppercase
    ls_fcat-tabname = 'LTB_REPORT'.   "<------------ changed to upper case
    ls_fcat-fieldname = 'NAME_ORG1'.
    ls_fcat-seltext_s = 'Distributor Name'.
    ls_fcat-seltext_m = 'Distributor Name'.
    ls_fcat-seltext_l = 'Distributor Name'.
    ls_fcat-datatype = 'CHAR'.
    ls_fcat-outputlen = 30.
    APPEND ls_fcat TO ct_fcat.

  • How to send a ALV report as a workitem

    Hi All,
    How to send a ALV report to the SAP Inbox for approval.
    Requirement: When the reviewer executes the report and click on send button.
    It will go to the approver for report approval.
    How to send a report when reviewer click on the send button.
    I am unable to find a solution when the user click on the send button the report will go to the approver.
    Please help me out on this...
    Regards,
    Siraj,
    +918008322278.

    Hi Siraj
    I do not have a ready sample with me; however, here can be a logical sequencing of steps which you can follow to achieve this:
    1) Define a custom PF STATUS in the ALV with the SEND Button
    2) In the User Command routine for ALV, code for SEND
    3) See how standard ALV - EXPORT to EXCEL Works - Debug and find the steps to generate an EXCEL - in the SEND Functionality
    4) Once Excel is downloaded, create a SOFM document for the same - Check the method CREATE of object SOFM on the coding required to do it
    5) Generate the SOFM Object Instance using the document created and calling FM SWO_INVOKE
    6) Now you have the run time instance of the report output as a document
    7) Define a custom Business object and a custom workflow based on that object
    8) Define a custom event with the event parameter of type SOFM
    9) From your SEND routine of the report -> trigger the event and pass the SOFM Instance of the excel as event parameter
    10) Workflow will have this object via binding from event to workflow container
    11) In the decision step to approver, bind this to _ATTACH_OBJECTS
    For each of these, you will find some  link already on SCN.
    Hope this helps.
    Once you have the solution, by the above steps or a better one, do remember to create a document on SCN in order to help others - this is a valid requirement and it would be good to have a ready reckoner :-)
    regards,
    Modak

  • How to do the ALV report output in groups and caluculate the tOTALS(URGENT

    Hi
    In my ALV report output .I have to group the output based on the DAYS field
    0-10 days in one group
    10-30 days in one group
    above 30 days one group
    There is also a field by name "AMOUNT" in my output.
    I have to calculate SUBTOTALs at the end of every group and at the end of the report i should caluculate GRAND TOTAL.
    Please remember that i should not use any any BLOCKED ALVs and for Totals i should not use the SYMBOLS provided in the application toolbar of the report
    Thanks in Advance

    Please don't repost your questions...
    Check out my answer in your other post.
    How to make the ALV report in groups  and caluculate the TOTALS
    Regards,
    Naimesh Patel

  • How to display the alv report blocks wise with out using the blocked alv

    Hi
    How to display the alv report with out using the blocked alv function module.
    Thanks
    Chinnu

    see this Standard Program
    RPR_ABAP_SOURCE_SCAN

  • How to get header in the ALV report

    Hi
    I want to print header in the ALV report.But i am not getting that.Plz see my program it is getting error and also not printing header.If there is any error means plz give me the solution.In this program there is an error.
    REPORT  ZREPORT_ALV .
    TYPE-POOLS : slis.
    tables:vbak,vbap.
    DATA:  report_id LIKE sy-repid.
    DATA: I_LAYOUT TYPE SLIS_LAYOUT_ALV.
    data: heading        TYPE slis_t_listheader,
          wa_header      TYPE slis_listheader,
         events         TYPE slis_t_event.
    data: l_string type c.
    data: ivariant(1) type c,
          itvariant like disvariant,
          w_variant like disvariant.
    initialization.
    REPORT_ID = SY-REPID.
    PERFORM pgm. "F1000_LAYOUT_INIT. "using I_LAYOUT.
    ivariant = 'A'.
    *PERFORM init.
    itvariant = w_variant.
    select-options:so_vbeln for vbap-vbeln.
    data:itab like vbak occurs 0 with header line.
    data:itab1 like vbap occurs 0 with header line.
    start-of-selection.
    select * from vbak into table itab where vbeln in so_vbeln.
    if not itab[] is initial.
    select * from vbap into table itab1
    for all entries in itab
    where vbeln = itab-vbeln.
    endif.
    data:ls_fieldcat TYPE slis_fieldcat_alv,
    lt_fieldcat1  TYPE slis_t_fieldcat_alv.
    ****For alv display
    IF NOT itab1[] IS INITIAL.
       DEFINE ls_fieldcat.
       add 1 to ls_fieldcat-col_pos.
        ls_fieldcat-fieldname    = &1.
        ls_fieldcat-outputlen    = &2.
        ls_fieldcat-seltext_l    = &3.
         ls_fieldcat-emphasize  = &4.
        append ls_fieldcat to lt_fieldcat1.
        clear ls_fieldcat.
      END-OF-DEFINITION.
        ls_fieldcat 'VBELN'           '10'     'Sales Order Number'.
       ls_fieldcat 'POSNR'           '6'        'SO Item'.
        ls_fieldcat 'MATNR'           '13'      'Material No'.
    m_fieldcat1 'NETWR'           '13'        'Amount'.
    CALL FUNCTION 'REUSE_ALV_GRID_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           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
    I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
       IS_LAYOUT                         =  I_LAYOUT
       IT_FIELDCAT                       =  lt_fieldcat1
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =   ITVARIANT
      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
      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                          =  itab1
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endif.
    CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
       I_SAVE              = ivariant
      CHANGING
       CS_VARIANT          = itvariant
    EXCEPTIONS
      WRONG_INPUT         = 1
      NOT_FOUND           = 2
      PROGRAM_ERROR       = 3
      OTHERS              = 4
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    FORM  pgm. "F1000_LAYOUT_INIT. "USING I_LAYOUT TYPE SLIS_LAYOUT_ALV.
    CLEAR I_LAYOUT.
    i_layout-colwidth_optimize = 'X'.
    I_LAYOUT-key_hotspot = u2018Xu2019.
    I_LAYOUT-hotspot_fieldname =  MATNR.
    ENDFORM.
    *regarding logo and header,,,,
    *first store the logo in T-code OAOR, then call that in your report.....
    *data: heading        TYPE slis_t_listheader,
         wa_header      TYPE slis_listheader,
        events         TYPE slis_t_event.
    To display TOP_OF_PAGE.
    FORM top_of_page.
      DATA : text(40),txtdt(40).
      CLEAR l_string.
      l_string = 'JCB India Limited'(hd2).
      wa_header-typ  = 'H'.
      wa_header-info = l_string.
      APPEND wa_header TO heading.                              " index 1.
      CLEAR l_string.
      WRITE :'Number of records:' TO text,'dbcnt' TO text+20 LEFT-JUSTIFIED.
      wa_header-typ  = 'S'.
      wa_header-info = text.
      APPEND wa_header TO heading.
    CLEAR l_string.
    wa_header-typ  = 'S'.
    WRITE : 'Report Run Date  :' TO txtdt,sy-datum TO txtdt+20 DD/MM/YY.
    WRITE sy-datum TO dat DD/MM/YY.
    wa_header-info = txtdt.
    APPEND wa_header TO heading.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
         i_logo             = 'ENJOYSAP_LOGO'
          it_list_commentary = heading.
      CLEAR heading.
    ENDFORM.                    "top_of_page
    *to execute top-of-page you have to create events.
    *for ex......
    FORM create_event USING p_events TYPE slis_t_event.
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = p_events.
      READ TABLE p_events WITH KEY name = slis_ev_top_of_page
                             INTO ls_event.
      IF sy-subrc = 0.
        MOVE formname_top_of_page TO ls_event-form.
        APPEND ls_event TO p_events.
      ENDIF.
    ENDFORM.                    " create_event

    Hi,
       Find below code for your question, you may get some idea,,
    *& Report  ZACTIONGRIDPRACTICE
    REPORT  ZACTIONGRIDPRACTICE.
    *data declarations.....
    TYPE-POOLS SLIS.
    TABLES : T529T ,PA0000.
    data : gd_repid type  sy-repid.
    DATA : LD_COLOR(10) TYPE N.
    DATA : GD_TAB_GROUP TYPE SLIS_T_SP_GROUP_ALV.
    Data:  is_fieldcat TYPE slis_fieldcat_alv.
    DATA : GD_LAYOUT TYPE SLIS_LAYOUT_ALV.
    DATA : GD_DATUM TYPE DATUM.
    DATA : BEGIN OF WA_TABLE,
                    MASSN TYPE T529T-MASSN,
                    MNTXT TYPE T529T-MNTXT,
                    userg type userg,
                    TOTAL TYPE I ,
                    begda type begda,
                    endda type endda,
                    april type i,
                    SLNO TYPE I,
                      LINE_COLOR(4) TYPE C,
                    END OF WA_TABLE,
                    IT_TABLE LIKE TABLE OF WA_TABLE.
    data : april type i.
    DATA : TEMP TYPE C.
    data :    LT_PA0000 TYPE TABLE OF PA0000,
              LT_PA0000_T typE TABLE OF PA0000 with header line.
    DATA : IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
            WA_FCAT LIKE LINE OF IT_FCAT.
    DATA : IT_EVENTS TYPE SLIS_T_EVENT,
            WA_EVENTS LIKE LINE OF IT_EVENTS.
            wa_events-form = 'HEADER'.
    WA_EVENTS-NAME = 'TOP_OF_PAGE'.
    APPEND WA_EVENTS TO IT_EVENTS.
    PERFORM HEADER.
    DATA : SLNO TYPE I.
    DATA : lv_output      TYPE  dats.
    CALL FUNCTION 'ZHR_RE_BE_CALC_START_DATE'
      EXPORTING
        id_daberi   = sy-datum
      IMPORTING
        ed_date_cor = lv_output.
    select-options...
    selection-screen BEGIN OF BLOCK B WITH FRAME TITLE TEXT-003.
    select-options : s_date for sy-datum OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK B.
    lv_output = sy-datum - 27.
    INITIALIZATION.
    S_DATE-LOW = lv_output.
    S_DATE-HIGH = SY-DATUM.
    S_DATE-SIGN = 'I'.
    S_DATE-OPTION = 'BT'.
    APPEND s_date.
    *AT SELECTION-SCREEN ON S_DATE.
    *SELECT MASSN INTO TABLE IT_TABLE FROM PA0000 WHERE BEGDA IN S_DATE.
    *SELECT STATEMENTS....
    start-of-selection.
      SELECT   t529t~MASSN t529t~MNTXT  INTO TABLE IT_table  FROM T529T where SPRSL EQ 'E' and t529t~massn in ('10','13','16','20','28','30','45','01','03') .
    DATUM IN S_DATE.
    PERFORM LAYOUT.
      loop at it_table into wa_table.
    LD_COLOR = 2.
      LD_COLOR = LD_COLOR + 1.
    if LD_COLOR = 8.
    LD_COLOR = 1.
    endif.
    concatenate 'C' '1' '11'  into wa_table-LINE_COLOR . "='C410'.
    modify it_table from wa_table.
    endloop.
      LOOP AT IT_TABLE INTO WA_TABLE." = 'C410'.
    select massn from pa0000 into table lt_pa0000 where begda in s_date and  massn = wa_table-massn.
    *write : / sy-dbcnt.  gt s_date-low and endda lt s_date-high
    *DESCRIBE TABLE LT_PA0000_t LINES LV_LINES.
    move sy-dbcnt to wa_table-total.
    READ TABLE lt_pa0000 INTO LT_PA0000_T WITH KEY MASSN = wa_TABLE-MASSN BINARY SEARCH.
    DESCRIBE TABLE LT_PA0000_t LINES LV_LINES.
    MOVE  LV_LINES to  wa_TABLE-TOTAL.
      MODIFY IT_TABLE FROM WA_TABLE.
    MOVE SY-TABIX TO WA_TABLE-SLNO.
      MODIFY IT_TABLE FROM WA_TABLE.
    REFRESH : LT_PA0000_t.
    CLEAR : LV_LINES.
      ENDLOOP.
    loop at it_table into wa_table.
    SELECT MASSN FROM PA0000 INTO TABLE lt_pa0000 where begda between '01.02.2008' and '20.02.2008'.
    MOVE SY-DBCNT TO   WA_TABLE-APRIL.
    MODIFY IT_TABLE FROM WA_TABLE.
    *endloop.
    *PERFORM STATEMENTS...
    PERFORM FCAT USING '1' 'MASSN' 'ACTIONCODE'.
    PERFORM FCAT USING '2' 'MNTXT' 'ACTION TYPE'.
    PERFORM fcat USING '3' 'TOTAL' 'TOTAL'.
    DEFINE m_fieldcat.
        is_fieldcat-fieldname = &1.
        is_fieldcat-hotspot = &2.
        is_fieldcat-seltext_m = &3.
        is_fieldcat-col_pos = &4.
        is_fieldcat-outputlen = &5.
        is_fieldcat-hotspot = &6.
        append is_fieldcat to it_fcat.
        clear is_fieldcat.
      END-OF-DEFINITION.
       m_fieldcat 'SLNO' '' Text-012 '1' '17'  ''.
      m_fieldcat 'MASSN' '' Text-010 '2' '40'  ''.
      m_fieldcat 'MNTXT'  ''  Text-009  '3' '50' ''  .
      m_fieldcat 'TOTAL'  ''  Text-011  '4' '10' 'X'.
      m_fieldcat 'april'  ''  Text-013  '5' '10' 'X'.
    *FOR DISPLAYING THE RECORDS...
    gd_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = gd_repid
      IS_LAYOUT = GD_LAYOUT
      I_CALLBACK_USER_COMMAND           = ' '
       I_GRID_TITLE                      = 'REPORT'
       IS_LAYOUT                         = gd_LAYOUT
       IT_FIELDCAT                       = IT_FCAT
       I_SAVE                            = 'X'
       IT_EVENTS                         = IT_EVENTS
      TABLES
        T_OUTTAB                          = IT_TABLE.
    **&      Form  FCAT
    *FORM FCAT  USING   FP_COL_POS
                     FP_FIELDNAME
                     FP_SELTEXT_M.
    WA_FCAT-COL_POS = FP_COL_POS.
    WA_FCAT-FIELDNAME = FP_FIELDNAME.
    wa_fcat-seltext_m = fp_seltext_m.
    APPEND WA_FCAT TO IT_FCAT.
    ENDFORM.
    *&      Form  HEADER
          text
    -->  p1        text
    <--  p2        text
    form header .
      DATA : IT_HEADER TYPE SLIS_T_LISTHEADER,
            WA_HEADER LIKE LINE OF it_header.
      WA_HEADER-TYP = 'H'.
      WA_HEADER-INFO = 'ACTION TYPE REPORT'.
      APPEND WA_HEADER TO IT_HEADER.
      wa_header-typ  = 'S'.
      wa_header-key = Text-022.
      CONCATENATE  s_date-low+6(2) '.'
                   s_date-low+4(2) '.'
                   s_date-low(4)
                   temp
                   '.     TO      .'
                   s_date-high+6(2) '.'
                   s_date-high+4(2) '.'
                   s_date-high(4)
                   INTO wa_header-info SEPARATED BY space.
      APPEND wa_header TO it_header.
      CLEAR wa_header.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = IT_HEADER
          I_LOGO             = 'HRRU_51050061'.
    *select single bstkd into CORRESPONDING FIELDS OF gt_vbkd
    *from vbkd where vbeln = rt_outtab-vgbel
    *and posnr = '000000'.
    *rt_outtab-bstkd = gt_vbkd-bstkd.
    ENDFORM.                    " HEADER
    *&      Form  LAYOUT
          text
    -->  p1        text
    <--  p2        text
    FORM LAYOUT .
    GD_LAYOUT-NO_INPUT = ''.
    gd_layout-colwidth_optimize = ''.
    gd_layout-totals_text = 'TOTALS'(201).
    gd_layout-info_fieldname =      'LINE_COLOR'.
    ENDFORM.                    " LAYOUT

  • Download the ALV Report output into excel sheet or notepad

    Hi,
    how to downlaod the alv report out into excel sheet or notepad in a proper manner. program contain large number records....
    Thanks in advance!!!!
    Regards,
    kranthi.

    Hi
    Download a report to excel with format (border, color cell, etc) 
    Try this program...it may help you to change the font ..etc.
    Code:
    REPORT ZSIRI NO STANDARD PAGE HEADING.
    this report demonstrates how to send some ABAP data to an
    EXCEL sheet using OLE automation.
    INCLUDE OLE2INCL.
    handles for OLE objects
    DATA: H_EXCEL TYPE OLE2_OBJECT,        " Excel object
          H_MAPL TYPE OLE2_OBJECT,         " list of workbooks
          H_MAP TYPE OLE2_OBJECT,          " workbook
          H_ZL TYPE OLE2_OBJECT,           " cell
          H_F TYPE OLE2_OBJECT.            " font
    TABLES: SPFLI.
    DATA  H TYPE I.
    table of flights
    DATA: IT_SPFLI LIKE SPFLI OCCURS 10 WITH HEADER LINE.
    *&   Event START-OF-SELECTION
    START-OF-SELECTION.
    read flights
      SELECT * FROM SPFLI INTO TABLE IT_SPFLI UP TO 10 ROWS.
    display header
      ULINE (61).
      WRITE: /     SY-VLINE NO-GAP,
              (3)  'Flg'(001) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (4)  'Nr'(002) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (20) 'Von'(003) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (20) 'Nach'(004) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (8)  'Zeit'(005) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP.
      ULINE /(61).
    display flights
      LOOP AT IT_SPFLI.
      WRITE: / SY-VLINE NO-GAP,
               IT_SPFLI-CARRID COLOR COL_KEY NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-CONNID COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-CITYFROM COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-CITYTO COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-DEPTIME COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP.
      ENDLOOP.
      ULINE /(61).
    tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-007
           EXCEPTIONS
                OTHERS     = 1.
    start Excel
      CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
    PERFORM ERR_HDL.
      SET PROPERTY OF H_EXCEL  'Visible' = 1.
    CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:\kis_excel.xls'
    PERFORM ERR_HDL.
    tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-008
           EXCEPTIONS
                OTHERS     = 1.
    get list of workbooks, initially empty
      CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
      PERFORM ERR_HDL.
    add a new workbook
      CALL METHOD OF H_MAPL 'Add' = H_MAP.
      PERFORM ERR_HDL.
    tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-009
           EXCEPTIONS
                OTHERS     = 1.
    output column headings to active Excel sheet
      PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
      PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
      PERFORM FILL_CELL USING 1 3 1 'Von'(003).
      PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
      PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
      LOOP AT IT_SPFLI.
    copy flights to active EXCEL sheet
        H = SY-TABIX + 1.
        PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
        PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
        PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
        PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
        PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
      ENDLOOP.
    changes by Kishore  - start
    CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
      CALL METHOD OF H_EXCEL 'Worksheets' = H_MAPL." EXPORTING #1 = 2.
      PERFORM ERR_HDL.
    add a new workbook
      CALL METHOD OF H_MAPL 'Add' = H_MAP  EXPORTING #1 = 2.
      PERFORM ERR_HDL.
    tell user what is going on
      SET PROPERTY OF H_MAP 'NAME' = 'COPY'.
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-009
           EXCEPTIONS
                OTHERS     = 1.
    output column headings to active Excel sheet
      PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
      PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
      PERFORM FILL_CELL USING 1 3 1 'Von'(003).
      PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
      PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
      LOOP AT IT_SPFLI.
    copy flights to active EXCEL sheet
        H = SY-TABIX + 1.
        PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
        PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
        PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
        PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
        PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
      ENDLOOP.
    changes by Kishore  - end
    disconnect from Excel
         CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING  #1 = 'C:\SKV.XLS'.
      FREE OBJECT H_EXCEL.
      PERFORM ERR_HDL.
          FORM FILL_CELL                                                *
          sets cell at coordinates i,j to value val boldtype bold       *
    FORM FILL_CELL USING I J BOLD VAL.
      CALL METHOD OF H_EXCEL 'Cells' = H_ZL EXPORTING #1 = I #2 = J.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_ZL 'Value' = VAL .
      PERFORM ERR_HDL.
      GET PROPERTY OF H_ZL 'Font' = H_F.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_F 'Bold' = BOLD .
      PERFORM ERR_HDL.
    ENDFORM.
    *&      Form  ERR_HDL
          outputs OLE error if any                                       *
    -->  p1        text
    <--  p2        text
    FORM ERR_HDL.
    IF SY-SUBRC <> 0.
      WRITE: / 'Fehler bei OLE-Automation:'(010), SY-SUBRC.
      STOP.
    ENDIF.
    ENDFORM.                    " ERR_HDL
    Please note that this example maybe slow at filling the excel table
    (perhaps four fields per second on a 900 MHz machine - almost 30 seconds
    for a short example).
    To get the data on properties and methods - there is a bit of smoke and mirrors
    going on here; they are EXCEL properties and methods, not sap ones - so you need
    to look at excel help to determine how a particular function is structured. then
    build the block in sap, as shown in the example.
    If you only want to transfer the data to Excel like when you transfer the data from
    ALV to Excel simply use the Function Modules:
    XXL_SIMPLE_API
    If you want more modifications when you transfer it to Excel use:
    XXL_FULL_API

  • Clear the values in the ALV report after calculating Subtotals

    Hi All,
    In my ALV report, I am displaying subtotals by passing DO_SUM in the Field Catalog.
    Now my problem is in the display I do not want the individual values to be displayed, I want to hide the values in the column(Not the whole column) but I want to display the subtotal of these values in the Subtotal Row.
    Example:
    Item1   10   20
    Item2   20   30
    Item3   10   50
               40   100
    As per our requirements, the output should be
    Item1
    Item2
    Item3
              40   100
    How can this be done? Please suggest.

    Populate i_sort table for the fields for which u want subtotal as shown below:
    *&      Form  sub_populate_sort
          Populate ALV sort table
          No Parameter
    FORM sub_populate_sort .
    Sort on material
      wa_sort-spos = '01' .
      wa_sort-fieldname = 'MATNR'.
      wa_sort-tabname = 'I_EKPO'.
      wa_sort-up = 'X'.
      wa_sort-subtot = 'X'.
      APPEND wa_sort TO i_sort .
      CLEAR wa_sort.
    Sort on plant
      wa_sort-spos = '02'.
      wa_sort-fieldname = 'WERKS'.
      wa_sort-tabname = 'I_EKPO'.
      wa_sort-up = 'X'.
      wa_sort-subtot = 'X'.
      APPEND wa_sort TO i_sort .
      CLEAR wa_sort.
    ENDFORM.                    " sub_populate_sort
    Then when populating the field catalog tables use:
    wa_lfl_fcat-no_out         =  'X'.        "No output
    Then display ur data:
    This function module for displaying the ALV report
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = l_repid
          i_callback_top_of_page   = 'SUB_ALV_TOP_OF_PAGE'
          is_layout                = wa_layout
          it_fieldcat              = i_fieldcat
          it_sort = i_sort
          it_events                = i_event
          i_default                = 'X'
          i_save                   = 'A'
        TABLES
          t_outtab                 = i_ekpo
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
    Regards,
    Joy.

  • Re: Display format in the ALV report output

    Hi Expert,
    In the alv report how to display below format in the output.
    Example:       Jan 2011                      feb 2011                        march 2011  .......................
                        no     amount                 no  amount                     no   amount
    As you seen in the above  output i need Below jan 2011 NO and AMOUNT similar for other months.
    Can any one throw some light...............
    Regards,
    Am.
    Edited by: anitha.mava on Nov 5, 2011 12:37 PM
    Moderator message : Spec dumping is not allowed, search for available information.  Thread locked.
    Edited by: Vinod Kumar on Nov 7, 2011 9:31 AM

    Hi,
    Are you able to populate NO ? If yes i don't see why u can't populate No Amount.
    If you are not able to populate No.. just pass the same based on the condition to the (string) field that column is referring to ..
    Or are u not able to align the columns ? If yes, you will have to do some hit and trial with write statement ..or better why not use grid display ..
    Please provide more details ..
    Regards,
    Pranav.

  • '@' not getting displayed in the ALV report

    Hello,
    I am facing  a strange issue in the ALV report display. A string starting with '@' is not getting displayed and says "default icon " on the report. and this is varying from system to system for the same user.
    can anyone please help me in resolving the issue.
    Thanks in advance.
    Thanks and Regards,
    Santhosh Guptha N.

    @ is a default value as per ALV internal process. This is used in icons .
    I think this is causing the confusion.
    Check in the fieldcat if there is any adjsutment to be made to handle this.
    Br,
    Vijay

  • Short dump when I do total or sub total in the ALV report

    Hi,
    When I do total or sub-total on the currency field in the ALV report, it'll give a short dump like
    " The current application program detected a situation which really
    should not occur. Therefore, a termination with a short dump was
    triggered on purpose by the key word MESSAGE (type X)".
       Short text of error message:
       Technical information about the message:
       Message classe...... "0K"
       Number.............. 000
       Variable 1.......... " "
       Variable 2.......... " "
       Variable 3.......... " "
       Variable 4.......... " "
       Variable 3.......... " "
       Variable 4.......... " "
    Trigger Location of Runtime Error
        Program                                 SAPLSLVC
        Include                                 LSLVCF36
        Row                                     2,726
        Module type                             (FORM)
        Module Name                             FILL_DATA_TABLE
    sometime when I do the page down on the ALV report, the same short dump is coming.
    Can anyone help me out.
    Thanks
    Selva

    Hi,
    I'm getting this short dump in the standard program.
    I'm getting ALV report display perfectly. the problem is, when I do total or subtotal on the currency fields.
    2704
    2705 ************************************
    2706 * Column per Fieldcat Entry
    2707 ************************************
    2708         ls_lvc_data-value = space.
    2709         clear ls_lvc_data-style.
    2710         loop at it_fcat_local assigning <ls_fcat>
    2711                 where tech ne 'X' and no_out ne 'X'.
    2712           if l_invisible eq 'X'.
    2713             clear l_invisible.
    2714             if <ls_fcat>-do_sum is initial.
    2715               continue.
    2716             else.
    2717               clear ls_lvc_data-col_pos.
    2718             endif.
    2719           endif.
    2720
    2721           add 1 to ls_lvc_data-col_pos.
    2722
    2723           assign component <ls_fcat>-fieldname
    2724                            of structure <ls_data> to <l_field_value>.
    2725           if sy-subrc ne 0.
    >>>>>             message x000(0k).
    2727           endif.
    2728
    in this standard program, I'm getting the dump. the line is mentioned above in the code.

  • Display/Print the Selection criteria entered by USER on the ALV Report o/p?

    Hi Experts,
    I hv a requirement of to print/display the Selection criteria entered by user in the selection screen.........on the top portion of the ALV report output lay out.
    There is a FM for this purpose, but, I forgot its name!!
    So, let me know the FM or FMs, so that, will choose, which is best one,
    or the piece of code, which covers all select-option entries..........appreciated.
    thanq
    Edited by: SAP ABAPer on Sep 3, 2008 6:35 PM

    Use the Function RS_REFRESH_FROM_SELECTOPTIONS get the selection details, now format the data accordingly in the TOP_OF_PAGE using the calss CL_DD_DOCUMENT.
    Check the below mention code.
    REPORT  ztest_page.
    TABLES: sflight.
    DATA : it_flight TYPE TABLE OF sflight WITH HEADER LINE.
    DATA BEGIN OF it_sel_opt OCCURS 0.
            INCLUDE STRUCTURE rsparams.
    DATA END   OF it_sel_opt.
    SELECT-OPTIONS: s_carrid FOR sflight-carrid.
    START-OF-SELECTION.
      SELECT * FROM sflight INTO TABLE it_flight
       WHERE carrid IN s_carrid.
    END-OF-SELECTION.
      CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
        EXPORTING
          curr_report     = sy-repid
        TABLES
          selection_table = it_sel_opt
        EXCEPTIONS
          not_found       = 01
          no_report       = 02.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program          = sy-repid
          i_callback_html_top_of_page = 'TOP_OF_PAGE'
          i_structure_name            = 'SFLIGHT'
        TABLES
          t_outtab                    = it_flight
        EXCEPTIONS
          program_error               = 1
          OTHERS                      = 2.
    *&      Form  top_of_page
    *       text
    *      -->DOCUMENT   text
    FORM top_of_page USING document TYPE REF TO cl_dd_document.
      DATA : dl_text(255) TYPE c.  "Text
    * Add new-line
      CALL METHOD document->new_line.
      CALL METHOD document->new_line.
      CLEAR : dl_text.
    * program ID
      dl_text = 'Program Name :'.
      CALL METHOD document->add_gap.
      CALL METHOD document->add_text
        EXPORTING
          text         = dl_text
          sap_emphasis = cl_dd_area=>heading
          sap_color    = cl_dd_area=>list_heading_int.
      CLEAR dl_text.
      dl_text = sy-repid.
      CALL METHOD document->add_text
        EXPORTING
          text         = dl_text
          sap_emphasis = cl_dd_area=>heading
          sap_color    = cl_dd_area=>list_negative_inv.
    * Add new-line
      CALL METHOD document->new_line.
      CLEAR : dl_text.
      dl_text = 'Selection Criteria'.
      CALL METHOD document->add_gap
        EXPORTING
          width = 34.
      CALL METHOD document->add_text
        EXPORTING
          text         = dl_text
          sap_emphasis = cl_dd_area=>heading
          sap_color    = cl_dd_area=>list_negative_inv.
    * Add new-line
      CALL METHOD document->new_line.
      CLEAR : dl_text.
      CONCATENATE 'SELECT Option' 'SIGN' 'OPTION' 'LOW' 'HIGH'
      INTO dl_text SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
      CALL METHOD document->add_gap
        EXPORTING
          width = 34.
      CALL METHOD document->add_text
        EXPORTING
          text         = dl_text
          sap_emphasis = cl_dd_area=>heading
          sap_color    = cl_dd_area=>list_negative_inv.
    * Add new-line
      CALL METHOD document->new_line.
      LOOP AT it_sel_opt.
        CLEAR : dl_text.
        CONCATENATE it_sel_opt-selname  it_sel_opt-sign
         it_sel_opt-option it_sel_opt-low it_sel_opt-high
        INTO dl_text SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
        CALL METHOD document->add_gap
          EXPORTING
            width = 34.
        CALL METHOD document->add_text
          EXPORTING
            text         = dl_text
            sap_emphasis = cl_dd_area=>heading
            sap_color    = cl_dd_area=>list_negative_inv.
    * Add new-line
        CALL METHOD document->new_line.
      ENDLOOP.
    ENDFORM.                    "top_of_page

  • To edit the field in the ALV report

    Hi,
        i want to edit the field of the ALV report what i need to do for that..
    Thanks & Regards
    Ashu Singh

    hi,
    check the code,
    REPORT  zalv_fcat.* Output table T006 structure declarationTYPES : BEGIN OF ty_t006.
            INCLUDE STRUCTURE t006.
    TYPES : END OF ty_t006.*Internal table and wa declaration for T006
    DATA : it_t006 TYPE STANDARD TABLE OF ty_t006,
           wa_t006 TYPE ty_t006.*declarations for ALV
    DATA: ok_code               TYPE sy-ucomm,
    fieldcatalog for T006
          it_fielcat           TYPE lvc_t_fcat,
    fieldcatalog for fieldcatalog itself:
          it_fielcatalogue           TYPE lvc_t_fcat,
          it_layout           TYPE lvc_s_layo.*declaration for toolbar function
    DATA:   it_excl_func        TYPE ui_functions.
    Controls to display it_t006 and corresponding fieldcatalog
    DATA: cont_dock TYPE REF TO cl_gui_docking_container,
          cont_alvgd     TYPE REF TO cl_gui_alv_grid.*controls to display the fieldcatalog as editable alv grid and container
    DATA: cont_cust TYPE REF TO cl_gui_custom_container,
          cont_editalvgd     TYPE REF TO cl_gui_alv_grid.*intialization event
    INITIALIZATION.*start of selection event
    START-OF-SELECTION.
    LOCAL CLASS Definition for data changed in fieldcatalog ALV
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS handle_data_changed
          FOR EVENT data_changed OF cl_gui_alv_grid
          IMPORTING er_data_changed.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    LOCAL CLASS implementation for data changed in fieldcatalog ALV
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_data_changed.
      ENDMETHOD.                    "handle_data_changed
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION*data declaration for event receiver
    DATA: event_receiver TYPE REF TO lcl_event_receiver.*end of selection event
    END-OF-SELECTION.*setting the screen for alv output for table display and
    *changed fieldcatalalogue display
    SET SCREEN 600.
    On this statement double click  it takes you to the screen painter SE51. Enter the attributes
    *Create a Custom container and name it CCONT and OK code as OK_CODE.
    *Save check and Activate the screen painter.
    *Now a normal screen with number 600 is created which holds the ALV grid.
    PBO of the actual screen , Here we can give a title and customized menus
    *Go to SE41 and create status 'STATUS600' and create THE function code 'SUBMIT'
    *and 'EXIT' with icons and icon texts
    Also create a TitleBar 'TITLE600' and give the relevant title.&----
    *&      Module  STATUS_0600  OUTPUT
    MODULE status_0600 OUTPUT.
      SET PF-STATUS 'STATUS600'.
      SET TITLEBAR 'TITLE600'.
    CREATE ALV GRID CONTROL IF DOES NOT EXISTS INITIALLY
      IF cont_dock IS INITIAL.
        PERFORM create_alv.
      ENDIF.ENDMODULE.                             " STATUS_0600  OUTPUT* PAI module of the screen created. In case we use an interactive ALV or
    *for additional functionalities we can create OK codes and based on the
    *user command we can do the coding as shown below
    *&      Module  USER_COMMAND_0600  INPUT
    MODULE user_command_0600 INPUT.
      CASE ok_code.
        WHEN 'SUBMIT'.
    *TO GET THE CURRENT FIELDCATALOGUE FROM THE FRONTEND
          CALL METHOD cont_alvgd->set_frontend_fieldcatalog
            EXPORTING
              it_fieldcatalog = it_fielcat.
    *refresh the alv
          CALL METHOD cont_alvgd->refresh_table_display.
    *to Send Buffered Automation Queue to Frontend
          CALL METHOD cl_gui_cfw=>flush.*Exit button clicked to leave the program
        WHEN 'EXIT'.
          LEAVE PROGRAM.  ENDCASE.ENDMODULE.                             " USER_COMMAND_0600  INPUT&----
    *&      Form  CREATE_ALV
    &----FORM create_alv.*create a docking container and dock the control at the botton
      CREATE OBJECT cont_dock
          EXPORTING
               dynnr = '600'
               extension = 100
               side = cl_gui_docking_container=>dock_at_bottom.*create the alv grid for display the table
      CREATE OBJECT cont_alvgd
          EXPORTING
               i_parent = cont_dock.*create custome container for alv
      CREATE OBJECT cont_cust
          EXPORTING
               container_name = 'CCONT'.
    *create alv editable grid
      CREATE OBJECT cont_editalvgd
          EXPORTING
               i_parent = cont_cust.* register events for the editable alv
      CREATE OBJECT event_receiver.
      SET HANDLER event_receiver->handle_data_changed FOR cont_editalvgd.  CALL METHOD cont_editalvgd->register_edit_event
        EXPORTING
          i_event_id = cl_gui_alv_grid=>mc_evt_modified.*building the fieldcatalogue for the initial display
      PERFORM build_fieldcat CHANGING it_fielcat it_fielcatalogue.*building the fieldcatalogue after the user has changed it
      PERFORM change_fieldcat CHANGING it_fielcatalogue.*fetch data from the table
      PERFORM fetch_data.*    Get excluding functions for the alv editable tool bar  APPEND cl_gui_alv_grid=>mc_fc_loc_append_row TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_loc_insert_row TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_loc_cut TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_sort TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_sort_asc TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_sort_dsc TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_subtot TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_sum TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_graph TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_info TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_print TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_filter TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_views TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_mb_export TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_mb_sum TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_mb_sum TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_mb_paste TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_find TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_loc_copy  TO it_excl_func.
    *Alv display for the T006 table at the bottom
      CALL METHOD cont_alvgd->set_table_for_first_display
        CHANGING
          it_outtab       = it_t006[]
          it_fieldcatalog = it_fielcat[].
    optimize column width of grid displaying fieldcatalog
      it_layout-cwidth_opt = 'X'.* Get fieldcatalog of table T006 - alv might have
    modified it after passing.
      CALL METHOD cont_alvgd->get_frontend_fieldcatalog
        IMPORTING
          et_fieldcatalog = it_fielcat[].to Send Buffered Automation Queue to Frontend  CALL METHOD cl_gui_cfw=>flush. Display fieldcatalog of table T006 in editable alv grid
      CALL METHOD cont_editalvgd->set_table_for_first_display
        EXPORTING
          is_layout            = it_layout
          it_toolbar_excluding = it_excl_func
        CHANGING
          it_outtab            = it_fielcat[]
          it_fieldcatalog      = it_fielcatalogue[].
    ENDFORM.                               " CREATE_alv
    *&      Form  fetch_data
    FORM fetch_data.* select data of T006
      SELECT * FROM t006 INTO TABLE it_t006 UP TO 50 ROWS.
    ENDFORM.                               " fetch_data
    *&      Form  BUILD_FIELDCAT
    FORM build_fieldcat CHANGING it_fldcat TYPE lvc_t_fcat
                                       it_fcat TYPE lvc_t_fcat.
    Fieldcatalog for table T006: it_fldcat
    to generate the fields automatically  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = 'T006'
        CHANGING
          ct_fieldcat            = it_fldcat[]
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.*----
    Fieldcatalog for table LVC_T_FCAT:it_fcat
    Generate fieldcatalog of fieldcatalog structure.
    This fieldcatalog is used to display fieldcatalog 'it_fldcat'
    on the top of the screen.  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = 'LVC_S_FCAT'
        CHANGING
          ct_fieldcat            = it_fcat[]
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                               " BUILD_FIELDCAT
    *&      Form  CHANGE_FIELDCAT
    *after the user has modified the fieldcatalogue we build another fieldcat
    *for the modified alv display
    FORM change_fieldcat CHANGING it_fcat TYPE lvc_t_fcat.  DATA ls_fcat TYPE lvc_s_fcat.  LOOP AT it_fcat INTO ls_fcat.
        ls_fcat-coltext = ls_fcat-fieldname.
        ls_fcat-edit = 'X'.    IF ls_fcat-fieldname = 'COL_POS' OR ls_fcat-fieldname = 'FIELDNAME'.
          ls_fcat-key = 'X'.
        ENDIF.    MODIFY it_fcat FROM ls_fcat.
      ENDLOOP.
    ENDFORM.                               " CHANGE_FIELDCAT
    ref:saptechnical tutorial.
    Regards,
    Anirban

  • ALV report using the field catalog

    which is the quickest way to generate an ALV report using the field catalog merge.  without needing to build the field catalog manually .
    is it easier to create a structure and passe it in the field catalog merge .  if yes can i have an example plzzzz

    hI
    Supports the creation of the field catalog for the ALV function modules
    based either on a structure or table defined in the ABAP Data
    Dictionary, or a program-internal table.
    The program-internal table must either be in a TOP Include or its
    Include must be specified explicitly in the interface.
    The variant based on a program-internal table should only be used for
    rapid prototyping since the following restrictions apply:
    o Performance is affected since the code of the table definition must
    always be read and interpreted at runtime.
    o Dictionary references are only considered if the keywords LIKE or
    INCLUDE STRUCTURE (not TYPE) are used.
    If the field catalog contains more than 90 fields, the first 90 fields
    are output in the list by default whereas the remaining fields are only
    available in the field selection.
    If the field catalog is passed with values, they are merged with the
    'automatically' found information.
    Below is an example ABAP program which will populate a simple internal table(it_ekpo) with data and
    display it using the basic ALV grid functionality(including column total). The example details the main
    sections of coding required to implement the ALV grid functionality:
                             Data declaration
                             Data retrieval
                             Build fieldcatalog
                             Build layout setup
    *& Report  ZDEMO_ALVGRID                                               *
    *& Example of a simple ALV Grid Report                                 *
    *& The basic requirement for this demo is to display a number of       *
    *& fields from the EKKO table.                                         *
    REPORT  zdemo_alvgrid                 .
    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.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    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-do_sum      = 'X'.        "Display column total
      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_XEVENTS
                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

Maybe you are looking for

  • How do you recommend a JE configuration according to app. construction?

    Hi to all, When we use JE as following configuration, CPU utilization is consistently high ans sometimes low. How do you recommend a JE configuration according to application construction? Our Application and use of JE configuration is as follows. -

  • Trying to install Windows 7 - no device drivers were found

    On top, i sorry for my bad english. I have a trouble. Actually i have on my HP notebook ( H0W28EA ) SUSE Linux Enterprise Desktop. But i want install Windows 7. I put pendrive to my notebook, boot, and... error : No device driver were found. I don't

  • Change style of TOC?

    Hey everyone. I'm creating an epub from scratch to load onto an iPad and view with iBooks. Is there anyway to style the .ncx document (or maybe some other method) so that the default iBooks TOC isn't that black, blocky text? Specifically, can you use

  • Please Explain ORABPEL-05002 for this process

    I have a very simple BPEL process which pulls messages off the Oracle AQ and sends them on to a BPEL process correlated to the received string data. Step 1. An async partner link on the Oracle AQ to recieve a message Step 2. It waits a minute Step 3.

  • Connection.properties

    Hi, I am trying to connect to Oracle via Thin Client "classes12.zip" or "classes12.jar", it is working fine when I have all the java, class and connection.properties file are in the same folder, but it is not working when I am deploying it in jboss.