REPORT.
PARAMETERS p_test.
INITIALIZATION.
DATA(picture) = NEW cl_gui_picture( parent = NEW cl_gui_gos_container( width = 38 ) ).
DATA url TYPE cndp_url.
CALL FUNCTION 'DP_PUBLISH_WWW_URL'
EXPORTING
objid = 'ACHTUNG'
lifetime = cndp_lifetime_transaction
IMPORTING
url = url
EXCEPTIONS
dp_invalid_parameters = 1
no_object = 2
dp_error_publish = 3.
IF sy-subrc = 0.
picture->load_picture_from_url_async( url = url ).
picture->set_display_mode( picture->display_mode_fit ).
ENDIF.
REPORT.
PARAMETERS p_test.
PARAMETERS p_show AS CHECKBOX DEFAULT 'X' USER-COMMAND dummy.
CLASS info DEFINITION.
PUBLIC SECTION.
METHODS icon IMPORTING name TYPE clike RETURNING VALUE(info) TYPE REF TO info.
METHODS pic IMPORTING name TYPE clike RETURNING VALUE(info) TYPE REF TO info.
METHODS constructor IMPORTING width TYPE i.
METHODS with_text IMPORTING text TYPE clike RETURNING VALUE(info) TYPE REF TO info..
METHODS hide.
METHODS show.
PROTECTED SECTION.
DATA picture TYPE REF TO cl_gui_picture.
METHODS handle_click FOR EVENT picture_click OF cl_gui_picture.
DATA text TYPE string.
ENDCLASS.
CLASS info IMPLEMENTATION.
METHOD constructor.
picture = NEW cl_gui_picture( parent = NEW cl_gui_gos_container( width = width ) ).
picture->set_registered_events( VALUE #(
( eventid = cl_gui_picture=>eventid_picture_click )
) ).
SET HANDLER handle_click FOR picture.
ENDMETHOD.
METHOD icon.
picture->load_picture_from_sap_icons( name ).
picture->set_display_mode( picture->display_mode_fit ).
info = me.
ENDMETHOD.
METHOD pic.
DATA url TYPE cndp_url.
CALL FUNCTION 'DP_PUBLISH_WWW_URL'
EXPORTING
objid = CONV w3objid( name )
lifetime = cndp_lifetime_transaction
IMPORTING
url = url
EXCEPTIONS
dp_invalid_parameters = 1
no_object = 2
dp_error_publish = 3.
IF sy-subrc = 0.
picture->load_picture_from_url_async( url = url ).
picture->set_display_mode( picture->display_mode_fit ).
ENDIF.
info = me.
ENDMETHOD.
METHOD with_text.
me->text = text.
info = me.
ENDMETHOD.
METHOD handle_click.
CHECK text IS NOT INITIAL.
MESSAGE text TYPE 'I'.
ENDMETHOD.
METHOD hide.
picture->set_visible( space ).
ENDMETHOD.
METHOD show.
picture->set_visible( 'X' ).
ENDMETHOD.
ENDCLASS.
INITIALIZATION.
DATA(info) = NEW info( 38 )->pic( 'ACHTUNG' ).
DATA(green) = NEW info( 39 )->icon( icon_led_green )->with_text( 'Everything ok' ).
DATA(yellow) = NEW info( 39 )->icon( icon_led_yellow )->with_text( 'aargh...' ).
DATA(red) = NEW info( 39 )->icon( icon_led_red )->with_text( 'error. error. error.' ).
AT SELECTION-SCREEN OUTPUT.
CASE p_show.
WHEN abap_true.
info->show( ).
WHEN abap_false.
info->hide( ).
ENDCASE.
DATA(red) = NEW info( 39 )->icon( icon_led_red )->with_text( 'error. error. error.' ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |