cancel
Showing results for 
Search instead for 
Did you mean: 

BDT - How to set a field mandatory?

Former Member
0 Kudos

Dear Experts,

how can I set a BDT-Field mandatory?

I made an BDT-Application including a field group and a view and hooked it into the first tab of contract. Now, I want to have a certain field dynamically switched to mandatory if a specific condition is true.

I tried to set OUT_STATUS of my ZZGC_REGC_EVENT_FMOD2 function to u2018u2019 (required) but this puts to set the field group in edit mode even if the whole tab is in view mode. I can hide my subscreen though by using u2018-u2018 instead of u2018u2019 but is there a way to set a single field to mandatory?

Thanks for your help,

Jan Dahl

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi ,

Even i have tried to do similar thing and found out that, if we want to control filed status of a single field, we need to create separate field group only for that field, then we can control the status of the filed alone.

You are mentioning that based on some condition you want to make that field mandatory, then only option left with is to write that condition in BADI of the contract "Check All" method, which checks the condition and shows error message saying the field is mandatory. If you are using this BADI (BADI_RE_CN_CN), then you don't need to define only this field in a field group as using BADI we are controlling the field behavior.

Thanks,

Bala.

Former Member
0 Kudos

Hello Bala,

you have been able to set a field to mandatory by setting the whole field group mandatory? That would be sufficient for my case. How did you do that? I wasnu2019t even able to set fields statically to mandatory. Iu2019m still a newbie to RE-FX and BDT, maybe I donu2019t see the simple things.

Thanks

Jan

Former Member
0 Kudos

Hi,

You can make field group as mandatory through RE-FX config, but it make all the field in this filed group are mandatory.

goto spro\re-fx\contract\dialog\screen layout\field groups

Srini

Former Member
0 Kudos

Finaly I solved it. And it works like it is designd I was just confused the field was editable even in view mode. Now I don't touch the status when in view mode and change it only to 'required' when in edit mode.

To feedback the comunity, here is the code:

function z_gc_regc_event_zzgc20 .
* Wenn Vertrag Anwenderstatus OFFE dann Offe_datum = Pflicht

*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"  IMPORTING
*"     VALUE(FLDGR) LIKE  TBZ3W-FLDGR
*"     VALUE(IN_STATUS) LIKE  BUS000FLDS-FLDSTAT
*"  EXPORTING
*"     VALUE(OUT_STATUS) LIKE  BUS000FLDS-FLDSTAT
*"----------------------------------------------------------------------

*---------------------------------------------------------------------
* Set OUT_STATUS to
*   optional:        '.'
*   required:        '+'
*   display:         '*'
*   suppressed:      '-'
*
* IN_STATUS = SPACE means not specified
*
* FLDGR is the fieldgroup in BDT-Customizing
*---------------------------------------------------------------------

  if in_status = '*'.
* Edit mode
    out_status = in_status.
  else.

.... put your query here, for the field must be mandatory

    if YourQuery is true.
      out_status = '+'.
    else.
*   set default
      out_status = in_status.
    endif.
  endif.

endfunction.

Former Member
0 Kudos

See here

[|]

Former Member
0 Kudos

@Alexandr Faderov

With your note/link you can't swich a field dynamicly, your link discibe how to do it in customizing.