我需要在Movelet中重复调用相同的屏幕(问题)进行填充并将其字段发送到SAP。 屏幕的调用次数将根据变量值进行动态设置。
有可能吗?我该怎么办?
提前致谢。
答案 0 :(得分: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.
祝你好运,欢呼,
ALEQ