Daynamic selecation of screen in sap abap

Well i going to cover all senario below topic
Reports     : Alv Reports, Classical Report And interactive Reports
Forms       : Scripts and Smart Forms Adove Forms
Interface   : RFC BAPI ALE/IDCS
Converstion : BDC LSMW BAPI

Enhancement : User-EXITS BADI, Customer Exit
as per the requirment some time what happend when you work in selecction screen and make fields 
required then you got error in programs and lot of confuation to develop the code so rectify this problem you can write this code daynamci selection scrren help you restify this problems

*-----------------------------------------------------------------------
*  Report  ZRFI_MODIFY_SCREEN.                                                *
*                                                                      *
*----------------------------------------------------------------------*
*                                                                      *
*   Author..............    :   rohini kumar                           *
*   Creation Date.......    :                                          *
*   Requested by........    :                                          *
*   Reference document..    :                                          *
*   mobile number      .    :  9198967510                              *
*   Email id           .    :  rkm4888@gmail.com                       *
*   Project.............    :                                          *
*   Description.........    :                                          *
*----------------------------------------------------------------------*
* Modification History :                                               *
*                                                                      *
*   Author      Date    Correction #   Purpose/Reason                  *
*  --------   --------  ------------   --------------------------------*
*                                                                      *
*  --------   --------  ------------   --------------------------------*

REPORT  zrfi_modify_screen.
* Top include for global data declraiton
INCLUDE zrfi_modify_screen_top.
* sel include for selection
INCLUDE zrfi_modify_screen_sel.
* fo1 include for subrotine program and selecation
INCLUDE zrfi_modify_screen_f01.


*----------------------------------------------*
* I N I T I A L I Z A T I O N                  *
*----------------------------------------------*
INITIALIZATION.
  PERFORM f_clear_data.


*----------------------------------------------*
* A T S E L E C T I O N O N O U T P U T        *
*----------------------------------------------*
AT SELECTION-SCREEN OUTPUT.
  PERFORM f_formates_screen.







*----------------------------------------------*
* S  T A R T - O F - S E  L E C T I O N        *
*----------------------------------------------*
START-OF-SELECTION.
  PERFORM f_get_data.





*----------------------------------------------*
* E N D - O F - S E  L E C T I O N             *
*----------------------------------------------*
END-OF-SELECTION.
  PERFORM f_display_data.

* top include for global data declration
*&---------------------------------------------------------------------*
*&  Include           ZRFI_MODIFY_SCREEN_TOP
*&---------------------------------------------------------------------*
TABLES: ekko.

* po document type
TYPES: BEGIN OF typ_ekko_ekpo,
       ebeln TYPE ekko-ebeln, " PO NUMBER
       bukrs TYPE ekko-bukrs,
       bstyp TYPE ekko-bstyp,
       bsart TYPE ekko-bsart, " PO NUMBER
       bsakz TYPE ekko-bsakz,
       bedat TYPE ekko-bedat, " PO DATE
       matnr TYPE ekpo-matnr,
       END OF typ_ekko_ekpo.

* so document type
TYPES: BEGIN OF  typ_vbak_vbap,
       vbeln TYPE vbak-vbeln, " sales document
       erdat TYPE vbak-erdat, " creation date
       auart TYPE vbak-auart,
       matnr TYPE vbap-matnr, " materila nubmer
      END OF     typ_vbak_vbap.



* declration of work area and internal table
DATA: gt_ekko TYPE STANDARD TABLE OF typ_ekko_ekpo,
      gt_vbak TYPE STANDARD TABLE OF typ_vbak_vbap,
      gs_ekko TYPE                   typ_ekko_ekpo,
      gs_vbak TYPE                   typ_vbak_vbap.

* constants used to avoid hard coded text
CONSTANTS: gc_x TYPE c VALUE 'X'.
* sel include for selecation
*&---------------------------------------------------------------------*
*&  Include           ZRFI_MODIFY_SCREEN_SEL
*&---------------------------------------------------------------------*
*selecation screen you puraches order form

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: PO_DET RADIOBUTTON GROUP g2 USER-COMMAND flag  DEFAULT 'X' ,
            SA_DET RADIOBUTTON GROUP g2 .
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-001.
SELECT-OPTIONS: S_ebeln FOR GS_EKKO-ebeln modif id m1,
                S_BEDAT FOR GS_EKKO-BEDAT modif id m1,
                S_BSART FOR GS_EKKO-BSART modif id m1.
parameters: p_mate as checkbox modif id m1 user-command flag.
SELECT-OPTIONS: s_matnr for gs_ekko-matnr modif id m3.

SELECTION-SCREEN END OF BLOCK b2.

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-002.
select-OPTIONS: s_vbeln for gs_vbak-vbeln modif id m2,
                s_erdat for gs_vbak-erdat modif id m2,
                s_AUART for gs_vbak-auart modif id m2.

                parameters: p_mate2 as checkbox modif id m2 user-command flag.
select-OPTIONS:  s_matnr1 for gs_vbak-matnr modif id m4.
SELECTION-SCREEN END OF BLOCK b3.

f01 include for subroutine program 
*&---------------------------------------------------------------------*
*&  Include           ZRFI_MODIFY_SCREEN_F01
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Form  F_CLEAR_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_clear_data .
* clear work area and internal table data
  CLEAR: gs_ekko.
  REFRESH: gt_ekko.

ENDFORM.                    " F_CLEAR_DATA
*&---------------------------------------------------------------------*
*&      Form  F_GET_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_get_data .

ENDFORM.                    " F_GET_DATA
*&---------------------------------------------------------------------*
*&      Form  F_DISPLAY_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_display_data .

ENDFORM.                    " F_DISPLAY_DATA
*&---------------------------------------------------------------------*
*&      Form  F_FORMATES_SCREEN
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_formates_screen .
  IF po_det = gc_x.
    LOOP AT SCREEN.
      IF screen-group1 = 'M2' OR screen-group1 = 'M3'  OR screen-group1 = 'M4'.
        screen-active = 0 .
        MODIFY SCREEN.
      ENDIF.
      IF p_mate = gc_x.
        LOOP AT SCREEN.
          IF screen-group1 = 'M3'.
            screen-active = 1.
            MODIFY SCREEN.
          ELSE.
            IF screen-group1 = 'M2'  OR screen-group1 = 'M4'.
              screen-active = 0 .
              MODIFY SCREEN.
            ENDIF.
          ENDIF.
        ENDLOOP.
        EXIT.
      ENDIF.
    ENDLOOP.
  ENDIF.
  IF sa_det = gc_x.
    LOOP AT SCREEN.
      IF screen-group1 = 'M1' OR screen-group1 = 'M3'  OR screen-group1 = 'M4'.
        screen-active = 0 .
        MODIFY SCREEN.
      ENDIF.
      IF p_mate2 = gc_x.
        LOOP AT SCREEN.
          IF screen-group1 = 'M4'.
            screen-active = 1.
            MODIFY SCREEN.
          ELSE.
            IF screen-group1 = 'M1'  OR screen-group1 = 'M3'.
              screen-active = 0 .
              MODIFY SCREEN.
            ENDIF.
          ENDIF.
        ENDLOOP.
        EXIT.
      ENDIF.
    ENDLOOP.
  ENDIF.
ENDFORM.                    " F_FORMATES_SCREEN

text symbol program 
PO_DET Puraches Order Details
P_MATE Material Selection
P_MATE2 Material Selection
SA_DET Sales Order Details
S_AUART Sales Document Type
S_BEDAT Document Date
S_BSART Purchasing Doc. Type
S_EBELN Purchasing Document
S_ERDAT Created on
S_MATNR Material
S_MATNR1 Material
S_VBELN Sales Document


Comments

Popular posts from this blog

all user exit mv45afzz (implicit user exit )

MB_MIGO_BADI THIS BADI USED TO POSTING DATA IN MIGO

Long Text in input and output field in module pool