‎2015 Dec 30 8:43 AM
Hi gurus. I Have screen no 100 ( main screen). in this screen i have kunnr field. Then i called a sub screen 110. In the sub screen 110 i have 'land1' is mandatory and 'name1' is optional. And TWO PUSH BUTTONS 'DISPLAY' AND 'SAVE' . After giving 'kunnr' if i entered a 'display' button
land1 and name1 should be fill.Because of Land1 is mandatory in sub screen the error raised 'fill required data' after i enter KUNNR . if i changed land1 is mandatory to recommended the problem is solved. so i want solution with land1 is mandatory but i want details.
Thanking you.
‎2015 Dec 31 11:15 AM
Hi Srinivas,
Try,
Created two push buttons one with exit command(dispay). make the fields mandatory using the code for change push button.
process before output.
module status_0100.
process after input.
module icon_100 at exit-command.
module status_0100 output.
set pf-status 'STATUS'.
* SET TITLEBAR 'xxx'.
if sy-ucomm = 'CHANGE'.
loop at screen.
check screen-name = 'VBAP-VBELN'.
screen-required = '1'.
modify screen.
endloop.
else.
endif.
endmodule. " STATUS_0100 OUTPUT
module icon_100 input.
case sy-ucomm.
when 'BACK'.
leave program.
when 'DISP'.
loop at screen.
check screen-name = 'VBAP-VBELN'.
screen-required = '0'.
modify screen.
endloop.
endcase.
endmodule. " ICON_100 INPUT
Hope it helpful,
Regards,
Venkat.
‎2015 Dec 30 12:38 PM
Hi Srinivas,
I suggest you to remove the mandatory to the land1, and try to raise the popup to warn that that the mandatory field should not be blank do you wish to continue.
Please refer the below code.
data: land1 TYPE land1,
LV_ANSWER TYPE STRING.
IF land1 is INITIAL .
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TEXT_QUESTION = 'Land 1 is mandatory field and cannot be blank do you wish to continue still'
IMPORTING
ANSWER = LV_ANSWER.
.
IF LV_ANSWER = '1'.
* Proceed further
ELSE.
* Stop ,
ENDIF.
Output:
Thanks and Regards,
Girish Kumar V.
‎2015 Dec 30 12:56 PM
Hi girish ,
thanks for giving replay. here i have two push buttons i.e., 'DISPLAY' And 'SAVE'. We don't know the end user may click on 'SAVE' at that time he takes help( drop down) at that time the empty space occurs so my client ask i don't want to see that empty space. Then i need to use 'LAND1' field as a mandatory.
‎2015 Dec 30 1:45 PM
Firstly I hope that the push buttons are standard (ie the save in the toolbar) etc ?
Secondly, SAP generally has different transactions for display and edit variants, the screen attributes are changed at run time dependant on either the Transactiuon type (defined in T180-TrTyp), or with reference to the transaction code.
In your PBO have a module that loops around the screen (LOOP AT Screen) and modify the field attributes according to either a transaction coede or a transaction type.
Regards
Rich
‎2015 Dec 31 3:46 AM
Hi Richard,
Thanks for your replay. Ya i already tried it but empty space occurs while end user take drop down button.
‎2015 Dec 30 2:17 PM
hi,
In PAI of main screen...
use statement CALL SUBSCREEN <subscreen area> after the module where you are fetching data for name1 and land1..
the flow of the screen will be PAI(100)-->> PAI(101)--->PBO(100)--->PBO(101).
now it's up to you where you want to assign the values to screen field (before PAI of 101) and you can also change the properties of screen field using LOOP AT SCREEN based on whether field is blank or not.
thanks!!
‎2015 Dec 31 3:42 AM
Hi chintu,
Thanks for your replay. No i already tried it.. at that time also it raise error fill mandatory fields.
‎2015 Dec 30 5:54 PM
HI Srinivas,
Try,
Make the screen fields required to possible.
if sy-ucomm = 'Change' AND land1 is initial.
message ' ' type 'E'.
endif.
Hope it helpful,
Regards,
Venkat.
‎2015 Dec 31 3:44 AM
No if i change the fields required to change while customer want to save a customer then he may choose drop down(for help) at that time the empty field occurs then my client ask i dont want that empty field. For that i choose required...
‎2015 Dec 31 4:15 AM
‎2015 Dec 31 4:40 AM
Hi,
are you passing this mandatory field to any select query??
‎2015 Dec 31 4:50 AM
HI
yes, while customer click on DISPLAY data fetch from kna1 and fill on screen for this i write.
in pai.
if sy-ucomm = 'DISP'.
select single * from kna1 into corresponding fields of w_kna1 where kunnr = w_kna1-kunnr.
elseif sy-ucomm = 'save'.
data should be saved in kna1 table.
endif.
‎2015 Dec 31 5:32 AM
what's the use of making LAND1 field mandatory when you are not passing it to any select query, make it recommended and put validation according to field values, it will resolve all your issues.
‎2015 Dec 31 5:36 AM
Thanks but if i make as recommended while he take drop down option( i dint show that. I forgot to add in the screen) Empty space will come. If i make as required only data will appear with out space. Actually my scenario is different for analyze purpose i post small scenario.
‎2015 Dec 31 5:52 AM
hi,
check the screen shot.. in my select query.. give customer number does not contain name which I am passing to mandatory field (after putting validation not actual mandatory), if it is initial it will give error message.
and then I manually enter data to it..
it give an information message that field is not initial.
make your logic like this by putting validation on LAND1 field after USER-commands
thanks!!
‎2015 Dec 31 6:07 AM
‎2015 Dec 31 6:13 AM
first write statement CALL SUBSCREEN <subarea> after USER-COMMAND module, so your user command's get execute first then in PAI of sub-screen validate LAND1 field simple.
thanks!!
‎2015 Dec 31 6:19 AM
no not working chintu.
PROCESS BEFORE OUTPUT.
CALL SUBSCREEN SUB1 INCLUDING SY-REPID '0300'.
MODULE STATUS_0210.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0210.
CALL SUBSCREEN SUB1.
MODULE EXIT AT EXIT-COMMAND.
‎2015 Dec 31 6:19 AM
Hi Srinivas,
By default make land1 file non-editable and after pressing 'DISPLAY' button use loop at screen in PBO event and set screen-input and screen-required equal to 1.
LOOP AT SCREEN.
IF kunnr is not initial.
IF screen-name = 'LAND1'.
screen-input = '1'.
screen-required = '1'.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.
Thanks and Regards,
Pavan Kumar
‎2015 Dec 31 6:25 AM
Thanks,
If i make non editable suppose my client want to save the data at that time he need to enter land1 data also. So your ans not working for my requirement.
‎2015 Dec 31 6:38 AM
As soon as client enter kunnr and press display button i will become editable with mandatory.
‎2015 Dec 31 6:44 AM
Hi,
in PBO.. write the following code..
LOOP AT SCREEN.
if flag = X and land1 is initial.
IF screen-name = 'LAND1'.
screen-required = '1'.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.
in PAI
and set flag = 'X' after successful select query on KNA1 or if land1 have value.
it will work for sure
thanks!!
‎2015 Dec 31 6:44 AM
No No No my requirement is We dont know client may use this screen for display or save. If he click on display the data should be populated on screen based on kunnr or if the end user want to create he is able to enter all data and click on save.
your description is good for display but not save pupose.
‎2015 Dec 31 6:49 AM
‎2015 Dec 31 7:05 AM
yes..
first PAI will trigger.. whether its SAVE or DISPLAY..
then do validation on LAND1 field and name1 field and set the FLAG after getting the values from select query or manual entry.
most simplest value is to validate land1 field in PAI.
as per your requirement.. if user hit display.. value should appear in the land1 field if there is value database table.
if there is no value in land1 field user should enter it before saving.. isn't it??
then simply put validation on SAVE command,
if land1 or whatever field you want mandatory is not initial.
code for save.
else.
message 'fill the mandatory field' type 'S' display like 'E'.
leave list processing.
endif.
thanks!!
‎2015 Dec 31 7:17 AM
HI CHINTU
IN THE BELOW CODE
LOOP AT SCREEN.
if flag = X and land1 is initial.
IF screen-name = 'LAND1'.
screen-required = '1'.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.
LAND1 IS ALWAYS INITIAL FIRST TIME. EVEN IF YOU CLICK ON DISPLAY IT RAISE SAME ERROR. AND HOW TO DECLARE FLAG.
‎2015 Dec 31 7:22 AM
if there is no value in land1 field user should enter it before saving.. isn't it??
MY ANSWER IS NO.. VALUE EXITS OR NOT THATS NOT A PROBLEM. IF THE DATA AVAILABLE IN DB DATA SHOULD BE DISPLAY OR IF THE USER GIVES ALL DATA AND CLICK ON SAVE THE DATA SAVE ON DB. IF HE TAKE DROP DOWN FROM LAND1 LAST RECORD SHOULD NOT BE EMPTY.
‎2015 Dec 31 11:15 AM
Hi Srinivas,
Try,
Created two push buttons one with exit command(dispay). make the fields mandatory using the code for change push button.
process before output.
module status_0100.
process after input.
module icon_100 at exit-command.
module status_0100 output.
set pf-status 'STATUS'.
* SET TITLEBAR 'xxx'.
if sy-ucomm = 'CHANGE'.
loop at screen.
check screen-name = 'VBAP-VBELN'.
screen-required = '1'.
modify screen.
endloop.
else.
endif.
endmodule. " STATUS_0100 OUTPUT
module icon_100 input.
case sy-ucomm.
when 'BACK'.
leave program.
when 'DISP'.
loop at screen.
check screen-name = 'VBAP-VBELN'.
screen-required = '0'.
modify screen.
endloop.
endcase.
endmodule. " ICON_100 INPUT
Hope it helpful,
Regards,
Venkat.
‎2016 Jan 19 5:16 AM