Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Syncronizing (enable/disable )the subscreen with main screen

Former Member
0 Likes
579

Hi Experts,

I have implemented a screen exit (MM06E005)in me22/23 for customer data.This comes as a tab in PO header. Now the issue that i am facing is when i click change/display button i need to enable and disable the fields of my subscreen just like the main screen (both should get enabled and disabled together) but the issue is that change/display button will have always the same sy-ucomm so wether it needs to be enabled or disable is hard to figure out.

what i have done is that i have taken a flag which changes to 'C' to 'D' whenever user clicks the change/display button. for most of the time it works fine but many times when user clicks other buttons like save /change object this logic fails and i need to handle sy-ucomm of all these buttons.........what i feel is that this is not a clean logic and surely there would be a better way to syncronize the main screen and subsceen so they both are enabled and disabled at same time .

below is my code.

declaration in topinclude
     gv_disp(1) value 'D', "for me23n
      gv_disp1(1) value 'C'. "for me22n.

code in pbo

IF sy-tcode = 'ME23N'.
    IF gv_ucomm EQ ''. " when the transaction is called for the first time
      LOOP AT SCREEN.
        screen-input = 0.
        MODIFY SCREEN.
      ENDLOOP.
    ELSEIF gv_ucomm EQ 'MESAVE'. " When save button is clicked
      LOOP AT SCREEN.
        screen-input = 0.
        MODIFY SCREEN.
      ENDLOOP.
      gv_disp = 'D'.
    ELSEIF gv_ucomm EQ 'MECHOB'. " When save change object  is clicked
      LOOP AT SCREEN.
        screen-input = 0.
        MODIFY SCREEN.
      ENDLOOP.
      gv_disp = 'D'.
    ELSEIF gv_ucomm EQ 'METOGG'. " change/display button is clicked then we need to flipflop the screen.
      IF gv_disp = 'D'. "Display mode
        gv_disp = 'C'.   "change mode
        LOOP AT SCREEN.
          screen-input = 1.
          MODIFY SCREEN.
        ENDLOOP.
      ELSE.
        LOOP AT SCREEN.
          screen-input = 0.
          MODIFY SCREEN.
        ENDLOOP.
        gv_disp = 'D'.
      ENDIF.
    ENDIF.
  ELSEIF sy-tcode = 'ME22N'.
    IF gv_ucomm EQ ''.
      LOOP AT SCREEN.
        screen-input = 1.
        MODIFY SCREEN.
      ENDLOOP.
    ELSEIF gv_ucomm EQ 'MESAVE'.
      LOOP AT SCREEN.
        screen-input = 0.
        MODIFY SCREEN.
      ENDLOOP.
      gv_disp1 = 'D'.
    ELSEIF gv_ucomm EQ 'MECHOB'. " When save change object  is clicked
      LOOP AT SCREEN.
        screen-input = 1.
        MODIFY SCREEN.
      ENDLOOP.
      gv_disp = 'C'.
    ELSEIF gv_ucomm EQ 'METOGG'.
      IF gv_disp1 = 'D'. "Display mode
        gv_disp1 = 'C'.   "change mode
        LOOP AT SCREEN.
          screen-input = 1.
          MODIFY SCREEN.
        ENDLOOP.
      ELSE.
        LOOP AT SCREEN.
          screen-input = 0.
          MODIFY SCREEN.
        ENDLOOP.
        gv_disp1 = 'D'.
      ENDIF.
    ENDIF.
  ENDIF.

--

Regards,

Rahul

Added code tags

Edited by: Rob Burbank on Feb 27, 2009 11:39 AM

Hi Experts,

I have implemented a screen exit (MM06E005)in me22/23 for customer data.This comes as a tab in PO header. Now the issue that i am facing is when i click change/display button i need to enable and disable the fields of my subscreen just like the main screen (both should get enabled and disabled together) but the issue is that change/display button will have always the same sy-ucomm so wether it needs to be enabled or disable is hard to figure out.

what i have done is that i have taken a flag which changes to 'C' to 'D' whenever user clicks the change/display button. for most of the time it works fine but many times when user clicks other buttons like save /change object this logic fails and i need to handle sy-ucomm of all these buttons.........what i feel is that this is not a clean logic and surely there would be a better way to syncronize the main screen and subsceen so they both are enabled and disabled at same time .

below is my code.

declaration in topinclude
     gv_disp(1) value 'D', "for me23n
      gv_disp1(1) value 'C'. "for me22n.

code in pbo

IF sy-tcode = 'ME23N'.
    IF gv_ucomm EQ ''. " when the transaction is called for the first time
      LOOP AT SCREEN.
        screen-input = 0.
        MODIFY SCREEN.
      ENDLOOP.
    ELSEIF gv_ucomm EQ 'MESAVE'. " When save button is clicked
      LOOP AT SCREEN.
        screen-input = 0.
        MODIFY SCREEN.
      ENDLOOP.
      gv_disp = 'D'.
    ELSEIF gv_ucomm EQ 'MECHOB'. " When save change object  is clicked
      LOOP AT SCREEN.
        screen-input = 0.
        MODIFY SCREEN.
      ENDLOOP.
      gv_disp = 'D'.
    ELSEIF gv_ucomm EQ 'METOGG'. " change/display button is clicked then we need to flipflop the screen.
      IF gv_disp = 'D'. "Display mode
        gv_disp = 'C'.   "change mode
        LOOP AT SCREEN.
          screen-input = 1.
          MODIFY SCREEN.
        ENDLOOP.
      ELSE.
        LOOP AT SCREEN.
          screen-input = 0.
          MODIFY SCREEN.
        ENDLOOP.
        gv_disp = 'D'.
      ENDIF.
    ENDIF.
  ELSEIF sy-tcode = 'ME22N'.
    IF gv_ucomm EQ ''.
      LOOP AT SCREEN.
        screen-input = 1.
        MODIFY SCREEN.
      ENDLOOP.
    ELSEIF gv_ucomm EQ 'MESAVE'.
      LOOP AT SCREEN.
        screen-input = 0.
        MODIFY SCREEN.
      ENDLOOP.
      gv_disp1 = 'D'.
    ELSEIF gv_ucomm EQ 'MECHOB'. " When save change object  is clicked
      LOOP AT SCREEN.
        screen-input = 1.
        MODIFY SCREEN.
      ENDLOOP.
      gv_disp = 'C'.
    ELSEIF gv_ucomm EQ 'METOGG'.
      IF gv_disp1 = 'D'. "Display mode
        gv_disp1 = 'C'.   "change mode
        LOOP AT SCREEN.
          screen-input = 1.
          MODIFY SCREEN.
        ENDLOOP.
      ELSE.
        LOOP AT SCREEN.
          screen-input = 0.
          MODIFY SCREEN.
        ENDLOOP.
        gv_disp1 = 'D'.
      ENDIF.
    ENDIF.
  ENDIF.

--

Regards,

Rahul

Added code tags

Edited by: Rob Burbank on Feb 27, 2009 11:39 AM

1 REPLY 1
Read only

Former Member
0 Likes
410

I did not go thru ur entire code but I have a strong feeling that you need to add some conditions like you should not be allowing the user to save or change in display mode

Cheers

Vick