Application Development and Automation 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: 
Read only

regarding alv

Former Member
0 Likes
350

Hi all,

I am working on ALV program my program is getting activated but its going to dump.

i m getting dump error as

" Field symbol has not yet been assigned."

so frnds can anyone tell me whts the problem.


REPORT  ZTEST_ALV_satya_EDIT_1.

TABLES : zdata_12.

TYPE-POOLS : slis.

DATA : i_fieldcat TYPE slis_t_fieldcat_alv,
       wa_fieldact TYPE slis_fieldcat_alv.

*display images on basic grid

DATA : i_comment TYPE slis_t_listheader,
       wa_comment TYPE slis_listheader.

*events
DATA : i_events TYPE slis_t_event,
       wa_event LIKE LINE OF i_events.

*layout
DATA : wa_layout TYPE slis_layout_alv.

*Internal table declaration

data : BEGIN OF st_final.
*        mandt TYPE mandt,
*        emp(8),
*        subject(20),
*        date1(12),
       include structure zdata_12.
data : END OF st_final.

*internal table declaration
DATA : it_final like STANDARD TABLE OF st_final,
       wa_final LIKE LINE OF it_final.

DATA :   V_DATA(50).    "To Store Data

*selection-screen

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_emp FOR zdata_12.
SELECTION-SCREEN END OF BLOCK b1.

INITIALIZATION.
  MOVE 'Developed by'(001) TO V_DATA.




*start of selection.

PERFORM get_data.
PERFORM get_fldcat.
PERFORM get_layout.
PERFORM get_events.
PERFORM DISPLAY_DATA.
END-OF-SELECTION.


*&---------------------------------------------------------------------*
*&      Form  DISPLAY_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form DISPLAY_DATA .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
 EXPORTING
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                = ' '
*   I_BUFFER_ACTIVE                   = ' '
   I_CALLBACK_PROGRAM                = 'ZTEST_ALV_RAJ_EDIT_1'
*   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                  = 'zdata_12'
*   I_BACKGROUND_ID                   = ' '
*   I_GRID_TITLE                      = I_GRID_TITLE
*   I_GRID_SETTINGS                   = I_GRID_SETTINGS
   IS_LAYOUT                         = wa_layout
   IT_FIELDCAT                       = i_fieldcat
*   IT_EXCLUDING                      = IT_EXCLUDING
*   IT_SPECIAL_GROUPS                 = IT_SPECIAL_GROUPS
*   IT_SORT                           = IT_SORT
*   IT_FILTER                         = IT_FILTER
*   IS_SEL_HIDE                       = IS_SEL_HIDE
*   I_DEFAULT                         = 'X'
*   I_SAVE                            = ' '
*   IS_VARIANT                        = IS_VARIANT
*   IT_EVENTS                         = i_events
*   IT_EVENT_EXIT                     = IT_EVENT_EXIT
*   IS_PRINT                          = IS_PRINT
*   IS_REPREP_ID                      = 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_ALV_GRAPHICS
*   IT_HYPERLINK                      = IT_HYPERLINK
*   IT_ADD_FIELDCAT                   = IT_ADD_FIELDCAT
*   IT_EXCEPT_QINFO                   = IT_EXCEPT_QINFO
*   IR_SALV_FULLSCREEN_ADAPTER        = IR_SALV_FULLSCREEN_ADAPTER
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER           = E_EXIT_CAUSED_BY_CALLER
*   ES_EXIT_CAUSED_BY_USER            = ES_EXIT_CAUSED_BY_USER
  TABLES
    t_outtab                          = it_final
 EXCEPTIONS
   PROGRAM_ERROR                     = 1
   OTHERS                            = 2
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


endform.                    " DISPLAY_DATA


*&---------------------------------------------------------------------*
*&      Form  get_data
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_data .

SELECT mandt emp subject date1 FROM zdata_12 INTO TABLE it_final WHERE emp IN s_emp.

ENDFORM.                    " get_data
*&---------------------------------------------------------------------*
*&      Form  get_fldcat
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_fldcat .
wa_fieldact-fieldname = 'mandt'.
wa_fieldact-col_pos = '1'.
wa_fieldact-just = 'C'.
wa_fieldact-outputlen = '3'.
wa_fieldact-seltext_m  = 'client'.
wa_fieldact-ddictxt = 'M'.
wa_fieldact-ref_tabname = ' '.
wa_fieldact-hotspot = 'X'.
APPEND wa_fieldact TO i_fieldcat.
  CLEAR wa_fieldact .

wa_fieldact-fieldname = 'emp'.
wa_fieldact-col_pos = '2'.
wa_fieldact-just = 'C'.
wa_fieldact-outputlen = '8'.
wa_fieldact-seltext_m  = 'employee number'.
wa_fieldact-ddictxt = 'M'.
wa_fieldact-ref_tabname = ' '.
wa_fieldact-hotspot = 'X'.
APPEND wa_fieldact TO i_fieldcat.
  CLEAR wa_fieldact .

wa_fieldact-fieldname = 'subject'.
wa_fieldact-col_pos = '3'.
wa_fieldact-just = 'C'.
wa_fieldact-outputlen = '20'.
wa_fieldact-seltext_m  = 'subject'.
wa_fieldact-ddictxt = 'M'.
wa_fieldact-ref_tabname = ' '.
wa_fieldact-hotspot = 'X'.
APPEND wa_fieldact TO i_fieldcat.
  CLEAR wa_fieldact .

wa_fieldact-fieldname = 'date1'.
wa_fieldact-col_pos = '4'.
wa_fieldact-just = 'C'.
wa_fieldact-outputlen = '12'.
wa_fieldact-seltext_m  = 'date'.
wa_fieldact-ddictxt = 'M'.
wa_fieldact-ref_tabname = ' '.
wa_fieldact-hotspot = 'X'.
APPEND wa_fieldact TO i_fieldcat.
  CLEAR wa_fieldact .



ENDFORM.                    " get_fldcat
*&---------------------------------------------------------------------*
*&      Form  get_layout
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_layout .

  wa_layout-colwidth_optimize = 'X'.           "OPTIMIZING FIELD WIDTH
  wa_layout-zebra = 'X'.                       "PUTTING ZEBRA COLORS
  wa_layout-info_fieldname = 'COLOR'(034).     "APPLYING COLORS TO ROWS

ENDFORM.                    " get_layout
*&---------------------------------------------------------------------*
*&      Form  get_events
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_events .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
 EXPORTING
   i_list_type           = 0
 IMPORTING
   et_events             = i_events
 EXCEPTIONS
   list_type_wrong       = 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.

 IF NOT i_events[] IS INITIAL.
    READ TABLE i_events INTO wa_event WITH KEY name = 'TOP_OF_PAGE'.
    wa_event-form = 'GENERATE_USERCOMMAND_HEADER'.
    MODIFY i_events FROM wa_event INDEX sy-tabix.


    READ TABLE i_events INTO wa_event WITH KEY name = 'TOP_OF_PAGE'.
    wa_event-form = 'FRM_TOP_OF_PAGE'.
    MODIFY i_events FROM wa_event INDEX sy-tabix.

    READ TABLE i_events INTO wa_event WITH KEY name = 'END_OF_LIST'.
    wa_event-form = 'GENERATE_USERCOMMAND_FOOTER'.
    MODIFY i_events FROM wa_event INDEX sy-tabix.

    READ TABLE i_events INTO wa_event WITH KEY name = 'USER_COMMAND'.
    wa_event-form = 'GENERATE_USERCOMMAND3'.
    MODIFY i_events FROM wa_event INDEX sy-tabix.
  ENDIF.


ENDFORM.                    " get_events
FORM generate_usercommand_header.
CLEAR i_comment[].
  wa_comment-typ = 'H'.
  wa_comment-info = 'General Employee Info'.
  APPEND wa_comment TO i_comment.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
  EXPORTING
    it_list_commentary       = i_comment
   i_logo                   = 'ENJOYSAP_LOGO'.
         .

ENDFORM.                    " GENERATE_USERCOMMAND

FORM frm_top_of_page.

  WRITE :/ text-005 INTENSIFIED ON.
  WRITE :/ text-006 , sy-sysid,14 sy-mandt.
  WRITE :/ text-007 , sy-uname.
  WRITE :/ text-008 , sy-datum.
  WRITE :/ text-009 , sy-uzeit.
  SKIP.
ENDFORM.

FORM generate_usercommand_footer .
  CLEAR i_comment[].
  wa_comment-typ = 'S'.
  wa_comment-key = v_data.
  wa_comment-info = 'satya'(033).
  APPEND wa_comment TO i_comment.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
  EXPORTING
    it_list_commentary       = I_COMMENT
*   I_LOGO                   = I_LOGO
   I_END_OF_LIST_GRID       = 'X'.

ENDFORM.                    " GENERATE_USERCOMMAND_FOOTER

Code Formatted by: Alvaro Tejada Galindo on Feb 26, 2008 10:42 AM

Hi all,

I am working on ALV program my program is getting activated but its going to dump.

i m getting dump error as

" Field symbol has not yet been assigned."

so frnds can anyone tell me whts the problem.


REPORT  ZTEST_ALV_satya_EDIT_1.

TABLES : zdata_12.

TYPE-POOLS : slis.

DATA : i_fieldcat TYPE slis_t_fieldcat_alv,
       wa_fieldact TYPE slis_fieldcat_alv.

*display images on basic grid

DATA : i_comment TYPE slis_t_listheader,
       wa_comment TYPE slis_listheader.

*events
DATA : i_events TYPE slis_t_event,
       wa_event LIKE LINE OF i_events.

*layout
DATA : wa_layout TYPE slis_layout_alv.

*Internal table declaration

data : BEGIN OF st_final.
*        mandt TYPE mandt,
*        emp(8),
*        subject(20),
*        date1(12),
       include structure zdata_12.
data : END OF st_final.

*internal table declaration
DATA : it_final like STANDARD TABLE OF st_final,
       wa_final LIKE LINE OF it_final.

DATA :   V_DATA(50).    "To Store Data

*selection-screen

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_emp FOR zdata_12.
SELECTION-SCREEN END OF BLOCK b1.

INITIALIZATION.
  MOVE 'Developed by'(001) TO V_DATA.




*start of selection.

PERFORM get_data.
PERFORM get_fldcat.
PERFORM get_layout.
PERFORM get_events.
PERFORM DISPLAY_DATA.
END-OF-SELECTION.


*&---------------------------------------------------------------------*
*&      Form  DISPLAY_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form DISPLAY_DATA .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
 EXPORTING
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                = ' '
*   I_BUFFER_ACTIVE                   = ' '
   I_CALLBACK_PROGRAM                = 'ZTEST_ALV_RAJ_EDIT_1'
*   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                  = 'zdata_12'
*   I_BACKGROUND_ID                   = ' '
*   I_GRID_TITLE                      = I_GRID_TITLE
*   I_GRID_SETTINGS                   = I_GRID_SETTINGS
   IS_LAYOUT                         = wa_layout
   IT_FIELDCAT                       = i_fieldcat
*   IT_EXCLUDING                      = IT_EXCLUDING
*   IT_SPECIAL_GROUPS                 = IT_SPECIAL_GROUPS
*   IT_SORT                           = IT_SORT
*   IT_FILTER                         = IT_FILTER
*   IS_SEL_HIDE                       = IS_SEL_HIDE
*   I_DEFAULT                         = 'X'
*   I_SAVE                            = ' '
*   IS_VARIANT                        = IS_VARIANT
*   IT_EVENTS                         = i_events
*   IT_EVENT_EXIT                     = IT_EVENT_EXIT
*   IS_PRINT                          = IS_PRINT
*   IS_REPREP_ID                      = 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_ALV_GRAPHICS
*   IT_HYPERLINK                      = IT_HYPERLINK
*   IT_ADD_FIELDCAT                   = IT_ADD_FIELDCAT
*   IT_EXCEPT_QINFO                   = IT_EXCEPT_QINFO
*   IR_SALV_FULLSCREEN_ADAPTER        = IR_SALV_FULLSCREEN_ADAPTER
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER           = E_EXIT_CAUSED_BY_CALLER
*   ES_EXIT_CAUSED_BY_USER            = ES_EXIT_CAUSED_BY_USER
  TABLES
    t_outtab                          = it_final
 EXCEPTIONS
   PROGRAM_ERROR                     = 1
   OTHERS                            = 2
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


endform.                    " DISPLAY_DATA


*&---------------------------------------------------------------------*
*&      Form  get_data
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_data .

SELECT mandt emp subject date1 FROM zdata_12 INTO TABLE it_final WHERE emp IN s_emp.

ENDFORM.                    " get_data
*&---------------------------------------------------------------------*
*&      Form  get_fldcat
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_fldcat .
wa_fieldact-fieldname = 'mandt'.
wa_fieldact-col_pos = '1'.
wa_fieldact-just = 'C'.
wa_fieldact-outputlen = '3'.
wa_fieldact-seltext_m  = 'client'.
wa_fieldact-ddictxt = 'M'.
wa_fieldact-ref_tabname = ' '.
wa_fieldact-hotspot = 'X'.
APPEND wa_fieldact TO i_fieldcat.
  CLEAR wa_fieldact .

wa_fieldact-fieldname = 'emp'.
wa_fieldact-col_pos = '2'.
wa_fieldact-just = 'C'.
wa_fieldact-outputlen = '8'.
wa_fieldact-seltext_m  = 'employee number'.
wa_fieldact-ddictxt = 'M'.
wa_fieldact-ref_tabname = ' '.
wa_fieldact-hotspot = 'X'.
APPEND wa_fieldact TO i_fieldcat.
  CLEAR wa_fieldact .

wa_fieldact-fieldname = 'subject'.
wa_fieldact-col_pos = '3'.
wa_fieldact-just = 'C'.
wa_fieldact-outputlen = '20'.
wa_fieldact-seltext_m  = 'subject'.
wa_fieldact-ddictxt = 'M'.
wa_fieldact-ref_tabname = ' '.
wa_fieldact-hotspot = 'X'.
APPEND wa_fieldact TO i_fieldcat.
  CLEAR wa_fieldact .

wa_fieldact-fieldname = 'date1'.
wa_fieldact-col_pos = '4'.
wa_fieldact-just = 'C'.
wa_fieldact-outputlen = '12'.
wa_fieldact-seltext_m  = 'date'.
wa_fieldact-ddictxt = 'M'.
wa_fieldact-ref_tabname = ' '.
wa_fieldact-hotspot = 'X'.
APPEND wa_fieldact TO i_fieldcat.
  CLEAR wa_fieldact .



ENDFORM.                    " get_fldcat
*&---------------------------------------------------------------------*
*&      Form  get_layout
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_layout .

  wa_layout-colwidth_optimize = 'X'.           "OPTIMIZING FIELD WIDTH
  wa_layout-zebra = 'X'.                       "PUTTING ZEBRA COLORS
  wa_layout-info_fieldname = 'COLOR'(034).     "APPLYING COLORS TO ROWS

ENDFORM.                    " get_layout
*&---------------------------------------------------------------------*
*&      Form  get_events
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_events .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
 EXPORTING
   i_list_type           = 0
 IMPORTING
   et_events             = i_events
 EXCEPTIONS
   list_type_wrong       = 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.

 IF NOT i_events[] IS INITIAL.
    READ TABLE i_events INTO wa_event WITH KEY name = 'TOP_OF_PAGE'.
    wa_event-form = 'GENERATE_USERCOMMAND_HEADER'.
    MODIFY i_events FROM wa_event INDEX sy-tabix.


    READ TABLE i_events INTO wa_event WITH KEY name = 'TOP_OF_PAGE'.
    wa_event-form = 'FRM_TOP_OF_PAGE'.
    MODIFY i_events FROM wa_event INDEX sy-tabix.

    READ TABLE i_events INTO wa_event WITH KEY name = 'END_OF_LIST'.
    wa_event-form = 'GENERATE_USERCOMMAND_FOOTER'.
    MODIFY i_events FROM wa_event INDEX sy-tabix.

    READ TABLE i_events INTO wa_event WITH KEY name = 'USER_COMMAND'.
    wa_event-form = 'GENERATE_USERCOMMAND3'.
    MODIFY i_events FROM wa_event INDEX sy-tabix.
  ENDIF.


ENDFORM.                    " get_events
FORM generate_usercommand_header.
CLEAR i_comment[].
  wa_comment-typ = 'H'.
  wa_comment-info = 'General Employee Info'.
  APPEND wa_comment TO i_comment.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
  EXPORTING
    it_list_commentary       = i_comment
   i_logo                   = 'ENJOYSAP_LOGO'.
         .

ENDFORM.                    " GENERATE_USERCOMMAND

FORM frm_top_of_page.

  WRITE :/ text-005 INTENSIFIED ON.
  WRITE :/ text-006 , sy-sysid,14 sy-mandt.
  WRITE :/ text-007 , sy-uname.
  WRITE :/ text-008 , sy-datum.
  WRITE :/ text-009 , sy-uzeit.
  SKIP.
ENDFORM.

FORM generate_usercommand_footer .
  CLEAR i_comment[].
  wa_comment-typ = 'S'.
  wa_comment-key = v_data.
  wa_comment-info = 'satya'(033).
  APPEND wa_comment TO i_comment.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
  EXPORTING
    it_list_commentary       = I_COMMENT
*   I_LOGO                   = I_LOGO
   I_END_OF_LIST_GRID       = 'X'.

ENDFORM.                    " GENERATE_USERCOMMAND_FOOTER

Code Formatted by: Alvaro Tejada Galindo on Feb 26, 2008 10:42 AM

2 REPLIES 2
Read only

Former Member
0 Likes
322

Hello Satya,

I remember that field names that we are passing to alv functin module should be in CAPITAL letters not in small letters. Also pass the I_STRUCTURE_NAME = 'zdata_12'

as I_STRUCTURE_NAME = 'ZDATA_12'

Ex: wa_fieldact-fieldname = 'mandt'. as wa_fieldact-fieldname = 'MANDT'.

Please try this and let me know if you are still facing the same problem.

Regards,

Kiran I

Edited by: kiran i on Feb 26, 2008 9:17 PM

Read only

Former Member
0 Likes
322

HI,

Please chnage the code as below:


FORM get_fldcat .
wa_fieldact-fieldname = 'MANDT'. "Changed from mandt to MANDT to capital letter
wa_fieldact-col_pos = '1'.
wa_fieldact-just = 'C'.
wa_fieldact-outputlen = '3'.
wa_fieldact-seltext_m  = 'client'.
wa_fieldact-ddictxt = 'M'.
wa_fieldact-ref_tabname = ' '.
wa_fieldact-hotspot = 'X'.
APPEND wa_fieldact TO i_fieldcat.
  CLEAR wa_fieldact .

Thanks,

Sriram Ponna.