Wednesday, February 4, 2009

how to write icon to ABAP list

I need to add a button inside the existing ALV report. When the user press that button I need to display a report containing descriptions of the icon/symbols used in the ALV report.

First, add the button inside the status used when calling the ALV functions.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'F_SET_STATUS'
i_callback_user_command = 'F_USER_COMMAND'
is_layout = gs_gnr_clayt
it_fieldcat = gi_gnr_ccatl[]

i_default = 'X'
i_save = 'X'
is_variant = gs_gnr_cvrnt
it_events = gi_gnr_event[]
i_tabname_header = 'GI_URFDT'
i_tabname_item = 'GI_BATCH'
is_keyinfo = gs_gnr_kinfo
TABLES
t_outtab_header = gi_urfdt[]

t_outtab_item = gi_batch[]
EXCEPTIONS
program_error = 1
OTHERS = 2.

-------------------------------------------------------------------------
*&---------------------------------------------------------------------*
*& Form f_set_status
*&---------------------------------------------------------------------*
FORM f_set_status USING fu_extab TYPE slis_t_extab.
IF p_atach IS NOT INITIAL.
APPEND 'FRCE' TO fu_extab.
ELSE.

APPEND 'SAVE' TO fu_extab.
ENDIF.
SET PF-STATUS 'STANDARD' EXCLUDING fu_extab.
ENDFORM. "f_set_status

-------------------------------------------------------------------------
add the desired button to status STANDARD

Second, add a logic so when the user press the button, we will call screen 9100 for example. In the screen 9100 we will display the symbol and its description.
CASE fu_ucomm.

WHEN 'LEGN'.
CALL SCREEN 9100 STARTING AT 10 10
ENDING AT 90 20.
ENDCASE.
-------------------------------------------------------------------------
PBO Screen 9100 :
MODULE status_9100 OUTPUT.

SET TITLEBAR 'T02'.

SET PF-STATUS 'BLANK'.
LEAVE TO LIST-PROCESSING.
SUPPRESS DIALOG.
PERFORM f_write_ket.

ENDMODULE. " STATUS_9100 OUTPUT
--------------------------------------------------------------------------
FORM f_write_ket .

INCLUDE .

WRITE : 'Keterangan :'.
WRITE : / icon_package_query AS ICON, 'Batch is not completed'.
WRITE : / icon_led_yellow AS ICON, 'Batch is partially completed'.
WRITE : / icon_complete AS ICON, 'Batch is completed'.

WRITE : / icon_led_red AS ICON, 'Error in upload provisioning'.
* WRITE : / icon_led_green AS ICON, 'Upload provisioning is successful'.
WRITE : / icon_database_table AS ICON, 'Upload provisioning is successful and already saved to SAP ELog'.
WRITE : / icon_database_table_ina AS ICON, 'Upload provisioning is successful but not yet saved to SAP ELog'.
WRITE : / icon_package_standard AS ICON, '?? apa yah'.
WRITE : / icon_handling_unit AS ICON, 'Material is assigned to BOX ID'.
WRITE : / icon_infoset_ina AS ICON, 'Material is unpacked from BOX ID'.
WRITE : / icon_activity AS ICON, 'Material is allocated to PO'.


ENDFORM. " f_write_ket

The result :