2015 May 13 12:40 PM
HI,
I have created a module pool program in which there are around 30 input/output fields on screen.
out of which i have kept 3 fields are mandatory.
LIFNR - Vendor ID
BELNR - Acc. Dc. No.
Invoice date.
User update all the fields and and it gets saves into database.
Now i have placed one more command button on screen for display of data.
IF user enter the BELNR no. and click on display all others details should be auto populated.
But after entering BELNR and clicking in display it gives error "Fill all the required entries".
I do not want remove the mandatory tick of LIFNR and invoice date while entering data.
Any ideas to overcome this problem.
Thanks,
Amit Diwvedi
2015 May 13 1:16 PM
I had this problem before and I prefered to control everything in P.A.I event. I did it:
----------------------------------------------------------------------------
PROCESS BEFORE OUTPUT.
MODULE status_1000.
MODULE bloquear_campos.
PROCESS AFTER INPUT.
FIELD: w_xxx-belnr MODULE check_field.
MODULE user_command_1000.
----------------------------------------------------------------------------
MODULE check_field.
if belnr is initial
MESSAGE 'xxxxxxxxx' TYPE 'E'.
endif.
ENDMODULE.
----------------------------------------------------------------------------
You also can do that with loop at screen, setting group property for each field in your screen painter, and after:
----------------------------------------------------------------------------
LOOP AT SCREEN.
IF screen-group1 = 'GR1'.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
----------------------------------------------------------------------------
2015 May 13 12:55 PM
2015 May 13 1:16 PM
I had this problem before and I prefered to control everything in P.A.I event. I did it:
----------------------------------------------------------------------------
PROCESS BEFORE OUTPUT.
MODULE status_1000.
MODULE bloquear_campos.
PROCESS AFTER INPUT.
FIELD: w_xxx-belnr MODULE check_field.
MODULE user_command_1000.
----------------------------------------------------------------------------
MODULE check_field.
if belnr is initial
MESSAGE 'xxxxxxxxx' TYPE 'E'.
endif.
ENDMODULE.
----------------------------------------------------------------------------
You also can do that with loop at screen, setting group property for each field in your screen painter, and after:
----------------------------------------------------------------------------
LOOP AT SCREEN.
IF screen-group1 = 'GR1'.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
----------------------------------------------------------------------------
2015 May 13 2:12 PM
I do not want remove the mandatory tick of LIFNR and invoice date while entering data.
Don't seem possible:
As soon as there are initial mandatory fields on screen, only exit function code will be executed, other function code will trigger the Fill all the required entries message. So you cannot do that, as exit function-code will not transfer any data from screen to program and you won't be able to read data with the required database key...
If you manage the mandatory field in some FIELD/MODULE statement, even after execution of a USER_COMMAND module that would fill the data. As soon as the error message for required entries is raised, no data is sent back from program to screen and you lose previous action...
Regards,
Raymond
2015 May 13 2:59 PM
Hi Amit,
In my opinion It is not possible without removing Mandatory fields for your requirement.
Regards,
Surya
2015 May 13 3:02 PM
Hello Amit,
As Raymond said, it will be impossible to do if you don't remove the obligatory tick.
The only way to implement your requirement, is to remove the obligatory ticks, and use code to validate the field in PAI.
Example:
In your screen flow PAI:
PROCESS AFTER INPUT.
FIELD INPUT_FIELD MODULE validate_initial.
And inside the module validate_initial:
IF sy-ucomm EQ 'BUTTON1' AND input_field IS INITIAL.
MESSAGE 'Fill all required entries' TYPE 'E'.
ENDIF.
Depending on how your screen is built, you might need to use:
CHAIN.
FIELDS: field1 MODULE validate,
field2 MODULE validate2....
....
ENDCHAIN.
Regards,
Thales Schmidt
2015 May 13 6:35 PM
Hi Amit,
If you make user click a button to enter data entry mode then you could do it: Define a variable GV_ENTRY_MODE that you set to X in the PAI when that button is pressed, and set to blank when the button to display an entry is clicked.
Jim