2013 Sep 12 12:57 PM
Hello All,
I have created a maintenance view in which I need to disable some fields for input based on the other fields in the same row. For eg
Field1 Field2
Row1 A (Enabled)
Row2 B (Disabled)
For this I thought of creating a PBO module that would loop through the table view but the module is not getting invoked when the view is accessed.
The code at the screen is
PROCESS BEFORE OUTPUT.
MODULE LISTE_INITIALISIEREN.
LOOP AT EXTRACT WITH CONTROL
TCTRL_ZTESV_DE_SUPPRES CURSOR NEXTLINE.
MODULE LISTE_SHOW_LISTE.
ENDLOOP.
MODULE FIELD_DISABLE.
Whilst the MODULE LISTE_SHOW_LISTE is getting invoked the module FIELD_DISABLE isnt.
Also can you guide as to how I may loop through the table control to achieve the intended result as I am new to Dialog Programming.
2013 Sep 13 4:32 AM
Hi Nikunj,
Add your MODULE FIELD_DISABLE inside the Loop in PBO.
This will help you to trigger this module for each record present in the internal table.
Inside MODULE FIELD_DISABLE, use LOOP AT SCREEN and based on your conditions, enable or disable your field for editing by changing the parameter as follows.
Validate the field by IF condition using the SCREEN-NAME as mentioned in the screen (the one that you wanna disable) and according to your criteria change
SCREEN-INPUT = 0 (Disable for editing)
SCREEN-INPUT = 1 (Enable for editing)
Do not forget to Modify the screen after changing the screen Parameters.
Regards,
AyyamPerumal
2013 Sep 12 7:22 PM
Hi Nikunj
The module is not invoked because it is after the loop.
See these tutorials.
http://help.sap.com/saphelp_47x200/helpdata/en/e4/2adbef449911d1949c0000e8353423/frameset.htm
http://help.sap.com/saphelp_47x200/helpdata/en/52/670ba2439b11d1896f0000e8322d00/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb2d40358411d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/10/e7dbde82ba11d295a40000e8353423/content.htm
http://fuller.mit.edu/tech/dialog_programming.html
http://sap.mis.cmich.edu/sap-abap/abap09/index.htm
http://sap.mis.cmich.edu/sap-abap/abap09/sld011.htm
thanks.
2013 Sep 13 4:32 AM
Hi Nikunj,
Add your MODULE FIELD_DISABLE inside the Loop in PBO.
This will help you to trigger this module for each record present in the internal table.
Inside MODULE FIELD_DISABLE, use LOOP AT SCREEN and based on your conditions, enable or disable your field for editing by changing the parameter as follows.
Validate the field by IF condition using the SCREEN-NAME as mentioned in the screen (the one that you wanna disable) and according to your criteria change
SCREEN-INPUT = 0 (Disable for editing)
SCREEN-INPUT = 1 (Enable for editing)
Do not forget to Modify the screen after changing the screen Parameters.
Regards,
AyyamPerumal
2013 Sep 13 7:54 AM
Hello Ayyam,
Thanks for your reply. I tried as you suggested, keeping the module inside the loop but it is still not getting triggered.
Code at Screen
----------------------------------------------------------------------------------
PROCESS BEFORE OUTPUT.
MODULE LISTE_INITIALISIEREN.
LOOP AT EXTRACT WITH CONTROL
TCTRL_ZTESV_DE_SUPPRES CURSOR NEXTLINE.
MODULE LISTE_SHOW_LISTE.
MODULE FIELD_DISABLE.
ENDLOOP.
------------------------------------------------------------------------------------
Code at Module(which isn't getting triggered anyway)
---------------------------------------------------------
MODULE FIELD_DISABLE OUTPUT.
LOOP AT SCREEN.
if screen-input = 0.
endif.
ENDLOOP.
ENDMODULE.
----------------------------------------------------------
2013 Sep 13 9:15 AM
Hi Nikunj,
I would suggest you to uncheck the "INPUT FIELD" in the Field Attributes for FIELD2 in the screen.
After this,
Change the MODULE FIELD_DISABLE OUTPUT as follows.
MODULE FIELD_DISABLE OUTPUT.
IF EXTRACT-FIELD1 = 'A'.
LOOP AT SCREEN.
IF SCREEN-NAME = 'FIELD2'.
SCREEN-INPUT = 1.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
ENDMODULE.
Change the conditions based on your requirement. Just suggested you with your example.
Regards,
AyyamPerumal
2013 Sep 19 8:37 AM
Hello Ayyam,
I did something similar to this and it worked. Many thanks for your input.
The earlier issue regarding the module not getting invoked was resolved simply be re-logging in to the box.
2013 Sep 13 9:15 AM
Make use of your VIEW table control structure effectively..
All record to be displayed in your VIEW will be present in the IT GT_DOC.
And for each record in this table Module tc_9000_get_lines get called..where you can change the Column and row attribute using the control structure..tc_9000
You can have a try..could be useful
Regardes
Ansumesh