我想在觸發特定類方法時更改dynpro中的標題欄。所以我想我可以在我的dynpro所在的報告中調用一個函數,這些更改使用'SET TITLE'來更改標題欄內容。從類方法調用(報告)功能
這是可能的,究竟如何?或者還有更好的方法嗎?
謝謝!
我想在觸發特定類方法時更改dynpro中的標題欄。所以我想我可以在我的dynpro所在的報告中調用一個函數,這些更改使用'SET TITLE'來更改標題欄內容。從類方法調用(報告)功能
這是可能的,究竟如何?或者還有更好的方法嗎?
謝謝!
在PBO處理過程中使用SET TITLEBAR
- 直接使用方法,FORM或模塊無關緊要。我建議在控制流程中的同一點上總是調用一個單一的SET TITLEBAR
語句,而不是使用SET TITLEBAR
語句拋出代碼以實現更好的可維護性。
最近,我需要實現類似的東西,所以我定義了一個類層次結構,其中我使用方法'CALL_DYNPRO'創建了一個抽象類。該方法旨在將特定的dynpro加載到具體的類中。
因此,根據我在內部定義的操作生成適當的實例,然後方法'CALL_DYNPRO'加載我用自己的gui狀態和標題創建的dynpro。
以下或多或少是我創建的代碼。
********************************* The abstract class
class lc_caller definition abstract.
public section.
methods: call_dynpro.
endclass.
class lc_caller implementation.
method call_dynpro.
endmethod.
endclass.
********************************* The concrete classes
class lc_caller_01 definition inheriting from lc_caller.
public section.
methods: call_dynpro redefinition.
endclass.
class lc_caller_01 implementation.
method call_dynpro.
call screen 101.
endmethod.
endclass.
class lc_caller_02 definition inheriting from lc_caller.
public section.
methods: call_dynpro redefinition.
endclass.
class lc_caller_02 implementation.
method call_dynpro.
call screen 102.
endmethod.
endclass.
********************************* Factory
class caller definition.
public section.
class-methods call importing i_type type char01
returning value(r_instance) type ref to lc_caller.
endclass.
class caller implementation.
method call.
data: caller1 type ref to lc_caller_01,
caller2 type ref to lc_caller_02.
case i_type.
when '0'.
create object caller1.
r_instance = caller1.
when '1'.
create object caller2.
r_instance = caller2.
when others.
endcase.
endmethod.
endclass.
start-of-selection.
data obj type ref to lc_caller.
obj = caller=>call('0').
obj->call_dynpro().
這是PBOs中的代碼。
Dynpro 101
module status_0101 output.
set pf-status 'FORM1'.
set titlebar 'VER'.
endmodule.
Dynpro 102
module status_0102 output.
set pf-status 'FORM2'.
set titlebar 'TRA'.
endmodule.
如果明天我需要調用另一個dynpro我創建它,然後編寫具體的類加載它。
非常簡單,工作非常好。
希望它有幫助。
爲什麼?這背後的商業原因是什麼?答案取決於此的實際原因... – vwegert
自定義類或標準?這是什麼報道? – Suncatcher
我的同事做了一個報告(可運行程序),它正在調用一個類的所有方法。它應該成爲櫃檯的軟件。但現在這只是一個練習。 例如,如果某人付了他的東西,標題欄應該爲新客戶獲得一個新號碼。 所以問題是,在實際報告中沒有真正發生,但調用方法。我不知道如何從類方法改變標題欄。 – Dyrdek