0

我需要在 Movelet 中重复调用同一屏幕(问题)以填充并将其字段发送到 SAP。屏幕调用次数将根据变量值动态设置。

有可能这样做吗?我该怎么做?

提前致谢。

4

1 回答 1

1

有可能的。创建一个生成屏幕的方法(例如)ADD_LOOP_SCR:

IV_SCREEN_KEY   TYPE /MOVI/LZR_ANSWER_KEY   Movilizer: Answer Key
IV_NEXT_SCR_KEY TYPE /MOVI/LZR_ANSWER_KEY   Movilizer: Answer Key
CS_MOVELET  TYPE /MOVI/MS_ST_BUSSTEP_STRUCTURE  Movelet structure

实现(Epsilon 示例)

DATA:
   lr_screen  TYPE REF TO /movi/ms_st_screen_epsilon,
   lr_answer  TYPE REF TO /movi/ms_st_answer.

APPEND INITIAL LINE TO cs_movelet-epsilon_screens REFERENCE INTO lr_screen.
lr_screen->key = iv_screen_key.

APPEND INITIAL LINE TO lr_screen->answers REFERENCE INTO lr_answer.
CONCATENATE 'AK_' iv_screen_key INTO lr_answer->key.
CONCATENATE 'CK_' iv_screen_key INTO lr_answer->client_key.
lr_answer->next_screen_key  = iv_next_scr_key.
lr_answer->followup_action  = /movi/dsd_if_const=>movilizer-followup_action_none.

add_XXXXXX_mel(
EXPORTING
  ...... if needed
CHANGING
  ct_mel_expressions = lr_screen->mel_expressions
  ct_validations     = lr_screen->validations
  ct_restrictions    = lr_screen->restrictions ).

然后主要在GENERATE方法中:

es_movelet-first_screen_key  = 'SK_LOOPSCREEN_001'.

DATA:
  lv_i       TYPE numc3,
  lv_sk      TYPE /movi/lzr_answer_key,
  lv_next_sk TYPE /movi/lzr_answer_key.

DO 5 TIMES.
  lv_i = sy-index.
  CONCATENATE 'SK_LOOPSCREEN_' lv_i INTO lv_sk.
  ADD 1 TO lv_i.
  IF lv_i > 5.
    lv_next_sk = /movi/lzr_if_constants=>movilizer_movelet_exit_key.
  ELSE.
    CONCATENATE 'SK_LOOPSCREEN_' lv_i INTO lv_next_sk.
  ENDIF.
  add_generate_printout_data_scr( EXPORTING iv_screen_key   = lv_sk
                                            iv_next_scr_key = lv_next_sk
                                  CHANGING  cs_movelet      = es_movelet ).
ENDDO.

祝你好运,干杯,阿列克

于 2016-03-31T08:34:02.407 回答