05-14-2008 9:52 PM
I have a lcl_application class with its implementation. The only method defined is 'handle_node_double_click'. I want to display some fields in a dynpro when double click on one button and I want also to disable these fields when some others are pushed.
In fact, into the CLASS lcl_application IMPLEMENTATION I can not use 'loop at screen. if screen-name='ZT'. screen-input = '0'. endif. modify screen. endloop'. It does not work.
How can I do it ??
Thanks.
05-14-2008 9:55 PM
the actual screen processing is not (yet) supported in classes. you will have take care of this outside of the class (methods)!!!
05-14-2008 10:03 PM
That is not true..... you can put you screen processing inside of a local class method. I've done so many times before. Actually the fact that you are mentioning LCL_APPLICATION as your local class name, leads me to believe that you've seen one of my examples. Most likely this local class is only used for an event handler. But it could be extended to contain ALL of your program logic. For example, you could have a method called PBO, and a method called PAI. You would then call these methods inside of the MODULE...ENDMODULE of your screens. In these methods, you can put any screen processing like LOOP AT SCREEN, or in the case of PAI, you can check your OK_CODE.
What I think MIckey is talking about is that you CAN NOT defined screen(dynpros) and their modules within a global class which is not possible.
Regards,
Rich Heilman
05-14-2008 10:09 PM
For example, your program structure could be like so...
REPORT rich_0001.
DATA: ok_code TYPE sy-ucomm.
DATA: save_ok TYPE sy-ucomm.
************************************************************************
* CLASS lcl_application DEFINITION
************************************************************************
CLASS lcl_application DEFINITION FINAL.
PUBLIC SECTION.
CLASS-METHODS: pbo,
pai.
ENDCLASS. "lcl_application DEFINITION
START-OF-SELECTION.
CALL SCREEN 100.
************************************************************************
* Module STATUS_0100 OUTPUT
************************************************************************
MODULE status_0100 OUTPUT.
lcl_application=>pbo( ).
ENDMODULE. " STATUS_0100 OUTPUT
************************************************************************
* Module USER_COMMAND_0100 INPUT
************************************************************************
MODULE user_command_0100 INPUT.
lcl_application=>pai( ).
ENDMODULE. " USER_COMMAND_0100 INPUT
************************************************************************
* CLASS lcl_application IMPLEMENTATION
************************************************************************
CLASS lcl_application IMPLEMENTATION.
*************************************************************************
* Method PBO
*************************************************************************
METHOD pbo.
CASE sy-dynnr.
WHEN '0100'.
SET PF-STATUS '0100'.
SET TITLEBAR '0100'.
* Here you can LOOP at SCREEN
ENDCASE.
ENDMETHOD. "pbo
*************************************************************************
* Method PAI
*************************************************************************
METHOD pai.
save_ok = ok_code.
CASE sy-dynnr.
WHEN '0100'.
CASE ok_code.
WHEN 'BACK' OR 'EXIT'.
LEAVE PROGRAM.
WHEN 'EXECUTE'.
CLEAR ok_code.
ENDCASE.
ENDCASE.
ENDMETHOD. "pai
ENDCLASS. "lcl_application IMPLEMENTATION
Regards,
Rich Heilman
05-14-2008 10:10 PM
Rich,
correct, that was more or less what I was trying to say. Things like creating screens etc. are not possible, but I should have written this more explicitely in my reply.
And indeed, calling methods from within MODULE ENDMODULE is no problem at all.
05-14-2008 10:20 PM
In fact, when I select one node (of a tree created using objects) and I double-click, I want to enable or disable some other fields in the same dynpro so I guess this should be done into :
CLASS lcl_application IMPLEMENTATION.
METHOD handle_node_double_click.
Should I call the method PBO and PAI defined from this method implementation ??