Posts

Mastering Basic Math Functions in ABAP with Examples

Image
  LIST OF VARIOUS MATHEMATICAL FUNCTIONS IN ABAP ABAP FUNCTION NAME DESCRIPTION ABS() This function calculates the absolute value of the given argument. SIGN() This function calculates the sign of the given argument. If the sign is positive it returns 1, if the sign is negative it returns -1 otherwise it returns 0. CEIL() This function calculates the smaller integer value of the given argument. FLOOR() This function calculates the largest integer value of the given argument. TRUNC() This function Truncates and returns the integer part of the given value as argument. FRAC() This function returns the fractional part of the given value as argument. MOD This function calculates the remainder of a number divided by another number. ROUND() This function Rounds off a number upto a ...

Comparing Two Strings As Parameters in ABAP Program Using Functions

Introduction String comparison is often required while writing a program in ABAP or any other programming language. Various types of contrast can be used, such as comparing two names, two cities, or any other alphanumeric string.   *&---------------------------------------------------------------------* *& Report ZTESTING1 *&---------------------------------------------------------------------* *& WRITE A PROGRAM THAT CHECKS TWO STRINGS FOR EQUALITY USING A  *& FUNCTION THAT ACCEPTS STRINGS AS PARAMETERS AND RETURNS THE STATUS *&---------------------------------------------------------------------* REPORT  ZTESTING1 . PARAMETERS :  STR1  TYPE  STRING ,  STR2  TYPE  STRING . DATA :  FLAG  TYPE  ABAP_BOOL . START-OF-SELECTION . PERFORM  CHECK_STRINGS  USING  STR1 STR2 ...

25 SAP ABAP Programming Examples Using Parameter Types

EXAMPLE 1: SINGLE INPUT PARAMETERS PARAMETERS :  P_NAME  TYPE  CHAR100 . START-OF-SELECTION . WRITE :  / 'NAME: ' , P_NAME . EXAMPLE 2: ACCEPT MULTIPLE PARAMETERS PARAMETERS :  P_FNAME  TYPE  CHAR20 ,  P_LNAME  TYPE  CHAR20 . START-OF-SELECTION . WRITE :  / 'FIRSTNAME: ' , P_FNAME . WRITE :  / . WRITE :  / 'LASTNAME : ' , P_LNAME . EXAMPLE 3: PARAMETERS WITH DEFAULT VALUES "PARAMETER NAME CANNOT EXCEED 8 CHARACTERS PARAMETERS :  PCITY  TYPE  CHAR20  DEFAULT  'LUDHIANA' . PARAMETERS :  PCOUNTRY  TYPE  CHAR20  DEFAULT  'INDIA' . START-OF-SELECTION . WRITE :  / 'YOU LIVE IN ' , PCITY ,  'AND COUNTRY IS ' , PCOUNTRY . EXAMPLE 4: RADIOBUTTON GROUP PARAMETERS : P_RED  RADIOBUTTON  GROUP  G1 , P_BLUE  RADIOBUTTON  GROUP  G1 , P_GREEN  RADIOBUTTON  GROUP...