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: 

Problem in Module Pool-fill required entry

dipak_khatavkar
Participant
0 Kudos

Hi,

I have taken one text field mandatory if condition is true then this filed make obligatory and condition is false then  text filed will hide. its working properly.

but my problem is when i am changing the input value and this condition is false then also showing error 'fill required entry.' and after filling required entry the field is hiding.

so i want to show when i will changing the input value, suppose condition is true then field will hide without showing error MSG "fill required entry."

please help!!!

ex:

MODULE ABC OUTPUT. 

  IF zcustomer-cve_aut = 'B'.

    LOOP AT SCREEN.

      IF screen-name = 'name'.

        screen-required = '1'.

        MODIFY SCREEN.

      ENDIF.

    ENDLOOP.

  ELSE.  "if other c,d....

    LOOP AT SCREEN.

      IF screen-name = 'name'.

         screen-required= '0'.

        screen-invisible = '1'.

        screen-active  = '0' .

        MODIFY SCREEN.

      ENDIF.

    ENDLOOP.

  ENDIF.

ENDMODULE.

Thanks!!

Dipak.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello Dipak,

As per my understanding i can say ...

clear : zcustomr-cve.

clear the values of (zcustomr-cve) status & other variable values in PBO, otherwise the values which are existing previously will cause the error.

plzz explain u r doubt clearly. i can help u.

30 REPLIES 30

raymond_giuseppi
Active Contributor
0 Kudos

Try to attach an function code/user command to field checked in the condition (zcustomer-cve_aut) to trigger a PAI/PBO event.

The field must be a checkbox/radiobutton or use a dropdown list to allow this option. Define the function code as an exit command to bypass screen controls.

Regards,
Raymond

former_member209722
Participant
0 Kudos

Hi

Check system fields SY-MSGID and SY-MSGNO which are related to Message display...Try to clear and check.

Thanks,

Chandra

Former Member
0 Kudos

Hi,

you are telling that you made manade text field and checking values for it.

then your giving value in selection screen.

use

AT START OF SELECTION OUTPUT.

loop at screen.

**write logic**

endloop.

why you are writing in pbo ???

Thank and Regards

0 Kudos

yes i have written code in PBO because status filed means zcustomr-cve_aut field is 'B' then zcustomer-m_rech filed will be mandatory in my pgm if zcustomr-cve not 'B' then zcustomer-m_rech field will be hide.

so my problem is when user changes status B to some other status then zcustomer-m_rech
will be hide but i get error msg fill required entry. i tried to debug but when 1st time set to set status 'B.' & suppose user changes then field will not be hide.

Former Member
0 Kudos

Hi,

Please debug and check. The contents of field zcustomer-cve_aut might not be changing.

Regards,

Danish

Former Member
0 Kudos

Hello Dipak,

As per my understanding i can say ...

clear : zcustomr-cve.

clear the values of (zcustomr-cve) status & other variable values in PBO, otherwise the values which are existing previously will cause the error.

plzz explain u r doubt clearly. i can help u.

0 Kudos

MODULE ABC OUTPUT. 

  IF zcustomer-cve_aut = 'B'.

    LOOP AT SCREEN.

      IF screen-name = 'ZCUSTOMER_M_RECH'.

        screen-required = '1'.

        MODIFY SCREEN.

      ENDIF.

    ENDLOOP.

  ELSE.  "if other c,d....

    LOOP AT SCREEN.

      IF screen-name = ZCUSTOMER_M_RECH'.

      screen-required= '0'.

        screen-invisible = '1'.

        screen-active  = '0' .

        MODIFY SCREEN.

      ENDIF.

    ENDLOOP.

  ENDIF.

ENDMODULE.

SUPPOSE status zcustomer-cve_aut equal to 'B' then zcustomer-m_rech filed will make mandetory second case if not B then zcustomer-m_rech will hide. its working no doubts.

but in that case  user changed status to C or D or any other then value will not refresh error shown fill required entry ,when user fill this required entry after that field is hiding.

i want when user change status B to C or any that time this value will refresh and without showing error MSG, it will hide.

so , tried to clear but its no working .

pls help

0 Kudos

MODULE ABC OUTPUT. 

  IF zcustomer-cve_aut = 'B'.

    LOOP AT SCREEN.

      IF screen-name = 'ZCUSTOMER_M_RECH'.

        screen-required = '1'.

        MODIFY SCREEN.

      ENDIF.

    ENDLOOP.

  ELSE.  "if other c,d....

    LOOP AT SCREEN.

      IF screen-name = ZCUSTOMER_M_RECH'.

      screen-required= '0'.

        screen-invisible = '1'.

        screen-active  = '0' .

        MODIFY SCREEN.

      ENDIF.

    ENDLOOP.

  ENDIF.

ENDMODULE.

SUPPOSE status zcustomer-cve_aut equal to 'B' then zcustomer-m_rech filed will make mandetory second case if not B then zcustomer-m_rech will hide. its working no doubts.

but in that case  user changed status to C or D or any other then value will not refresh error shown fill required entry ,when user fill this required entry after that field is hiding.

i want when user change status B to C or any that time this value will refresh and without showing error MSG, it will hide.

so , tried to clear but its no working .

pls help

0 Kudos

Hi,

you may not able to solve this ,  change your logic , instead of making that field mendetory Issue error meesage programatically in PBO if field ZCUSTOMER_M_RECH  is empty & zcustomer-cve_aut = 'B'

Thanks

Raj

0 Kudos

Hi,

in your screen or selection screen you would have define the field obligatory.

Instead of making it obligatory, define input as possible and in PBO you can write the above logic.

And also by ONLY writing "screen-active  = '0' ." would hide the field.

Regards,

Gaurav.

0 Kudos

Hi,

First ensure that for screen field ZCUSTOMER_M_RECH, in the screen layout, under Program attributes, both Input field and Output field checkbox is checked. Also, ensure that the Input is selected as "Possible".

Try the below code in your PBO.

    LOOP AT SCREEN.
    IF SCREEN-NAME EQ 'ZCUSTOMER_M_RECH'.
      IF ZCUSTOMER-CVE_AUT EQ 'B'.
        SCREEN-REQUIRED = 1.
      ELSE.
        SCREEN-ACTIVE = 0.
      ENDIF.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

Regards,

Danish

0 Kudos

Hi Danish,

I want ZCUSTOMER-M_RECH field hide and required based on status of ZCUSTOMER-CVE_AUT. if ZCUSTOMER-CVE_AUT = 'B' that time only ZCUSTOMER-M_RECH filed will required or available.

its working but when first time status is 'B' and that time  ZCUSTOMER-M_RECH  will required, and user was not filled  required entry.
suppose user changed status to C or any that time also showing error fill require entry,when user fill the required entry after that filed is hiding .so its not correct behavior. i tried to debug.





0 Kudos

Hi Dipak

Here are the two options what you can do.

First of all when value of ZCUSTOMER-CVE_AUT changes you can write

CHAIN.

FIELD  ZCUSTOMER-CVE_AUT module M_validate on chain-request.

ENDCHAIN.

As  soon as your value of this field changes the above module will get triogger where based on value you can loop at screen and make the field not obligatory.

Second solution is you just hide the the field based on value using the above apporach and check mandatory and all in PAI and throw some error message rather than making it mandatory your self.

I hope it answer your query.

Thanks

Nabheet

0 Kudos

Hi,

Listen what you can do is remove the screen-required = 1 check from your PBO. Handle all validations in your PAI.

Try this.

* Add this in PBO

    LOOP AT SCREEN.
    IF SCREEN-NAME EQ 'ZCUSTOMER-M_RECH'.
      IF ZCUSTOMER-CVE_AUT EQ 'B'.
        SCREEN-ACTIVE = 1.
      ELSE.
        SCREEN-ACTIVE = 0.
      ENDIF.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

* Add this in PAI

  IF ZCUSTOMER-CVE_AUT EQ 'B'.
    IF ZCUSTOMER-M_RECH IS INITIAL.
      MESSAGE 'Your error message' TYPE 'E'.
    ENDIF.
  ENDIF.

Regards,

Danish.

0 Kudos

hi

i have removed code from PBO

and just make Validation  in PAI.

IF ZCUSTOMER-CVE_AUT EQ 'B'.

    IF ZCUSTOMER-M_RECH IS INITIAL.

      MESSAGE ID 'ZE' TYPE 'E' NUMBER '369'.

    ENDIF.

  ENDIF.

IF ZCUSTOMER-CVE_AUT NE 'B'.

    IF ZCUSTOMER-M_RECH IS not INITIAL.

      clear zcustomer-m_rech.

  ENDIF.

  endif.

for time-being its working but customer want to hide this field.

if you have any solution then pls help.

Thanks.

0 Kudos

Hi,

The hiding part was already mentioned by me in the previous post as I had told you that hiding part is to be done in PBO and validating to be done in PAI.

Regards,

Danish.

0 Kudos

Thanks Nabheet.

Its working fine now,

BY using

CHAIN.

FIELD  ZCUSTOMER-CVE_AUT module M_validate on chain-request.

ENDCHAIN.

0 Kudos

All Issues resolved?

Nabheet

0 Kudos

Solved issue of required field entry error msg

No, issue is field is not hiding when ZCUSTOMER-CVE_AUT NE 'B'

I have tried to using screen-invisible = 1 but in PAI its bot working.

0 Kudos

Here is what you can do.

In PBO check the value of this field.

If A-->Hide it

loop at screen

if screen-name eq 'ABC'.

screen-active = 0.

modify screen.

endif.

endloop.

If B display it

loop at screen

if screen-name eq 'ABC'.

screen-active = 1.

modify screen.

endif.

endloop.

0 Kudos

Here is what you can do.

In PBO check the value of this field.

If A-->Hide it

loop at screen

if screen-name eq 'ABC'.

screen-active = 0.

modify screen.

endif.

endloop.

If B display it

loop at screen

if screen-name eq 'ABC'.

screen-active = 1.

modify screen.

endif.

endloop.

0 Kudos

yes i have tried this one PBO , field is hiding but when status is changes to B then m_rech is not showing obligatory

0 Kudos

yes i have tried this one PBO , field is hiding but when status is changes to B then m_rech is not showing obligatory

0 Kudos

Hi

In this case you can put a check in PAI in same module  chain endchain if staus is B and Field 2 is empty then display error

0 Kudos

Hi

In this case you can put a check in PAI in same module  chain endchain if staus is B and Field 2 is empty then display error

0 Kudos

Hi

In this case you can put a check in PAI in same module  chain endchain if staus is B and Field 2 is empty then display error

Former Member
0 Kudos

Hi,

I have taken one text field mandatory if condition is true then this filed make obligatory and condition is false then  text filed will hide. its working properly.

are you trying with DEFAULT is obligatory[required field], just put as normal field and make it mandatory when it is required.

Hope it will solve your issue...

Former Member
0 Kudos

Hi Dipak,

You can do one thing. When u going to hide-unhide the fields at that time check the field which is mandatory and you going to hide it. If its blank then pass some value to the field before doing hiding process and then after hiding it jus immediately clear its assigned value..

Hope this will help you.

Former Member
0 Kudos

Hi,

Try using the below statement

screen-required = 2.  "used for conditional mandatory fields

Regards,

Sharin

Former Member
0 Kudos

Hello Deepak...

I worked on your problem...The following details will solve your problem. This is working fine.

Things u need to do.

1) whenever we encounter the mandatory field , we must need At Exit-command to avoid it.

we are not going to use it in this case when the value is not 'B' .

>>>>>  so make that field as not a mandatory field.   ( change that screen field to "possible" ,  don't keep it as "required")

2)  Do the following code..

The following  code is perfectly working ...

DATA : zval(1) TYPE c.

DATA : ztext_now(10) TYPE c.

DATA : zflag(1) TYPE c.

MODULE status_1234 OUTPUT.

  IF zval = 'B'  AND zflag = 'X'.

    LOOP AT SCREEN.

     IF screen-name = 'ZTEXT_NOW'.

*        screen-required = '1'.    "  <<<<< comment this , otherwise this will make mandatory field

        screen-invisible = '0'.

        screen-active  = '1' .

        MODIFY SCREEN.

      ENDIF.

    ENDLOOP.

  ELSEIF zval NE 'B' AND zflag EQ ' '.

    LOOP AT SCREEN.

      IF screen-name = 'ZTEXT_NOW'.

        screen-active  = '0' .

        MODIFY SCREEN.

      ENDIF.

    ENDLOOP.

  ENDIF.

ENDMODULE.                 " STATUS_1234  OUTPUT

*---------------------------------------------------

MODULE user_command_1234 INPUT.

  IF zval = 'A'.

    zflag = 'X'.

  ELSE.

    zflag = ' '.

  ENDIF.

ENDMODULE.                 " USER_COMMAND_1234  INPUT

change the variable's according to your requirement .

zval  represent variable for  (A/B/C)

( ztext_now represent a variable which is going to be display / hide)

if u have any issues.. come back again..

Thanks & Regards

JVS