Rotate Wallpaper in SAPgui

Upload your favorite images in SAP via transaction SMW0 (with names z*.gif or z*.jpg).

Schedule daily in the morning and be surprised !

*&--------------------------------------------------------------------*
*& Report  Z_SAPGUI_WALLPAPER
*&--------------------------------------------------------------------*
* Rotate Wallpaper in SAPgui                    IperCube 2009
*---------------------------------------------------------------------*
* Only image = Z*.GIF, Z*.JPG
*---------------------------------------------------------------------*
* Use Transaction SMW0 for image Upload
*---------------------------------------------------------------------*
 
REPORT  z_sapgui_wallpaper.
 
DATA: tab_tadir TYPE TABLE OF tadir WITH HEADER LINE.
DATA: current_image TYPE sobj_name.
DATA : v_index    TYPE sy-tabix.
DATA: v_nbr_image(5) TYPE n.
 
* Get Current Wallpaper
SELECT SINGLE path FROM ssm_cust INTO current_image
      WHERE id = 'START_IMAGE'.
 
* Get images from repository 
SELECT * FROM tadir INTO TABLE tab_tadir
  WHERE object = 'W3MI'
  AND   obj_name LIKE 'Z%.JPG'.
 
SELECT * FROM tadir APPENDING TABLE tab_tadir
  WHERE object = 'W3MI'
  AND   obj_name LIKE 'Z%.GIF'.
 
* Number of images in repository 
DESCRIBE TABLE tab_tadir LINES v_nbr_image.
 
IF current_image IS INITIAL.
  v_index = 1.
 
ELSE.
 
  " Get Next Image Index
  LOOP AT tab_tadir WHERE obj_name = current_image.
    v_index = sy-tabix + 1.
    EXIT.
  ENDLOOP.
 
  IF sy-subrc IS NOT INITIAL.
    v_index = 1.
  ENDIF.
 
* Check Index
  IF v_index > v_nbr_image.
    v_index = 1.
  ENDIF.
 
ENDIF.
 
" Get Next Image
IF v_index > 0.
  READ TABLE tab_tadir INDEX v_index.
 
  " Update WallPaper
  UPDATE ssm_cust SET path = tab_tadir-obj_name
      WHERE id = 'START_IMAGE'.
ENDIF.