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

Making buttons inactive in module pool program

Former Member
0 Likes
2,045

Hai experts,

i have following issues in module pool program . They are

1. I have 3 push buttons in my screen 1 . They are " Create , Display , Change ", the issue is , when i am clicking Create button remaining two buttons should be inactive . How can I do it ?

2. I have created two transactions ( Create , Display ) , whenever I use transaction either Create or Dispaly , the name of the transaction should be dispalyed in the top of the screen .

example: Purchase Order ZPOCREATE.

Thanks and regards,

Mani.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,125

Hi,

Go through the following code


*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS 'STATUSMAIN'.


  if sy-tcode eq 'ZPURCR_G13'.
     set titlebar 'CREATETITLE'.
  elseif sy-tcode eq 'ZPURCHG_G13'.
      set titlebar 'CHANGETITLE'.
  elseif sy-tcode eq 'ZPURDIS_G13'.
      set titlebar 'DISPLAYTITLE'.
  endif.


  if sy-tcode eq 'ZPURCR_G13'.
    loop at screen.
      if screen-name eq 'CHANGE'.
        screen-input = '0'.
        modify screen.
      elseif  screen-name eq 'DISPLAY'.
        screen-input = '0'.
        modify screen.
      endif.
    endloop.
  endif.

  if sy-tcode eq 'ZPURCHG_G13'.
    loop at screen.
      if screen-name eq 'CREATE'.
        screen-input = '0'.
        modify screen.
      elseif screen-name eq 'DISPLAY'.
        screen-input = '0'.
        modify screen.
      endif.
    endloop.
  endif.

  if sy-tcode eq 'ZPURDIS_G13'.
    loop at screen.
      if screen-name eq 'CREATE'.
        screen-input = '0'.
        modify screen.
      elseif  screen-name eq 'CHANGE'.
        screen-input = '0'.
        modify screen.
      endif.
    endloop.
  endif.

ENDMODULE.                 " STATUS_0100  OUTPUT

6 REPLIES 6
Read only

Former Member
0 Likes
1,125

Hi,

To display the transaction name set it in the titlebar using SET TITLEBAR in the PBO of teh screen.

To disable a buttuon; loop on the screen table and put screen-input = 0.

loop at screen.
  case screen-name .
    when 'TEST1' .    "button name
      screen-input = '0'.
      modify screen.
    endcase.
  endloop.

Regards,

Ankur Parab

Edited by: Ankur Parab on Aug 7, 2009 3:31 PM

Read only

MarcinPciak
Active Contributor
0 Likes
1,125

Where do you have your buttons, in application toolbar? If so then use this logic


DATA fcode TYPE TABLE OF sy-ucomm. 

"PAI module
case sy-ucomm.
  when 'FC_CREATE'.  "if create button was selected (function code for create button)
    "then hide all the others
    append 'FC_CHANGE' to fcode.
    append 'FC_DISPLAY' to fcode.
  when 'FC_DISPLAY.  
    "then hide CHANGE and CREATE
  when 'FC_CHANGE' .
    "same here.
 endcase.
  
"PBO module
set pf-status 'YOUR_STATUS'  excluding fcode.  "hide all buttons which are in FCODE table

For Title you can use


"in PBO module
SET TITLEBAR title.

Regards

Marcin

Read only

former_member585060
Active Contributor
0 Likes
1,125

Hi,

Add the the below code in the PBO of the First screen, this should be the first module after status & title bar.

In Main screen PBO

PROCESS BEFORE OUTPUT.
  MODULE status_2000.


*&---------------------------------------------------------------------*
*&      Module  status_2000  OUTPUT
*&---------------------------------------------------------------------*
* " Triggering Transactions here.
*----------------------------------------------------------------------*
MODULE status_2000 OUTPUT.

  CCASE sy-tcode.

      WHEN 'ZCREATE'.

PERFORM f_title_bar.               " ----- Set Title

   LOOP AT SCREEN.
      CASE screen-name.
        WHEN 'CREATE'.
          screen-input = 1.
          MODIFY SCREEN.
        WHEN 'CHANGE'.
          screen-input = 0.
          MODIFY SCREEN.
        WHEN 'DISPLAY'.
          screen-input = 0.
          MODIFY SCREEN.
      ENDCASE.
    ENDLOOP.

      WHEN 'ZCHANGE'.

PERFORM f_title_bar.               " ----- Set Title

   LOOP AT SCREEN.
      CASE screen-name.
        WHEN 'CREATE'.
          screen-input = 0.
          MODIFY SCREEN.
        WHEN 'CHANGE'.
          screen-input = 1.
          MODIFY SCREEN.
        WHEN 'DISPLAY'.
          screen-input = 0.
          MODIFY SCREEN.
      ENDCASE.
    ENDLOOP.

     WHEN 'ZDISPLAY'.

PERFORM f_title_bar.               " ----- Set Title

   LOOP AT SCREEN.
      CASE screen-name.
        WHEN 'CREATE'.
          screen-input = 0.
          MODIFY SCREEN.
        WHEN 'CHANGE'.
          screen-input = 0.
          MODIFY SCREEN.
        WHEN 'DISPLAY'.
          screen-input = 1.
          MODIFY SCREEN.
      ENDCASE.
    ENDLOOP.

ENDCASE.

ENDMODULE.                 " status_2000  OUTPUT

Regards

Bala Krishna

Read only

Former Member
0 Likes
1,126

Hi,

Go through the following code


*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS 'STATUSMAIN'.


  if sy-tcode eq 'ZPURCR_G13'.
     set titlebar 'CREATETITLE'.
  elseif sy-tcode eq 'ZPURCHG_G13'.
      set titlebar 'CHANGETITLE'.
  elseif sy-tcode eq 'ZPURDIS_G13'.
      set titlebar 'DISPLAYTITLE'.
  endif.


  if sy-tcode eq 'ZPURCR_G13'.
    loop at screen.
      if screen-name eq 'CHANGE'.
        screen-input = '0'.
        modify screen.
      elseif  screen-name eq 'DISPLAY'.
        screen-input = '0'.
        modify screen.
      endif.
    endloop.
  endif.

  if sy-tcode eq 'ZPURCHG_G13'.
    loop at screen.
      if screen-name eq 'CREATE'.
        screen-input = '0'.
        modify screen.
      elseif screen-name eq 'DISPLAY'.
        screen-input = '0'.
        modify screen.
      endif.
    endloop.
  endif.

  if sy-tcode eq 'ZPURDIS_G13'.
    loop at screen.
      if screen-name eq 'CREATE'.
        screen-input = '0'.
        modify screen.
      elseif  screen-name eq 'CHANGE'.
        screen-input = '0'.
        modify screen.
      endif.
    endloop.
  endif.

ENDMODULE.                 " STATUS_0100  OUTPUT

Read only

Former Member
0 Likes
1,125

Hi,

See to this link.

Regards,

Revathi Bhoopal.

Read only

Former Member
0 Likes
1,125

loop at screen.

case sy-tcode.

when 'ZGP2_1'.

set titlebar 'T001' with 'Create'.

set pf-status 'PF_1'.

if screen-group1 = 'CH' or screen-group1 = 'DI'.

screen-input = 0.

endif.

when 'ZGP2_2'.

set titlebar 'T001' with 'Change'.

set pf-status 'PF_1'.

if screen-group1 = 'CR' or screen-group1 = 'DI'.

screen-input = 0.

endif.

when 'ZGP2_3'.

set titlebar 'T001' with 'DISPLAY'.

set pf-status 'PF_1' excluding it_excl.

if screen-group1 = 'CH' or screen-group1 = 'CR'.

screen-input = 0.

endif.

endcase.

modify screen.

endloop.

hope it will help you.

regards,

Shweta.