ABAP/4

Program Selections in ABAP/4

When you want to create report in SAP, the selection screen will be displayed when we want to execute program. The syntax for create selections are compose of:

SELECT-OPTIONS in ABAP/4

SELECT-OPTIONS is a complex selection. If user want to input value of field more than one value, it is possible by using SELECT-OPTIONS.

Syntax

SELECT-OPTIONS  FOR .

Example

SELECT-OPTIONS s_belnr FOR bkpf-belnr.

Structure of Selection

SELECT-OPTIONS have structures:

  • SIGN Possoble value are I(Include) and E(Exclude).
  • OPTION Possilble value are EQ(Equal), NE(Not Equal), GT(Greater Than),GE(Greater Tahn or Equal), LT(Less Than), LE(Less Than or Equal), CP(Contains Pattern), NP(Not Contains Pattern), BT(Between), NB(Not Between)
  • LOW keep low value
  • HIGH keep high value

Options

Commenting in ABAP/4

In ABAP/4, we have 2 formatting for comment:

  1. Line Comment: If you want to comment whole line, you can put * sign in front of the line.
    Example:
    * Comment Line
    WRITE: This is the example for commenting.
  2. Partial Line Comment: If you want to comment partail of line, you can put " sign in front of the comment text
    Example:
    WRITE: This is the example for commenting.    "Comment Line

PARAMETERS in ABAP/4

Syntax


              

PARAMETERS (length) [TYPE type or LIKE obj] DECIMALS d.


              

Examples

PARAMETERS: char1(20) TYPE C,
date1 LIKE SY-DATUM,
number1 TYPE P DECIMALS 2. 

Options

  • DEFAULT
    Example: 
    PARAMETERS p1(5) TYPE C DEFAULT ’we’.
  • MEMORY ID
    Example: 
    PARAMETERS p2(5) TYPE C MEMORY ID pid.

How to get Text of Domain Value in ABAP/4


CALL FUNCTION ’DOMAIN_VALUE_GET’
   EXPORTING
     I_DOMNAME       = lv_name "Domain Name
     I_DOMVALUE      = lv_value "Domain Value
   IMPORTING
     E_DDTEXT        = lv_text "Text of Domain Value
   EXCEPTIONS
     NOT_EXIST       = 1
     OTHERS          = 2
           .

Get Last Date of Month in ABAP/4


*&---------------------------------------------------------------------*
*&     Form get_last_date_of_month
*&---------------------------------------------------------------------*
*      get last date of month
*----------------------------------------------------------------------*
*     -->P_BEGDA is the date in month that you want to know last date
*     <--P_ENDDA last date of month that system will return to you
*----------------------------------------------------------------------*
form get_last_date_of_month using   p_begda
                           changing p_endda.
CALL FUNCTION ’LAST_DAY_OF_MONTHS’