2017-11-25 139 views
0

我在模塊池屏幕上有一個按鈕。我需要根據邏輯/條件動態地更改圖標,工具提示和文本。我可以成功更改圖標和文本,但無法將所有三項內容(圖標,文本和工具提示)一起更改。如何同時動態設置按鈕工具提示,文字和圖標?

樣品PBO代碼:

Data but(30) type c." here but is the name of button in screen. 
write 'icon xxx' as ICON to but. 
Concatenate but 'click here' into but separated by space. 

它沒有設置提示,這應該顯示「請點擊此處繼續」的值。我怎樣才能做到這一點?

+0

你爲什麼不定義所有按鍵,並動態地隱藏你不需要的按鈕? – Oguz

回答

0

使用ICON_CREATE FM代替。

下面是示例如何改變即時所有三個屬性:

PARAMETERS: p_icon TYPE icon_d MATCHCODE OBJECT h_icon, 
      p_text TYPE string, 
      p_toolt TYPE string. 

SELECTION-SCREEN BEGIN OF SCREEN 500. 
SELECTION-SCREEN PUSHBUTTON 49(30) but USER-COMMAND ret. 
SELECTION-SCREEN END OF SCREEN 500. 

AT SELECTION-SCREEN. 
    CASE sy-ucomm. 
    WHEN 'ONLI'. 
     CALL FUNCTION 'ICON_CREATE' 
     EXPORTING 
      name  = p_icon 
      text  = p_text 
      info  = p_toolt 
      add_stdinf = 'X' 
     IMPORTING 
      result  = but. 
     CALL SELECTION-SCREEN 500. 
    WHEN 'RET'. 
     LEAVE TO SCREEN 0. 
    WHEN OTHERS. 
    ENDCASE. 
相關問題