Hello,

Sign up to join our community!

Welcome Back,

Please sign in to your account!

Forgot Password,

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

You must login to ask a question.

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

SAP EWM Help Latest Questions

  • 0
  • 0
DPM125

ABAP Selection-Screen Elements

This report is a sample program that demonstrates how a user can enter and organize different kinds of input on an SAP screen. It includes simple fields like dates, codes, and names where you can type in values. It also provides choices through radio buttons and checkboxes, allowing users to pick options easily. To keep things clear, inputs are grouped into sections with titles and labels. Visual elements such as lines, spacing, and comments make the screen more structured and easier to read. A button is available for triggering specific actions directly from the screen. The program also uses tabs to separate information into different pages, making it less cluttered. Overall, this example shows how SAP screens can be designed to be interactive, organized, and user-friendly.

*&---------------------------------------------------------------------*
*& Report  ZTEST_PROGRAM_2
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ztest_program_2.

*---------------------------------------------------------------------*
* SELECTION-SCREEN DECLARATION
*---------------------------------------------------------------------*
tablesmara.

*--- Simple parameters
PARAMETERSp_matnr TYPE mara-matnr OBLIGATORY,   " Material number
            p_mtart TYPE mara-mtart,              " Material type
            p_date  TYPE sy-datum.                " Date input

*--- Select-options for ranges
SELECT-OPTIONSs_matkl FOR mara-matkl,           " Material group range
                s_ersda FOR mara-ersda.           " Creation date range

*--- Radio buttons (same group -> only one active)
PARAMETERSr_raw   RADIOBUTTON GROUP g1 DEFAULT 'X'" Raw materials
            r_finsi RADIOBUTTON GROUP g1.            " Finished goods

*--- Checkbox
PARAMETERSp_test AS CHECKBOX DEFAULT 'X'.

*--- Blocks with title
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERSp_user TYPE sy-uname DEFAULT sy-uname.
SELECTION-SCREEN END OF BLOCK b1.

*--- Inline elements
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERSp_len TYPE DEFAULT 10.
SELECTION-SCREEN COMMENT 25(20text-002 FOR FIELD p_len.
SELECTION-SCREEN END OF LINE.

*--- Pushbutton
SELECTION-SCREEN PUSHBUTTON 10(20but1 USER-COMMAND pb1.

*---------------------------------------------------------------------*
* TEXT ELEMENTS
*---------------------------------------------------------------------*
* text-001 = "User Settings"
* text-002 = "Length of Value"
* but1     = "Execute Action"


*---------------------------------------------------------------------*
* START-OF-SELECTION
*---------------------------------------------------------------------*
START-OF-SELECTION.

  WRITE/ 'Material Number:'p_matnr,
         / 'Material Type  :'p_mtart,
         / 'Date Entered   :'p_date.

  WRITE/ 'Material Group :'s_matkl,
         / 'Creation Date  :'s_ersda.

  IF r_raw 'X'.
    WRITE/ 'Material CategoryRaw Material'.
  ELSE.
    WRITE/ 'Material CategoryFinished Goods'.
  ENDIF.

  IF p_test 'X'.
    WRITE/ 'Test Mode Active'.
  ENDIF.

  WRITE/ 'User:'p_user.
  WRITE/ 'Length:'p_len.

  " Fetch and display matching materials from MARA
  DATAlt_mara TYPE TABLE OF mara,
        ls_mara TYPE mara.

  SELECT FROM mara
    INTO TABLE lt_mara
        UP TO 20 ROWS
    WHERE matnr p_matnr
      AND mtart p_mtart
      AND matkl IN s_matkl
      AND ersda IN s_ersda.

  IF sy-subrc 0.
    WRITE/ '--Materials Found ---'.
    LOOP AT lt_mara INTO ls_mara.
      WRITE/ ls_mara-matnrls_mara-mtartls_mara-matklls_mara-ersda.
    ENDLOOP.
  ELSE.
    WRITE/ 'No materials found for given criteria.'.
  ENDIF.


*---------------------------------------------------------------------*
* AT SELECTION-SCREEN EVENT (for pushbutton handling)
*---------------------------------------------------------------------*
AT SELECTION-SCREEN.
  CASE sy-ucomm.
    WHEN 'PB1'.
      MESSAGE 'Pushbutton was pressed!' TYPE 'I'.
  ENDCASE. 

Related Questions

Leave an answer

Leave an answer