‎2008 Aug 26 7:06 AM
Hi,
I have 3 Parameters on Selection-Screen
Material No
Invoice No
Batch No.
If the User enters the value in Material No or Invoice No,Batch No should be blocked and if the User User enters the value in Batch No both Material No and Invoice Noshould be blocked .
How can i code this requirement .Please help.
Thanks,
K Srinivas
‎2008 Aug 26 7:10 AM
Hi srinivas,
Refer to this sample code
*"Selection screen elements............................................
SELECTION-SCREEN BEGIN OF BLOCK blk
WITH FRAME TITLE text-001.
PARAMETERS:
p_uname TYPE sy-uname. " Username
SELECTION-SCREEN END OF BLOCK blk.
*"Selection screen elements............................................
SELECTION-SCREEN BEGIN OF BLOCK blk1
WITH FRAME TITLE text-002.
PARAMETERS:
p_fname(20) TYPE c MODIF ID nam, " Firstname
p_lname(20) TYPE c MODIF ID nam, " Lastname
p_empid(20) TYPE c MODIF ID nam. " Employeeid
SELECTION-SCREEN END OF BLOCK blk1.
*"--------------------------------------------------------------------*
* AT SELECTION-SCREEN OUTPUT *
*"--------------------------------------------------------------------*
AT SELECTION-SCREEN OUTPUT.
PERFORM validate_username.
*"--------------------------------------------------------------------*
* AT SELECTION-SCREEN ON p_uname *
*"--------------------------------------------------------------------*
AT SELECTION-SCREEN ON p_uname.
PERFORM display_username.
*"--------------------------------------------------------------------*
* START-OF-SELECTION Event *
*"--------------------------------------------------------------------*
START-OF-SELECTION.
PERFORM validate_user_details.
*&---------------------------------------------------------------------*
*& Form validate_username
*&---------------------------------------------------------------------*
* This subroutine validates the username entered by user
*----------------------------------------------------------------------*
* This subroutine does not have interface parameters to pass
*----------------------------------------------------------------------*
FORM validate_username .
IF p_uname IS INITIAL OR p_uname NE sy-uname.
LOOP AT SCREEN.
IF screen-group1 EQ 'NAM'.
screen-active = 0.
MODIFY SCREEN.
ENDIF. " IF screen-group1..
ENDLOOP. " Loop at screen..
ELSE.
LOOP AT SCREEN.
IF screen-group1 EQ 'NAM'.
screen-active = 1.
MODIFY SCREEN.
ENDIF. " IF screen-group1..
ENDLOOP. " Loop at screen..
ENDIF. " IF p_uname is initial..
ENDFORM. " validate_username
*&---------------------------------------------------------------------*
*
*& Form display_username
*&---------------------------------------------------------------------*
* This subroutine validates the user entry on selection screen
*----------------------------------------------------------------------*
* This subroutine does not have interface parameters to pass
*----------------------------------------------------------------------*
FORM display_username.
IF p_uname NE sy-uname.
MESSAGE text-003 TYPE 'E'.
ENDIF. " IF p_uname...
ENDFORM. " display_username
*&---------------------------------------------------------------------*
*& Form validate_user_details
*&---------------------------------------------------------------------*
* This subroutine validates the User details
*----------------------------------------------------------------------*
* This subroutine does not have
*----------------------------------------------------------------------*
FORM validate_user_details .
IF p_uname IS INITIAL OR
p_fname IS INITIAL OR
p_lname IS INITIAL.
MESSAGE 'Fill all the fields' TYPE 'I'.
ELSE.
PERFORM display_user_details.
ENDIF. " IF p_uname...
ENDFORM. " validate_user_details
*&---------------------------------------------------------------------*
*& Form display_user_details
*&---------------------------------------------------------------------*
* This subroutine displays the user details.
*----------------------------------------------------------------------*
* This subroutine does not have interface parameters to pass
*----------------------------------------------------------------------*
FORM display_user_details .
WRITE:
/ 'Username:', p_uname,
/ 'First Name:', p_fname,
/ 'Last Name:', p_lname,
/ 'Employee Id:',p_empid.
ENDFORM. " display_user_detailsRegards,
Sravanthi
‎2008 Aug 26 7:10 AM
HI ,
u can use the following code.
at selection screen output .
if material_no is not initial and invoice no is not initial.
loop at screen .
if screen-name = 'Batch no'.
screen-input = 0.
screen-output = 1.
modify screen.
endloop.
endif.
same logic for other one.
‎2008 Aug 26 7:10 AM
hi,
Use AT SELECTION-SCREEN ON <FIELD> event.
Write this Event for all the three fields.
Place the Blocking code in the Event based on the condition.
Regards
Sumit Agarwal
‎2008 Aug 26 7:14 AM
Hii,
Try this logic
REPORT z_sdn.
PARAMETERS:
p_matnr TYPE mara-matnr MODIF ID abc,
p_invc(10) TYPE c MODIF ID abc,
p_batch(10) TYPE c MODIF ID xyz.
AT SELECTION-SCREEN OUTPUT.
IF p_matnr IS NOT INITIAL OR p_invc IS NOT INITIAL.
LOOP AT SCREEN.
IF screen-group1 EQ 'XYZ'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSEIF p_batch IS NOT INITIAL.
LOOP AT SCREEN.
IF screen-group1 EQ 'ABC'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
START-OF-SELECTION.
WRITE: 'TEST'.
Regards
Abhijeet
‎2008 Aug 26 7:16 AM
Hi Srinivas,
You get this functionality using AT SELECTION-SCREEN OUTPUT Event.
If not p_matno is initial or p_invoiceno is initial.
loop at screen.
if screen-name = p_batchno.
screen-input = 0'.
modify screen.
endif.
endloop.
endif.Best regards,
raam
‎2008 Aug 26 7:17 AM
Hi,
You can use loop at screen concept here.
IF Material No = 'X' or
Invoice No = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'SG2'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENIDF.
For the second condition also same thing u have to do.
Regards,
Kusuma.
‎2008 Aug 26 7:18 AM
hai,
srinivas u can use
at selection-screen output
loop at screen
if sreen-group1 ='groupname'
if val=1
screen-output =0.
modify screen.
else
val = 2
screenoutput =1.
modify screen.
endif.
endif.
endloop.
regards,
sridhar
‎2008 Aug 26 7:25 AM
Hi,
U can also use this :
at selection screen
if p_mat is not initial or p_invoi is not initial
and p_batch NE ""
then error message
else
continue
same for the other
Thanks and regards
‎2008 Aug 26 7:57 AM
Hi,
Check the following code:
PARAMETERS:
p_matnr TYPE mara-matnr MODIF ID abc,
p_invc(10) TYPE c MODIF ID klm,
p_batch(10) TYPE c MODIF ID xyz.
AT SELECTION-SCREEN OUTPUT.
IF p_matnr IS NOT INITIAL.
IF p_invc IS NOT INITIAL.
LOOP AT SCREEN.
IF screen-group1 EQ 'XYZ'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSEIF p_batch IS NOT INITIAL.
LOOP AT SCREEN.
IF screen-group1 EQ 'KLM'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
Regards,
Bhaskar
‎2011 Feb 18 6:30 AM