hello all,
we have developed a Z-Report like this,
when i click the hotspot field on first container the corresponding data is displayed on second container,
however if no data exists for that particular record,
i tried to display message (MESSAGE 'No data Exists' type 'I')...
but the problem is when i select another record(which has data) it is throwing error,
********this is my code*************************
FORM ALV_DISPLAY_ON_SAME_SCREEN . if custom2 IS INITIAL . CREATE OBJECT CUSTOM2 EXPORTING * PARENT = CONTAINER_NAME = 'CONTAINER2' * STYLE = * LIFETIME = lifetime_default * REPID = * DYNNR = * NO_AUTODEF_PROGID_DYNNR = * 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. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. CREATE OBJECT GRID2 EXPORTING * I_SHELLSTYLE = 0 * I_LIFETIME = I_PARENT = custom2 * I_APPL_EVENTS = space * I_PARENTDBG = * I_APPLOGPARENT = * I_GRAPHICSPARENT = * I_NAME = * I_FCAT_COMPLETE = SPACE * EXCEPTIONS * ERROR_CNTL_CREATE = 1 * ERROR_CNTL_INIT = 2 * ERROR_CNTL_LINK = 3 * ERROR_DP_CREATE = 4 * 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. *fieldcat for second custom container ************************* REFRESH it_fcat2. clear wa_fcat2. clear wa_fcat2. wa_fcat2-col_pos = 1. wa_fcat2-fieldname = 'PSPNR'. wa_fcat2-tabname = 'IT_SEC_PROJ'. wa_fcat2-outputlen = 20. wa_fcat2-coltext = 'Proj Def'. wa_fcat2-style = ALV_STYLE_FONT_BOLD. * wa_fcat2-just = 'C'. * wa_fcat2-emphasize = 'C501'. APPEND wa_fcat2 to it_fcat2. clear wa_fcat2. clear wa_fcat2. wa_fcat2-col_pos = 2. wa_fcat2-fieldname = 'POST1'. wa_fcat2-tabname = 'IT_SEC_PROJ'. wa_fcat2-outputlen = 30. wa_fcat2-coltext = 'Description'. wa_fcat2-style = ALV_STYLE_FONT_BOLD. * wa_fcat2-just = 'C'. * wa_fcat2-emphasize = 'C501'. APPEND wa_fcat2 to it_fcat2. clear wa_fcat2. clear wa_fcat2. wa_fcat2-col_pos = 3. wa_fcat2-fieldname = 'WTJHR'. wa_fcat2-tabname = 'IT_SEC_PROJ'. wa_fcat2-outputlen = 20. wa_fcat2-coltext = 'Budget Division Level'. wa_fcat2-style = ALV_STYLE_FONT_BOLD. wa_fcat2-do_sum = 'X'. * wa_fcat2-just = 'C'. * wa_fcat2-emphasize = 'C501'. APPEND wa_fcat2 to it_fcat2. clear wa_fcat2. clear wa_fcat2. wa_fcat2-col_pos = 4. wa_fcat2-fieldname = 'WTJHR1'. wa_fcat2-tabname = 'IT_SEC_PROJ'. wa_fcat2-outputlen = 20. wa_fcat2-coltext = 'Budget Issued to WOs'. wa_fcat2-style = ALV_STYLE_FONT_BOLD. * wa_fcat2-just = 'C'. wa_fcat2-emphasize = 'C501'. wa_fcat2-do_sum = 'X'. wa_fcat2-hotspot = 'X'. APPEND wa_fcat2 to it_fcat2. clear wa_fcat2. clear wa_fcat2. wa_fcat2-col_pos = 5. wa_fcat2-fieldname = 'BAL'. wa_fcat2-tabname = 'IT_SEC_PROJ'. wa_fcat2-outputlen = 20. wa_fcat2-coltext = 'Balance'. wa_fcat2-style = ALV_STYLE_FONT_BOLD. wa_fcat2-do_sum = 'X'. * wa_fcat2-just = 'C'. * wa_fcat2-emphasize = 'C601'. * wa_fcat2-hotspot = 'X'. APPEND wa_fcat2 to it_fcat2. clear wa_fcat2. *********string****************************** string1 = 'Wise Budget Details'. CONCATENATE lv_ptext string1 into string2 SEPARATED BY space. *layout details ***************************** wa_layout2-cwidth_opt = 'X'. wa_layout2-zebra = 'X'. wa_layout2-GRID_TITLE = string2. *variant details ****************************** wa_variant2-report = sy-repid. wa_variant2-username = sy-uname. *if it_sec_proj[] is NOT INITIAL. CALL METHOD GRID2->SET_TABLE_FOR_FIRST_DISPLAY EXPORTING * I_BUFFER_ACTIVE = * I_BYPASSING_BUFFER = * I_CONSISTENCY_CHECK = * I_STRUCTURE_NAME = IS_VARIANT = wa_variant2 I_SAVE = 'A' * I_DEFAULT = 'X' IS_LAYOUT = wa_layout2 * IS_PRINT = * IT_SPECIAL_GROUPS = * IT_TOOLBAR_EXCLUDING = * IT_HYPERLINK = * IT_ALV_GRAPHICS = * IT_EXCEPT_QINFO = * IR_SALV_ADAPTER = CHANGING IT_OUTTAB = it_sec_proj IT_FIELDCATALOG = it_fcat2 * IT_SORT = * IT_FILTER = EXCEPTIONS INVALID_PARAMETER_COMBINATION = 1 PROGRAM_ERROR = 2 TOO_MANY_LINES = 3 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. else. call METHOD grid2->refresh_table_display. endif. "endif of custom2 is initial CREATE OBJECT obj_event_class2. set HANDLER obj_event_class2->handle_hotspot_click FOR grid2. ENDFORM. " ALV_DISPLAY_ON_SAME_SCREEN
***************************************************
how do i avoid this...
thanks in advance.....