![]() |
|
||||||
Substring in SAP's ABAP programmingUnlike many of the higher level languages there is no stand-alone substring call. We have split, shift, replace, translate and condense but no substring. So if we want to know the first four characters from the start of a field how do we do it? The WRITE statement is what we use to substring a field. The syntax is as follows:
A real-life use of the substring functions I needed to build a character date field for a cross-platform integration project I was working on. First, I defined the date field: data: datechar(10). To build the date lets use sy-datum, which has the current system date. write SY-DATUM+4(2) to datechar+0(2). write '/' datechar+2(1). write SY-DATUM+6(2) to datechar+3(2). write '/' TO datechar+5(1). write SY-DATUM+0(4) to datechar+6(4). Value of SY-DATUM 20010616 Here's how the field changes with the execution of each line. 06________ 06/_______ 06/16_____ 06/16/____ 06/16/2001This is just one of the great functionalities of WRITE. |
|||||||
[Perl help] [ABAP help] [MySQL help] [TCP/IP troubleshooting] [HTML help] [Feedback] [Humor] Advertise on Golden Ink's Georgia Network
|
|||||||