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

Problem with Check box in module pool Programming

Former Member
0 Likes
13,887

Hi,

I have developed Screen which is look like below screen.In that whenever i selected check box it is showing error 'Enter a valid value'.Actually my requirement is I have to check check box and select value in drop down.I didn't take fct code for check box and drop down.Please help.Error screen is attached below.

32 REPLIES 32
Read only

Former Member
0 Likes
12,039

Hi Sai,

Could you please send your chack box and dropdown properties in a screen shot.

Thanks

Read only

0 Likes
12,039

Hi Mohan,

Thank you responding my question.Here are the screen shots for both.I didn't write anything in PAI Module.

This is for checkbox.

This is for drop down

This is my code already have.

*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.

*  Data:ok_code1 type sy-ucomm,
*         Check type c.
*
**  if ok_code1 = check.
*     if CHECK = 'X'.
*       wever = 'Collective Slip'.
*       elseif
*         wever = 'Individual Slip'.
*         elseif
*           wever = 'Individual Slip with Inspection Text'.
*          " Do coding for the pop up"
*      Endif.
**    Endif.
   CASE sy-ucomm.
     WHEN 'BACK'.
*Give warning and then leave the program.
*       For clearing the screen.
       CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
         EXPORTING
          defaultoption        = 'Y'
           textline1            = 'Are you sure to Exit from the current Transaction ?'
*         TEXTLINE2            = ' '
           titel                = 'GRN CONFIRMATION'
*         START_COLUMN         = 25
*         START_ROW            = 6
*         CANCEL_DISPLAY       = 'X'
        IMPORTING
          answer               = answer.

       IF answer EQ 'J'.

         LEAVE PROGRAM.

       ELSEIF answer EQ 'N'.
*
         EXIT.
       ENDIF.

     WHEN 'EXIT'.
*Give warning and then leave the program.
*       For clearing the screen.
       CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
         EXPORTING
          defaultoption        = 'Y'
           textline1            = 'Are you sure to Exit from the current Transaction ?'
*         TEXTLINE2            = ' '
           titel                = 'GRN CONFIRMATION'
*         START_COLUMN         = 25
*         START_ROW            = 6
*         CANCEL_DISPLAY       = 'X'
        IMPORTING
          answer               = answer.

       IF answer EQ 'J'.

         LEAVE PROGRAM.

       ELSEIF answer EQ 'N'.
*
         EXIT.
       ENDIF.

     WHEN 'CANCEL'.
*            break-point.
*       For clearing the screen.
       CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
         EXPORTING
          defaultoption        = 'Y'
           textline1            = 'Are you sure to Exit from the current Transaction ?'
*         TEXTLINE2            = ' '
           titel                = 'GRN CONFIRMATION'
*         START_COLUMN         = 25
*         START_ROW            = 6
*         CANCEL_DISPLAY       = 'X'
        IMPORTING
          answer               = answer.

       IF answer EQ 'J'.

*        PERFORM clear_fields_cancel.
         MESSAGE i003(zgrn) WITH 'GRN not created.'.
         PERFORM clear_fields_cancel.
         LEAVE TO SCREEN 0100.           " phani edited"""
       ELSEIF answer EQ 'N'.
*
         EXIT.
       ENDIF.

*            LEAVE PROGRAM.

   ENDCASE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT

Read only

venkateswaran_k
Active Contributor
0 Likes
12,039

Hi Sai,

1. Please provide us with the properties you set for the checkbox and dropdown fields.

2. Please provide us with what you have entered under PAI .. 

   

Regards,

Venkat

Read only

0 Likes
12,039

Hi Venkat,

Thanks for responding my question.Here is my screen shots and code.I didn't write any code.Please help me.

This is my Check box attributes

This is my drop down attributes

This is my code having in PAI user command.

*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.

*  Data:ok_code1 type sy-ucomm,
*         Check type c.
*
**  if ok_code1 = check.
*     if CHECK = 'X'.
*       wever = 'Collective Slip'.
*       elseif
*         wever = 'Individual Slip'.
*         elseif
*           wever = 'Individual Slip with Inspection Text'.
*          " Do coding for the pop up"
*      Endif.
**    Endif.
   CASE sy-ucomm.
     WHEN 'BACK'.
*Give warning and then leave the program.
*       For clearing the screen.
       CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
         EXPORTING
          defaultoption        = 'Y'
           textline1            = 'Are you sure to Exit from the current Transaction ?'
*         TEXTLINE2            = ' '
           titel                = 'GRN CONFIRMATION'
*         START_COLUMN         = 25
*         START_ROW            = 6
*         CANCEL_DISPLAY       = 'X'
        IMPORTING
          answer               = answer.

       IF answer EQ 'J'.

         LEAVE PROGRAM.

       ELSEIF answer EQ 'N'.
*
         EXIT.
       ENDIF.

     WHEN 'EXIT'.
*Give warning and then leave the program.
*       For clearing the screen.
       CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
         EXPORTING
          defaultoption        = 'Y'
           textline1            = 'Are you sure to Exit from the current Transaction ?'
*         TEXTLINE2            = ' '
           titel                = 'GRN CONFIRMATION'
*         START_COLUMN         = 25
*         START_ROW            = 6
*         CANCEL_DISPLAY       = 'X'
        IMPORTING
          answer               = answer.

       IF answer EQ 'J'.

         LEAVE PROGRAM.

       ELSEIF answer EQ 'N'.
*
         EXIT.
       ENDIF.

     WHEN 'CANCEL'.
*            break-point.
*       For clearing the screen.
       CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
         EXPORTING
          defaultoption        = 'Y'
           textline1            = 'Are you sure to Exit from the current Transaction ?'
*         TEXTLINE2            = ' '
           titel                = 'GRN CONFIRMATION'
*         START_COLUMN         = 25
*         START_ROW            = 6
*         CANCEL_DISPLAY       = 'X'
        IMPORTING
          answer               = answer.

       IF answer EQ 'J'.

*        PERFORM clear_fields_cancel.
         MESSAGE i003(zgrn) WITH 'GRN not created.'.
         PERFORM clear_fields_cancel.
         LEAVE TO SCREEN 0100.           " phani edited"""
       ELSEIF answer EQ 'N'.
*
         EXIT.
       ENDIF.

*            LEAVE PROGRAM.

   ENDCASE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT

Read only

0 Likes
12,039

Hi Ganesha,

Change MKPF-WEVER to another name without reference to dictionary

or VERS as shown below

It will solve your problem

Read only

0 Likes
12,039

Hi Susmitha,

I have already tried that one also.But it is not working.When ever i selected that check box it show enter a valid value.Actually that check box is MKPF-WEVER field.

Read only

0 Likes
12,039

Dear Ganesha,

Why do you have to link the checkbox to dictionary?

I have written the code that will approximately do what you want in the previous question you had raised.

https://scn.sap.com/thread/3416579

Check this link, the check box is a normal character variable.

You can have your wever variable also in the screen, to store the value for wever, that need to be passed to the GR. This is maintained as drop down as you wish.

What are the values you want in the drop down when the check box is ticked and unchecked? Populate the drop down in the code above accordingly.

I guess you want the drop down to be populated only if the checkbox is ticked.

So modify the above code to populate drop down like this.

FORM ddown_value .

      data: lv_name type vrm_id,
          lt_list type vrm_values,
          ls_value like line of lt_list.

     refresh lt_list.
     clear lt_list.
        if vers = 'X'.

   

          ls_value-key = '01'.
          ls_value-text = ' Collective slip'.
          append ls_value to lt_list.
   
         ls_value-key = '02'.
         ls_value-text = 'Individual slip'.
         append ls_value to lt_list.

         ls_value-key = '03'.
         ls_value-text = 'Individual slip with Inspection text'.
         append ls_value to lt_list.


       endif.


       lv_name = 'WEVER'.
      call function 'VRM_SET_VALUES'
      exporting
        id     = lv_name
        values = lt_list.

ENDFORM.                    " F4_VALUE_COL2

Then once the value is selected from drop down, pass value in wever to the GR BAPI structure.

Read only

Former Member
0 Likes
12,039

Its because it is linked to the dictionary, just declare it as a normal char field.

Refer my answer to your previous question.

Read only

Former Member
0 Likes
12,039

Hi Sai Ganesh ,

   Your question is not that clear ,and i am replying based on what i understood from your problem ,

problem is not at the screen painter .

  • May be you would have assigned value other than 'x' to your check box
  • declared checkbox wrong in the flow logic
  • you might have validated check box with some other value and thrown error 
    say   if check_box != 'a' 

                   'error message ' .

check this link out it will be helpful for you  

http://help.sap.com/saphelp_nw04/helpdata/en/e6/83a0375b5dd003e10000009b38f8cf/content.htm

Regards ,

Juneed K Manha

Read only

Former Member
0 Likes
12,039

Hi Sai,

The name of the variable mapped on the screen check the type of the variable it should be C and length 1.

Also double click on the error it will show you whether it is standard error or custom.. if custom check your own program for validation.

Regards

Read only

0 Likes
12,039

Hi Mohammed,

how to find system whether it is standard error or custom.I think it is standard error.I didn't write any validations for check box.I will attach my error.Please check it and help me.

Read only

himanshu_gupta13
Product and Topic Expert
Product and Topic Expert
0 Likes
12,039

Hi Sai,

type of checkbox should be character type of one length or the data dictionary type should also be character type of one length.

Himanshu

Read only

0 Likes
12,039

Hi Himanshu,

You are right.

I have taken from dictionary i.e From MKPF table in that WEVER is having length 1 only.When ever i selected that field it is asking convert into checkbox or radio button or no need to convert.

Read only

0 Likes
12,039

Hi sai,

then there would be absolutely values available in value range of domain of wever.

If yes, then you can not use it as checkbox.

Many Thanks / Himanshu Gupta

Read only

0 Likes
12,039

Hi Himanshu,

Yes For WEVER field,in Domain Value Range is there,Then how to do it...

Thanks

Read only

venkateswaran_k
Active Contributor
0 Likes
12,039

Dear Sai,

The problem is you have assigned the Check box attributes to MKPF-WEVER.

Actually, the valid values for the WEVER are 1,2,3 only.. 

When you check this box, the actual values assigned is 'X'.

so it is giving give valid value error...

Please use the simple Char value.

Regards,

Venkat

Read only

0 Likes
12,039

Hi Venkat,

where i will use Char value.i have to take that field from MKPF only.In MKPF table that field have length 1 only.Even i assigned wever value to BAPI Structure.Please help me.It's urget requirement.

Thanks.

Read only

0 Likes
12,039

Dear Sai,

You cannot use WEVER field here as check box, since the valid values allowed for this field is only 1,2,3

If you still want to use the mkpf field only, then use  FLS_RSTO  field  MKPF-FLS_RSTO  which will allow the value 'X'.

Since when you check the box, the program assigns 'X' to the field internally.  Because of this, the above field WEVER displays error as it is not a valid.

use MKPF-FLS_RSTO.

Regards,

Venkat

Read only

0 Likes
12,039

Hi Venkat,

Here i am using WEVER field for Version Print,and for this I make Drop down.But as u mention above MKPF-FS_RSTO field is not for version print.then how to use it..Please help me.

Thanks

Read only

0 Likes
12,039

Hi Venkat,

I clearly tell you,how i placed WEVER field in screen.Previously i have already some fields in screen,for this i have to add WEVER field with values.

1  I will click on my screen 100,and then click on Dictionary Fields icon,then enter table name MKPF and select field WEVER,then press enter.

2  After that whenever i placed WEVER fieldon screen it is asking MKPF-WEVER is Char 1 field Convert in to check box,radio button,no need to convert.

3  After that i choose check box,then placed in screen.For this WEVER field attributes,by default Name is MKPF-WEVER and Text is empty.

4  After that I will select I/O field from screen and make it as listbox and in attributes I gave name as WEVER.

5 After that i declared one variable for WEVER like this.

    Data:wever like mkpf-wever.

6 After that I will move this variable to BAPI Standard Structure like this.

    DATA : goodsmvt_header  LIKE  bapi2017_gm_head_01 .

Pass variable to this structure twice.  

goodsmvt_header-ver_gr_gi_slip = wever.

that's it.For this it is showing Error 'Please enter valid value'.

Actually this screen is for generating GRN for released   Purchase Order.I think is there any link between PO and WEVER.I don't understand.It is urgent requirement.If u need anything more please let me know.

If u know how to do it..Please help me.

Thanks.

Read only

0 Likes
12,039

Yes Sai, that is what I am trying to say...

The WEVER is a version related field.... it has its own domain level constraints that the value range should be 1,2,3 ...  You cannot use X there ..  since you used that field as Check box, the system tries to allocate X to that field and hence you are getting the domain level error saying 'Please enter valid value'.. 

Since you are already having the dropdown for it, why to use Check box again (to me it seems redundant)... 

If you still want to use the checkbox, then remove the link to data dictionary on that field...

Regards,

Venkat

Read only

0 Likes
12,039

Hi Venkat,

Actually check box means WEVER field only,When i will select type pf slip from drop down i will check my check box(WEVER) for printing,that value is updated in MKPF for particular GRN.Once you observe in MIGO transaction.

Read only

Former Member
0 Likes
12,039

Hi Sai,

          Venkat is absolutly right. as you can see below screen shot. I suffered with same issue

Regards

Amit

Read only

0 Likes
12,039

Hi Amit,

Then tell me how to do.Please help me.

Thanks

Read only

0 Likes
12,039

Hi Sai,

        I was using check box for logical operation like "Is Initital or IS NOT INITIAL", If MKPF-WEVER is not this much required then create globle variable like GW_IND type char1. and use GW_IND for check box.

Just remove MKPF-WEVER from name and give your GW_IND.

for just accuracy delete check box Element from screen and create new check box with GW_IND.

Regards

Amit

Read only

0 Likes
12,039

Hi Amit,

Can you do me a favour?I am still in confuse...Please access my system through team viewer and help me out.If you are free.

Thanks

Read only

0 Likes
12,039

Hi Sai,

             Sorry Sai !!!

      I dont belive in spoon feeding, so Please do it from your end. And try to know why it is happening. And there is nothing to be confuse.

If you see Venkat's and other's reply they all saying same thing and that is enough to achive it.

Regards

Amit

Read only

venkateswaran_k
Active Contributor
0 Likes
12,039

Yes Sai, that is what I am trying to say...

The WEVER is a version related field.... it has its own domain level constraints that the value range should be 1,2,3 ...  You cannot use X there ..  since you used that field as Check box, the system tries to allocate X to that field and hence you are getting the domain level error saying 'Please enter valid value'.. 

Since you are already having the dropdown for it, why to use Check box again (to me it seems redundant)... 

If you still want to use the checkbox, then remove the link to data dictionary on that field...

Regards,

Venkat

Read only

0 Likes
12,039

Hi Venkat,

Can you do me a favor..I am still in confuse...Can you connect my system using Team Viewer and help me out,if you are free.

Thanks

Read only

0 Likes
12,039

Hi Sai,

There is nothing to be confused. Your check box is of the type MKPF-WEVER, and it is linked to Dictionary. Now if you look at the Table Field WEVER, it is assigned to a domain with FIXED VALUES. THis means, the Field MKPF-WEVER cannot take anyother values other than those mentioned in the Fixed Values of the domain.

If you are using it as a check box, it assumes 'X' as value once it is checked. Since there is a link to the dictionary, this value will not be allowed.

Best case is to delcare your check box as character of length 1.

Regards,

Anish Oommen

Read only

former_member188282
Active Participant
0 Likes
12,039

Hi sai,

Check the domain you given for that field. Other wise un-check from dictionary reference in attributes option for that field.

Thanks,

Rajesh.

Read only

former_member188282
Active Participant
0 Likes
12,039

Please check the below screen. Here it will accept only these values. you are getting the error because of this domain. please change the domain and check once.

Thanks

Rajesh