HELP IN ALV FIELD CAT

HI,
I use that function for alv and fieldcat and its working o.k. but i wont to add
field name to colman and its not working ,and optimaize colman for text , and title how i do that?
Regards
DEFINE m_fieldcat.
  add 1 to ls_fieldcat-col_pos.
  ls_fieldcat-fieldname   = &1.
  ls_fieldcat-ref_tabname = &2.
  ls_fieldcat-fix_column = &3. "this is not working
  append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
  DATA l_rnd_value TYPE integer2.
  FIELD-SYMBOLS : <itab> LIKE LINE OF itab .
  LOOP AT itab ASSIGNING <itab>.
    CASE <itab>-object.
      WHEN 'Badi'.
        <itab>-line_color = 'C510'.   " Blue.
      WHEN 'User Exit'.
        <itab>-line_color = 'C611'.   " Red.
    ENDCASE.
  ENDLOOP.
ENDFORM.
FORM f_display_data.
  DATA:
    ls_layout   TYPE slis_layout_alv,
    ls_fieldcat TYPE slis_fieldcat_alv,
    lt_fieldcat TYPE slis_t_fieldcat_alv.
* Build the field catalog
  m_fieldcat 'OBJECT' 'ITAB' 'X'.
  m_fieldcat 'OBJECT_NAME' 'ITAB' 'X' .
*  m_fieldcat 'VBELN' 'VBAK'.
*  m_fieldcat 'NETWR' 'VBAK'.
* Fill Layout - Name of the field with color
  ls_layout-info_fieldname = 'LINE_COLOR'.
* Display the list
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      is_layout   = ls_layout
      it_fieldcat = lt_fieldcat
    TABLES
      t_outtab    = itab.
ENDFORM.                    "f_display_data

You will have to use this:
1. Change the macro following way:
DEFINE m_fieldcat.
  add 1 to ls_fieldcat-col_pos.
  ls_fieldcat-fieldname   = &1.
  ls_fieldcat-ref_tabname = &2.
  ls_fieldcat-fix_column = &3.
  ls_fieldcat-reptext_ddic = &4.    " << will repalce from the macro's argument
  append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
2. Call the macro like this.
m_fieldcat 'OBJECT' 'ITAB' 'X' 'Object'
  m_fieldcat 'OBJECT_NAME' 'ITAB' 'X'  'Oject Name'.
Regards,
Naimesh Patel

Similar Messages

  • Hi, i have doubt in alv field cat log

    1)In alv field cat preparation (i dont want to display for one particular field in output screen) can u pls send me the code.
    2)in field cat for a particular field i want to display in different color for that can u send me code.
    3)code for (DOUBLE CLICK) event.
                for the can u send me a code
    Regards,
    Nagesh

    Hi Nagesh,
    I think you have posted your question in the wrong forum, this forum is for education related topics only.  Please review the existing forums and re-post it to the appropriate one.
    Regards,
    Simon

  • Getting dump when using do_sum in alv field cat in the output of the report

    Dear Freinds,
                 Iam getting the alv report when i click on the segma field (Sum) on my salary
    field iam getting dump. and also if i try to print my alv output iam getting dump , only
    happening to my custom report.
    i have used the following code pleae correct me .
    This perform is used for Layout settings
      perform st_layout_build  using gs_layout.
    form st_layout_build  using  st_ls_layout type slis_layout_alv.
       st_ls_layout-no_input          = 'X'.
      st_ls_layout-colwidth_optimize = 'X'.
    st_ls_layout-zebra             = 'X'.
    st_ls_layout-detail_popup      = 'X'.
    endform.                    " st_layout_build
    Field Catalog details
    perform st_fieldcat_init changing gt_fieldcat.
    form st_fieldcat_init  changing  fp_i_fieldcat type slis_t_fieldcat_alv.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 1.
      ls_fieldcat-fieldname    = 'ORGUNIT'.
      ls_fieldcat-seltext_l    = 'Orgunit'.
    ls_fieldcat-no_out       = 'X'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 2.
      ls_fieldcat-fieldname    = 'ORGTEXT'.
      ls_fieldcat-seltext_l    = 'Orgdesc'.
    ls_fieldcat-no_out       = 'X'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = 'SALARY'.
      ls_fieldcat-seltext_l    = 'Salary'.
      ls_fieldcat-col_pos      = 3.
      ls_fieldcat-outputlen   = 15.
      ls_fieldcat-do_sum       = 'X'.
      ls_fieldcat-datatype     = 'CURR'.    "CURR
      append ls_fieldcat to fp_i_fieldcat.
    endform.
    Variant
      perform st_variant_init  using gs_variant g_repid.
    form st_variant_init   using  st_gs_variant type disvariant
                                 st_repid      like sy-repid.
      clear st_gs_variant.
      st_gs_variant-report = st_repid.
    endform.                    " st_variant_init
      g_repid = sy-repid.
      perform st_comment_build  using gt_list_top_of_page[].
    form st_comment_build  using   st_lt_top_of_page type slis_t_listheader.
      data: ls_line type slis_listheader.
    Listenüberschrift: Typ H
      clear ls_line.
      ls_line-typ  = 'H'.
    LS_LINE-KEY:  not used for this type
      ls_line-info = text-000.
      append ls_line to st_lt_top_of_page.
    endform.                    " st_comment_build
         call function 'REUSE_ALV_GRID_DISPLAY'
          exporting
             i_buffer_active        = 'X'
            i_callback_top_of_page = 'TOP_OF_PAGE'
            i_callback_program     = g_repid
            is_layout              = gs_layout
            it_fieldcat            = gt_fieldcat[]
           i_structure_name       = 'i_final'   "c_i_final "'objec'
           i_save                 = g_save
            is_variant             = gs_variant
          tables
            t_outtab               = fp_i_pyrol_final
          exceptions
            program_error          = 1
            others                 = 2.
        if sy-subrc ne 0.
          message e018. " Displaying the ALV GRID has failed
        endif.
    Please could any  one let me know why iam getting dump when iam clicking for total
    on my salary field.
    Regards
    latha

    Dear Chandu,
    my code iam giving in details
    types : begin of ty_output_data,
            staffno     type pernr_d,
            staffname   type emnam,
            grade       type stell,
            orgunit     type orgeh,
            orgtext     type hr_mcstext,
            psgroup     type trfgr,      " Pay Scale Group
            salary      type maxbt,       "PAD_AMT7S,
            rrefunded   type pad_amt7s,
            leavepay    type pad_amt7s,
            mshortfal   type pad_amt7s,   " Medical Shortfall
            echkshfal   type pad_amt7s,   " Execute checkup shortfall
            ofindeduc   type pad_amt7s,   " Other Finance Deduction
            mtyprem     type pad_amt7s,   " maternity premium
            vpbonus     type pad_amt7s,   " VP/Bonus
            gratuity    type pad_amt7s,   " Gratuity
            vpay        type pad_amt7s,   " Variable pay
            mallowance  type pad_amt7s,   " Meal Allowance
            overtime    type pad_amt7s,   " overtime
            other       type  pad_amt7s,  "  OTHER
            pfundeecon  type pad_amt7s,   " PFund Employee's Contribution
            banktrnsfer type pad_amt7s,   " Bank Transfer
            count       type i,
            end of ty_output_data.
    data : i_final         type standard table of ty_output_data.
    iam getting all my data in the internal table  I_FINAL.
    perform get_final_alv  using  i_final.
    form get_final_alv  using   fp_i_pyrol_final type ty_t_output_data.
    *local variable declarations
      data : l_v_idx      type sy-tabix.
    *local work areas
      data : l_wa_final type ty_output_data.
      g_save = 'A'.
    This perform is used for Layout settings
      perform st_layout_build  using gs_layout.
    Field Catalog details
      perform st_fieldcat_init changing gt_fieldcat.
    Variant
      perform st_variant_init  using gs_variant g_repid.
      g_repid = sy-repid.
      perform st_comment_build  using gt_list_top_of_page[].
      if not fp_i_pyrol_final is initial.
        delete adjacent duplicates from fp_i_pyrol_final comparing all fields.
        call function 'REUSE_ALV_GRID_DISPLAY'
          exporting
             i_buffer_active        = 'X'
            i_callback_top_of_page = 'TOP_OF_PAGE'
            i_callback_program     = g_repid
            is_layout              = gs_layout
            it_fieldcat            = gt_fieldcat[]
           i_structure_name       = 'i_final'   "c_i_final "'objec'
           i_save                 = g_save
            is_variant             = gs_variant
          tables
            t_outtab               = fp_i_pyrol_final
          exceptions
            program_error          = 1
            others                 = 2.
        if sy-subrc ne 0.
          message e018. " Displaying the ALV GRID has failed
        endif.
      endif.
    endform.                    " get_final_alv
    form st_layout_build  using  st_ls_layout type slis_layout_alv.
       st_ls_layout-no_input          = 'X'.
      st_ls_layout-colwidth_optimize = 'X'.
    st_ls_layout-zebra             = 'X'.
    st_ls_layout-detail_popup      = 'X'.
    endform.                    " st_layout_build
    form st_fieldcat_init  changing  fp_i_fieldcat type slis_t_fieldcat_alv.
      data: ls_fieldcat type slis_fieldcat_alv.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 1.
      ls_fieldcat-fieldname    = 'ORGUNIT'.
      ls_fieldcat-seltext_l    = 'Orgunit'.
    ls_fieldcat-no_out       = 'X'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 2.
      ls_fieldcat-fieldname    = 'ORGTEXT'.
      ls_fieldcat-seltext_l    = 'Orgdesc'.
    ls_fieldcat-no_out       = 'X'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 5.
      ls_fieldcat-fieldname    = 'STAFFNAME'.
    ls_fieldcat-no_out       = 'X'.
      ls_fieldcat-seltext_l    = 'StaffName'.
      append ls_fieldcat to fp_i_fieldcat.
       clear ls_fieldcat.
      ls_fieldcat-col_pos      = 4.
      ls_fieldcat-fieldname    = 'STAFFNO'.
    ls_fieldcat-no_out       = 'X'.
      ls_fieldcat-seltext_l    = 'StaffNo.'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 6.
      ls_fieldcat-fieldname    = 'GRADE'.
      ls_fieldcat-seltext_l    = 'Grade'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 3.
      ls_fieldcat-fieldname    = 'COUNT'.
      ls_fieldcat-seltext_l    = 'Headcount'.
      append ls_fieldcat to fp_i_fieldcat.
    if the field name is 'Salary' then do a sum on this field.
    IF  fp_fname = c_betrg.
        l_wa_fieldcat-do_sum    = c_x.
    ENDIF.
    NOTE : IAM GETTING PROBLEM IN THE BELOW SALARY.
    IAM JUST CHECKING ITSELF NOT ALLOWING ME TO EXECUTE
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = 'SALARY'.
      ls_fieldcat-seltext_l    = 'Salary'.
      ls_fieldcat-col_pos      = 7.
      ls_fieldcat-outputlen   = 20.
      ls_fieldcat-do_sum       = 'X'.
      ls_fieldcat-datatype     = 'CURR'.    "CURR
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 9.
      ls_fieldcat-fieldname    = 'LEAVEPAY'.
      ls_fieldcat-seltext_l    = 'Leave Pay'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 10.
      ls_fieldcat-fieldname    = 'MSHORTFAL'.
      ls_fieldcat-seltext_l    = 'Med.Sfall'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 11.
      ls_fieldcat-fieldname    = 'ECHKSHFAL'.
      ls_fieldcat-seltext_l    = 'EX.Chckup.Sfall'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 12.
      ls_fieldcat-fieldname    = 'OFINDEDUC'.
      ls_fieldcat-seltext_l    = 'Oth.Fin.Deduction'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 13.
      ls_fieldcat-fieldname    = 'MTYPREM'.
      ls_fieldcat-seltext_l    = 'Mat.Premium'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 14.
      ls_fieldcat-fieldname    = 'VPBONUS'.
      ls_fieldcat-seltext_l    = 'VP/Bonus'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 15.
      ls_fieldcat-fieldname    = 'GRATUITY'.
      ls_fieldcat-seltext_l    = 'Gratuity'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 16.
      ls_fieldcat-fieldname    = 'VPAY'.
      ls_fieldcat-seltext_l    = 'Variable Pay'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 17.
      ls_fieldcat-fieldname    = 'MALLOWANCE'.
      ls_fieldcat-seltext_l    = 'Meal.Allowance'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 18.
      ls_fieldcat-fieldname    = 'OVERTIME'.
      ls_fieldcat-seltext_l    = 'Overtime'.
      append ls_fieldcat to fp_i_fieldcat.
        clear ls_fieldcat.
      ls_fieldcat-col_pos      = 19.
      ls_fieldcat-fieldname    = 'OTHER'.
      ls_fieldcat-seltext_l    = 'Other'.
      append ls_fieldcat to fp_i_fieldcat.
    pfundeecon
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 20.
      ls_fieldcat-fieldname    = 'P FUND EMPLOYEES CONTRIBUTION'.
      ls_fieldcat-seltext_l    = 'P.Fund.Emp.Contrib'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 21.
      ls_fieldcat-fieldname    = 'BANKTRNSFER'.
      ls_fieldcat-seltext_l    = 'Payment'.
      append ls_fieldcat to fp_i_fieldcat.
    endform.                    " st_fieldcat_init
    form st_variant_init   using  st_gs_variant type disvariant
                                 st_repid      like sy-repid.
      clear st_gs_variant.
      st_gs_variant-report = st_repid.
    endform.                    " st_variant_init
    form st_comment_build  using   st_lt_top_of_page type slis_t_listheader.
      data: ls_line type slis_listheader.
    Listenüberschrift: Typ H
      clear ls_line.
      ls_line-typ  = 'H'.
    LS_LINE-KEY:  not used for this type
      ls_line-info = text-000.
      append ls_line to st_lt_top_of_page.
    endform.                    " st_comment_build
          FORM TOP_OF_PAGE                                              *
    form top_of_page.
      data: l_i_detailheader type slis_t_listheader.
    To get the header for ALV
      perform detail_header changing l_i_detailheader.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
        exporting
          it_list_commentary = l_i_detailheader.
    endform.                    "top_of_page
    form detail_header  changing fp_i_detailheader type slis_t_listheader.
      data: l_wa_header       type slis_listheader,
            l_v_time         type slis_edit_mask,
            l_v_date         type slis_edit_mask,
            l_v_abkrs        type char5,
            l_v_pabrj        type char8,
            l_v_pagno        type char10.
    Local Constants
      constants: l_c_h type char1 value 'H',
                 l_c_1  type i     value '1',
                 l_c_edit type char10 value '__.__.____',
                 l_c_slash  type c value '/'. " constant for slash
    To display the report Header
      l_wa_header-typ = l_c_h.
    WRITE sy-repid TO l_wa_header-info LEFT-JUSTIFIED.
      write text-014  to l_wa_header-info left-justified.
      append l_wa_header to fp_i_detailheader.
      clear l_wa_header.
    To display the Page no
      l_v_pagno =   sy-pagno + l_c_1.
      l_wa_header-typ = c_s.
      l_wa_header-key = text-008. " Page No:
      l_wa_header-info =  l_v_pagno.
      append l_wa_header to fp_i_detailheader.
      clear l_wa_header.
    To Display the User ID
      l_wa_header-typ = c_s.
      l_wa_header-key = text-009. " User ID
      l_wa_header-info = sy-uname.
      append l_wa_header to fp_i_detailheader.
      clear l_wa_header.
    To Display the Date/Time
      l_wa_header-typ = c_s.
      l_wa_header-key = text-010. " Date/Time:
      l_v_time = sy-uzeit.
      l_v_date = sy-datum.
      write: sy-uzeit to l_v_time.
      write sy-datum to l_v_date using edit mask l_c_edit.
      concatenate l_v_date
                  l_c_slash
                  l_v_time into l_wa_header-info+0(25) separated by space.
      append l_wa_header to fp_i_detailheader.
      clear: l_wa_header, l_v_date.
    To Display the Report Description
      l_wa_header-typ = c_s.
      l_wa_header-key = text-011.                " Report Description
      l_wa_header-info = text-012.
      append l_wa_header to fp_i_detailheader.
      clear l_wa_header.
      append l_wa_header to fp_i_detailheader.
    endform.                    " detail_header
    I will be greatful if any one can please help me in removing me the dump.
    REGARDS
    LATHA.

  • Field cat in alv

    hi all,
    in my itab i have a field naming sum_invoice its value is sum of records of a field , now when i pass this value to field cat its not coming correctly , it takes the value of the next field
    ADD 1 TO  g_field_count.
       ls_fieldcat-fieldname     = 'sum_invoice'.
       ls_fieldcat-cfieldname = 'WAERS'.
        ls_fieldcat-do_sum       = 'X'.
       ls_fieldcat-seltext_l = text-f02.
       ls_fieldcat-col_pos       = g_field_count.
       ls_fieldcat-ref_fieldname = 'NETWR'.
       APPEND ls_fieldcat TO lt_fieldcat.
       CLEAR ls_fieldcat.
    This is the code i am  doing.
    can anybody help me with it?

    hi,
    ADD 1 TO g_field_count.
    ls_fieldcat-fieldname = 'sum_invoice'.  <--------  use capital letters 'SUM_INVOICE'
    ls_fieldcat-cfieldname = 'WAERS'.
    ls_fieldcat-do_sum = 'X'.
    ls_fieldcat-seltext_l = text-f02.
    ls_fieldcat-col_pos = g_field_count.
    ls_fieldcat-ref_fieldname = 'NETWR'.
    APPEND ls_fieldcat TO lt_fieldcat.
    CLEAR ls_fieldcat.

  • Reg : F4 help for custom fields in ALV report

    hi friends..
    in my internal table i have fields including 1 custom field..
    DATA : BEGIN OF i_final OCCURS 0,
      pernr LIKE p0000-pernr,
      begda LIKE p0000-begda,
      plans LIKE ZPOSITION-plans,  (custom)
      werks LIKE pspar-werks,
      end of i_final.
    i want to display this i_final table in alv. for that i genetrate one fieldcatalog
    PERFORM fcat USING:
                      'I_FINAL' 'PERNR' 'P0000' 'PERNR' '15' 'X' '',
                      'I_FINAL' 'BEGDA' 'P0000' 'BEGDA' '10' 'X' '',
                      'I_FINAL' 'PLANS' 'ZPOSITION' 'PLANS' '8' 'X' '',
                      'I_FINAL' 'WERKS' 'PSPAR' 'WERKS' '14' 'X' ''.
    in custom table zposition, i maintain serch help for custom field "PLANS".
    then i used reuse_alv_grid_display.. for all the std fields along wit custom fields
    i got f4 all std fields but for my custom i am not getting the f4 help
    how can i get the F$ help for this custom fields Zposition-plans..
    plz give some idea

    Hi
    In that Ztable against the field
    PLANS give the check table name as  <b>T528B</b>
    then it will automatically give the search help
    or you can create your own search help(elementary) and add to that field
    Reward if useful
    regards
    Anji

  • How to enable F4 help for a field in ALV?

    Hi,
    I want to activate the F4 help in ALV output for a field for which we do not have search help assigned at table ,data element and domain level.
    In field catalog i have enabled it by below line.
      ls_fcat-F4AVAILABL = 'X'.
    but because there are no standard input help available it is giving message as "No input help is available".
    Can you please help?
    Best Regards,
    Rajesh Gupta

    Thanks.
    But i have my own custom search help which i want to assign for the ALV field as the standard field does not have the search help associated with it.
    and because its a standard dataelement we can not even assign the search help at dataelement level.
    do we have any way that we can pass our own custom search help from field catalog or any other way to implement the same.
    Thanks again!!
    Rajesh
    Edited by: Rajesh Gupta on Nov 18, 2010 4:12 PM

  • Reference field and table for AUFK for F4 help in alv.

    Hi All,
       I need to put F4 help on ALV for order no (AUFK) what is the reference field and table for that?
      i tried giving field as aufk and table as ccss but its not working.
       ls_fcat-ref_field = 'AUFNR'.
        ls_fcat-ref_table = 'CCSS'.
    Thanks & Regards,
    Ruchi Tiwari

    Hi,
    Try this.
    Set the f4 help for the field in the fieldcatalog
      ls_fcat-f4availabl = 'X'.
    1. Create a event of ONF4 for the alv grid.
    2. Set the event handler.
    3. Append the field for the F4 help in the internal table and call the below method
        CALL METHOD g_mprn->register_f4_for_fields
        EXPORTING
          it_f4 = i_f4.
    4. create a class definition and implementation
        refer sample pgms (BCALV_F4, BCALV_GRID_EDIT_DELTA and BCALV_GRID_EDIT)
    Hope this may be helpful.
    Regards,
    Sharin.

  • How to pass custom search help(F4 help) for a field in ALV output?

    Hi,
    I want to activate the F4 help in ALV output for a field for which we do not have search help assigned at table ,data element and domain level.
    In field catalog i have enabled it by below line.
    ls_fcat-F4AVAILABL = 'X'.
    but because there are no standard input help available it is giving message as "No input help is available".
    so how to pass our custom search help (g_search) for any field in ALV output.
    I am using object oriented ALV grid display.
    Thanks!!!
    Rajesh Gupta.

    hi,
    check this out:
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/b3d5e890-0201-0010-c0ac-bba85ec2ae8d
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/acdefb13-0701-0010-f1a2-8eeefa7d3780
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b3d5e890-0201-0010-c0ac-bba85ec2ae8d?quicklink=index&overridelayout=true

  • Editable field with F4 help in alv tree output using cl_gui_alv_tree

    HI
    i need Editable field with F4 help in alv tree output using cl_gui_alv_tree
    Regards
    Naresh

    Hi Naresh,
    Pass the field catalog with the additional parameter (ls_fcat-edit = 'X'.).
    for F4 help if the data element have the search help it automatically will come. other wise include the additional parameter in the field catalog (ls_fcat-F4AVAILABL = 'X')
    Reward if found helpful.
    Regards,
    Boobalan Suburaj

  • F4 help for ALV table field

    Hi Experts,
    I need to implement F4 help for ALV table field.
    I my scenario, I am using two views. If we click on any record in fist view then it displays the popup window (second view) with relevant record details.
    Here one of the columns having fieldnames corresponding values (old values), for correcting old values I have created new value editable column, we can enter new value for old value then we can save it. Till this functionality is ok.
    Then I have included OVS help for new value field. Here I need to get f4 help for newvalue field relevant to fieldname.
    For example: user clicks on f4 in cell (new value) then if corresponding fieldname is u2018WERKSu2019 then it shows the plant values
    Here I can get fieldname, domain name  and value table using method set_attribute ().
    Same concept I have implemented in ALV using F4IF_FIELD_VALUE_REQUEST. It is working fine
    Here I have little bit confusion. Please advise me how to implement in OVS.
    Regards,
    BBC

    Hi,
    you'll have to create a method for the OVS search help (define it in the "OVS component usage" field in the context).
    Sample code (should work for WERKS):
    method on_ovs .
    declare data structures for the fields to be displayed and
    for the table columns of the selection list, if necessary
      types:
        begin of lty_stru_input,
      add fields for the display of your search input here
          WERKS TYPE WERKS,
        end of lty_stru_input.
      types:
        begin of lty_stru_list,
      add fields for the selection list here
          WERKS TYPE WERKS_D,
          NAME1 type NAME1,
        end of lty_stru_list.
      data: ls_search_input  type lty_stru_input,
            lt_select_list   type standard table of lty_stru_list,
            ls_text          type wdr_name_value,
            lt_label_texts   type wdr_name_value_list,
            lt_column_texts  type wdr_name_value_list,
            lv_window_title  type string,
            lv_group_header  type string,
            lv_table_header  type string,
            lv_werks type werks_d.
      field-symbols: <ls_query_params> type lty_stru_input,
                     <ls_selection>    type lty_stru_list.
      case ovs_callback_object->phase_indicator.
        when if_wd_ovs=>co_phase_0.  "configuration phase, may be omitted
      in this phase you have the possibility to define the texts,
      if you do not want to use the defaults (DDIC-texts)
    Set label from Medium Description to something more logical...
          ls_text-name = `NAME1`.  "must match a field in list structure
          ls_text-value = `Plant description`.
          insert ls_text into table lt_label_texts.
    Set col header from Medium Description to something more logical...
          ls_text-name = `NAME1`.  "must match a field in list structure
          ls_text-value = `Plant description`.
          insert ls_text into table lt_column_texts.
         lv_window_title = wd_assist->get_text( `003` ).
         lv_group_header = wd_assist->get_text( `004` ).
         lv_table_header = wd_assist->get_text( `005` ).
          ovs_callback_object->set_configuration(
                    label_texts  = lt_label_texts
                    column_texts = lt_column_texts
                    group_header = lv_group_header
                    window_title = lv_window_title
                    table_header = lv_table_header
                    col_count    = 2
                    row_count    = 20 ).
        when if_wd_ovs=>co_phase_1.  "set search structure and defaults
      In this phase you can set the structure and default values
      of the search structure. If this phase is omitted, the search
      fields will not be displayed, but the selection table is
      displayed directly.
      Read values of the original context (not necessary, but you
      may set these as the defaults). A reference to the context
      element is available in the callback object.
         ovs_callback_object->context_element->get_static_attributes(
             importing static_attributes = ls_search_input ).
        pass the values to the OVS component
         ovs_callback_object->set_input_structure(
             input = ls_search_input ).
        when if_wd_ovs=>co_phase_2.
      If phase 1 is implemented, use the field input for the
      selection of the table.
      If phase 1 is omitted, use values from your own context.
          if ovs_callback_object->query_parameters is not bound.
          endif.
          assign ovs_callback_object->query_parameters->*
                                  to <ls_query_params>.
          if not <ls_query_params> is assigned.
    TODO exception handling
          endif.
            call method ovs_callback_object->context_element->get_attribute
              exporting
                name  = 'WERKS'
              importing
                value = lv_werks.
            data: lv_subcat_text type rstxtmd.
            select werks
                   name1
              into table lt_select_list
              from T001W.
            ovs_callback_object->set_output_table( output = lt_select_list ).
        when if_wd_ovs=>co_phase_3.
      apply result
          if ovs_callback_object->selection is not bound.
          endif.
          assign ovs_callback_object->selection->* to <ls_selection>.
          if <ls_selection> is assigned.
            ovs_callback_object->context_element->set_attribute(
                                   name  = `WERKS`
                                   value = <ls_selection>-werks ).
          endif.
      endcase.
    endmethod.

  • How to add F1 help for a field on ALV grid

    Hi All,
    When we execute a program, the output is displayed using ALV grid.
    on the ALV grid, if we press F1 on a field, it should popup the help document.
    How to add F1 help for a field on ALV grid.
    Thank you all in advance.

    fill field LVC_S_FCAT-ROLLNAME of your fieldcatalog in method SET_TABLE_FOR_FIRST_DISPLAY
    A.

  • Help me on field catalog in alv step by step,

    Error while running alv field catalouge not found.
    points will be awarded

    Hi
    Don't declare the internal table with Types which is used in the field catalog..
    straight away declare with Occurs o with header line.
    See this doc
    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
    Reward points if useful
    Regards
    Anji

  • Alv field with f4 help without using class

    Hi,
    Can any one give me a program of "Alv field with f4 help without using class".
    Thanking you in advance.

    hi
    <b>Linking F4 Help to Fields</b>
    For the last section, we will deal with linking F4 help to fields. It is easy. As usual, define, implement and register the event “onf4” at proper places in your code. For F4 help, you must register the fields whose F4 request will trigger the “onf4” event. For this you must prepare a table of type “LVC_T_F4” and register this table using the method “register_f4_for_fields”. While preparing table you must include a line for each field which will trigger F4 event. For each field in the structure;
    &#1048766; Pass the fieldname to ‘FIELDNAME’
    &#1048766; Set ‘REGISTER’ to make the field registered,
    &#1048766; Set ‘GETBEFORE’ to provide field content transport before F4 in editable mode
    &#1048766; Set ‘CHNGEAFTER’ to make the data changed after F4 in editable mode.
    DATA: lt_f4 TYPE lvc_t_f4 WITH HEADER LINE .
    lt_f4-fieldname = 'PRICE'.
    lt_f4-register = 'X' .
    lt_f4-getbefore = 'X' .
    APPEND lt_f4 .
    CALL METHOD gr_alvgrid->register_f4_for_fields
    EXPORTING
    it_f4 = lt_f4[] .
    Preparing table for the fields to be registered to trigger F4 event
    METHOD handle_on_f4 .
    PERFORM f4_help USING e_fieldname es_row_no .
    er_event_data->m_event_handled = 'X' .
    ENDMETHOD .
    A sample “onf4” method implementation
    Again, we set the attribute “er_event_data->m_event_handled” to prevent further processing of standard F4 help.
    regards
    Ravish
    <b>
    reward if useful</b>

  • Exception while creating f4 help for editable alv field

         hi experts
    i have created search help for editable alv field by following link
    http://scn.sap.com/docs/DOC-39832
    But i m getting an exception :  Field symbol has not yet been assigned.
    exception area code
       read table <tab1> into <ls_wa> index i_row_id.
        assign component m_cl_variant->ms_layout-stylefname
               of structure <ls_wa> to <l_field>.
        read table <l_field> into ls_style
                with table key fieldname = is_col_id-fieldname.
        if sy-subrc eq 0.
          if ls_style-style o mc_style_enabled.
            ready_for_input = 1.
            exit.
          elseif ls_style-style o mc_style_disabled.
            ready_for_input = 0.
            exit.
          endif.
    first read statement is giving sy-subrc =4.
    PS: exception from method..:IS_READY_FOR_INPUT
    kindly help

    Hello Ankush,
    read table <tab1>  ASSIGNING <ls_wa> index i_row_id.
    IF  <ls_wa> IS ASSIGNED.
        assign component m_cl_variant->ms_layout-stylefname
               of structure <ls_wa> to <l_field>.
        read table <l_field> into ls_style
                with table key fieldname = is_col_id-fieldname.
        if sy-subrc eq 0.
          if ls_style-style o mc_style_enabled.
            ready_for_input = 1.
            exit.
          elseif ls_style-style o mc_style_disabled.
            ready_for_input = 0.
            exit.
          endif.
    ENDIF.
    Regards,
    TP

  • Alv grid f4 help populating fieldcatalog field from f4 chosen field

    Suggest help to do f4 help on alv oo-object .
    when i click f4 for field it should call screen 200 their i have button search which need to extract data from for particular table on chosen from f4 help . Double click on value it should populate that value in screen 100 . note calling screen 200 dynamically field catalog get populated with f4 chosen from screen 100.
    can u suggest me the how to do this double click on the screen need to populate that value in f4 screen.
    CLASS lcl_application_f4 IMPLEMENTATION.
    method on_f4.
    f4_params-c_fieldname = e_fieldname.
    f4_params-cs_row_no = es_row_no.
    f4_params-cr_event_data = er_event_data.
    f4_params-ct_bad_cells = et_bad_cells.
    f4_params-c_display = e_display

    Hai Manoj
    Try with the following Code
      DATA: BEGIN OF LI_FABGRP OCCURS 0,
            FABGRP LIKE ZAPO_FABGRP-FABGRP,
            BEGDA LIKE ZAPO_FABGRP-BEGDA,
         END OF LI_FABGRP.
      DATA : T_RETURN TYPE STANDARD TABLE OF DDSHRETVAL WITH HEADER LINE,
             L_RETFIELD TYPE DFIES-FIELDNAME.
    parameters : S_FABGR like ZAPO_FABGRP-FABGRP.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_FABGR.
      SELECT FABGRP BEGDA FROM ZAPO_FABGRP INTO table LI_FABGRP.
      SORT LI_FABGRP BY FABGRP ASCENDING  BEGDA DESCENDING.
    Henter de mulige fabriksgrupper med nyeste BEGDA *indenfor hver
      DELETE ADJACENT DUPLICATES FROM LI_FABGRP COMPARING FABGRP.
    L_RETFIELD = 'FABGRP'.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
      EXPORTING
        RETFIELD               = L_RETFIELD
        DYNPPROG               = SY-REPID
        DYNPNR                 = '1000'
        DYNPROFIELD            = 'S_FABGR'
        VALUE_ORG              = 'S'
        MULTIPLE_CHOICE        = ' '
      TABLES
        VALUE_TAB              = LI_FABGRP
        RETURN_TAB             = T_RETURN
    EXCEPTIONS
       PARAMETER_ERROR        = 1
       NO_VALUES_FOUND        = 2
       OTHERS                 = 3.
    Thanks & regards
    Sreenivasulu P

Maybe you are looking for

  • IPad app won't download and can't delete it

    An iPad app I have previously installed had an update which I went to install as usual.  The download  is stalled on "waiting" and won't progress.  I can't delete the app because when I hold it down it wiggles but the "delete x" won't show.  The App

  • OIM 11g - Change 'Modify Self Profile'

    Hi, i want to change the access policy for 'modify self profile' 1. By default there are some attributes (mail, firstname...) which can be modified by a user. I want to disable some attributes. How do i modify these access policy? 2. This access poli

  • Looking help for developing labview code [Urgent]

    Hi, I need help in developing labview code. I am new to labview and will appreciate if someone can help me in this matter. I need to control the intensity of AC load (halogen lamp with 2kW,230V,50Hz) using Labview and Arduino. But my project using in

  • Coding Block for Stock PO

    Hi, We have a stock PO ( With no account assignment and standard item category) . It is triggering "Account assignment" tab at item level. We need to add "Business Area" field in that. So, I created a new Coding Block with business area included and

  • Upgrading from 4.0 to 11.1.1.2

    Hi All, I need sone help understanfing the correct process to migrate an HFM app, reports and users from version 4.0 to 11.1.1.2. As far as I am aware the LCM utility cannot be used with pre-system 9 versions. I think the doc states an upgrade to Sys