0

当触发特定的类方法时,我想在 dynpro 中更改我的标题栏。所以我想我可以在我的 dynpro 所在的报告中调用一个函数,它使用“SET TITLE”来更改标题栏内容。

这是可能的吗?还是有更好的方法?

谢谢!

4

2 回答 2

1

在 PBO 处理期间使用SET TITLEBAR- 无论是直接从方法、FORM 还是模块中使用都没有关系。我建议使用一个SET TITLEBAR始终在控制流中的同一点调用的单个语句,而不是在代码中乱扔代码以SET TITLEBAR获得更好的可维护性。

于 2016-02-18T12:33:05.930 回答
0

最近我需要实现类似的东西,所以我定义了一个类层次结构,在其中我使用方法“CALL_DYNPRO”创建了一个抽象类。此方法旨在在具体类中加载特定的 dynpro。

因此,根据我在内部定义的操作,我生成适当的实例,然后方法“CALL_DYNPRO”加载我创建的 dynpro 及其自己的 gui 状态和标题。

以下或多或少是我创建的代码。

********************************* 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( ).

这是 PBO 内部的代码。

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,我会创建它,然后编写具体的类来加载它。

非常简单,效果很好。

希望能帮助到你。

于 2016-02-18T15:57:56.497 回答