Thursday 23 March 2017

AT SELECTION-SCREEN OUTPUT Example

AT SELECTION-SCREEN OUTPUT event gets triggered before generating the Selection Screen. Thus, it can be used to manipulate the elements of the selection screens. It can also be used to generate dynamic selection screens. Below is a simple example to show how AT SELECTION-SCREEN OUTPUT can be used.

The following program accepts an employee id  and displays the corresponding name and designation in the selection screen.

TABLES: zemp_mstr.
DATA: ls_mstr TYPE zemp_mstr.

SELECTION-SCREEN: BEGIN OF BLOCK b1.
PARAMETERS: p_eid TYPE zemp_i.
SELECTION-SCREEN: END OF BLOCK b1.

SELECTION-SCREEN: BEGIN OF BLOCK b2.
PARAMETERS: p_ename TYPE zemp_n MODIF ID m1.
PARAMETERS: p_des TYPE zemp_d MODIF ID m1.
SELECTION-SCREEN: END OF BLOCK b2.

AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    IF p_eid IS NOT INITIAL.
      IF screen-group1 = 'M1'.
        screen-active = 1.
        screen-input = 0.   "for input disable
        CLEAR: ls_mstr.
        SELECT SINGLE * FROM zemp_mstr INTO ls_mstr WHERE emp_id = p_eid.
        p_ename = ls_mstr-emp_name.
        p_des = ls_mstr-designation.
        CLEAR: ls_mstr.
        MODIFY SCREEN.
      ENDIF.
    ELSE.
      IF screen-group1 = 'M1'.
        screen-active = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDIF.
  ENDLOOP.

2 comments:

  1. We have the best SAP module consultants, and Denpro Technologies has a proven track record in SAP. If you are searching for a company that can help boost your business, Denpro Technologies is the most best SAP Consultant services in Noida.

    ReplyDelete
  2. SAP integration services streamline your business processes by seamlessly connecting SAP systems with other applications and data sources. With expertise in integrating diverse systems, our SAP Integration Services ensure smooth data flow and enable real-time visibility across your organization.




    ReplyDelete

Report to find CDS view of Standard Table

A small change has been made to the original program ( SAP YARD Article ) so that it can also display the common CDS used by multiple table...