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

at selection-screen

Former Member
0 Likes
978

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

10 REPLIES 10
Read only

Former Member
0 Likes
946

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_details

Regards,

Sravanthi

Read only

Former Member
0 Likes
946

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.

Read only

Former Member
0 Likes
946

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

Read only

Former Member
0 Likes
946

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

Read only

Former Member
0 Likes
946

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

Read only

Former Member
0 Likes
946

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.

Read only

0 Likes
946

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

Read only

Former Member
0 Likes
946

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

Read only

Former Member
0 Likes
946

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

Read only

Former Member
0 Likes
946

answered