ALV Grid Subscreen to Display Text

Folks,
I am really sorry I am creating a new thread for this because I can see it has been discussed a lot but I am finding it hard to clearly identify what needs to be done from all the posts.
I have an ABAP with a selection screen, it runs and generates an ALV output, on that ALV output I have a column called COMMENT, in the column COMMENT there is a string of text which can be very large. Since I can not change the row height on the ALV grid I am going to implement a work-around where when the user double-clicks on the comment, it pops up a screen displaying the full text.
I presume I need to call a subscreen to get this to happen but I can not see how to do this and any help would be greatly appreciated.
Many Thanks,
Colm
P.S. Here is how I catch the double click.
FORM user_command USING r_ucomm LIKE sy-ucomm
                  rs_selfield TYPE slis_selfield.           "#EC CALLED
  DATA: w_ans(1).
  CASE r_ucomm. "The users command
   WHEN '&IC1'.                       "Double Click
*Doc drill down
      IF rs_selfield-fieldname = 'COMMENT'.
        READ TABLE gt_output INDEX rs_selfield-tabindex.
        IF sy-subrc = 0.
*Call the screen here displaying the full note text
        ENDIF.

I feel so foolish, I was trying to re-invent the wheel and didn't think before I asked. Apologies and Thanks.
However, if for some reason I didn't want to use the POPUP_TEXT FM, is there a way I could have called the subscreen?
Here is the code I used if anyone is interested:
DATA: w_ans(1),
        lt_text TYPE TABLE OF trtab,
        ls_title TYPE c,
        crlf(2) TYPE c VALUE cl_abap_char_utilities=>cr_lf.
  CASE r_ucomm. "The users command
    WHEN '&IC1'.                       "Double Click
*Doc drill down
      IF rs_selfield-fieldname = 'COMMENT'.
        READ TABLE gt_output INDEX rs_selfield-tabindex.
        IF sy-subrc = 0.
          SPLIT gt_output-comment AT crlf INTO TABLE lt_text.
          CALL FUNCTION 'LAW_SHOW_POPUP_WITH_TEXT'
            EXPORTING
              titelbar                     = ls_title
             line_size                    = 132
            TABLES
              list_tab                     = lt_text.

Similar Messages

  • ALV GRID AND LIST DISPLAY

    Hi experts, how are you.
    What is the difference between ALV Grid Display and ALV List Display?

    ALV LIST Can be coded using only FMs
    ALV GRID Can be coded using FMs and object oriented concepts
    ALV LIST Can be displayed hieraicharlly
    ALV GRID cannot be displayed hierarichally
    ALV grid uses ActiveX controls
    present on the Presentation Server.
    Hence, it consumes More Memory
    on the presentation server.
    ALV LIST is Display Only.
    Whereas
    ALV Grid Can Be made EDITABLE for entry purpose.
    In alv grid, these options are possible,
    but not in alv list.
    without horizontal lines
    without vertical lines
    without cell merging during sorts
    display total lines above the entries
    Thanks
    Seshu

  • ALV grid is not displaying few fields of final internal table of type DMBTR

    hello frnds,
    i am displaying 10 fields in ALV grid using field catalog.
    among them five fields are currency fields on which i doing some arithematic operations. but all these fields are not getting displayed in alv grid.
    here is my code....
    declaring final strucutre to generate report
    TYPES:BEGIN OF ty_final,
              gjahr   TYPE gjahr,       " Year
              wwert   TYPE wwert_d,     " Traslation date
              bukrs   TYPE bukrs,       " company code
              hkont   TYPE hkont,       " General ledger account
              txt20   TYPE txt20_skat,  " Account name
              belnr   TYPE belnr_d,     " Purchase order number
              shkzg   TYPE shkzg,       " Dt/Cr indicator
              dmbtr1   TYPE dmbtr,       " Ammount in local currency
              v_alc   TYPE dmbtr,       " Ammount in local currency
              wrbtr   TYPE wrbtr,       " Ammount in foreign currency
              ebeln   TYPE ebeln,       " Purchase order number
              ebelp   TYPE ebelp,       " Item number
              matnr   TYPE matnr,       " Material number
              menge   TYPE menge_d,     " Qunatity
              meins   TYPE meins,       " Unit of measure
              stprs   TYPE stprs,       " Std material master
              v_iv    TYPE dmbtr,       " Invoice value
              pswsl   TYPE pswsl,       " Currency
              v_erc   TYPE dmbtr,       " Exchange rate calculated
              v_op    TYPE dmbtr,       " Order price
              v_uos   TYPE dmbtr,       " Unit order to stock
              v_io    TYPE dmbtr,       " Invoice to order
              v_uv    TYPE dmbtr,       " Unit value
              v_t     TYPE dmbtr,       " Total
              v_d     TYPE dmbtr,       " Differecne
              netpr   TYPE bprei,       " Net price in purchasing document
              v_total TYPE dmbtr,       " Total
              v_os    TYPE dmbtr,       " Order to stock
              v_ito   TYPE dmbtr,       " Invoice to order
              saknr   TYPE saknr,       " G/L account number
           END OF ty_final.
    FORM move_data.
      IF NOT i_bseg[] IS INITIAL.
        LOOP AT i_bseg INTO wa_bseg.
          wa_final-gjahr  = wa_bseg-gjahr.
          wa_final-bukrs  = wa_bseg-bukrs.
          wa_final-hkont  = wa_bseg-hkont.
          wa_final-belnr  = wa_bseg-belnr.
          wa_final-shkzg  = wa_bseg-shkzg.
          wa_final-wrbtr  = wa_bseg-wrbtr.
          wa_final-ebeln  = wa_bseg-ebeln.
          wa_final-ebelp  = wa_bseg-ebelp.
          wa_final-matnr  = wa_bseg-matnr.
          wa_final-menge  = wa_bseg-menge.
          wa_final-meins  = wa_bseg-meins.
          wa_final-pswsl  = wa_bseg-pswsl.
          wa_final-dmbtr1  = wa_bseg-dmbtr.
          wa_final-saknr  = wa_bseg-saknr.
          wa_final-v_total = wa_bseg-dmbtr.
          READ TABLE i_bkpf INTO wa_bkpf WITH KEY bukrs = wa_bseg-bukrs.
          IF sy-subrc = 0.
            wa_final-wwert = wa_bkpf-wwert.
          ENDIF.
         CLEAR wa_bkpf.
          READ TABLE i_mbew INTO wa_mbew WITH KEY matnr = wa_bseg-matnr.
          IF sy-subrc = 0.
            wa_final-stprs = wa_mbew-stprs.
          ENDIF.
         CLEAR wa_mbew.
          READ TABLE i_ekpo INTO wa_ekpo WITH KEY ebeln = wa_bseg-ebeln.
          IF sy-subrc = 0.
            wa_final-netpr = wa_ekpo-netpr.
          ENDIF.
         CLEAR wa_ekpo.
          READ TABLE i_skat INTO wa_skat WITH KEY saknr = wa_bseg-saknr.
          IF sy-subrc = 0.
            wa_final-txt20 = wa_skat-txt20.
          ENDIF.
    calculating output values
          IF wa_bseg-shkzg = 'H'.
            wa_final-v_alc = -1 * wa_bseg-dmbtr.
          ELSEIF wa_bseg-shkzg = 'S'.
            wa_final-v_alc = 1 * wa_bseg-dmbtr.
          ENDIF.
         DATA : l_c_v_alc TYPE p DECIMALS 2,
         l_c_v_iv TYPE p DECIMALS 2.
         l_c_v_alc = wa_final-v_alc.
          IF wa_bseg-menge NE 0.
            wa_final-v_iv = wa_bseg-dmbtr / wa_bseg-menge.
          ENDIF.
          IF wa_bseg-dmbtr NE 0.
            wa_final-v_erc  = wa_bseg-wrbtr   / wa_final-dmbtr1.
          ENDIF.
          IF wa_final-v_erc NE 0.
            wa_final-v_op   = wa_ekpo-netpr   / wa_final-v_erc.
          ENDIF.
          wa_final-v_uos  = wa_mbew-stprs   - wa_final-v_op.
          wa_final-v_io   = wa_final-v_iv   + wa_final-v_uos.
          wa_final-v_uv   = wa_final-v_uos  + wa_final-v_io.
          wa_final-v_t    = wa_final-v_uv   + wa_bseg-menge.
          wa_final-v_d    = wa_final-v_t    - wa_final-v_alc.
          wa_final-v_os   = wa_final-v_uos  * wa_bseg-menge.
          wa_final-v_ito  = wa_final-v_io   * wa_bseg-menge.
          CLEAR wa_bseg.
          APPEND wa_final TO i_final.
          CLEAR wa_final.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    "data_retrieval
    *&      Form  build_fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM build_fieldcat.
      CLEAR wa_fieldcat.
    *  TYPES : v_alc TYPE dmbtr. "curr. " decimal 2.
    DATA: l_c_v_alc TYPE p DECIMALS 2,
    l_c_v_iv TYPE p DECIMALS 2 .
    l_c_v_alc = v_alc.
    l_c_v_iv = v_iv.
    Constant Declarations.
      CONSTANTS:
                l_c_gjahr(5)   TYPE c VALUE 'GJAHR',      " Year
                l_c_wwert(5)   TYPE c VALUE 'WWERT',      " Traslation date
                l_c_bukrs(5)   TYPE c VALUE 'BUKRS',      " company code
                l_c_hkont(5)   TYPE c VALUE 'HKONT',      " General ledger account
                l_c_txt20(10)  TYPE c VALUE 'TXT20',      " Account name
                l_c_belnr(5)   TYPE c VALUE 'BELNR',      " Doc number
                l_c_shkzg(5)   TYPE c VALUE 'SHKZG',      " Dt/Cr indicator
                l_c_dmbtr(5)   TYPE c VALUE 'DMBTR1',      " Ammount in local currency
               " l_c_v_alc      TYPE c VALUE 'V_ALC',      " Ammount in local currency
                l_c_wrbtr(5)   TYPE c VALUE 'WRBTR',      " Ammount in foreign currency
                l_c_ebeln(5)   TYPE c VALUE 'EBELN',      " Purchase order number
                l_c_ebelp(5)   TYPE c VALUE 'EBELP',      " Item number
                l_c_matnr(5)   TYPE c VALUE 'MATNR',      " Material number
                l_c_menge(7)   TYPE c VALUE 'MENGE',      " Qunatity
                l_c_meins(5)   TYPE c VALUE 'MEINS',      " Unit of measure
                l_c_stprs(5)   TYPE c VALUE 'STPRS',      " Std material master
               " l_c_v_iv(4)    TYPE c VALUE 'V_IV',           " Invoice value
                l_c_pswsl(5)   TYPE c VALUE 'PSWSL',      " Currency
                l_c_v_erc(5)   TYPE c VALUE 'V_ERC',      " Exchange rate calculated
                l_c_v_op(4)    TYPE c VALUE 'V_OP',       " Order price
                l_c_v_uos(5)   TYPE c VALUE 'V_UOS',      " Unit order to stock
                l_c_v_io(4)    TYPE c VALUE 'V_IO',       " Invoice to order
                l_c_v_uv(4)    TYPE c VALUE 'V_UV',       " Unit value
                l_c_v_t(3)     TYPE c VALUE 'V_T',        " Total
                l_c_v_d(3)     TYPE c VALUE 'V_D',        " Differecne
                l_c_netpr(5)   TYPE c VALUE 'NETPR',      " Net price in purchasing document
                l_c_v_total(7) TYPE c VALUE 'V_TOTAL',    " Total
                l_c_v_os(4)    TYPE c VALUE 'V_OS',      " Order to stock
                l_c_v_ito(5)   TYPE c VALUE 'V_ITO',      " Invoice to order
                l_c_saknr(5)   TYPE c VALUE 'SAKNR',      " G/L account number
                l_c_i_final(7) TYPE c VALUE 'I_FINAL'.    " Final internal table
    Fieldcat for fiscal year
      wa_fieldcat-col_pos   =  1.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_gjahr.
      wa_fieldcat-seltext_m = text-007.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Translation date
      wa_fieldcat-col_pos   =  2.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_wwert.
      wa_fieldcat-seltext_m = text-008.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Company code
      wa_fieldcat-col_pos   =  3.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_bukrs.
      wa_fieldcat-seltext_m = text-009.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for General ledger account
      wa_fieldcat-col_pos   =  4.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_hkont.
      wa_fieldcat-seltext_m = text-010.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Account name
      wa_fieldcat-col_pos   =  5.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_txt20.
      wa_fieldcat-seltext_m = text-011.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Doc number
      wa_fieldcat-col_pos   =  6.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_belnr.
      wa_fieldcat-seltext_m = text-012.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Dt/Cr indicator
      wa_fieldcat-col_pos   =  7.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_shkzg.
      wa_fieldcat-seltext_m = text-013.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Ammount in local currency
      wa_fieldcat-col_pos   =  8.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = 'DMBTR1'.
      wa_fieldcat-seltext_m = text-014.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Ammount in local currency
      wa_fieldcat-col_pos   =  9.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = 'V_ALC'.
      wa_fieldcat-seltext_m = text-015.
      wa_fieldcat-ref_fieldname = 'DMBTR'.
    wa_fieldcat-no_sign   = 'X'.
    wa_fieldcat-do_sum    =  c_x.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Ammount in foreign currency
      wa_fieldcat-col_pos   =  10.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_wrbtr.
      wa_fieldcat-seltext_m = text-016.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Purchse order number
      wa_fieldcat-col_pos   =  11.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_ebeln.
      wa_fieldcat-seltext_m = text-017.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Item No
      wa_fieldcat-col_pos   =  12.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_ebelp.
      wa_fieldcat-seltext_m = text-018.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Material number
      wa_fieldcat-col_pos   =  13.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_matnr.
      wa_fieldcat-seltext_m = text-019.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Qunatity
      wa_fieldcat-col_pos   =  14.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_menge.
      wa_fieldcat-seltext_m = text-020.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Unit of measure
      wa_fieldcat-col_pos   =  15.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_meins.
      wa_fieldcat-seltext_m = text-021.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Std material master
      wa_fieldcat-col_pos   =  16.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_stprs.
      wa_fieldcat-seltext_m = text-022.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Invoice value,
      wa_fieldcat-col_pos   =  17.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = 'V_IV'.
      wa_fieldcat-seltext_m = text-023.
      wa_fieldcat-ref_fieldname = 'DMBTR'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Currency
      wa_fieldcat-col_pos   =  18.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_pswsl.
      wa_fieldcat-seltext_m = text-024.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Exchange rate calculated
      wa_fieldcat-col_pos   =  19.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = 'V_ERC'.
      wa_fieldcat-seltext_m = text-025.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Order price
      wa_fieldcat-col_pos   =  20.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_op.
      wa_fieldcat-seltext_m = text-026.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Unit order to stock
      wa_fieldcat-col_pos   =  21.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_uos.
      wa_fieldcat-seltext_m = text-027.
      wa_fieldcat-do_sum    = c_x.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Invoice to order
      wa_fieldcat-col_pos   =  22.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_io.
      wa_fieldcat-seltext_m = text-028.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Unit value
      wa_fieldcat-col_pos   =  23.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_uv.
      wa_fieldcat-seltext_m = text-029.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Total
      wa_fieldcat-col_pos   =  24.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_t.
      wa_fieldcat-seltext_m = text-030.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Difference
      wa_fieldcat-col_pos   =  25.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_d.
      wa_fieldcat-seltext_m = text-031.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Net Price in Purchasing Document
      wa_fieldcat-col_pos   =  26.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_netpr.
      wa_fieldcat-seltext_m = text-032.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Total
      wa_fieldcat-col_pos   =  27.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_total.
      wa_fieldcat-seltext_m = text-033.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Order to stock
      wa_fieldcat-col_pos   =  28.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_os.
      wa_fieldcat-seltext_m = text-034.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Invoice to order
      wa_fieldcat-col_pos   =  29.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_ito.
      wa_fieldcat-seltext_m = text-035.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    fieldcat for invoice to order
      wa_fieldcat-col_pos   =  30.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_saknr.
      wa_fieldcat-seltext_m = text-035.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    ENDFORM.                    "build_fieldcat

    Hi romanch,
    defining the field catalog you must reference all currency fields to the respective currency key field (type CUKY).
    <alv_fieldcat>-cfieldname         = 'HWAER'.
    This is sample for alv output of a currency field. The alv structure has a field HWAER which carries the currency key, e.g. USD or so.
    Obviously you do not provide a cutrrency key for your values. If they are initial (zero), ALV will not display them as 0,00 but leave the field empty if the reference too currency key is not established.
    If you define a DDIC structure for the ALV output this refernce is enforced. You can pass the DDIC structure name to the ALV and don not have to create the field catalog manually.
    Regards,
    Clemens

  • Alv grid column name display

    alv grid column name could not be displayed fully.we manually want to drag the column,to see the column name fully.  for ex. if column name is 'COMPANYNAME'.it shows 'COMPA' alone.
    how could i solve this problem....?

    hI,
        Check the below code...
    *& Report  ZALV_PROGRAAM
    REPORT  ZALV_PROGRAAM.
    TYPE-POOLS SLIS.
    DATA : BEGIN OF WA_KNA1,
    KUNNR TYPE KUNNR,
    NAME1 TYPE NAME1,
    END OF WA_KNA1,
    IT_KNA1 LIKE TABLE OF WA_KNA1.
    DATA : IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
    WA_FCAT LIKE LINE OF IT_FCAT.
    SELECT KUNNR NAME1 INTO TABLE IT_KNA1 FROM KNA1 UP TO 5 ROWS.
    PERFORM FCAT USING '1' 'KUNNR' 'CUSTOMERNUMBER' '40'.
    PERFORM FCAT USING '2' 'NAME1' 'CUSTOMERNAME' '40'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = SY-CPROG
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
       IT_FIELDCAT                       = IT_FCAT
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      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                          = IT_KNA1
    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  FCAT
          text
         -->P_0052   text
         -->P_0053   text
         -->P_0054   text
         -->P_0055   text
    form FCAT  using    FP_COL_POS
                        FP_FIELDNAME
                        FP_SELTEXT_M
                        FP_OUTPUTLEN.
    WA_FCAT-COL_POS = FP_COL_POS.
    WA_FCAT-FIELDNAME = FP_FIELDNAME.
    WA_FCAT-SELTEXT_M = FP_SELTEXT_M.
    WA_FCAT-OUTPUTLEN = FP_OUTPUTLEN.
    APPEND WA_FCAT TO IT_FCAT.
    CLEAR WA_FCAT.
    endform.                    " FCAT
    thanks,
    Thiru. R

  • How to Set Checkbox of ALV Grid Dark on Display Mode

        ABAP experts, I want to switch between display mode and edit mode for some columns of ALV Grid. So I set "LVC_S_FCAT-EDIT" "X" for the columns which need to switch mode, and use method "SET_READY_FOR_INPUT" to switch.
        Currently, the function of switch mode has been achieved. But icons of checkbox columns are light but not dark when display mode, although the columns can't be edited. (Please refer to the image below.) I want to make checkbox columns dark as other columns on display mode.
        I tried to use "CL_GUI_ALV_GRID=>MC_STYLE_ENABLED" and "CL_GUI_ALV_GRID=>MC_STYLE_DISABLED", but failed. I also studied sample program "BCALV_EDIT_05" which is related to checkbox in ALV Grid, and compared my program with this program. But I still have not found problems.
        Help me solve this problem, please.
        Part of my codes are as follows.
        Part 1:
    IF iv_is_create_group = abap_true OR iv_is_edit_group = abap_true.
           set_enable( iv_flag = 1 ).
           LOOP AT gt_acct_group_item ASSIGNING <lfs_acct_group_item>.
             CLEAR ls_celltab.
             IF <lfs_acct_group_item>-celltab IS INITIAL.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'CHECK_BOX'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'XPORE'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
             ELSE.
               LOOP AT <lfs_acct_group_item>-celltab ASSIGNING <lfs_celltab>.
                 <lfs_celltab>-style = cl_gui_alv_grid=>mc_style_enabled.
               ENDLOOP.
             ENDIF.
           ENDLOOP.
         ELSE.
           set_enable( iv_flag = 0 ).
           LOOP AT gt_acct_group_item ASSIGNING <lfs_acct_group_item>.
             IF <lfs_acct_group_item>-celltab IS INITIAL.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'CHECK_BOX'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'XPORE'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
             ELSE.
               LOOP AT <lfs_acct_group_item>-celltab ASSIGNING <lfs_celltab>.
                 <lfs_celltab>-style = cl_gui_alv_grid=>mc_style_disabled.
               ENDLOOP.
             ENDIF.
           ENDLOOP.
         ENDIF.
         CALL METHOD gr_grid->refresh_table_display
    *      EXPORTING
    *        is_stable      =
    *        i_soft_refresh =
           EXCEPTIONS
             finished       = 1
             OTHERS         = 2
         IF sy-subrc <> 0.
    *     Implement suitable error handling here
         ENDIF.
        Part 2:
    METHOD set_enable.
         gr_grid->set_ready_for_input(
             i_ready_for_input = iv_flag
    ENDMETHOD.

    Hi Liu,
        Please go through the below code.
    *& Report  YEDIT_DISPLAY
    REPORT  YEDIT_DISPLAY.
    TABLES : VBAK.
    TYPE-POOLS SLIS.
    TYPES : BEGIN OF TY_VBAK,
              VBELN TYPE VBAK-VBELN,
             END OF TY_VBAK,
             BEGIN OF TY_FINAL,
               BOX TYPE C,
               VBELN TYPE VBAK-VBELN,
             END OF TY_FINAL.
    DATA : IT_VBAK TYPE TABLE OF TY_VBAK,
            WA_VBAK TYPE TY_VBAK,
            IT_FINAL TYPE TABLE OF TY_FINAL,
            WA_FINAL TYPE TY_FINAL,
            IT_FCAT TYPE TABLE OF SLIS_FIELDCAT_ALV,
            WA_FCAT TYPE SLIS_FIELDCAT_ALV.
    START-OF-SELECTION.
       PERFORM FETCH_DATA.
       PERFORM FCAT_DATA.
       PERFORM DISPLAY.
    *&      Form  FETCH_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM FETCH_DATA .
       SELECT VBELN INTO TABLE IT_VBAK FROM VBAK UP TO 10 ROWS.
       LOOP AT IT_VBAK INTO WA_VBAK.
         WA_FINAL-VBELN = WA_VBAK-VBELN.
         APPEND WA_FINAL TO IT_FINAL.
         CLEAR : WA_FINAL , WA_VBAK.
       ENDLOOP.
    ENDFORM.                    " FETCH_DATA
    *&      Form  FCAT_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM FCAT_DATA .
       WA_FCAT-COL_POS = 1.
       WA_FCAT-FIELDNAME = 'BOX'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'BOX'.
       wa_fcat-checkbox = 'X'.
       WA_FCAT-EDIT = 'X'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
       WA_FCAT-COL_POS = 2.
       WA_FCAT-FIELDNAME = 'VBELN'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'Sales Document'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
    ENDFORM.                    " FCAT_DATA
    *&      Form  DISPLAY
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM DISPLAY .
       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           = 'USER_COMMAND'
    *   I_CALLBACK_TOP_OF_PAGE            = ' '
          IT_FIELDCAT                       = IT_FCAT
    *   I_DEFAULT                         = 'X'
    *   I_SAVE                            = ' '
         TABLES
           T_OUTTAB                          = IT_FINAL
    * EXCEPTIONS
    *   PROGRAM_ERROR                     = 1
    *   OTHERS                            = 2
       IF SY-SUBRC <> 0.
    * Implement suitable error handling here
       ENDIF.
    ENDFORM.                    " DISPLAY
    FORM USER_COMMAND USING UCOMM TYPE SY-UCOMM
                             RTAB TYPE slis_selfield.
       CASE UCOMM.
         WHEN '&IC1'.
           MESSAGE 'SUCESSFUL' TYPE 'S'.
         WHEN '&DATA_SAVE'.
           PERFORM FIL_FCAT.
           PERFORM DISPLAY1.
         WHEN 'BACK'.
           LEAVE TO SCREEN 0.
         WHEN OTHERS.
           LEAVE TO SCREEN 0.
       ENDCASE.
    ENDFORM.
    *&      Form  FIL_FCAT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM FIL_FCAT .
    CLEAR IT_FCAT.
       WA_FCAT-COL_POS = 1.
       WA_FCAT-FIELDNAME = 'BOX'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'BOX'.
       wa_fcat-checkbox = 'X'.
    **  WA_FCAT-EDIT = 'X'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
       WA_FCAT-COL_POS = 2.
       WA_FCAT-FIELDNAME = 'VBELN'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'Sales Document'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
    ENDFORM.                    " FIL_FCAT
    *&      Form  DISPLAY1
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM DISPLAY1 .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
          I_CALLBACK_PROGRAM                = SY-REPID
    *   I_CALLBACK_TOP_OF_PAGE            = ' '
          IT_FIELDCAT                       = IT_FCAT
    *   I_DEFAULT                         = 'X'
    *   I_SAVE                            = ' '
         TABLES
           T_OUTTAB                          = IT_FINAL
    * EXCEPTIONS
    *   PROGRAM_ERROR                     = 1
    *   OTHERS                            = 2
       IF SY-SUBRC <> 0.
    * Implement suitable error handling here
       ENDIF.
    ENDFORM.                    " DISPLAY1
    Here i written code under the SAVE button , if requires you create your own status and apply.
    Regards,
    Krishna

  • ALV Grid is not Displaying after executing?

    Hi Guys,
                 I am using ALV grid in my program with OO Concepts.I was not able to see the final o/p after entering the data into the selection Screen.Can anybody tell me what's the reason.I am sending u the code.
         Call Method grid1->set_table_for_first_display
                Exporting I_Structure_name = 'T_FINAL_OUT'
                 Changing it_outtab = i_final_out1[]
                          it_fieldcatalog = I_FCAT
                 Exceptions
                          Invalid_parameter_combination = 1
                          program_error                 = 2
                          too_many_lines                = 3
                          Others                        = 4.
                 If sy-subrc <> 0.
                 ENDIF.
    Please respond to this mail
    Thanks,
    Gopi.

    Hi Ashish,
                  I tried like what u told. but its  not working.
    I am sending u the complete code.
      My only doubt is regarding Container does i need to crerate a conatiner .I created a custome control also but same problem
    Data : grid1 type ref to cl_gui_alv_grid,
           g_custom_container type ref to cl_gui_custom_container,
           i_FCAT TYPE  LVC_T_FCAT,
           i_FCAT_str type lvc_s_fcat,
    Structure  for layout
          i_layout_s   TYPE  lvc_s_layo,
          i_lvccat TYPE lvc_t_fcat,
    INITIALIZATION of Fields
    Initialization.
      v_repid = sy-repid.
      set screen '101'.
      MODULE STATUS_0101 output.
    if g_custom_container is initial .
         create object g_custom_container
             Exporting
                 Container_name = 'CCCONTAINER'
             Exceptions
                 cntl_error = 1
                 cntl_system_error = 2
                 create_error = 3
                 lifetime_error = 4
                 Others = 5.
                 If sy-subrc <> 0.
                 ENDIF.
         Create Object grid1
             Exporting
                 I_Parent = g_custom_container
             Exceptions
                 error_cntl_create = 1
                 error_cntl_init   = 2
                 error_cntl_link   = 3
                 error_dp_create   = 4
                 Others            = 5.
                 If sy-subrc <> 0.
                 ENDIF.
    Start-OF-Selection
    i_FCAT_str-col_pos = 1.
      i_FCAT_str-fieldname = 'MATNR'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_fcat_str-seltext = Text-024.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 2.
      i_FCAT_str-fieldname = 'GJAHR'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_fcat_str-seltext = Text-012.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 3.
      i_FCAT_str-fieldname = 'PERIO'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_fcat_str-seltext = Text-013.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 4.
      i_FCAT_str-fieldname = 'LIFNR_ND1'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_fcat_str-seltext = Text-014.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
    if  not grid1 is Initial.
      If sy-SUBRC = 0.
         Call Method grid1->set_table_for_first_display
                 Exporting
                          I_STRUCTURE_NAME = 'I_FCAT'
                          IS_LAYOUT = i_layout_s
                 Changing it_outtab = i_final_out1[]
                          it_fieldcatalog = I_FCAT
                 Exceptions
                          Invalid_parameter_combination = 1
                          program_error                 = 2
                          too_many_lines                = 3
                          Others                        = 4.
                 If sy-subrc <> 0.
                 ENDIF.
    ENDIF.
    Else.
    if g_custom_container is initial .
          create object g_custom_container
              Exporting
                  Container_name = 'CCCONTAINER'
              Exceptions
                  cntl_error = 1
                  cntl_system_error = 2
                  create_error = 3
                  lifetime_error = 4
                  Others = 5.
                  If sy-subrc <> 0.
                  ENDIF.
          Create Object grid1
              Exporting
                  I_Parent = g_custom_container
              Exceptions
                  error_cntl_create = 1
                  error_cntl_init   = 2
                  error_cntl_link   = 3
                  error_dp_create   = 4
                  Others            = 5.
                  If sy-subrc <> 0.
                  ENDIF.
         Call Method grid1->set_table_for_first_display
                 Exporting
                 I_STRUCTURE_NAME = 'I_FCAT'
                 IS_LAYOUT = i_layout_s
                 Changing it_outtab = i_final_out1[]
                          it_fieldcatalog = I_FCAT
                 Exceptions
                          Invalid_parameter_combination = 1
                          program_error                 = 2
                          too_many_lines                = 3
                          Others                        = 4.
                 If sy-subrc <> 0.
                 ENDIF.
       Endif.
       ENDIF.
    Thanks,
    Gopi.

  • ALV grid using classes(displaying subtotals groupwise in ALV grid control)

    Hello ,
      please can any body help me its urgent tome.
    displaying subtotals groupwise ..say for ex..
    cost group  costelement         amount     
    10          101         100.00
    10                            102          200.00
    10                            103          300.00
    20                            104          400.00
    20                            105          500.00
    20                            106          600.00
                    101         100.00
                    102         200.00
                    103         300.00
    10                          600.00
              104         400.00
              105         500.00
              106         600.00
    20                         1500.00
    In ALV grid control using classes.
    Thanks in Advance

    Hi alson,
    MODULE pbo OUTPUT.
    SET PF-STATUS 'MAIN100'.
    IF g_custom_container IS INITIAL.
    CREATE OBJECT g_custom_container
    EXPORTING container_name = g_container.
    CREATE OBJECT grid1
    EXPORTING i_parent = g_custom_container.
    <b>CALL METHOD grid1->set_table_for_first_display
    EXPORTING IS_LAYOUT = it_LAY
    CHANGING it_fieldcatalog = fieldcat
    it_sort = it_sort
    it_outtab = itab[].</b>
    ENDIF.
    ENDMODULE. " PBO OUTPUT
    keep the below code
    <b>CALL METHOD grid1->set_table_for_first_display
    EXPORTING IS_LAYOUT = it_LAY
    CHANGING it_fieldcatalog = fieldcat
    it_sort = it_sort
    it_outtab = itab[].</b>
    here
    IF pdel = 'X'.
    *BEGIN OF CHANGES BY VINAY DASARI
    PERFORM get_data.
    <b>CALL METHOD grid1->set_table_for_first_display
    EXPORTING IS_LAYOUT = it_LAY
    CHANGING it_fieldcatalog = fieldcat
    it_sort = it_sort
    it_outtab = itab[].</b>
    ENDIF.

  • Dynamic ALV Grid is not displaying !!

    Hi all,
      I am trying to create dynamic alv grids and upto five levels(five grids) out put is displaying fine without any problem. But when I try to display the 6th grid, the program is going into infinite loop and getting timed out. Even I tried to increse the height of the grid even though it is not displaying.
    Please correct me if any thing is wrong in below code.
    *1st Level grid
    IF <table1> IS ASSIGNED AND <table1> IS NOT INITIAL.
       CREATE OBJECT ob_split1
           EXPORTING
             parent      = ob_custom
             orientation = cl_gui_easy_splitter_container=>orientation_vertical.
        PERFORM set_split_height USING ob_split1  '20'.
        CREATE OBJECT ob_grid1
          EXPORTING
            i_parent = ob_split1->top_left_container.
    ELSE.
        CREATE OBJECT ob_split1
           EXPORTING
             parent      = ob_custom
             orientation = cl_gui_easy_splitter_container=>orientation_vertical.
        PERFORM set_split_height USING ob_split1  '0'.
    ENDIF.
    *2nd Level grid
    IF <table2> IS ASSIGNED AND <table2> IS NOT INITIAL.
       CREATE OBJECT ob_split2
           EXPORTING
             parent      = ob_split1->bottom_right_container
             orientation = cl_gui_easy_splitter_container=>orientation_vertical.
          PERFORM set_split_height USING ob_split2   '20'.
        CREATE OBJECT ob_grid2
          EXPORTING
            i_parent = ob_split2->top_left_container.
      ELSE.
         CREATE OBJECT ob_split2
            EXPORTING
              parent      = ob_split1->bottom_right_container
              orientation = cl_gui_easy_splitter_container=>orientation_vertical.
         PERFORM set_split_height USING ob_split2    '0'.
      ENDIF.
    (Created 3rd,4th,5th same like above).
    *6th Level grid
    IF <table6> IS ASSIGNED AND <table6> IS NOT INITIAL.
    CREATE OBJECT ob_split6
           EXPORTING
             parent      = ob_split5->bottom_right_container
             orientation = cl_gui_easy_splitter_container=>orientation_vertical.
         PERFORM set_split_height USING ob_split6  '20'.
         CREATE OBJECT ob_grid6
           EXPORTING
             i_parent = ob_split6->top_left_container.
      ELSE.
         CREATE OBJECT ob_split6
           EXPORTING
             parent      = ob_split5->bottom_right_container
             orientation = cl_gui_easy_splitter_container=>orientation_vertical.
         PERFORM set_split_height USING ob_split6  '0'.
      ENDIF.
    Appreciated your reply. Please let me know for additional info.
    Thanks,
    Ranjith.
    Edited by: Thomas Zloch on Dec 8, 2010 5:44 PM - please use code tags

    Hi romanch,
    defining the field catalog you must reference all currency fields to the respective currency key field (type CUKY).
    <alv_fieldcat>-cfieldname         = 'HWAER'.
    This is sample for alv output of a currency field. The alv structure has a field HWAER which carries the currency key, e.g. USD or so.
    Obviously you do not provide a cutrrency key for your values. If they are initial (zero), ALV will not display them as 0,00 but leave the field empty if the reference too currency key is not established.
    If you define a DDIC structure for the ALV output this refernce is enforced. You can pass the DDIC structure name to the ALV and don not have to create the field catalog manually.
    Regards,
    Clemens

  • Changing field catalog of ALV grid after first display (was: "ALV GRID")

    Dear experts!
    I am using CL_GUI_ALV_GRID to display an ALV, whose fieldcatalog has 5 fields (FIELD1, FIELD2, FIELD3, FIELD4 and FIELD5).
    I am setting "NO_OUT = 'X' " to the fields FIELD3 and FIELD5 in the fieldcatalog before call the method SET_TABLE_FOR_FIRST_DISPLAY.
    If a specific event occurs on the screen, I would like to set "NO_OUT = 'X'" to the fields FIELD2 and FIELD4 and I would like to set the "NO_OUT = ''" to the fields and FIELD3 FIELD5. This should happen at runtime after the method call "SET_TABLE_FOR_FIRST_DISPLAY".
    I've tried using the method SET_FIELDCATALOG, but it is private.
    Does anyone have any idea how to solve this problem?
    Thank you very much!
    Rubens
    Edited by: Thomas Zloch on Aug 22, 2011 3:49 PM - subject corrected

    Hi
    Try to use the method SET_FRONTEND_FIELDCATALOG (it'll call private method SET_FIELDCATALOG)
    Max

  • New ALV Grid Field not Displaying?

    I revised a report to have a new column. So I added this new field to the code.
    I see the field and the value when I call
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    Bbut the field I added does not display.
    Thank-you.

    Hi,
    Please ensure that you added the related logic in the FIELD CATALOG of the ALV.
    Regards,
    Nirmal

  • 'TOTAL' text display in ALV GRID output

    Hi,
      My requirement is to display 'TOTAL' text at the end of the ALV report alongwith Totals for the respective columns.
      I've used Classical method(i.e. used ALV GRID FM) to display the report.
      For Totals I've used 'DO_SUM', option and for text populated 'TOTALS_TEXT' field, but still its not showing the desired text.
      I've tried most of the solutions provided on SDN, and they are not working.
      So, plssss help me to find out correct solution.
      Thanks in Advance!!!!!!
    Thanks & regards,
    Amit

    hi,
    i hope this code will exactli fulfil ur requirement.
    type-poolS: slis.
    TYPES: BEGIN OF S_TAB,
           F1 TYPE CHAR5,
           F2 TYPE I,
           F3 TYPE I,
           END OF S_TAB.
    TYPES: BEGIN OF sf_TAB,
           f0 type char10,
           F1 TYPE CHAR5,
           F2 TYPE I,
           F3 TYPE I,
           END OF Sf_TAB.
    DATA: IT_TAB TYPE TABLE OF S_TAB,
          WA_TAB TYPE S_TAB,
          IT_FIN TYPE TABLE OF Sf_TAB,
          WA_FIN TYPE Sf_TAB.
    data: fcat type slis_t_fieldcat_alv,
          wa_fcat type slis_fieldcat_alv,
          layout  type slis_layout_alv,
          it_sort type SLIS_T_SORTINFO_ALV,
          wa_sort type SLIS_SORTINFO_ALV.
    FREE IT_TAB. CLEAR WA_TAB.
    WA_TAB-F1 = 'A1'.
    WA_TAB-F2 = '10'.
    WA_TAB-F3 = '20'.
    APPEND WA_TAB TO IT_TAB.
    CLEAR WA_TAB.
    WA_TAB-F1 = 'A1'.
    WA_TAB-F2 = '10'.
    WA_TAB-F3 = '20'.
    APPEND WA_TAB TO IT_TAB.
    CLEAR WA_TAB.
    WA_TAB-F1 = 'A2'.
    WA_TAB-F2 = '15'.
    WA_TAB-F3 = '30'.
    APPEND WA_TAB TO IT_TAB.
    CLEAR WA_TAB.
    WA_TAB-F1 = 'A3'.
    WA_TAB-F2 = '15'.
    WA_TAB-F3 = '40'.
    APPEND WA_TAB TO IT_TAB.
    CLEAR WA_TAB.
    WA_TAB-F1 = 'A3'.
    WA_TAB-F2 = '20'.
    WA_TAB-F3 = '60'.
    APPEND WA_TAB TO IT_TAB.
    CLEAR WA_TAB.
    LOOP AT IT_TAB INTO WA_TAB.
    wa_fin-f0 = 'Total'.
    wa_fin-f1 = wa_tab-f1.
    wa_fin-f2 = wa_tab-f2.
    wa_fin-f3 = wa_tab-f3.
    append wa_fin to it_fin.
    clear wa_fin.
    ENDLOOP.
    Define Imacro.
    wa_fcat-fieldname      = &1.
    wa_fcat-tabname        = &2.
    wa_fcat-reptext_ddic  = &3.
    wa_fcat-col_pos       = &4.
    WA_FCAT-DO_SUM      = &5.
    WA_FCAT-NO_OUT = &6.
    append wa_fcat to fcat .
    clear wa_fcat.
    end-of-definition.
    imacro 'F0'   'it_fin' ''   '1' ''  'X'.
    imacro 'F1'   'it_fin' 'PO Document'   '2' ''  ''.
    imacro 'F2'   'it_fin' 'TOTAL'    '3' 'X'  ''.
    imacro 'F3'   'it_fin' 'Space'     '4' '' ''.
    ****************DEFINE LAYOUT
    layout-zebra             = 'X'.
    layout-colwidth_optimize = 'X'.
    layout-no_totAlLine = 'X'.
    WA_SORT-SPOS = 1.
    WA_SORT-fieldname = 'F0'.
    wa_SORT-UP = 'X'.
    WA_SORT-SUBTOT = 'X'.
    APPEND WA_SORT TO IT_SORT.
    CLEAR WA_SORT.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = SY-REPID
       I_GRID_TITLE                      = 'SALES ORDER DETAILS'
       IS_LAYOUT                         = layout
       IT_FIELDCAT                       = fcat
       IT_SORT                           = IT_SORT
       TABLES
       T_OUTTAB                          = IT_FIN
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Cheers,
    Rudhir

  • ALV grid in Subscreen

    Hi all,
    I have a subscreen with ALV grid in module pool program.
    The main screen has two subscreens (one is header and other is items/reports)
    from the main screen, the ALV Grid subscreen can be called in two ways.
    1. from application tool bar (show report button) - ALV grid will be displayed in Items/Reports subscreen.
    2. In Items/Reports subscreen, while displaying items there is a requirement to display same ALV grid subscreen report on hotspot of particular item.
    ALV Grid in subscreen displaying only first come first serve for subscreen, if the subscreen called from application toolbar button then the ALV grid from items hotspot call not displaying and vice versa.
    Not sure where i am doing wrong, but if i free the container, alv and re-generate all the objects its working fine but user doesn't like the flickering display of conatiner when it re-generating.
    Any suggestions would help.
    Regards
    Syed

    Hi Aruna Kumara,
    Thanks for the reply.
    I have only one ALV grid instance.
    Process Flow from Application toolbar
    Main Screen: 100
    PBO:
    CALL SUBSCREEN C_REPORT INCLUDING SY_REPID '0300'.
    SUBSCREEN: 300
    PBO:
    IF CONTAINER IS NOT BOUND.
         CREATE Container.           with container name
         CREATE ALV_Grid.           passing container created
         BUILD FIELDCAT.
         CREATE EVENTS.
         CALL METHOD SET_DISPLAY_TABLE_FIRST.
    ELSE.
         REFRESH_TABLE_DISPLAY.
         FLUSH.     "tried with without flush too.
    ENDIF.
    Process Flow from Items:
    Items table is a subscreen 200 in main screen.
    When the desired item click thru hotspot, a Modal dialog screen 250 open with subscreen element.
    In event hotspot_click.
    CALL SCREEN 250 STARTING AT ...ENDING AT.
    PBO of 250:
    CALL SUBSCREEN C_REPORT INCLUDING SY-REPID '0300'.
    SubScreen 0300:
    PBO as describe above, as the container already bound next time it refreshes the table display. But i see a blank screen in Popup.
    Hope this helps.
    Regards
    Syed

  • Getting present display records  or Row Id's information in ALV grid?

    Hi,
    I am using REUSE_ALV_GRID_DISPLAY for ALV display.
    I need to get the row id's when user filter the records with any conditions  - or any other ways if he selected particular records - I need to process my logic only for those present displaying records in ALV grid.
    So How do I can get preset display records in ALV grid or Present display records row id's ?
    Please let me know .
    And also I  am using 
    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
        IMPORTING
          e_repid = i_repid
          e_grid  = lt_grid
    In lt_grid there is a table MT_ROID  this table is having selected row id's information but I could not read this table. I think this will work only OO ABAP and also method - get_selected_rows is also not working.
    I highly appreciate your answers.
    Thanks
    Kevin

    Hallo,
    Any ideas?
    Thanks.

  • Displaying the selected rows in ALV Grid output

    Hi Experts,
    I am developing one interactive ALV Grid report where user can process the selected records/rows from the ALV Grid output.
    for displaying the ALV Grid, I have used the class CL_GUI_ALV_GRID class. I am working on ECC 6.0 system.
    when I select any records/rows from output and then press any Application Toolbar button, PAI and then PBO modules of the screen gets executed as per the normal flow.
    however After PBO, when same ALV output comes, all the selected/highlighted rows appear as unselected, that means I want to retain the ALV
    rows selection during the round trip.
    please advise.
    Regards,
    Jagesh

    Hi,
    Feiyun Wu is correct.
    Get_selected_rows and set_selected_rows are the methods to be used .
    Some code:
    Note the sequence of code:
    FORM set_gui_alv_grid_1 .
      DATA: wa_layout TYPE lvc_s_layo ,
            wa_print TYPE lvc_s_prnt .
      DATA: it_sort TYPE lvc_t_sort ,
            wa_sort TYPE LINE OF lvc_t_sort .
      DATA: it_fieldcatalog TYPE lvc_t_fcat.
      IF gui_custom_container_1 IS INITIAL .
        CREATE OBJECT gui_custom_container_1
          EXPORTING
            container_name = 'GUI_CUSTOM_CONTAINER_1'
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            OTHERS                      = 6 .
        IF sy-subrc <> 0.
        ENDIF.
        PERFORM get_field_catalog
          USING gc_log_group_1
          CHANGING it_fieldcatalog  .
        CREATE OBJECT gui_alv_grid_1
          EXPORTING i_parent = gui_custom_container_1.
        CREATE OBJECT ob_event_receiver_1
          EXPORTING log_group = gc_log_group_1 .
    * registers the event handlers
        SET HANDLER ob_event_receiver_1->handle_toolbar      FOR gui_alv_grid_1 .
        SET HANDLER ob_event_receiver_1->handle_user_command FOR gui_alv_grid_1 .
        SET HANDLER ob_event_receiver_1->print_top_of_page   FOR gui_alv_grid_1 .
        SET HANDLER ob_event_receiver_1->hotspot_click       FOR gui_alv_grid_1 .
        wa_layout-cwidth_opt = abap_true .
    *   wa_layout-excp_fname = gc_excp_fname .
    *   wa_layout-ctab_fname = gc_ctab_fname.
    *   wa_layout-excp_led   = abap_true .
        CALL METHOD gui_alv_grid_1->set_table_for_first_display
          EXPORTING
            is_layout       = wa_layout
            is_print        = wa_print
            i_save          = 'A'
            is_variant      = gs_disvariant_1
          CHANGING
            it_sort         = it_sort
            it_fieldcatalog = it_fieldcatalog
            it_outtab       = it_alv_grid_1.
      ELSE .
        CALL METHOD gui_alv_grid_1->refresh_table_display.
    * Restore selections
        CALL METHOD gui_alv_grid_1->set_selected_rows
          EXPORTING
            it_index_rows = ob_event_receiver_1->it_rows.
    * Restore position
        CALL METHOD gui_alv_grid_1->set_scroll_info_via_id
          EXPORTING
            is_col_info = ob_event_receiver_1->wa_col
            is_row_no   = ob_event_receiver_1->wa_roid.
      ENDIF.
    ENDFORM .                    "set_gui_alv_grid_1
    Regards.

  • Generic function displaying alv grid for undefined structure

    Hi experts,
    I'm doing my first steps on abap development (Totally noob).
    I'm writing some little reports based on simple selections (1 or 2 tables).
    In every report, I've defined a structure (internal table) that i'm displaying with an ALV Grid.
    In every report, I need to create a catalog for my structure in order to make the alv grid working.
    What I would like to do is :
    Create a function that receives a undefined structure (for all my reports) as a parameter.
    This function sould create the catalog for the coresponding structure and call the alv grid function to display the data's contained in this structure.
    The goal is : In every report, I would like to use this function to show the selected data's without taking care of catalogs, alv grid, etc...
    Is it possible ?
    I really don't see how I can do that... Does anybody already tried something like that ?
    Thank you for your help
    Regards
    Quentin

    Hi,
    In this method Pass the structure name-
    CALL METHOD gh_grid->set_table_for_first_display
    EXPORTING
    I_BUFFER_ACTIVE =
    I_BYPASSING_BUFFER =
    I_CONSISTENCY_CHECK =
    I_STRUCTURE_NAME = "<- here pass the structure
    IS_VARIANT =
    I_SAVE =
    I_DEFAULT = 'X'
    IS_LAYOUT = "<-Layout variable if using layout
    IS_PRINT =
    IT_SPECIAL_GROUPS =
    IT_TOOLBAR_EXCLUDING =
    IT_HYPERLINK =
    IT_ALV_GRAPHICS =
    IT_EXCEPT_QINFO =
    CHANGING
    it_outtab = gt_line[]
    it_fieldcatalog = gt_fieldcat
    IT_SORT =
    IT_FILTER =
    EXCEPTIONS
    invalid_parameter_combination = 1
    program_error = 2
    too_many_lines = 3
    OTHERS = 4

Maybe you are looking for