Skip to Content
-1
Oct 24, 2019 at 11:09 AM

HIDING A COLUMN IN ALV GRID WHOSE PROFIT CENTER DON'T HAVE DATA.

63 Views

hai guys,please corrent my code.
if profit center dont have data, i dont want display in alv.
so i just want to show in alv, only those whose profit center has data.

" Profit Center
 SELECT prctr FROM zpi_map_plant INTO CORRESPONDING FIELDS OF TABLE it_map_plant WHERE werks = wa_master-werks.
 IF sy-subrc = 0.
 SELECT SINGLE prctr FROM zpi_map_plant INTO wa_item_master-prctr WHERE werks = wa_stock-werks.
 ELSE.
 SELECT SINGLE prctr_klinik FROM zpi_map_plant INTO wa_item_master-prctr WHERE werks_klinik = wa_stock-werks.
 SELECT SINGLE prctr_klinik FROM zpi_map_plant INTO wa_item_master-prctr_klinik WHERE werks_klinik = wa_stock-werks.
 ENDIF.

FORM show_alv.
 lo_layout-zebra = 'X'.
 lo_layout-colwidth_optimize = 'X'.
 lo_layout-info_fieldname = 'COLOR'.
 ls_variant-report = sy-repid.
 CLEAR wa_event.
 MOVE 'TOP_OF_PAGE' TO wa_event-name.
 MOVE 'TOP_OF_PAGE' TO wa_event-form.
 APPEND wa_event TO events.
 grids-coll_top_p = 'X'.
 PERFORM fill_structure.
 IF opty EQ 'X'.
 CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
 EXPORTING
 i_callback_program = sy-repid
 it_fieldcat = it_fieldcat
 i_default = 'X'
 i_save = 'A'
 TABLES
 t_outtab = it_item_stock_assigned[].
 ELSEIF optn EQ 'X'.
 CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
 EXPORTING
 i_callback_program = sy-repid
 it_fieldcat = it_fieldcat
 i_default = 'X'
 i_save = 'A'
 " i_background_id = d_alv_bg_id
 TABLES
 t_outtab = it_item_stock_not_assigned[].
 ENDIF.
ENDFORM.
FORM set_pop_custom USING rt_extab TYPE slis_t_extab.
 REFRESH rt_extab.
 SET PF-STATUS '4000'.
ENDFORM.
FORM user_command_change USING p_comm TYPE sy-ucomm
 wa_selfield TYPE slis_selfield.
 CASE p_comm.
 WHEN 'BACK'.
 LEAVE TO SCREEN 0.
 WHEN 'CLOSE'.
 LEAVE TO SCREEN 0.
 WHEN 'EXIT'.
 LEAVE TO SCREEN 0.
 WHEN '&XLS'.
 " PERFORM save_excel_0030.
 ENDCASE.
ENDFORM.