cancel
Showing results for 
Search instead for 
Did you mean: 

CRM WebUi - Saving possible, also when mandatory field is empty

Private_Member_19084
Active Contributor
0 Kudos

Hi experts,

on creation/editing screen of incident, I've maintained a view fields as mandatory (e.g. description).

But when the descripition field is empty, saving is also possible?!?!

I get an error message in the header, that I've to fill out the empty fields, however saving is possible and it creates a new incident order.

How can I make a mandatory field to a real mandatory field?

Or how can I change the "saving-process" so, that it is only possible, when no mandatory fields are empty?

Thx in advance

Accepted Solutions (1)

Accepted Solutions (1)

VishnAndr
Active Contributor
0 Kudos

Hello, Christian.

There is a parameter NO_SAVE_MAND_FIELDS in table SMOFPARSFA which control the behavior. Check if the Note 1353553 - Opportunity: Behavior of mandatory fields in Web UI which introduced this parameter will be helpful for you.

Private_Member_19084
Active Contributor
0 Kudos

Thx a lot for help

do you know, is there a possibility, to exit the screen after saving, or go automatically in display mode?

Thx

Former Member
0 Kudos

Hi Christian,

We can change a view into display mode when ever we want by using IF_BSP_WD_VIEW_GROUP_CONTEXT . Just redefine the SET_VIEW_GROUP_CONTEXT(under Request Processing)  method and write the fallowing code.

if iv_first_time eq abap_true and view_group_context is initial.

     if iv_parent_context is initial.

       create object view_group_context

         type

           cl_bsp_wd_view_group_context.

     else.

       view_group_context ?= iv_parent_context.

     endif.

   endif.

Now at any condition in any event u can make the view into display mode by using the methods.

SET_ALL_EDITABLE (to change into editable) & RESET(To change into display mode).


VishnAndr
Active Contributor
0 Kudos

Christian,

sometimes there is a button like 'Save and back' available on different views. Check its logic somewhere. Perhaps me or other members will be able to provide more help if you tell us which component/view you are talking about.

Private_Member_19084
Active Contributor
0 Kudos

First thx again for help,

I talk about the Incident screen. There is only a button called save.

Another question at this time, can I also remove buttons by designing views, not or?

Or how can I maintain the button "more", on what is it depending?

Thx for help

Private_Member_19084
Active Contributor
0 Kudos

Hi Ravi,

could you please explain the steps to realize this a little bit more exactly.

Where do I have to implement this coding, is it a badi?

And how can I use the methods (editable/display mode), is it via an action?

Thx in advance

VishnAndr
Active Contributor
0 Kudos

Christian,

if there is no such button as "Save and Back" I'd suggest to ask you ABAP folks to implement it in similar way as in other components/views where it is presented.

Generally you can not remove buttons by configuration. Some coding is needed.

Button more will appear if you have more buttons then the number of visible buttons. Best practice is to use IF_BSP_WD_TOOLBAR_CALLBACK~GET_BUTTONS (or IF_BSP_WD_DYN_BTN_CONTROL~GET_LOCAL_TOOLBAR_BUTTONS)  method of view controller to set buttons (all buttons), but sometimes there is a coding in DO_PREPARE_OUTPUT method or somewhere else to do the same. And accordingly there should be method like IF_BSP_WD_TOOLBAR_CALLBACK~GET_NUMBER_OF_VISIBLE_BUTTONS

(or IF_BSP_WD_DYN_BTN_CONTROL~GET_NO_OF_VISIBLE_TOOLBAR_BTNS ) to set the number of visible buttons.

So if you have 8 buttons and set number of visible buttons to 3 it will be 3 buttons available and More button under which other buttons will be placed.

Former Member
0 Kudos

Hi Christian,

Go to SET_VIEW_GROUP_CONTEXT method and redefine it. Then add the fallowing the code.

if iv_first_time eq abap_true and view_group_context is initial.

     if iv_parent_context is initial.

       create object view_group_context

         type

           cl_bsp_wd_view_group_context.

     else.

       view_group_context ?= iv_parent_context.

     endif.

   endif.

Now based on your requirement u can change the view into edit / display mode as i mention in previous post by using the methods SET_ALL_EDITABLE and RESET.

ex: when ever click on the EDIT button ,then if u have to make the view into editable, call the view_group_context->set_all_editable in the edit event handler method. if u want to make the view non editable always then call reset method in do_prepare_output.

I hope this will useful...

Thanks & Regards..

Y Ravi Kumar...

Private_Member_19084
Active Contributor
0 Kudos

Hi Ravi,

first sorry for my late answer.

I am a bit confused lol

Could you please explain again, how to implement the method to change the view from edi to displaymode.

I would like to react on saving (so after saving it sould change to display mode).

I already found a BADI in saving-process.

But I don't understand, how I can implement your coding.

In which transaction do I've to do this???

Could you explain the steps a little bit more exactly.

Would be great, 1000 thx to you

Former Member
0 Kudos

Hi Christian,

go to bsp_wd_cmpwb transaction and open your component.

After that goto the view which you want to make display mode or edit mode.

In that view go to request processing folder and redefine the method SET_VIEW_GROUP_CONTEXT and give the code as i mention in my previous post.

after doing redefine and activating the method .

Making the view display only after saving:

go to save event handler method and call the method view_group_context->reset( )(after saving code).

hope this will help you....

Regards..

Y.Ravi Kumar.

Private_Member_19084
Active Contributor
0 Kudos

Hi Ravi,

thx a lot again for help.

I already found the method you mean, but how can I redefinie it?

When I click on redefine, I always get a popup for registry-key.

Do I have to make an modification?

Or do I've to make an Enhancement Set???

If yes, how?

I tried this but it don't worked, could you please explain, what I've to do to enhance a component without registry key!?

BTW:

I tried this to make an enhancement set, but it don't works:

1. TA BSP_WD_CMPWB with component AIC_INCIDENT_H

2. I created an enhancement set named ZITSM

3. I click on display

4. I click on "Enhance Component"

5. I enter a name for appication and bsp

6... and at this step I don't know what to do next....

Thx a lot

Former Member
0 Kudos

Hi Christian,

After that just right click on the view and select enhance on which u want to enhance.After this system will create a zclass. So after that simply redefine methods what ever u want to add code and based on your requirement call the super class method(which already given as commented).

Private_Member_19084
Active Contributor
0 Kudos

Hi Ravi,

thx a lot for help.

Now I got the redefined method.

But it don't seems to work.

I activated it and set an external break-point in there.

And also in the original method set_view_group_context (not Z).

But the break-point only stops at the original method, not at my definition.

Do I've to activate something else?

Or what else is missing?

btw: the Icon near my method (in bsp_wd_cmpwb) is green.

Thx for help

Private_Member_19084
Active Contributor
0 Kudos

@ Ravi, could you please give me another tip, thx in advance

Private_Member_19084
Active Contributor
0 Kudos

New Solution

Hi experts, and many thx to Ravi for great help.
However, now I found an option, to change to display-mode after saving in customizing.

There is a customizing table called AGS_WORK_CUSTOM

Append there the entry IM_READONLY_AFTER_SAVE with a 'X'.

I found this entry in the type-goup AGSWI.

It seems, as there are more interessting options

Thx to all for help

Former Member
0 Kudos

Hi Ravi,

  I need your valuable help..

  i have written the code in Do_Prepare_Method( ) to display the messages on WEB UI Sales Order..

But i got strucked up at once my message is daiplayed on the screen Order should not be saved.I dont know how to stop saving the order, i have an idea order_savi badi but in my case i am not using that BADI soo pls provide methe code to stop order saving..\

My Functional Requirement : Based on Zipcode which has added by AET  messages have to be diaplayed

   SELECT SINGLE * FROM ZTOTC_PLANT_DET INTO IT_ZTOTC_PLANT_DET WHERE ZIPCODE = zip_code2.
      IF SY-SUBRC <> 0.
        lv_msg_service1 = me->view_manager->get_message_service( ).

        lv_msg_service1->add_message(  iv_msg_type   = 'E'
                                      iv_msg_id     = 'ZOTC'
                                      iv_msg_number = '001' ).

  after diaplaying the error mesaages i need to write the logic to stop saving process for order..

pls help me out.

Regards

Sandya

Answers (2)

Answers (2)

0 Kudos

I have the same question, but within a BP.

How you solved it?

Thanks.

Former Member
0 Kudos

Hi Christian,

Check out the method EH_ONSAVE , there should be some logic to check whether all mandatory fields are filled or not and it will eventually determine whether save should be performed based on it.

Regards,

Nithish