Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

F4 Help in Alv Grid

lijisusan_mathews
Active Contributor
0 Kudos

Hi,

I need to call an F4 help in an editable alv grid. I need the f4 help for the field VBAP-MVGR4. the ref table is TVM4 and the field in that table is MVGR4 too, but that table does not have a desciption (text) of that field, but i want to display the value and its corresponding text.. How do i get it. Plz help.

i tried onf4, but its not getting triggered. Also tried giving f4available = 'X' in fieldcatalog with the reference table and reference field but it is resulting in a program dump...

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Check this link-

16 REPLIES 16

bpawanchand
Active Contributor
0 Kudos

Hi

Check the link

[Sample Code|]

Regards

pavan

Former Member
0 Kudos

Hi,

Check this link-

0 Kudos

hi..

i tried all the documents.. but F4 event is not getting triggered. infact i triued pasting the c0ode in 1 document into a new program and tried running it, but even the method for f4 is not getting invoked.. i tried f1 and datachanged events and these are working, but F4 is not.. Please help.

0 Kudos

Hi

Check this blog

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/howtoimplementF4searchhelpinOOALV+Grid

Regards

Pavan

0 Kudos

its not working.. maybe it is the F4 help fields table... i gave the fieldname as 'EMPNAME'. Should i give the fieldname as 'ITAB-EMPNAME' or anything else.. and shud i give it in quotes??

0 Kudos

Hi

You should give the name of the field in the quotes as 'EMPNAME'.

Regards

pavan

0 Kudos

I tried that way.. but i cant get the f4 help even with the eg code given....please give me a simple working code.. anything except BCALV programs...

Edited by: Suzie on Aug 23, 2008 1:06 PM

0 Kudos

i am pasting my code beneath. actually its an example code modified slightly.. The f1 event is triggering and calling the f4 help functiuon module but this event cannot return valuers to the field... but the F4 is not triggerring the module handle_onf4...Please check and tell me what is wrong...

&----


*& Report ZLSM_F4HELP_ALV_OBJETCS

*&

&----


*&

*&

&----


REPORT zooalvf14 .

Global data definitions for ALV.......................................

DATA : alvgrid TYPE REF TO cl_gui_alv_grid,

custom_container TYPE REF TO cl_gui_custom_container,

fieldcatalog TYPE lvc_t_fcat.

table to contain fields that require f4...............................

DATA : lt_f4 TYPE lvc_t_f4 WITH HEADER LINE.

ok_code declaration...................................................

DATA : ok_code TYPE sy-ucomm.

Tables declaration....................................................

TABLES : zemployee_c7.

Types declaration.....................................................

TYPES : BEGIN OF ty_emp,

empid LIKE zemployee_c7-empid,

empname LIKE zemployee_c7-empname,

END OF ty_emp.

Internal table declaration............................................

DATA : i_emp TYPE TABLE OF ty_emp.

Workarea declaration..................................................

DATA : wa_emp TYPE ty_emp.

Selection screen parameters...........................................

SELECT-OPTIONS : s_empid FOR zemployee_c7-empid.

----


  • CLASS lcl_event_handler DEFINITION

----


  • ........ *

----


CLASS lcl_event_handler DEFINITION.

PUBLIC SECTION.

METHODS :

handle_on_f1 FOR EVENT onf1 OF cl_gui_alv_grid

IMPORTING e_fieldname es_row_no er_event_data,

handle_on_f4 for event onf4 of cl_gui_alv_grid

importing e_fieldname E_FIELDVALUE es_row_no er_event_data ET_BAD_CELLS E_DISPLAY

.

ENDCLASS.

----


  • CLASS lcl_event_handler IMPLEMENTATION

----


  • ........ *

----


CLASS lcl_event_handler IMPLEMENTATION.

METHOD handle_on_f1.

custom f1 help for empid field.......................................

IF e_fieldname = 'EMPID'.

*CALL SCREEN 3001.

DATA IT_NAME TYPE TABLE OF zemployee_c7.

SELECT * FROM zemployee_c7 INTO TABLE IT_NAME.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'EMPID'

  • PVALKEY = ' '

DYNPPROG = SY-REPID

DYNPNR = SY-DYNNR

DYNPROFIELD = 'I_EMP-EMPID'

  • STEPL = 0

  • WINDOW_TITLE =

  • VALUE = ' '

VALUE_ORG = 'S'

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = 'X'

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

tables

value_tab = IT_NAME[]

  • FIELD_TAB =

  • RETURN_TAB =

  • DYNPFLD_MAPPING =

  • EXCEPTIONS

  • PARAMETER_ERROR = 1

  • NO_VALUES_FOUND = 2

  • OTHERS = 3

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDIF.

to prevent processing of standard f1 help............................

er_event_data->m_event_handled = 'X'.

ENDMETHOD.

Method handle_on_f4.

custom f1 help for empid field.......................................

IF e_fieldname = 'EMPID'.

*CALL SCREEN 3001.

DATA IT_NAME TYPE TABLE OF zemployee_c7.

SELECT * FROM zemployee_c7 INTO TABLE IT_NAME.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = ' '

retfield = 'EMPID'

  • PVALKEY = ' '

DYNPPROG = SY-REPID

DYNPNR = SY-DYNNR

DYNPROFIELD = 'I_EMP-EMPID'

  • STEPL = 0

  • WINDOW_TITLE =

  • VALUE = ' '

VALUE_ORG = 'S'

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = 'X'

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

tables

value_tab = IT_NAME[]

  • FIELD_TAB =

  • RETURN_TAB =

  • DYNPFLD_MAPPING =

  • EXCEPTIONS

  • PARAMETER_ERROR = 1

  • NO_VALUES_FOUND = 2

  • OTHERS = 3

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDIF.

to prevent processing of standard f1 help............................

er_event_data->m_event_handled = 'X'.

endmethod.

ENDCLASS.

start of selection....................................................

START-OF-SELECTION.

SELECT empid empname FROM zemployee_c7

INTO CORRESPONDING FIELDS OF TABLE i_emp

WHERE empid IN s_empid.

CALL SCREEN 3000.

&----


*& Module STATUS_3000 OUTPUT

&----


  • text

----


MODULE status_3000 OUTPUT.

SET PF-STATUS 'ZTOOL'.

SET TITLEBAR 'ZTITLE'.

IF alvgrid IS INITIAL.

CREATE OBJECT custom_container

EXPORTING

container_name = 'ZCONTAINER'.

CREATE OBJECT alvgrid

EXPORTING

i_parent = custom_container.

PERFORM prepare_f4.

.

creating instance for event handler..................................

DATA : event_handler TYPE REF TO lcl_event_handler.

CREATE OBJECT event_handler.

SET HANDLER event_handler->handle_on_f1 FOR alvgrid.

SET HANDLER event_handler->handle_on_f4 FOR alvgrid.

CALL METHOD alvgrid->register_f4_for_fields

EXPORTING

it_f4 = lt_f4[].

preparing field catalog..............................................

PERFORM prepare_fieldcatalog CHANGING fieldcatalog.

CALL METHOD alvgrid->set_table_for_first_display

CHANGING

it_outtab = i_emp

it_fieldcatalog = fieldcatalog

  • others = 4

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDIF.

ENDMODULE. " STATUS_3000 OUTPUT

preparing field catalog...............................................

FORM prepare_fieldcatalog CHANGING i_fieldcatalog TYPE lvc_t_fcat.

DATA : ls_fcat TYPE lvc_s_fcat.

ls_fcat-fieldname = 'EMPID'.

ls_fcat-ref_table = 'ZEMPLOYEE_C7'.

ls_fcat-coltext = 'EMPLOYEE ID'.

LS_FCAT-EDIT = 'X'.

APPEND ls_fcat TO i_fieldcatalog.

CLEAR ls_fcat.

ls_fcat-fieldname = 'EMPNAME'.

ls_fcat-ref_table = 'ZEMPLOYEE_C7'.

ls_fcat-coltext = 'EMPLOYEE NAME'.

APPEND ls_fcat TO i_fieldcatalog.

ENDFORM.

&----


*& Module USER_COMMAND_3000 INPUT

&----


  • text

----


MODULE user_command_3000 INPUT.

CASE ok_code.

WHEN 'BACK'.

LEAVE TO SCREEN 0.

WHEN 'EXIT'.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE. " USER_COMMAND_3000 INPUT

&----


*& Module USER_COMMAND_3001 INPUT

&----


  • text

----


MODULE user_command_3001 INPUT.

CASE ok_code.

WHEN 'SAVE'.

LEAVE TO SCREEN 0.

WHEN 'BACK'.

LEAVE TO SCREEN 0.

ENDCASE.

ENDMODULE. " USER_COMMAND_3001 INPUT

&----


*& Module STATUS_3001 OUTPUT

&----


  • text

----


MODULE status_3001 OUTPUT.

SET PF-STATUS 'GUI'.

SET TITLEBAR 'TITLE'.

ENDMODULE. " STATUS_3001 OUTPUT

preparing fields to be registered for f4 help.........................

FORM prepare_f4.

lt_f4-fieldname = 'EMPID'.

lt_f4-register = 'X'.

lt_f4-getbefore = 'X'.

lt_f4-chngeafter = 'X'.

APPEND lt_f4.

ENDFORM.

Former Member
0 Kudos

hi suzie,

just this 2 things in your fieldcatalog

apply this to all that fields on which u want a search help

fieldcatalog-ref_fieldname = ' '.

fieldcatalog-ref_tabname = ' '.

now here fieldname will be your main database table fieldname

which u r fatching from the main sap database table

& tablename name will be name of that table

after doing this u will find a little button on ur field when u click on that.

0 Kudos

i added ref_fieldname and ref_tabname and the f4 button appeared at the side of the field, but wen i click on it, the program generates a dump. Can someone review the code i wrote(given above) and find out whats the error please..??

Edited by: Suzie on Aug 24, 2008 7:12 AM

uwe_schieferstein
Active Contributor
0 Kudos

Hello Suzie

Perhaps the sample report ZUS_SDN_ALVGRID_EDITABLE_10 may be useful for you.


*&---------------------------------------------------------------------*
*& Report  ZUS_SDN_ALVGRID_EDITABLE_10
*&
*&---------------------------------------------------------------------*
*& Thread: F4 Help in Alv Grid
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1016754"></a>
*&---------------------------------------------------------------------*

REPORT  zus_sdn_alvgrid_editable_10.

TYPES: BEGIN OF ty_s_outtab.
INCLUDE TYPE vbap.
TYPES: bezei       TYPE tvm4t-bezei.
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab    TYPE STANDARD TABLE OF ty_s_outtab
                      WITH DEFAULT KEY.

DATA:
 gt_tvm4t          TYPE STANDARD TABLE OF tvm4t.

DATA:
  gd_okcode        TYPE ui_func,
  gd_repid         TYPE syst-repid,
*
  gt_fcat          TYPE lvc_t_fcat,
  gs_layout        TYPE lvc_s_layo,
  gs_variant       TYPE disvariant,
  go_docking       TYPE REF TO cl_gui_docking_container,
  go_grid          TYPE REF TO cl_gui_alv_grid.


DATA:
  gt_outtab        TYPE ty_t_outtab.


*----------------------------------------------------------------------*
*       CLASS lcl_eventhandler DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_eventhandler DEFINITION.

  PUBLIC SECTION.

    CLASS-METHODS:
      handle_on_f4 FOR EVENT onf4 OF cl_gui_alv_grid
        IMPORTING
          e_fieldname
          e_fieldvalue
          es_row_no
          er_event_data
          et_bad_cells e_display.

ENDCLASS.                    "lcl_eventhandler DEFINITION

*----------------------------------------------------------------------*
*       CLASS lcl_eventhandler IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_eventhandler IMPLEMENTATION.

  METHOD handle_on_f4.

    BREAK-POINT.

"   NOTE: Triggers PAI after standard F4 help has finished
    CALL METHOD cl_gui_cfw=>set_new_ok_code
      EXPORTING
        new_code = 'REFRESH'
*      IMPORTING
*        rc       =
        .

  ENDMETHOD.                    "handle_on_f4

ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION


INITIALIZATION.
  SELECT * FROM  tvm4t INTO TABLE gt_tvm4t
         WHERE  spras  = syst-langu.

  SORT gt_tvm4t BY spras mvgr4. " for BINARY SEARCH



START-OF-SELECTION.

  SELECT * FROM vbap INTO TABLE gt_outtab UP TO 500 ROWS.

  PERFORM init_controls.

* Build fieldcatalog
  PERFORM build_fieldcatalog.
  PERFORM set_layout_and_variant.

  PERFORM register_f4.



  SET HANDLER:
    lcl_eventhandler=>handle_on_f4 FOR go_grid.



* Display data
  CALL METHOD go_grid->set_table_for_first_display
    EXPORTING
      i_save          = 'A'
      is_variant      = gs_variant
      is_layout       = gs_layout
    CHANGING
      it_outtab       = gt_outtab
      it_fieldcatalog = gt_fcat
    EXCEPTIONS
      OTHERS          = 4.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.




* Link the docking container to the target dynpro
  gd_repid = syst-repid.
  CALL METHOD go_docking->link
    EXPORTING
      repid                       = gd_repid
      dynnr                       = '0100'
*      CONTAINER                   =
    EXCEPTIONS
      OTHERS                      = 4.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


* ok-code field = GD_OKCODE
  CALL SCREEN '0100'.


END-OF-SELECTION.

*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'STATUS_0100'.
*  SET TITLEBAR 'xxx'.


ENDMODULE.                 " STATUS_0100  OUTPUT

*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.

*     Transport of changes from ALV grid -> itab
  go_grid->check_changed_data( ).

  CASE gd_okcode.
    WHEN 'BACK' OR
         'EXIt'  OR
         'CANC'.
      SET SCREEN 0. LEAVE SCREEN.


    WHEN 'REFRESH'.
      PERFORM add_description.
      CALL METHOD go_grid->refresh_table_display
*        EXPORTING
*          is_stable      =
*          i_soft_refresh =
*        EXCEPTIONS
*          finished       = 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.


    WHEN OTHERS.
  ENDCASE.

  CLEAR: gd_okcode.

ENDMODULE.                 " USER_COMMAND_0100  INPUT


*&---------------------------------------------------------------------*
*&      Form  BUILD_FIELDCATALOG_KNB1
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM build_fieldcatalog .
* define local data
  DATA:
    ld_idx         TYPE i,
    ls_fcat        TYPE lvc_s_fcat,
    lt_fcat        TYPE lvc_t_fcat.

  REFRESH: gt_fcat.
  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
*     I_BUFFER_ACTIVE              =
      i_structure_name             = 'VBAP'
*     I_CLIENT_NEVER_DISPLAY       = 'X'
      i_bypassing_buffer           = 'X'
*     I_INTERNAL_TABNAME           =
    CHANGING
      ct_fieldcat                  = gt_fcat
    EXCEPTIONS
      inconsistent_interface       = 1
      program_error                = 2
      OTHERS                       = 3.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


  LOOP AT gt_fcat INTO ls_fcat.
    IF ( ls_fcat-key = abap_true ).

    ELSEIF ( ls_fcat-fieldname CS 'MVGR' ).

      IF ( ls_fcat-fieldname = 'MVGR4' ).
        ls_fcat-edit    = abap_true.
        ls_fcat-col_opt = abap_true.
        MODIFY gt_fcat FROM ls_fcat.
      ENDIF.

    ELSE.
      DELETE gt_fcat INDEX syst-tabix.
    ENDIF.

  ENDLOOP.

  REFRESH: lt_fcat.
  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
*     I_BUFFER_ACTIVE              =
      i_structure_name             = 'TVM4T'
*     I_CLIENT_NEVER_DISPLAY       = 'X'
      i_bypassing_buffer           = 'X'
*     I_INTERNAL_TABNAME           =
    CHANGING
      ct_fieldcat                  = lt_fcat
    EXCEPTIONS
      inconsistent_interface       = 1
      program_error                = 2
      OTHERS                       = 3.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  DELETE lt_fcat WHERE ( fieldname NE 'BEZEI' ).

  READ TABLE gt_fcat TRANSPORTING NO FIELDS
       WITH KEY fieldname = 'MVGR4'.
  IF ( syst-subrc = 0 ).
    ld_idx = syst-tabix + 1.

    READ TABLE lt_fcat INTO ls_fcat INDEX 1.
    INSERT ls_fcat INTO gt_fcat INDEX ld_idx.
  ENDIF.


  LOOP AT gt_fcat INTO ls_fcat.
    ls_fcat-col_pos = syst-tabix.

    MODIFY gt_fcat FROM ls_fcat.
  ENDLOOP.


ENDFORM.                    " BUILD_FIELDCATALOG_KNB1


*&---------------------------------------------------------------------*
*&      Form  INIT_CONTROLS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM init_controls .

* Create docking container
  CREATE OBJECT go_docking
    EXPORTING
      parent = cl_gui_container=>screen0
      ratio  = 90
    EXCEPTIONS
      OTHERS = 6.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


* Create ALV grid
  CREATE OBJECT go_grid
    EXPORTING
      i_parent = go_docking
    EXCEPTIONS
      OTHERS   = 5.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

ENDFORM.                    " INIT_CONTROLS
*&---------------------------------------------------------------------*
*&      Form  SET_LAYOUT_AND_VARIANT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM set_layout_and_variant .

  CLEAR: gs_layout,
         gs_variant.

  gs_layout-zebra = abap_true.
  gs_layout-cwidth_opt = abap_true.

  gs_variant-report = syst-repid.
  gs_variant-handle = 'GRID'.

ENDFORM.                    " SET_LAYOUT_AND_VARIANT


*&---------------------------------------------------------------------*
*&      Form  REGISTER_F4
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM register_f4 .
* define local data
  DATA: ls_f4   TYPE lvc_s_f4,
        lt_f4   TYPE lvc_t_f4.


  ls_f4-fieldname = 'MVGR4'.
  ls_f4-register = 'X'.
  ls_f4-getbefore = 'X'.
  ls_f4-chngeafter = 'X'.
  APPEND ls_f4 TO lt_f4.

  CALL METHOD go_grid->register_f4_for_fields
    EXPORTING
      it_f4 = lt_f4.

ENDFORM.                    " REGISTER_F4
*&---------------------------------------------------------------------*
*&      Form  ADD_DESCRIPTION
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM add_description .
* define local data
  DATA: ld_idx        TYPE i,
        ls_outtab     TYPE ty_s_outtab,
        ls_tvm4t      TYPE tvm4t.

  ls_outtab-bezei = space.
  MODIFY gt_outtab FROM ls_outtab
    TRANSPORTING bezei
    WHERE ( mvgr4 IS INITIAL ).

  LOOP AT gt_outtab INTO ls_outtab
                    WHERE ( mvgr4 IS NOT INITIAL ).

    READ TABLE gt_tvm4t INTO ls_tvm4t
         WITH KEY spras = syst-langu
                  mvgr4 = ls_outtab-mvgr4.
    IF ( syst-subrc = 0 ).
      ls_outtab-bezei = ls_tvm4t-bezei.

      MODIFY gt_outtab FROM ls_outtab
        TRANSPORTING bezei
        WHERE ( mvgr4 = ls_outtab-mvgr4 ).
    ENDIF.
  ENDLOOP.

ENDFORM.                    " ADD_DESCRIPTION

Regards

Uwe

lijisusan_mathews
Active Contributor
0 Kudos

hi ..

thanx all.. i got it corrected.. The code was correct but was showing all the errors because i had given stylename = 'CELLSTYLES' . i don know y that caused a dump , but when that line was commented, i got the standard f4 help. CAn someone explain to me wat was wrong in giving stylename??

0 Kudos

>

> hi ..

> thanx all.. i got it corrected.. The code was correct but was showing all the errors because i had given stylename = 'CELLSTYLES' . i don know y that caused a dump , but when that line was commented, i got the standard f4 help. CAn someone explain to me wat was wrong in giving stylename??

STYLES are meant for specific purpose, if yoi see the class you can get the different styles like edit, f4, hotspot etc..

Why it is dumping..?

if you have mention the style name and you don't have any style field with that name in your internal table then it gives the dump,

data: begin of it_data,




          cellstyles type LVC_T_STYL, "<=====if it is not there in your internal table definition it dump
        end of it_data.

0 Kudos

Hello Suzie

When you fill GS_LAYOUT-STYLEFNAME with a value (e.g. 'CELLSTYLES' or any other name) then the grid instance is seaching for a corresponding field in you OUTTAB itab. Since you can choose any name the grid instance will try to fetch this field using an ASSIGN statement, e.g.:


FIELD-SYMBOLS: <lt_styles>   TYPE lvc_t_styl.

ASSIGN COMPONENT layout-stylefname OF STRUCTRE <outtab> TO <lt_styles>.

If you do not have the corresponding field in your outtab th ASSIGN just results in sy-subrc NE 0 but as soon as the grid instance tries to work with the cellstyles you get the dump because the the field-symbol is not assigned.

Regards

Uwe

0 Kudos

thanz a lot...