如何根据复选框在SAP ABAP中禁用/启用Steploop中的行。

huangapple go评论87阅读模式
英文:

How to disable/Enable a row in Steploop based on checkbox- SAP ABAP

问题

我一直在为一个带有Steploops的手持设备制作报告。我遇到的问题是,当选中复选框时,我需要禁用一个数量字段,但在取消选中时再次启用它。

应用Phil的答案后,它按预期工作:

英文:

I have been working on a report for a Handheld device with Steploops.
The problem I am having is that I need to disable a qty field when a checkbox is checked but enable it again when it is unchecked.

如何根据复选框在SAP ABAP中禁用/启用Steploop中的行。

The main problem right now is that on my Loop at Screen, I will see one row instead of them all and if I change it to Screen-active = '0'. It disables all the qty fields.

There is any idea I will apply to fix it?

After applying Phil answer it works as expected:

如何根据复选框在SAP ABAP中禁用/启用Steploop中的行。

答案1

得分: 1

以下是您要求的代码部分的中文翻译:

关键是在屏幕的LOOP内部调用DYNPRO中的一个模块
这是一个最小样式的手工解决方案用来说明这个概念

    在输出之前进行处理
      在DATA_AREA_TAB上进行循环光标为current_line将数据存储到data_area_rec中
           调用模块LOOP_INIT
           调用模块DATA_AREA_TAB_SHOW
      循环结束

然后在模块内部...

您可以读取当前行以便了解内容并相应地调整字段由于它是针对dynpro的每一行调用的
它会更新当前行

   
    模块DATA_AREA_TAB_SHOW 输出  
    从data_area_tab中读取数据存储到data_area_rec中索引为current_line

    在屏幕上进行循环

    如果screen-name = '???'   " 在此处添加您的规则
    如果data_area_rec-VALUE  = '???'
        screen-invisible = '0'
        screen-input = '1'
      否则
        screen-invisible = '1'
        screen-input = '0'
      结束如果
    结束如果

     修改屏幕
    循环结束
    结束模块

请注意,这个翻译是针对您提供的ABAP代码的代码部分的翻译。如果您需要任何其他帮助,请随时告诉我。

英文:

The trick is to call a module from the DYNPRO inside LOOP on the screen.
Here is minimum style solution, by hand to illustrate the concept.

PROCESS BEFORE OUTPUT.
  LOOP AT DATA_AREA_TAB  CURSOR current_line INTO data_area_rec.
       MODULE LOOP_INIT.
       MODULE DATA_AREA_TAB_SHOW.
  ENDLOOP.

then inside the MODULE...

You can read the current line so you know the content
and adjust the field accordingly. Since it is called per line of dynpro
it updates the current line.

MODULE DATA_AREA_TAB_SHOW OUTPUT.  
READ TABLE data_area_tab INTO data_area_rec INDEX current_line.

LOOP AT SCREEN.

IF screen-name = '???'.   " your rules here
IF data_area_rec-VALUE  = '???'
    screen-invisible = '0'.
    screen-input = '1'.
  ELSE.
    screen-invisible = '1'.
    screen-input = '0'.
  ENDIF.
ENDIF.

 MODIFY SCREEN.
ENDLOOP.
ENDMODULE.

huangapple
  • 本文由 发表于 2023年7月18日 01:48:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/76706949.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定