Application Development 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: 

Table control + mandantory fields, and cancel button

Former Member
0 Kudos

Hello Friends,

I have a table control which have some mandantory fields, the issue is, when I click on cancel button, still the msg comes that mandantory fields should be fillied ?

How I can avoid this issue ...

Regards,

26 REPLIES 26

Former Member
0 Kudos

Give LEAVE program in CANCEL BUtton

Former Member
0 Kudos

Hello,

Write a module in PAI with <b>at exit command </b>adition.

Write that cancel ok_code capture in that module.

remember the function type of the cancel to be 'E'.

This will surely work.

Reward if found helpfull.

Regards rakesh.

Former Member
0 Kudos

hi,

write like this at table control screen,

module exit_prg at exit-command.

and doble click on module, write code like this,

module exit_prg input.

if sy-ucomm = 'CANCEL'.

leave program.

endif.

endmodule. " exit_prg INPUT

and your CANCEL button's Functional type should be E 'Exit command' in the PF-STATUS

reward points if useful,

regards,

seshu.

Former Member
0 Kudos

Hi,

Have you tried with at exit command?

In PAI add 'MODULE exit_control at exit-command.'

module exit_control input.

case ok_code.

when 'EXIT'.

leave program.

endcase.

endmodule. " exit_control INPUT

0 Kudos

Hello All,

On cancel button, I have already given 'Leave Program'....

What I can do further to exit when user press cancel button ?

Regards,

0 Kudos

The thing is following:

If I do not place any entry in table control, and press cancel button things works fine, but if 1 column is fillied, in table control, but still I want to cancel, then comes the msg, tha all mandantory fields should be filled...

Regards,

I have a module called MODULE USER_COMMAND_0100 INPUT, and there I am leaving the program when is cancel button pressed !

Message was edited by:

Shah H

0 Kudos

Hello dear,

you shoul write that code inside a module that having AT EXIT-COMMAND addition. Then only it will work. Otherwise it will not work as those are automatic field checks provided by SAP.

Regards,

Rakesh.

0 Kudos

did you made ur CANCEL button's Functional type as E 'Exit command' in the PF-STATUS of ur screen?

0 Kudos

Hello,

Thanks I will try with exit command, .... and will let you guys know...

Regards,

0 Kudos

All the best, I'm sure it will work.

Regards rakesh.

0 Kudos

Hi Rakesh,

Unfortunatelly, it did not work, or might be I made some mistake:

Well I did followings:

I created a new PAI module see code pls:

process after input.

*&spwizard: pai flow logic for tablecontrol 'Z_TAB_CTRL'

MODULE EXIT AT EXIT-COMMAND.

loop at g_z_tab_ctrl_itab.

chain.

field zenco_tab_ctrl-videocodec.

field zenco_tab_ctrl-BITC.

field zenco_tab_ctrl-AUDIO.

field zenco_tab_ctrl-kommentar.

field zenco_tab_ctrl-videonorm.

field zenco_tab_ctrl-hdformat.

field zenco_tab_ctrl-bitratemin.

field zenco_tab_ctrl-bitrateave.

field zenco_tab_ctrl-bitratemax.

field zenco_tab_ctrl-videosize.

field zenco_tab_ctrl-aspectratio.

field zenco_tab_ctrl-qc_level.

module z_tab_ctrl_modify on chain-request.

endchain.

endloop.

module z_tab_ctrl_user_command.

*&spwizard: module Z_TAB_CTRL_change_tc_attr.

*&spwizard: module Z_TAB_CTRL_change_col_attr.

module user_command_0100.

process on value-request.

And this is my module:

MODULE EXIT INPUT.

save_ok = ok_code.

CLEAR ok_code.

CASE save_ok.

WHEN 'E'.

  • leave PROGRAM.

LEAVE TO SCREEN 0.

ENDCASE.

ENDMODULE.

Any idea what I am doing wrong ?

Regards,

0 Kudos

put a BREAK-POINT in MODULE EXIT INPUT and see what's happening

0 Kudos

I try to debug it, but in debug mode, the control is not comming to exit module ?

Why, even the first line of my PAI is exit module...

<b>

Well what I notice is when I do double click on moduel exit, it gives me msg that, "PAI mdoule EXIT is not used in Screen of the program SAPLZ_popup"</b>

Any idea, what is going on ?

Message was edited by:

Shah H

0 Kudos

go to your PF-STATUS, click on the CANCEL icon, there it will ask for Functional type, give E in it, it will solve your problem

0 Kudos

Hello Tripat,

my cancel button is on screen, and using screen painter, I have place the fctcode to 'E'

Regards,

0 Kudos

buddy, its Functional type not Function Code, Functional type should be E, and function code can be any name you want to pass to SY-UCOMM, which u have given as E but i'll prefer to give Function Code as CANCEL

Message was edited by:

Tripat Pal Singh

0 Kudos

Well it was before CANCEL I do not understand your point, ...

What I want is, when user press the cancel button on screen, the screen should be cancelled, and not asked for mandantory fields to be filled.....

THE PF-STATUS relation with cancel button, can you pls explain a bit more, mean while I will set the PF_STATUS

Regards,

0 Kudos

Hello Tripat,

I now even set the PF-STATUF for cancel button ( it did not work for me ) , but I think there is one mis-understanding going on I guess you are talking about the cancel button on top menu ? right, .,,,

Actually, as I said I have my own button on screen, which I created using screen painter, and this is the button which should exit when user press it, ( and even when mandantory fields are not filled )...

Regards,

0 Kudos

see, if one wants to exit screen programing, then one must write MODULE EXIT AT EXIT-COMMAND. if u write LEAVE TO SCREEN 0 in MODULE USER_COMMAND, then all the code will be processed before this module as in ur case the code is

oop at g_z_tab_ctrl_itab.

chain.

field zenco_tab_ctrl-videocodec.

field zenco_tab_ctrl-BITC.

field zenco_tab_ctrl-AUDIO.

field zenco_tab_ctrl-kommentar.

field zenco_tab_ctrl-videonorm.

field zenco_tab_ctrl-hdformat.

field zenco_tab_ctrl-bitratemin.

field zenco_tab_ctrl-bitrateave.

field zenco_tab_ctrl-bitratemax.

field zenco_tab_ctrl-videosize.

field zenco_tab_ctrl-aspectratio.

field zenco_tab_ctrl-qc_level.

module z_tab_ctrl_modify on chain-request.

endchain.

endloop.

module z_tab_ctrl_user_command.

*&spwizard: module Z_TAB_CTRL_change_tc_attr.

*&spwizard: module Z_TAB_CTRL_change_col_attr.

and will throw the message.

MODULE EXIT AT EXIT-COMMAND is processed directly without processing any other code whenever a button EXIT,BACK,CANCEL is pushed, but given that ((((((Functional Type is E))))))))

0 Kudos

Hello Tripat,

Okey, thanks for your descriptive answer

<b>MODULE EXIT AT EXIT-COMMAND is processed directly without processing any other code whenever a button EXIT,BACK,CANCEL is pushed, but given that ((((((Functional Type is E))))))))</b>

But the button you are talking about are in PF-STATUS, I am talking about my own button, which is created using screen painter ? ( right ?.... well I have even set the PF-STATUS but the thing is my screen is displayed as a pop-up, and in pop-up those buttons which you are refering in PF-STATUS are not avaiable... )

<b>I have to exit the program when user press the cancel button which I have created using screen painter.</b>

0 Kudos

when you double click on your screen button in screen painter, an attribute window will open, give whatever code you wanna give in FctCode, this will be value OK_CODE will b carrying when that button is pushed, on it's right side is FctType with dropdown, select E from dropdown. now when u r running this program and u push this button, MODULE EXIT AT EXIT-COMMAND will be processed, in that module write LEAVE TO SCREEN 0, thats it

0 Kudos

Change name of module 'EXIT' to some other name like 'ON_EXIT'.

Write code for ON_EXIT by double clicking and creating the Module - End module statememts.

regards.

Manjunatha

Former Member
0 Kudos

*write a module in ur PAI. write it as the very first line in PAI.

MODULE EXIT AT EXIT-COMMAND.

in this module write LEAVE TO SCREEN 0.

and make sure that ur CANCEL button's Functional type should be E 'Exit command' in the PF-STATUS

Former Member
0 Kudos

In PAI of screen you should use this module.. only then this will be called

PROCESS AFTER INPUT.

MODULE MODULE_EXIT at exit-command.

0 Kudos

hi Srinivasa,

I have tried to change the name of the module as well, but still it did not work ?

Any one has any idea, what I am doing wrong ?

Regards,

Former Member
0 Kudos

yes, mean time I tried the same as you mentioned in your post...

And it works, ... thanks for your reply,..