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

Enable and disable button on screen.

Former Member
0 Likes
6,981

Hi Experts,

I need to enable and Disable button on Screen based on the screen field entry on the screen,

I had written the logic

LOOP AT SCREEN.

IF INPUT1 IS INITIAL.

IF SCREEN-NAME = 'INSERT'.

SCREEN-INPUT = 0.

ENDIF.

ELSEIF INPUT1 = 'X'.

SCREEN-INPUT = 1.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

this logic is working when i am pressing Enter after any entry to the input field. but my aim is

when there is no entry in the input field the button should be in disable mode when i start entering the data the button should be in enable  mode  simultaneously without pressing enter.

any methods in OO ABAP Please help me out,

or any example program.

Hi Experts,

I need to enable and Disable button on Screen based on the screen field entry on the screen,

I had written the logic

LOOP AT SCREEN.

IF INPUT1 IS INITIAL.

IF SCREEN-NAME = 'INSERT'.

SCREEN-INPUT = 0.

ENDIF.

ELSEIF INPUT1 = 'X'.

SCREEN-INPUT = 1.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

this logic is working when i am pressing Enter after any entry to the input field. but my aim is

when there is no entry in the input field the button should be in disable mode when i start entering the data the button should be in enable  mode  simultaneously without pressing enter.

any methods in OO ABAP Please help me out,

or any example program.

14 REPLIES 14
Read only

Former Member
0 Likes
4,242

Hi,

First understand what is the difference between Active = 0 or 1 and Input = 0 or 1.

Active = 0 - Means the screen element will not be shown while run-time.

Input = 0   - Means the Screen element will be shown but it will not accept any input. i.e. it is the element will be shown in grey mode.

So, If you want the screen element will be shown to the user but no action will be done on that then use :

Loop at Screen.

If screen-name eq 'xyz'.

     screen-input = 0.

endif.

endloop.

If you want the screen element will not be shown to the user i.e. no display of that element then use:

Loop at Screen.

If screen-name eq 'xyz'.

     screen-active = 0.

endif.

endloop.

you must write this code in PBO only.

hope this will help you.

Regards,

Naveen.

Read only

0 Likes
4,242

Thanks Naveen for the reply,

the problem is not respect to the logic which i had posted  its just the sample code which can be done in abap while pressing enter to meet my aim ,but i want the way to do so without pressing Enter on the screen,

Thanks Again...

Read only

0 Likes
4,242

Hi,

what you want is only possible if you find a way to trigger a function when you start typing. Unfortunately I think it isn't possible. You can trigger a function when you click on a checkbox or change the selection of a radiobutton group.

Maybe it helps.

Read only

0 Likes
4,242

Hi burde,

It can be achieved by OO ABAP but i don't know which method to use,

hope so any one can help me out on this.

thanks for your reply.....

Read only

0 Likes
4,242

Hi

no, You need an action triggers the PAI event (so AT SELECTION-SCREEN and AT SELECTION-SCREEN OUTPUT), that means you need to assign a functional code to I/O fields, but it's possible for checkbox and radiobutton only.

Max

Read only

Former Member
0 Likes
4,242

Hi Sir

Try this way IF SCREEN-NAME = '  '.

Keep it as blank and check it is disabling

Read only

0 Likes
4,242

If INPUT1 is a checkbox or radio button use the keyword USER-COMMAND in the parameter definition, with a default value.

PARAMETER

   p_list as checkbox default 'X' user-command col.

Read only

Clemenss
Active Contributor
0 Likes
4,242

Hi Ppy,

yes, screen processing allows only radiobutton group and parameters and Listbox to have the supplement USER-COMMAND <any>.

It does not matter which user-comand you use, even a non-existing will trigger PAI and then PBO and again the screen. In PBO you can set screen-input accordingly.

It is advisable to assign a MODIF ID to the parameters you want to set active/inactive. You can use SCREEN-GROUP1 to compare with MODIF ID in LOOP AT SCREEN.

So if you can not use Checkbox or radiobutton, put all possible input values into Listbox. If the parameter is created with a data type from ABAP Dictionary, and the data type is associated with the input help in the Dictionary, the first column of the input help is displayed in the list box.

Otherwise, use  FUNCTION 'VRM_SET_VALUES' to set the selectable values.

Regards,

Clemens

Read only

Former Member
0 Likes
4,242

Thanks All for the reply,,

But my main intention remains the same is it possible or not to do so without any key pressing.

Thanks all for your intention again..

Read only

0 Likes
4,242

Hi

I think the replies are clear: no it's not possible:

it's not a problem on which kind of ABAP (object or classical) used, but it needs to have an event triggers the PAI:

if you don't want to press ENTER key, it needs to assign a functional code to i/o field: but it's possible only for certain kinds of fields (checkbox, etc,....).

Max

Read only

RaymondGiuseppi
Active Contributor
0 Likes
4,242

This is a FAQ and the answer is NO (on SAPGUI) if the tested field doesn't allow a function code to trigger a PAI/PBO cycle.

So only those are allowed in selection-screen

AS CHECKBOX [USER-COMMAND fcode]

RADIOBUTTON GROUP group [USER-COMMAND fcode]

AS LISTBOX VISIBLE LENGTH vlen [USER-COMMAND fcode]

And in classic dynpro (extract from General Attributes )

Function code: This attribute is only for pushbuttons and input/output fields with the DropdownList box attribute.

Regards,

Raymond

Read only

Former Member
0 Likes
4,242

Hi ,

follow this code.

**********************************************************************

SELECTION-SCREEN: BEGIN OF SCREEN 1100.

PARAMETERS: u1 RADIOBUTTON GROUP a USER-COMMAND sel DEFAULT 'X',

             u2 RADIOBUTTON GROUP a,

             u3 RADIOBUTTON GROUP a.

SELECTION-SCREEN: END OF SCREEN 1100.

CALL SCREEN 1100.

AT SELECTION-SCREEN OUTPUT.

   IF u1 = 'X'.

     LOOP AT SCREEN.

       MODIFY SCREEN.

     ENDLOOP.

   ELSEIF u2 = 'X'.

     LOOP AT SCREEN.

       MODIFY SCREEN.

     ENDLOOP.

   ELSEIF u3 = 'X'.

     LOOP AT SCREEN.

       MODIFY SCREEN.

     ENDLOOP.

   ENDIF.

START-OF-SELECTION.

IF U1 EQ 'X'.

PERFORM user_email_list.

ELSEIF U2 EQ 'X'.

PERFORM user_editable_alv.

ELSEIF U3 EQ 'X'.

   PERFORM user_without_email_list.

ENDIF.

Regards,

venkat.

Read only

Former Member
0 Likes
4,242

Hi,

 

Check out the below link for module should be called when cusor is positioned on particular screen element.

http://help.sap.com/saphelp_470/helpdata/en/9f/dbabbd35c111d1829f0000e829fbfe/content.htm

The module <mod> is only called if the cursor is positioned on an input/output field <f> or an input/output field <fi> in the processing chain.

Read only

bharat_rathod2
Active Participant
0 Likes
4,242

Dear,

If your screen is not a standard SAP screen then put you logic in PAI and put module for modify screen between chain endchain for particular field.