1
votes

This one has me pretty stumped.

I've made an enhancement on MB1B, and I want its changes to be visible over MB1B and MI09, and that's working. I am, however, trying to prevent these changes from appearing on different transactions (e.g. IH08, IE05, IQ09). What I've done is surround all of my enhancement code with if statements, like the following:

IF sy-tcode = 'MB1B' OR sy-tcode = 'MI09'.
  INCLUDE z_pallet_selopt.
ENDIF.

When I run IH08, however, the debugger will get to this point and go ahead and include z_pallet_selopt.

So I'll be here, and press F5... First Step

And lo and behold, it skips straight to here. Second Step

In the second screenshot you can see the same IF statement. If I F5 from that point, it will skip straight out (or so it seems), but when the program is finished executing and the selection screen shows, the selection field is still visible. The only changes I've made are these IF statements, which are all the same, but interestingly enough, it does work around the chunk of code that changes the title of S_PALLET to Pallet. Third Step

Things I've tried:

  • If I comment everything in these IF statements out, the field will not be there, so I know that it's somehow getting inside of there.
  • Completely exiting SAP GUI and re-entering (in case of bad caching).

Thank you for your time.

The following solved my issue:

In an enhancement point following AT SELECTION-SCREEN OUTPUT., I inserted the following code:

" If I'm not being executed from MB1B and MI09, hide myself
IF sy-tcode <> 'MB1B' AND sy-tcode <> 'MI09'.
  LOOP AT SCREEN.
    IF SCREEN-GROUP1 = 'PLT'.
      SCREEN-ACTIVE = '0'.
      MODIFY SCREEN.
      CONTINUE.
    ENDIF.
  ENDLOOP.
ENDIF.

and for the particular selection screen option I wished to hide:

s_pallet for ausp-atwrt MODIF ID PLT.

Thank you to Gert Beukema and this helpful thread. My problem was trying to use conditional statements in the selection screen area, which doesn't work.

1

1 Answers

4
votes

There is no such thing as an IF statement in the selection screen. What is happening is that the include includes your new SELECT-OPTION and as you have noticed the IF is ignored.

What you can do is add logic in the AT SELECTION-SCREEN OUTPUT event to suppress your newly added SELECT-OPTION.