SAP ABAP Syntax for Receive Keyword

Receive is the keyword used in abap programming of sap erp and its syntax is explained Below.The previous post deals with read keyword of sap abap.

Basic form

REPLACE f WITH g INTO h.

Addition

... LENGTH len (length specification for field f )

Effect

Replaces the first occurrence of the contents of field f in field h with the contents of field g . All fields are handled in their defined length; this means that closing blanks are not ignored.

The return code value indicates whether the string f was

found in h and replaced by g :

SY-SUBRC = 0 String replaced.
SY_SUBRC =Justify Full 4 String not replaced.

Example

DATA FIELD(10).
MOVE 'ABCB' TO FIELD.
REPLACE 'B' WITH 'string' INTO FIELD.

returns:

FIELD = 'AstringCB', SY-SUBRC = 0

The fields f and g in the REPLACE statement should not overlap. Otherwise, the result is undefined.

Addition

... LENGTH len ... (length specification for field f )

Effect

Searches for the string f in the field h not in its (full) field length, but in the length len .

Example

DATA: PATTERN(5) VALUE 'ABC',
LEN TYPE I,
REPL_STRING(5) VALUE '12345',
FIELD(12) VALUE 'abcdeABCDE'.
REPLACE PATTERN WITH REPL_STRING
INTO FIELD.

does not change FIELD , since 'ABC ' does not occur in abcdeABCDE ' .

LEN = STRLEN( PATTERN ).
REPLACE PATTERN LENGTH LEN
WITH REPL_STRING
INTO FIELD.

Related Posts:

SAP R/3 Introduction to best ERP Mysap
Challenges in implementing ERP
ERP implementation practices
Enterprise resource planning introduction
ERP software selection
ERP implementation process and advantages SAP FINANCE cost center summery
MYsap crm business scenarios and sap solutions
MySAP CRM and customer relationship management
Customer Relationship Management and mysap an introduction
CRM Management and sales and service strategy of mysap crm
MySAP CRM and customer as business partner
How Customer Relationship management makes company Leader
CRM Uses and how to get best results with CRM
CRM software solutions and mysap advantage
SAP FICO internal order summery report
Credit Score Chart