2009 Dec 15 6:35 PM
Hi All,
I have a requirement where I need to dynamically enable/disable a I/O box drop-down?
This can be easily done in Classic ABAP reporting via
AT SELECTION-SCREEN.
LOOP AT SCREEN.
name_of_field-input = 0.
"or
name_of_fileld-input = 1.
ENDLOOP.
In the case of moduled program, AT SELECTION-SCREEN event and LOOP AT SCREEN are not allowed in the PBO of a module program.
Any suggestions?
Thanks.
2009 Dec 15 6:54 PM
Hi,
Same thing you can do in PBO EVENT in case of dialog programs. Write a MODULE under PBO event and place ur screen modification code based on ur dynamic logic.
LOOP AT SCREEN.
Modify screen fields.
ENDLOOP.
Thanks,
Vinod.
2009 Dec 15 6:54 PM
Hi,
Same thing you can do in PBO EVENT in case of dialog programs. Write a MODULE under PBO event and place ur screen modification code based on ur dynamic logic.
LOOP AT SCREEN.
Modify screen fields.
ENDLOOP.
Thanks,
Vinod.
2009 Dec 15 7:07 PM
Hi Vinod,
Yes I did that in my PBO:
module DISABLE_INPUT output.
"AT SELECTION-SCREEN.
LOOP AT SCREEN.
IO_VENDORLOT_RES-INPUT = 0. "Error: The data object has no structure and therefore no component called INPUT
ENDLOOP.
endmodule. " DISABLE_INPUT OUTPUT
How can I enable/disable the I/O box field then since AT SELECTION-SCREEN is not allowed.
thanks
2009 Dec 15 7:10 PM
Hi
What's IO_VENDORLOT_RES?
Your code should be:
LOOP AT SCREEN.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDLOOP.Max
2009 Dec 15 7:13 PM
Hi Max,
IO_VENDORLOT_RES is the name of I/O box field in SCREEN PAINTER
and also the name in my TOP include declaration.
DATA: IO_VENDORLOT_RES LIKE ZCHECK-STATUS.
Thanks.
2009 Dec 15 7:17 PM
So
LOOP AT SCREEN.
CHECK SCREEN-NAME = 'IO_VENDORLOT_RES'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDLOOP.Max
2009 Dec 15 7:25 PM
Hi Max,
Almost there, thanks. Sorry I forgot to include more details, my I/O box is defined as ListDown. I notice that yes the field was disabled but I can still access it via dropDown.
I'm expecting like that the I/O box itself should be disabled and not accessible even via the drop-down.
Am I missing any other deactivation events/attributes here?
Or it seems like SAP do it that way? Yes the drop-down is still accessible BUT the user cannot select any value(s). Comparing it to other dev tool, Unlike in .NET where we can customize the events freely.
Thanks..
Edited by: Jaime Cabanban on Dec 16, 2009 3:27 AM
2009 Dec 15 7:29 PM
Hi
You wrote:
This can be easily done in Classic ABAP reporting via...So I think if u can do it in a selection-screen u can do it in a dynpro: now what did you do in the AT SELECTION-SCREEN?
Max
2009 Dec 15 7:35 PM
Yes Max,
I did nothing "AT SELECTION-SCREEN", your solution partially works as such that:
- the I/O box(DropDown) is disabled for input
- but it is still accessible via DropDown
- Is this how SAP behave in locking I/O box field?
I'm expecting like it will be a total disable wherein the dropDown is not even accessible.
Thanks.
2009 Dec 15 7:50 PM
Hi
I don't believe it can changed an attribute like a listbox, I've created this little report, but the listbox isstill active:
PARAMETERS: P_BUKRS LIKE BSEG-KOART AS LISTBOX VISIBLE LENGTH 10.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDLOOP.
Max
2009 Dec 15 7:53 PM
Hi Max,
Question answered, thanks. I also notice that only one SCREEN-NAME can be check only on one LOOP AT SCREEN. Please correct me if I'm wrong.
Only the first screen-name will be disabled.
LOOP AT SCREEN.
CHECK SCREEN-NAME = 'IO_VENDORDESC_RES'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
CHECK SCREEN-NAME = 'IO_MATERIALNUM_RES'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDLOOP.
It will work this way:
LOOP AT SCREEN.
CHECK SCREEN-NAME = 'IO_VENDORDESC_RES'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDLOOP.
LOOP AT SCREEN.
CHECK SCREEN-NAME = 'IO_MATERIALNUM_RES'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDLOOP.
Thanks,
2009 Dec 16 7:13 AM
>
> Hi Max,
> Question answered, thanks. I also notice that only one SCREEN-NAME can be check only on one LOOP AT SCREEN. Please correct me if I'm wrong.
>
> Only the first screen-name will be disabled.
>
> LOOP AT SCREEN. > CHECK SCREEN-NAME = 'IO_VENDORDESC_RES'. > SCREEN-INPUT = 0. > MODIFY SCREEN. > > CHECK SCREEN-NAME = 'IO_MATERIALNUM_RES'. > SCREEN-INPUT = 0. > MODIFY SCREEN. > ENDLOOP. >>
> It will work this way:
>
> LOOP AT SCREEN. > CHECK SCREEN-NAME = 'IO_VENDORDESC_RES'. > SCREEN-INPUT = 0. > MODIFY SCREEN. > ENDLOOP. > > LOOP AT SCREEN. > CHECK SCREEN-NAME = 'IO_MATERIALNUM_RES'. > SCREEN-INPUT = 0. > MODIFY SCREEN. > ENDLOOP. >>
> Thanks,
Have you read the ABAP help on CHECK.
CHECK conditionis exactly the same as
IF NOT condition.
EXIT.
ENDIF.For multiple checks use CASE.
2009 Dec 16 8:48 AM
Hi
The problem is LOOP AT SCREEN can't have a WHERE condition, so it need to use an alternative solution in order to change the attribute of I/O fields.
It needs to consider everytime LOOP AT SCREEN is used, all I/O fields will be read in the LOOP, anyway the command is very fast, so it hasn't performance problem if it uses several LOOP AT SCREEN instead of one.
That means all these abap lines have the same effect:
LOOP AT SCREEN.
CASE SCREEN-NAME.
WHEN 'IO_VENDORDESC_RES'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
WHEN ' 'IO_MATERIALNUM_RES'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDCASE:
ENDLOOP.or
LOOP AT SCREEN.
IF SCREEN-NAME = 'IO_VENDORDESC_RES'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
IF SCREEN-NAME = 'IO_MATERIALNUM_RES'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.or
LOOP AT SCREEN.
CHECK SCREEN-NAME = 'IO_VENDORDESC_RES'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDLOOP.
LOOP AT SCREEN.
CHECK SCREEN-NAME = 'IO_MATERIALNUM_RES'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDLOOP.Max
2009 Dec 16 9:12 AM
2009 Dec 16 9:31 AM
Thanks Max and Bran,
I just revise my code in a better way.
Question answered at best state.
2009 Dec 15 7:55 PM
2009 Dec 15 8:02 PM
Hi Rob,
I can't hide it because it's part of a toggle screen for Display/Change. Thanks.
Question Answered,
Solution:
1. In PBO, create a module for Enable/Disable of I/O box Field
2. In the module, use LOOP AT-SCREEN .. ENDLOOP (as shown in my code above)
Note: if you have multiple screen values, you need to put them in one LOOP AT-SCREEN container.
Friendly Reminder: Ensure that the variable name in your Screen Painter and ABAP declaration(TOP include) are exactly the same.
Thanks.
P.S.
Hi Rob & Max,
You might as well want to check a closely relevant thread on module pool - I/O box field: How to Clear Value(s)
Edited by: Jaime Cabanban on Dec 16, 2009 4:04 AM
2009 Dec 15 8:16 PM