How to merge the 2 field in alv gride display

Tables for ALV display
DATA: it_fieldcat   TYPE  slis_t_fieldcat_alv,
      wa_fieldcat   TYPE  slis_fieldcat_alv,
      wa_layout     TYPE  slis_layout_alv,
      it_exclude    TYPE  slis_t_extab,
      wa_exclude    TYPE  slis_extab,
      it_header TYPE STANDARD TABLE OF zqm_imir_hdr,
      wa_header LIKE LINE OF it_header,
      it_final TYPE STANDARD TABLE OF zqm_imir_itm,
      wa_final LIKE LINE OF it_final,
      it_vcode      TYPE RANGE OF zqm_wtr_itm-vcode,
       wa_vcode      LIKE LINE OF  it_vcode.
DEFINE m_fieldcat.
  wa_fieldcat-fieldname = &1.
  wa_fieldcat-tabname   = &2.
  wa_fieldcat-seltext_m = &3.
  wa_fieldcat-outputlen = &4.
  wa_fieldcat-col_pos   = &5.
  append wa_fieldcat to it_fieldcat.
  clear wa_fieldcat.
END-OF-DEFINITION.
DEFINE m_vcode.
  wa_vcode-option   = &1.
  wa_vcode-sign     = &2.
  wa_vcode-low      = &3.
  wa_vcode-high     = ''.
  append wa_vcode to it_vcode.
  clear wa_vcode.
END-OF-DEFINITION.
START-OF-SELECTION.
  PERFORM data_retrival.
  PERFORM lead_time_calculation.
  IF it_final[] IS NOT INITIAL.
    PERFORM alv_display.
  ENDIF.
Display ALV
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program = sy-repid
      is_layout          = wa_layout
      it_fieldcat        = it_fieldcat
      i_save             = c_x
      it_excluding       = it_exclude
    TABLES
      t_outtab           = IT_OUTPUT[]
    EXCEPTIONS
      program_error      = 1
      OTHERS             = 2.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
  m_fieldcat: 'ZIMIRNO'  'IT_OUTPUT' text-003 21  0,
              'PRUEFLOS'  'IT_OUTPUT' text-004 21  1,
              'ZCRDAT'    'IT_OUTPUT' text-030 9 2,
              'INITS'     'IT_OUTPUT' text-031 6 3,
              'SPLIT'     'IT_OUTPUT' text-005 12  4,
              'WERK'     'IT_OUTPUT' text-006  5 5,
              'LOSMENGE'  'IT_OUTPUT' text-007 24  6,
              'MENGENEINH' 'IT_OUTPUT' text-008  15  7,
              'NAMEVEND'   'IT_OUTPUT' text-009  11  8,
*& Hypercare - 721600 - IMIR Changes - Start
             'KONT_PSPNR' 'IT_OUTPUT' text-023  15  7,
              'POSID' 'IT_OUTPUT' text-023  15  9,
*& Hypercare - 721600 - IMIR Changes - End
              'LTEX1' 'IT_OUTPUT'  text-024  24  10,
              'EBELN'    'IT_OUTPUT' text-010  26  11,
              'MBLNR'    'IT_OUTPUT' text-011  24  12,
              'ANZGEB'   'IT_OUTPUT' text-012  17  13,
              'GEBEH'    'IT_OUTPUT' text-013  4 14,
              'MATNR'    'IT_OUTPUT' text-014  18 15,
              'TXZ01'   'IT_OUTPUT' text-015  128 16,
              'SPECE'    'IT_OUTPUT' text-016  23  17,
              'VCODE'   'IT_OUTPUT' text-017 24  18,
              'TAGNO'   'IT_OUTPUT' text-018 10  19,
              'HEATNO'   'IT_OUTPUT' text-019  11  20,
              'IDCODE'   'IT_OUTPUT' text-020  7 21,
              'TCNO'   'IT_OUTPUT' text-021  9 22,
              'REMARKS'   'IT_OUTPUT' text-022 30 23,
              'BUDAT'   'IT_OUTPUT' text-025 30 24,
              'CPUTM'   'IT_OUTPUT' text-026 30 25,
              'VDATUM'   'IT_OUTPUT' text-027 30 26,
              'VEZEITERF'   'IT_OUTPUT' text-028 30 27,
             'ZLTIME'    'IT_OUTPUT' text-029 30 26,
              'LEADTIME'   'IT_OUTPUT' text-029 30 28.
DATA : v_unit like T006-MSEHI VALUE 'HR',
       v_FCALID like SCAL-FCALID,
       v_zltim TYPE f,
       v_zltime TYPE p LENGTH 8 DECIMALS 2.
SELECT SINGLE FABKL INTO v_FCALID FROM T001W WHERE WERKS = s_werks.
SELECT zcrdat INTO TABLE it_zqm_imir_hdr
       from zqm_imir_hdr
        FOR ALL ENTRIES IN it_final
        where zcrdat EQ it_final-zcrdat.
SELECT mblnr mjahr budat cputm
      INTO TABLE it_mkpf
      from mkpf
        FOR ALL ENTRIES IN it_final
      where mblnr EQ it_final-mblnr
        AND mjahr EQ it_final-mjahr.
SELECT prueflos vdatum vezeiterf
      INTO TABLE it_qave
      from qave
        FOR ALL ENTRIES IN it_final
      where prueflos EQ it_final-prueflos.
SORT it_mkpf    BY mblnr mjahr.
SORT it_qave    by prueflos.
SORT it_zqm_imir_hdr  BY zcrdat.
    LOOP AT it_final into wa_final.
      CLEAR: wa_output,wa_mkpf,wa_qave,wa_zqm_imir_hdr.
      MOVE-CORRESPONDING wa_final to wa_output.
READ TABLE it_zqm_imir_hdr INTO wa_zqm_imir_hdr WITH KEY zcrdat = wa_final-zcrdat
                                               BINARY SEARCH.
      READ TABLE it_mkpf INTO wa_mkpf WITH KEY mblnr = wa_final-mblnr
                                               mjahr = wa_final-mjahr
                                               BINARY SEARCH.
      MOVE wa_zqm_imir_hdr-zcrdat TO wa_output-zcrdat.
      MOVE wa_mkpf-budat TO wa_output-budat.
      MOVE wa_mkpf-cputm TO wa_output-cputm.
      READ TABLE it_qave INTO wa_qave WITH KEY prueflos = wa_final-PRUEFLOS
                                               BINARY SEARCH.
      MOVE wa_qave-vdatum     TO wa_output-vdatum.
      MOVE wa_qave-vezeiterf  TO wa_output-vezeiterf.
LV_START_DATE = wa_zqm_imir_hdr-zcrdat.
LV_START_DATE = wa_mkpf-budat.
LV_START_TIME =  wa_mkpf-cputm.
LV_END_TIME   = wa_qave-vezeiterf.
LV_END_DATE   =  wa_qave-vdatum.
IF LV_START_DATE IS NOT INITIAL.
   IF LV_END_DATE IS NOT INITIAL.
      CALL FUNCTION 'SD_CALC_DURATION_FROM_DATETIME'
        EXPORTING
          i_date1                =  LV_START_DATE
          i_time1                =  LV_START_TIME
          i_date2                =  LV_END_DATE
          i_time2                =  LV_END_TIME
       IMPORTING
         E_TDIFF                =  LV_DIFF
        E_DATE2_EARLY          =  E_DATE2_EARLY
      EXCEPTIONS
        INVALID_DATETIME       = 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.
eNDFORM.}
This is my code unable to merge the to tabs position is on 3rd and 4th.
need help ......
thanks,

Hi,
From Your code I saw that you called Macro of fieldcat after Calling the ALV Function Did You Check That One.
Following links may be useful for you ,
ALV report: How to merge 2 columns into 1 column?
Hope this information helps You
Regards,
Raghava Channooru

Similar Messages

  • How to capture the event in ALV grid display?

    Hi experts,
      How to capture the event in an ALV grid display which is editable. I have to capture the TAB key or ENTER key.
    regards,
    Arul Jothi.

    Hi Arul,
    Take a look at sample program BCALV_EDIT_03. (Find string "register ENTER" in the program to see how to register)
    Basically you have to Register edit events using method call REGISTER_EDIT_EVENT and then write a handler method for event DATA_CHANGED..
    If you are using a REUSE..GRID fm then first get the grid reference using function module GET_GLOBALS_FROM_SLVC_FULLSCR and then repeat the above procedure..
    Hope this helps..
    Sri
    Message was edited by: Srikanth Pinnamaneni

  • How to make a field of ALV Grid to use a Search Help?

    Hi;
    I have a ALV grid with a field catalog. Say the field is 'USR000'.
    F4availabl = 'X' . for the field in the field catalog.
    I have prepared search help named ZEV_PROTYPE that uses tha table ZEV_PROTYPES.(two fields in the table :ProType and Text).
    Is it possible to make the field in ALV grid to use this search help if F4 is pressed on the field. ?
    Which structure of the ALV must be used for that ? Is it Field Catalog ?
    Would you please help me ?
    erk.

    Hi,
    If you have a Z data element and the search help is attached to it, you can just give the reference table and field in the field catalog for the editable ALV field, and the search help should appear.
    Regards,
    Sagar

  • Wan to add push button in the output of ALV Grid display.

    Hi Friends,
    I wan to add a Push button in the output of ALV GRID display with STANDARD ikons.
    How to copy standard ikons of GRID output.
    How to apply the copied status into my code.
    Regards,
    Viji

    Hi,
    Goto SE41, create a pf-status for your alv report program.
    On the next screen, click menu EXTRAS --> click option ADJUST TEMPLATES and select radiobutton LIST VIEWER --> you will get all standard buttons of alv in the pf-status.
    Delete the unwanted buttons and also you can add new buttons if reqd.
    Activate pf-status --> and apply in alv program.
    Now to apply this pf-status in your alv report follow code:-
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         i_callback_program                = v_rep_id       " report id
         i_callback_pf_status_set          = 'PF'           " for PF-STATUS
         i_callback_user_command           = 'USER_COMMAND' " for User-Command
         is_layout                         = wa_layout      " for layout
         it_fieldcat                       = it_field       " field catalog
         it_sort                           = it_sort        " sort info
        TABLES
          t_outtab                          = it_final      " internal table
       EXCEPTIONS
         program_error                     = 1
         OTHERS                            = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    *&      Form  pf
    *       SUB-ROUTINE PF IS USED TO SET THE PF-STATUS OF THE SCREEN
    *       ON WHICH THE ALV GRID IS DISPLAYED
    *       -->RT_EXTAB
    FORM pf USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZTG_STAT'. "<--pass pf-status name here
    ENDFORM.                    "pf
    *&      Form  USER_COMMAND
    *       SUB-ROUTINE USER_COMMAND IS USED TO HANDLE THE USER ACTION
    *       AND EXECUTE THE APPROPIATE CODE
    *      -->LV_OKCODE   used to capture the function code
    *                     of the user-defined push-buttons
    *      -->L_SELFIELD   text
    FORM user_command USING lv_okcode LIKE sy-ucomm l_selfield TYPE slis_selfield.
    * assign the function code to variable v_okcode
      lv_okcode = sy-ucomm.
    * handle the code execution based on the function code encountered
      CASE lv_okcode.
        WHEN '<function_code>'. "<--to handle user actions
      ENDCASE.
    ENDFORM.                    "USER_COMMAND
    Hope this helps you.
    Regards,
    Tarun

  • How to color a row in ALV grid display

    Hi,
    A few rows in the output of ALV grid display should be shown in different color.How can I achieve this?

    Hi,
    Try out this code
    DATA : BEGIN OF G_T_CASH OCCURS 0,
           PARTICULARS TYPE CHAR120,
           AMOUNT1 TYPE CHAR20,
           AMOUNT2 TYPE CHAR20,
           AMOUNT3 TYPE CHAR20,    
           ROW_COLOR TYPE CHAR4,----
    add this in the internal table for alv
          END OF G_T_CASH.
      CLEAR G_WA_CASH.
      G_WA_CASH-PARTICULARS = 'Opening Cash Balance'.
      G_WA_CASH-AMOUNT1 = G_DMBTR.
      G_WA_CASH-AMOUNT2 = ''.
      G_WA_CASH-AMOUNT3 = ''.
    while appending other values also add the following code
      G_WA_CASH-ROW_COLOR = 'C200'.----- C200 depicts light gray color
      APPEND G_WA_CASH TO G_T_CASH.
    add the following code in layout
    MOVE 'ROW_COLOR' TO WA_LS_LAYOUT-INFO_FIELDNAME.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_BYPASSING_BUFFER = ' '
          I_SAVE             = 'A'
        I_CALLBACK_PROGRAM                = SY-REPID
      I_CALLBACK_PF_STATUS_SET          = 'SET_PF_STATUS'
       I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
         IS_LAYOUT                        = WA_LS_LAYOUT
         IT_FIELDCAT                      = G_T_CATALOG
         IT_EVENTS                         = GT_EVENTS
         TABLES
           T_OUTTAB                       = G_T_CASH[]
    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.
    Let me know if the problem still persist.
    Regards,
    Janaki

  • Problem in placing the background in ALV Grid display

    I have created one image of the business flow, and it have to be displayed in the background of ALV grid display.
    For this I have gone to T.Code –<b>OAER</b> , Given class name as <b>PICTURES</b> , Class type as <b>OT</b> , Object Key <b>BACKGROUND</b>, clicked on the triangle of Standard Doc , then double click on screen, and finally uploaded the background into SAP.
    In the function module <b>‘REUSE_ALV_GRID_DISPLAY’</b> I passed this background to the parameter I_BACKGROUND_ID.
    It is working fine, and I was able to see the back ground in my program.
    (developed in IDES)
    But the same is not working in my development client, will some one suggest be the reason for the problem. Please kindly help me out from this problem.

    hello Dinesh,
    I have created the object key in the development client itself and used in the grid display of the same client. i am not understanding where the problem is, any how thank you very much for your responce. if you have any other solution please let me know.
    Thank you

  • Issue on sorting the fields in ALV Grid

    I have created a report in ALV Grid I have sorted the fields using slis_sortinfo_alv to avoid the duplicates . I could display the output in sorted fashion, but when I export it to a file it is displaying in the same fashion as it is in the database that is in the allowing duplicates.. I cant use DELETE ADJACENT DUPLICATES as it will delete the adjacent records . i need help from you guys please help me...

    Hi,
    As you have data in your internal table that is to be displayed in the alv grid display.
    So, instead you can sort the internal table on that field and then can delete the duplicate records comparing that very field.
    Use code:-
    sort <itab> by <field_name>. "to sort
    delete adjacent duplicates from <itab> comparing <field_name>. "to delete duplicate entries
    This will delete all the duplicates records for the column.
    Now you can use this internal table to display the data in the ALV grid.
    Or if you dont wish to delete the data from the initial internal table, then you can use a temporary internal table of same structure and use:-
    it_temp = itab.
    sort it_temp by <field_name>. "to sort
    delete adjacent duplicates from it_temp comparing <field_name>. "to delete duplicate entries
    Now you can use this internal table to be displayed as alv output.
    Hope this helps you.
    Thanks & Regards,
    Tarun

  • Dump when summing up CURR field in ALV GRID display

    Hi All,
    I am getting dump when I try to sum the CURR field in my ALV Grid Display. The field is of CURR 23.  I am using classes and methods to display alv grid.
    I tried passing <fs_fieldcat>-do_sum = 'X'. When I did this, it is dumping without even displaying the alv grid.
    Here is the part it is throwing dump:
            ls_lvc_data-value = space.
            clear ls_lvc_data-style.
            loop at it_fcat_local assigning <ls_fcat>
                    where tech ne 'X' and no_out ne 'X'.
              if l_invisible eq 'X'.
                clear l_invisible.
                if <ls_fcat>-do_sum is initial.
                  continue.
                else.
                  clear ls_lvc_data-col_pos.
                endif.
              endif.
              add 1 to ls_lvc_data-col_pos.
              assign component <ls_fcat>-fieldname
                               of structure <ls_data> to <l_field_value>.
              _if sy-subrc ne 0.
                message x000(0k).
              endif._
    Regards,
    Guru

    Thomas,
    Here is the dump:
    Runtime Errors         MESSAGE_TYPE_X
    Date and Time          10/22/2010 23:30:53
    Short text
    The current application triggered a termination with a short dump.
    What happened?
    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).
    Error analysis
    Short text of error message:
    Long text of error message:
    Technical information about the message:
    Message class....... "0K"
    Number.............. 000
    Variable 1.......... " "
    Variable 2.......... " "
    Variable 3.......... " "
    Variable 4.......... " "
    How to correct the error
    Probably the only way to eliminate the error is to correct the program.
    If the error occures in a non-modified SAP program, you may be able to
    find an interim solution in an SAP Note.
    If you have access to SAP Notes, carry out a search with the following
    keywords:
    "MESSAGE_TYPE_X" " "
    "SAPLSLVC" or "LSLVCF36"
    "FILL_DATA_TABLE"
    If you cannot solve the problem yourself and want to send an error
    notification to SAP, include the following information:
    1. The description of the current problem (short dump)
    To save the description, choose "System->List->Save->Local File
    (Unconverted)".
    2. Corresponding system log
    Display the system log by calling transaction SM21.
    Restrict the time interval to 10 minutes before and five minutes
    after the short dump. Then choose "System->List->Save->Local File
    (Unconverted)".
    3. If the problem occurs in a problem of your own or a modified SAP
    program: The source code of the program
    In the editor, choose "Utilities->More
    Utilities->Upload/Download->Download".
    4. Details about the conditions under which the error occurred or which
    actions and input led to the error.
    Source Code Extract
    Line
    SourceCde
    2708
    is_subtottxt_info = ls_subtot_info
    2709
    ip_subtot_line    = lr_data
    2710
    changing
    2711
    c_subtottxt       = l_subtottxt.
    2712
    ls_lvc_data-value = l_subtottxt.
    2713
    2714
    append ls_lvc_data to ct_lvc_data.
    2715
    endif.
    2716
    2717
    2718
    Column per Fieldcat Entry
    2719
    2720
    ls_lvc_data-value = space.
    2721
    clear ls_lvc_data-style.
    2722
    loop at it_fcat_local assigning <ls_fcat>
    2723
    where tech ne 'X' and no_out ne 'X'.
    2724
    if l_invisible eq 'X'.
    2725
    clear l_invisible.
    2726
    if <ls_fcat>-do_sum is initial.
    2727
    continue.
    2728
    else.
    2729
    clear ls_lvc_data-col_pos.
    2730
    endif.
    2731
    endif.
    2732
    2733
    add 1 to ls_lvc_data-col_pos.
    2734
    2735
    assign component <ls_fcat>-fieldname
    2736
    of structure <ls_data> to <l_field_value>.
    2737
    if sy-subrc ne 0.
    >>>>>
    message x000(0k).
    2739
    endif.
    2740
    2741
    *... work on average
    2742
    if <ls_fcat>-do_sum eq 'C'.
    2743
              Initialize average result and entries
    2744
    <l_field_value> = 0.
    2745
    clear l_entries.
    2746
    2747
              retrive unit from fieldcatalog
    2748
    assign space to <l_unit>.
    2749
    if not <ls_fcat>-cfieldname is initial.
    2750
    assign component <ls_fcat>-cfieldname
    2751
    of structure <ls_data> to <l_unit>.
    2752
    endif.
    2753
    if not <ls_fcat>-qfieldname is initial.
    2754
    assign component <ls_fcat>-qfieldname
    2755
    of structure <ls_data> to <l_unit>.
    2756
    endif.
    2757

  • Currency field in alv grid display

    Hi,
    I am using alv grid display.I am having one currency field netprice.I want it to be displayed as blank when i am not passing any value.But it gives 0.00 when it is not having any value.How to make it blank instead of 0.00.
    Points will be rewarded.
    Regards,
    Sowmya.

    HI,
    If itab-curr  = '0.00' .
    itab-curr = ''.
    modify itab.
    endif.

  • Total for a Numeric field in ALV Grid display

    Hi all,
    I am not getting the Total for a Numeric field in ALV Grid output. What might be the problem.
    Regards,
    Balavardhan.K

    Check this code for subtotals and totals..
    REPORT ZYFI_REPT007
           NO STANDARD PAGE HEADING
           LINE-SIZE 300
           LINE-COUNT 50
           MESSAGE-ID ZYFI.
    TABLES : COOI, " Commitments Management: Line Items
             LFA1,                         " Vendor master (general section)
             VBEP,
             RKPLN.
          TABLE TYPES AND INTERNAL TABLES                                *
    DATA : BEGIN OF TYP_COOI ,
           OBJNR LIKE COOI-OBJNR,
           SAKTO LIKE COOI-SAKTO,
           MEGBTR LIKE COOI-MEGBTR,
           MEINH LIKE COOI-MEINH,
           WKGBTR LIKE COOI-WKGBTR,
           REFBN LIKE COOI-REFBN,
           RFPOS LIKE COOI-RFPOS,
           SGTXT LIKE COOI-SGTXT,
           BUDAT LIKE COOI-BUDAT,
           LIFNR LIKE COOI-LIFNR,
           END OF TYP_COOI.
    DATA : BEGIN OF TYP_LFA1 ,
            LIFNR LIKE LFA1-LIFNR,
            NAME1 LIKE LFA1-NAME1,
           END OF TYP_LFA1.
    DATA : BEGIN OF IT_OUTTAB OCCURS 0,
             OBJNR LIKE COOI-OBJNR,
             SAKTO LIKE COOI-SAKTO,
             MEGBTR LIKE COOI-MEGBTR,
             MEINH LIKE COOI-MEINH,
             WKGBTR LIKE COOI-WKGBTR,
             REFBN LIKE COOI-REFBN,
             RFPOS LIKE COOI-RFPOS,
             SGTXT LIKE COOI-SGTXT,
             BUDAT LIKE COOI-BUDAT,
             LIFNR LIKE COOI-LIFNR,
             NAME1 LIKE LFA1-NAME1,
           END OF IT_OUTTAB.
    DATA : IT_COOI LIKE TYP_COOI OCCURS 0 WITH HEADER LINE,
           IT_LFA1 LIKE TYP_LFA1 OCCURS 0 WITH HEADER LINE.
    *-- ALV Declarations
    TYPE-POOLS SLIS.
    DATA: IT_EVENTS            TYPE SLIS_T_EVENT,
          GS_EVENT             TYPE SLIS_ALV_EVENT,
          wa_fldcat            type slis_fieldcat_alv.
    DATA: S_LAYOUT TYPE SLIS_LAYOUT_ALV,
          GT_PRINT TYPE SLIS_PRINT_ALV.
    DATA: IT_FLDCAT       TYPE SLIS_T_FIELDCAT_ALV.
    DATA: IT_SORT             TYPE SLIS_T_SORTINFO_ALV.
    DATA: V_REPID LIKE SY-REPID.
                        SELECTION SCREEN                                 *
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS : S_KOKRS FOR COOI-KOKRS NO-EXTENSION NO INTERVALS,
                                           " Controlling Area
                     S_BUKRS FOR COOI-BUKRS NO-EXTENSION NO INTERVALS,
                                           " Company code
                     S_GJAHR FOR COOI-GJAHR NO-EXTENSION NO INTERVALS,
                                           " Fiscal Year
                     S_OBJNR FOR RKPLN-AUFNR MATCHCODE OBJECT ORDE,
                                                            " Internal order
                     S_SAKTO FOR COOI-SAKTO MATCHCODE OBJECT KART,
                                                              " Cost Element
                     S_BUDAT FOR COOI-BUDAT, " Debit Date
                     S_LIFNR FOR COOI-LIFNR. " Vendor
    SELECTION-SCREEN END OF BLOCK B1.
           S T A R T   O F   S E L E C T I O N                           *
    START-OF-SELECTION.
    *-- Read data
      PERFORM GET_DATA.
           E N D   O F   S E L E C T I O N                               *
    END-OF-SELECTION.
    *-- Process the data and prepare the output data
      PERFORM CALCULATE_FINAL_INFO.
    *--Display Report output
      PERFORM DISPLAY_REPORT.
          FORM CALCULATE_FINAL_INFO                                     *
        Process the data and prepare final internal table               *
    FORM CALCULATE_FINAL_INFO.
      DATA : L_OBJNR LIKE COOI-OBJNR.
      SORT IT_LFA1 BY LIFNR.
      DELETE ADJACENT DUPLICATES FROM IT_LFA1 COMPARING LIFNR.
      LOOP AT IT_COOI.
        L_OBJNR = IT_COOI-OBJNR+2(20).
        SHIFT L_OBJNR LEFT DELETING LEADING '0'.
        IF L_OBJNR IN S_OBJNR.
          READ TABLE IT_LFA1 WITH KEY LIFNR  = IT_COOI-LIFNR.
          IF SY-SUBRC EQ 0.
            IT_OUTTAB-NAME1 = IT_LFA1-NAME1.
          ENDIF.
          MOVE-CORRESPONDING IT_COOI TO IT_OUTTAB.
          CLEAR IT_OUTTAB-OBJNR.
          IT_OUTTAB-OBJNR = L_OBJNR.
          APPEND IT_OUTTAB.
          CLEAR IT_OUTTAB.
          CLEAR IT_LFA1.
          CLEAR L_OBJNR.
        ENDIF.
      ENDLOOP.
    ENDFORM.
    *&      Form  GET_DATA
         Fetch the Data from the table COOI and LFA1
    FORM GET_DATA.
      SELECT OBJNR
            SAKTO
            MEGBTR
            MEINH
            WKGBTR
            REFBN
            RFPOS
            SGTXT
            BUDAT
            LIFNR
            FROM COOI
            INTO TABLE IT_COOI
            WHERE   BUDAT IN S_BUDAT
            AND LIFNR IN S_LIFNR
            AND KOKRS IN S_KOKRS
            AND BUKRS IN S_BUKRS
            AND GJAHR IN S_GJAHR
            AND SAKTO IN S_SAKTO.
      IF SY-SUBRC EQ 0 .
    Get the Vendor name from LFA1
        SELECT LIFNR
               NAME1
               FROM LFA1
               INTO TABLE IT_LFA1
               FOR ALL ENTRIES IN IT_COOI
               WHERE LIFNR EQ IT_COOI-LIFNR.
      ELSE.
        MESSAGE I999 WITH TEXT-013.
      ENDIF.
    ENDFORM.                               " GET_DATA
    *&      Form  DISPLAY_REPORT
           Display the output
    FORM DISPLAY_REPORT.
      PERFORM BUILD_CATALOG.
      PERFORM FRM_PREPARE_EVENT_LIST TABLES IT_EVENTS.
      IF NOT IT_OUTTAB[] IS INITIAL.
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
             EXPORTING
                  I_CALLBACK_PROGRAM      = V_REPID
                  I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
                  IT_FIELDCAT             = IT_FLDCAT
                  IT_SORT                 = IT_SORT
                  IT_EVENTS               = IT_EVENTS
             TABLES
                  T_OUTTAB                = IT_OUTTAB
             EXCEPTIONS
                  PROGRAM_ERROR           = 1
                  OTHERS                  = 2.
      ELSE.
        MESSAGE I999 WITH TEXT-013.
      ENDIF.
    ENDFORM.                               " DISPLAY_REPORT
    *&      Form  BUILD_CATALOG
          Build the Field catalog for the ALV Report
    FORM BUILD_CATALOG.
      DATA: V_INDEX LIKE SY-TABIX.
      V_REPID = SY-REPID.
      DATA: LS_SORT TYPE SLIS_SORTINFO_ALV.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                I_PROGRAM_NAME         = V_REPID
                I_INTERNAL_TABNAME     = 'IT_OUTTAB'
                I_INCLNAME             = V_REPID
           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.
      READ TABLE IT_FLDCAT WITH KEY FIELDNAME = 'WKGBTR'
                             TABNAME = 'IT_OUTTAB' INTO WA_FLDCAT.
      IF SY-SUBRC  EQ 0.
        WA_FLDCAT-DO_SUM  = 'X'.
        MODIFY IT_FLDCAT FROM WA_FLDCAT INDEX SY-TABIX.
      ENDIF.
      READ TABLE IT_FLDCAT WITH KEY FIELDNAME = 'OBJNR'
                                TABNAME =  'IT_OUTTAB' INTO WA_FLDCAT.
      IF SY-SUBRC EQ 0.
         WA_FLDCAT-SELTEXT_L = 'Order'.
         WA_FLDCAT-COL_POS = 1.
         WA_FLDCAT-DDICTXT = 'L'.
        MODIFY IT_FLDCAT FROM WA_FLDCAT INDEX SY-TABIX.
      ENDIF.
      LS_SORT-FIELDNAME = 'OBJNR'.
      LS_SORT-SPOS      = 1.
      LS_SORT-UP        = 'X'.
      LS_SORT-SUBTOT    = 'X'.
      APPEND LS_SORT TO IT_SORT.
    ENDFORM.                               " BUILD_CATALOG
    *&      Form  FRM_PREPARE_EVENT_LIST
          Build the Events
    FORM FRM_PREPARE_EVENT_LIST TABLES IT_EVENTS TYPE SLIS_T_EVENT.
      CLEAR GS_EVENT.
      GS_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
      GS_EVENT-FORM = 'TOP_OF_PAGE_REPORT'.
      APPEND GS_EVENT TO IT_EVENTS.
    ENDFORM.                               " FRM_PREPARE_EVENT_LIST
         TOP OF PAGE
    FORM TOP_OF_PAGE_REPORT.
      CALL FUNCTION 'Z_YREPORT_HEADER'
           EXPORTING
                DL_TITLE = SY-TITLE
                DL_REPID = SY-CPROG
                DL_LINSZ = SY-LINSZ
           EXCEPTIONS
                OTHERS   = 1.
    ENDFORM.                               " FRM_TOP_OF_PAGE_REPORT
    *&      Form  USER_COMMAND
      Drill Down Functionality to Call the Transaction ME23
    FORM USER_COMMAND USING    P_UCOMM    LIKE SY-UCOMM
                               P_SELFIELD TYPE SLIS_SELFIELD.
      DATA : L_INDEX LIKE SY-INDEX,
             L_REFBN LIKE COOI-REFBN.
      L_INDEX = P_SELFIELD-TABINDEX.       " holds the selected table index
      CLEAR L_REFBN.
      CASE P_UCOMM.
    *-- On Double Click
        WHEN '&IC1'.
          CLEAR L_REFBN.
    *-- Read the Current Line
          READ TABLE IT_OUTTAB INDEX L_INDEX.
          IF SY-SUBRC EQ 0.
            L_REFBN = IT_OUTTAB-REFBN.
            IF NOT L_REFBN IS INITIAL.
    *-- Set the BES Paramater Id to the Current line Purchase Order Number
              SET PARAMETER ID 'BES' FIELD L_REFBN.
    *-- Call the Transaction Purchase Order Display with the above PO Number
              CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.
            ENDIF.
          ELSE.
            MESSAGE E999 WITH TEXT-014.
          ENDIF.
      ENDCASE.
    ENDFORM.                               " USER_COMMAND

  • How can we sum for the field on alv grid

    Dear Freinds,
                   I am having the field count .....in the ouput (iam using alv grid) .......which dispalys  the id's which are identical .
    i have scneario similar to the below in my ALV Output
    ID                count         total
    4000              3              100
                                          100
                                         200       Can i get count 3 also along with 200 in alv?
    i am using the code as follows for count can any one please let me know.
    my earlier question which i put was confusing.........so i am givin the qustion again
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 1.
      ls_fieldcat-fieldname    = 'ORGUNIT'.
      ls_fieldcat-seltext_l    =  text-015.  "'Orgunit'.
      ls_fieldcat-key          = 'X'.
      ls_fieldcat-key_sel      = 'X'.
    ls_fieldcat-no_out       = 'X'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 2.
      ls_fieldcat-fieldname    = 'COUNT'.
      ls_fieldcat-seltext_l    = 'H.Count'.
      ls_fieldcat-outputlen    = 4.
      ls_fieldcat-do_sum       = 'X'.
    ls_fieldcat-datatype    = 'NUMC'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-fieldname   = 'TOTAL'.
      ls_fieldcat-seltext_m   = 'total'.
      ls_fieldcat-col_pos     = 3.
      ls_fieldcat-outputlen   = 17.
      ls_fieldcat-do_sum      = 'X'.
      ls_fieldcat-datatype    = 'CURR'.
      append ls_fieldcat to fp_i_fieldcat.
    Please let me know how can do if so what is the parameter i have to change for COUNT
    regards
    syamal

    Hi Shamala Kiran.
                          My name is also kiran.I have a develop a code for u.Actually i cant understand your code.But i know ur problem .Plz check that code.In that code i develop a subtotals and grandttotal.Plz observe the FORM "FIELD CATALOG" in that observe the NETWR FIELD and observe the FORM SORTCATALOG then ur problem will be solved.
    Copy the the below code and execute that code and the result.
    If u r Satisfied with the answer plz give the REWARD POINTS.
    CODE:
    Type Pools
    TYPE-POOLS:slis.
    Tables
    TABLES: vbak,vbap.
    Global Variable
    data: w_var type i.
    Global Data
    DATA:it_fieldcat TYPE slis_t_fieldcat_alv,
         wa_fieldcat TYPE slis_fieldcat_alv,
         it_sortcat TYPE slis_t_sortinfo_alv,
         wa_sortcat  LIKE LINE OF it_sortcat.
    Internal Table
    data: BEGIN OF it_salesorder OCCURS 0,
            vbeln LIKE vbak-vbeln,    " Sales Document Number
            posnr like vbap-posnr,    " Sales Doc Item
            netwr like vbap-netwr,    " Net Value
          END OF it_salesorder.
    SELECT OPTIONS
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_vbeln FOR vbak-vbeln.   " Sales Document Number.
    SELECTION-SCREEN END OF BLOCK b1.
    Initialization
    INITIALIZATION.
      PERFORM initialization.
    *&      Form  initialization
          text
    -->  p1        text
    <--  p2        text
    form initialization .
      s_vbeln-sign   = 'I'.
      s_vbeln-option = 'BT'.
      s_vbeln-low    = '4969'.
      s_vbeln-high   = '5000'.
      APPEND s_vbeln.
    endform.                    " initialization
    Start Of Selection
    START-OF-SELECTION.
      PERFORM field_catalog.   "For Structure Creation
      PERFORM fetch_data.      "Get the Data From DB Table
      PERFORM sorting USING it_sortcat.
    End Of Selection
    END-OF-SELECTION.
      perform display_data.
    *&      Form  field_catalog
          text
    -->  p1        text
    <--  p2        text
    form field_catalog .
      wa_fieldcat-col_pos       = w_var.          " Column Position Variable
      wa_fieldcat-tabname       = 'IT_SALESORDER'. " Internal Table Name
      wa_fieldcat-fieldname     = 'VBELN'.         " Field Name
      wa_fieldcat-key           = 'X'.             " Blue Color
      wa_fieldcat-ref_tabname   = 'VBAK'.          " Table Name
      wa_fieldcat-ref_fieldname = 'VBELN'.         " Field Name
      wa_fieldcat-seltext_m     = 'Sales Doc No'.  " Display Text In Screen
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      ADD 1 TO w_var.
      wa_fieldcat-col_pos       = w_var.          " Column Position Variable
      wa_fieldcat-tabname       = 'IT_SALESORDER'. " Internal Table Name
      wa_fieldcat-fieldname     = 'POSNR'.         " Field Name
      wa_fieldcat-ref_tabname   = 'VBAP'.          " Table Name
      wa_fieldcat-ref_fieldname = 'POSNR'.         " Field Name
      wa_fieldcat-seltext_m     = 'Sales Doc Item'. " Display Text In Screen
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      ADD 1 TO w_var.
      wa_fieldcat-col_pos       = w_var.          " Column Position Variable
      wa_fieldcat-tabname       = 'IT_SALESORDER'. " Internal Table Name
      wa_fieldcat-fieldname     = 'NETWR'.         " Field Name
      wa_fieldcat-ref_tabname   = 'VBAP'.          " Table Name
      wa_fieldcat-ref_fieldname = 'NETWR'.         " Field Name
      wa_fieldcat-do_sum        = 'X'.             " Sum
      wa_fieldcat-seltext_m     = 'Net Value'.  " Display Text In Screen
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      ADD 1 TO w_var.
    endform.                    " field_catalog
    *&      Form  sorting
          text
         -->P_IT_SORTCAT  text
    form sorting using p_it_sortcat TYPE slis_t_sortinfo_alv.
      wa_sortcat-fieldname = 'VBELN'.
      wa_sortcat-up        ='X'.
      wa_sortcat-subtot    = 'X'.
      APPEND wa_sortcat TO p_it_sortcat.
    endform.                    " sorting
    *&      Form  display_data
          text
    -->  p1        text
    <--  p2        text
    form display_data .
    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                         =
        IT_FIELDCAT                       = it_fieldcat
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
        IT_SORT                           = it_sortcat
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      I_HTML_HEIGHT_TOP                 =
      I_HTML_HEIGHT_END                 =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
      TABLES
        t_outtab                          = it_salesorder
    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_data
    *&      Form  fetch_data
          text
    -->  p1        text
    <--  p2        text
    form fetch_data .
    select a~vbeln
           posnr
           b~netwr
      from vbak as a
    inner join vbap as b on  avbeln = bvbeln
      into table it_salesorder
      where a~vbeln in s_vbeln.
    endform.                    " fetch_data

  • How to merge the Rows in ALV table?

    Hi All,
    I want to merge the Rows in my ALV table(SALV_WD_TABLE). Is it possible?
    Regards,
    Yugesh A.

    Yogi1729 wrote:
    Hi All,
    how to Restrict the Row in the Pivot table.
    My Requirement is like this.
    i have to show the top 10 values in the pivot table but My report is show all the values.
    how can we achieve this.
    any quick solution for this appreciated.
    Thanks,
    Yogi.You can't really restrict the rows in a pivot table, but you can do this:
    http://oraclebizint.wordpress.com/2008/01/17/oracle-bi-101332-pagination-in-pivot-tables/

  • How to color the title in ALV grid

    Hi all,
    There is a title getting displayed in my ALV grid. could any one pls tell if there is any possibililty to colour it.
    Thanks

    Hi Deepti,
    Kindly check this out:
    MACROS
    FIELD CATALOGUE ENTRY FOR Keyed FIELDS
    DEFINE catfield.
    1= Fieldname,  2= Description, 3=Key
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = &1.
      ls_fieldcat-key          = &3.
      ls_fieldcat-hotspot       = &3.
    ls_fieldcat-key_sel      = 'X'.
      ls_fieldcat-tabname    = 'T_OUT'.
    Output length will be optimised by ALV
    ls_fieldcat-outputlen = '6'.
      ls_fieldcat-seltext_m = &2.
      append ls_fieldcat to gt_fieldcat.
    color   C or X   1-9 = color number 0/1 intensified 0/1 inverse
      ls_fieldcat-emphasize = 'C100'.
    END-OF-DEFINITION.
    FIELD CATALOGUE ENTRY FOR SUMMED FIELDS
    DEFINE catsum.
    1= Fieldname,  2= color, 3= Description,
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = &1.
      ls_fieldcat-do_sum       = 'X'.
      ls_fieldcat-key_sel      = 'X'.
      ls_fieldcat-tabname    = 'T_OUT'.
      ls_fieldcat-emphasize = &2.
      ls_fieldcat-seltext_m = &3.
      append ls_fieldcat to gt_fieldcat.
    END-OF-DEFINITION.

  • How to display MANDT field in ALV Grid display?

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = LV_REPID
       I_STRUCTURE_NAME                  = 'ZSTR_TRAIL'
       I_SAVE                            = 'A'
      TABLES
        T_OUTTAB                          = it_output
    EXCEPTIONS
       PROGRAM_ERROR                     = 1
       OTHERS                            = 2
    In the above code, I m using structure ZSTR_TRAIL, having MANDT field as the first field.
    But I am not able see the MANDT field column in the ALV output, but the internal table it_output is
    is populated with the client number in  MANDT field.
    What should I do to display the MANDT field?
    All the fields in the internal table it_output are displayed properly except the MANDT field.

    Hi Mohana,
    When you directly declare your structure in teh function module it will skip the Mandt field while displaying the out put.
    So if you would like to display the mandt field too then insted of defining it in the stucture parameter, you will have to manually fill the fieldcatalog.
    Ex :
      wa_fieldcat-col_pos = 1.
      wa_fieldcat-row_pos = 1.
      wa_fieldcat-fieldname = 'MANDT'.
      wa_fieldcat-tabname = 'it_final'.
      wa_fieldcat-ref_fieldname = 'MANDT'.
      wa_fieldcat-ref_tabname = 'ZSTR_TRAIL'.
      wa_fieldcat-outputlen = '20'.
      wa_fieldcat-key = 'X'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = 2.
      wa_fieldcat-row_pos = 2.
      wa_fieldcat-fieldname = 'ERDAT'.
      wa_fieldcat-tabname = 'it_final'.
      wa_fieldcat-ref_fieldname = 'ERDAT'.
      wa_fieldcat-ref_tabname = 'VBAK'.
      wa_fieldcat-reptext_ddic = 'X' .
      wa_fieldcat-key = 'X'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
        i_callback_program                = sy-cprog
        it_fieldcat                       = it_fieldcat
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = it_final
    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.
    This will fix your issue.
    Regards,
    Kittu
    Edited by: Kittu on Nov 5, 2009 8:25 AM

  • How to focus a cell on ALV grid display

    hi,
    I need to set the focus to the first cell on the first row in the ALV grid.I am using object oriented ALV grid control.Can anyone help me out in this regard.
    Regards,
    Anil.

    Re: simple Grid display
    Have a look at below links. It contains sample code for alv grid.
    http://www.erpgenie.com/abap/controls/alvgrid.htm#Complete%20code%20for%20the%20ALV%20grid%20example
    http://www.sap-img.com/abap/sample-programs-on-alv-grid.htm
    http://sap.niraj.tripod.com/id64.html
    Also have a look at below for OO alv grid:
    http://help.sap.com/saphelp_erp2004/helpdata/en/0a/b5533cd30911d2b467006094192fe3/frameset.htm
    -->
    ABAP List Viewer
    The common features of report are column alignment, sorting, filtering, subtotals, totals etc. To implement these, a lot of coding and logic is to be put. To avoid that we can use a concept called ABAP List Viewer (ALV).
    This helps us to implement all the features mentioned very effectively.
    Using ALV, We can have three types of reports:
    1. Simple Report
    2. Block Report
    3. Hierarchical Sequential Report
    There are some function modules which will enable to produce the above reports without much effort.
    All the definitions of internal tables, structures and constants are declared in a type-pool called SLIS.
    1. SIMPLE REPORT.
    The important function modules are
    a. Reuse_alv_list_display
    b. Reuse_alv_fieldcatalog_merge
    c. Reuse_alv_events_get
    d. Reuse_alv_commentary_write
    e. Reuse_alv_grid_display
    A. REUSE_ALV_LIST_DISPLAY : This is the function module which prints the data.
    The important parameters are :
    I. Export :
    i. I_callback_program : report id
    ii. I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status iii. I_callback_user_command : routine where the function codes are handled iv. I_structure name : name of the dictionary table v. Is_layout : structure to set the layout of the report vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.
    II. Tables :
    i. t_outtab : internal table with the data to be output
    B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to populate a fieldcatalog which is essential to display the data in ALV. If the output data is from a single dictionary table and all the columns are selected, then we need not exclusively create the field catalog. Its enough to mention the table name as a parameter(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases we need to create it.
    The Important Parameters are :
    I. Export :
    i. I_program_name : report id
    ii. I_internal_tabname : the internal output table iii. I_inclname : include or the report name where all the dynamic forms are handled.
    II Changing
    ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is declared in the type pool SLIS.
    C. REUSE_ALV_EVENTS_GET : Returns table of possible events for a list type
    Parameters :
    I. Import :
    Et_Events : The event table is returned with all possible CALLBACK events for the specified list type (column 'NAME'). For events to be processed by Callback, their 'FORM' field must be filled. If the field is initialized, the event is ignored. The entry can be read from the event table, the field 'FORM' filled and the entry modified using constants from the type pool SALV.
    II. Export :
    I_List_type :
    0 = simple list REUSE_ALV_LIST_DISPLAY
    1 = hierarchcal-sequential list REUSE_ALV_HIERSEQ_LIST_DISPLAY
    2 = simple block list REUSE_ALV_BLOCK_LIST_APPEND
    3 = hierarchical-sequential block list
    REUSE_ALV_BLOCK_LIST_HS_APPEND
    D. REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-of-page event to print the headings and other comments for the list.
    Parameters :
    I. it_list_commentary : internal table with the headings of the type slis_t_listheader.
    This internal table has three fields :
    Typ : ‘H’ – header, ‘S’ – selection , ‘A’ - action Key : only when typ is ‘S’.
    Info : the text to be printed
    E. REUSE_ALV_GRID_DISPLAY : A new function in 4.6 version, to display the results in grid rather than as a preview.
    Parameters : same as reuse_alv_list_display
    This is an example for simple list.
    2. BLOCK REPORT
    This is used to have multiple lists continuously.
    The important functions used in this report are:
    A. REUSE_ALV_BLOCK_LIST_INIT
    B. REUSE_ALV_BLOCK_LIST_APPEND
    C. REUSE_ALV_BLOCK_LIST_HS_APPEND
    D. REUSE_ALV_BLOCK_LIST_DISPLAY
    A. REUSE_ALV_BLOCK_LIST_INIT
    Parameters:
    I. I_CALLBACK_PROGRAM
    II. I_CALLBACK_PF_STATUS_SET
    III. I_CALLBACK_USER_COMMAND
    This function module is used to set the default gui status etc.
    B. REUSE_ALV_BLOCK_LIST_APPEND
    Parameters :
    Export :
    I. is_layout : layout settings for block II. it_fieldcat : field catalog III. i_tabname : internal table name with output data IV. it_events : internal table with all possible events
    Tables :
    i. t_outtab : internal table with output data.
    This function module adds the data to the block.
    Repeat this function for all the different blocks to be displayed one after the other.
    C. REUSE_ALV_BLOCK_LIST_HS_APPEND
    This function module is used for hierarchical sequential blocks.
    D. REUSE_ALV_BLOCK_LIST_DISPLAY
    Parameters : All the parameters are optional.
    This function module display the list with data appended by the above function.
    Here the functions REUSE_ALV_FIELDCATALOG_MERGE, REUSE_ALV_EVENTS_GET, REUSE_ALV_COMMENTARY_WRITE can be used.
    3. Hierarchical reports :
    Hierarchical sequential list output.
    The function module is
    A. REUSE_ALV_HIERSEQ_LIST_DISPLAY
    Parameters:
    I. Export:
    i. I_CALLBACK_PROGRAM
    ii. I_CALLBACK_PF_STATUS_SET
    iii. I_CALLBACK_USER_COMMAND
    iv. IS_LAYOUT
    v. IT_FIELDCAT
    vi. IT_EVENTS
    vii. i_tabname_header : Name of the internal table in the program containing the output data of the highest hierarchy level.
    viii. i_tabname_item : Name of the internal table in the program containing the output data of the lowest hierarchy level.
    ix. is_keyinfo : This structure contains the header and item table field names which link the two tables (shared key).
    II. Tables
    i. t_outtab_header : Header table with data to be output ii. t_outtab_item : Name of the internal table in the program containing the output data of the lowest hierarchy level.
    slis_t_fieldcat_alv : This internal table contains the field attributes. This internal table can be populated automatically by using ‘REUSE_ALV_FIELDCATALOG_MERGE’.
    Important Attributes :
    A. col_pos : position of the column
    B. fieldname : internal fieldname
    C. tabname : internal table name
    D. ref_fieldname : fieldname (dictionary) E. ref_tabname : table (dictionary) F. key(1) : column with key-color G. icon(1) : icon H. symbol(1) : symbol I. checkbox(1) : checkbox J. just(1) : (R)ight (L)eft (C)ent.
    K. do_sum(1) : sum up
    L. no_out(1) : (O)blig.(X)no out
    M. outputlen : output length
    N. seltext_l : long key word
    O. seltext_m : middle key word
    P. seltext_s : short key word
    Q. reptext_ddic : heading (ddic)
    R. ddictxt(1) : (S)hort (M)iddle (L)ong
    S. datatype : datatype
    T. hotspot(1) : hotspot
    Simple ALV report
    http://www.sapgenie.com/abap/controls/alvgrid.htm
    http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
    ALV
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    2. How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    3. How do I add subtotals (I have problem to add them)...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    4. How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    5. How to print page number / total number of pages X/XX in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
    6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
    http://www.sapfans.com/forums/viewtopic.php?t=64320
    http://www.sapfans.com/forums/viewtopic.php?t=44477
    7. How can I set the cell color in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    8. How do I print a logo/graphics in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=81149
    http://www.sapfans.com/forums/viewtopic.php?t=35498
    http://www.sapfans.com/forums/viewtopic.php?t=5013
    9. How do I create and use input-enabled fields in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    10. How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    11. How can I display an icon in ALV? (Common requirement is traffic light icon).
    http://www.sapfans.com/forums/viewtopic.php?t=79424
    http://www.sapfans.com/forums/viewtopic.php?t=24512
    12. How can I display a checkbox in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=88376
    http://www.sapfans.com/forums/viewtopic.php?t=40968
    http://www.sapfans.com/forums/viewtopic.php?t=6919
    Go thru these programs they may help u to try on some hands on
    ALV Demo program
    BCALV_DEMO_HTML
    BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode BCALV_GRID_DEMO Simple ALV Control Call Demo Program BCALV_TREE_DEMO Demo for ALV tree control BCALV_TREE_SIMPLE_DEMO BC_ALV_DEMO_HTML_D0100
    Reward If useful

Maybe you are looking for

  • Help Needed : Setting JDBC Datasource in Crystal XI using Sybase 12.5??

    All, We are migrating our systems to the Crystal XI from Crystal 9 Reporting Servers. I need some technical assistance on the Java API ( use of the Datasources) . Problem: Currently in Crystal 9 we are using OLEDB datasources to connect to various Sy

  • Mixed XP and Windows 7 Environment

    I installed a J4680 as a wireless device using my XP machine.  It works fine.  I then directly accessed the printer through the network on my Windows 7 machine and it prints oddly (e.g., the same image displayed twice on a page prints correctly the f

  • Video playing from macbook to TV

    Sorry for this odd question that may sound impossible for some or ludicrious for others but im a newbie and a computing n00b - so here goes: I have movies (AVI files) i play on my macbook but the 13" screen is bit small to enjoy the flick - so i ask:

  • Adobe Illustrator CS4 Auto Trace

    Hey everyone. I'm trying to convert some BMP or JPEGs into a nice vector. I've been reading around and it seems like auto trace is the function I want however I'm unable to find that tool in Illustrator. Can anyone help guide me to where this tool mi

  • Problem to create a Schema

    After installing Oracle 8i, I can't create a schema. Can you help me please to indicate to me how I can create a schema? Should I download other file? Thank You null