Leave a comment in the below comment section and let us know your feedback. Please stay tuned for ABAP for HANA/ABAP 7.4 tutorials. Next time when you write code try using the new syntax and let us know your experience. New Syntax DATA(indx) = line_index( it_bookings[ carrid = 'AA'Ĭongrats! You have successfully learned new features in ABAP 7.4 release. This is used to delete a line from internal table at any know index. You can delete the lines in a loop conditionally by adding the WHERE clause. Old Syntax READ TABLE it_bookings TRANSPORTING NO FIELDS WITH KEY carrid = 'AA'ĮNDIF. This is the simplest way for deleting lines. if sy-subrc = 0, then sy-tabix will give the index of the row. The new syntax is similar to READ TABLE with TRANSPORTING NO FIELDS followed by sy-subrc check. In ABAP 7.4 release, we have new syntax LINE_INDEX() to identify the index of a row when a condition is met while reading the internal table. New Syntax IF line_exists( it_bookings[ carrid = 'AA' Old Syntax READ TABLE it_bookings TRANSPORTING NO FIELDS WITH KEY carrid = 'AA' LINE_EXISTS function will return “true” if the row exists and “false” if the row does not exists. This syntax is short form to READ TABLE with TRANSPORTING NO FIELDS followed by sy-subrc check. In ABAP 7.4, we have new syntax to check if the record exists in the internal table based on some conditions. It_bookings[ KEY keyid COMPONENTS carrid = 'AA'ĮNDTRY. New Syntax *** Using Table Expressions ** READ TABLE IT_BOOKINGS ASSIGNING WITH TABLE KEY CARRID = 'AA'ĮNDIF. READ TABLE IT_BOOKINGS ASSIGNING WITH KEY CARRID = 'AA' READ TABLE IT_BOOKINGS ASSIGNING INDEX 1. We will look at both versions and you will also learn the new ABAP 7.4 new syntax Old Syntax * Modify the contents based on INDEX We also use FIELD-SYMBOL to modify the contents in internal table. In ABAP Netweaver 7.4 release SAP has introduced brand new syntax using table expressions. We use MODIFY statement to modify the contents in internal table. Tty_new TYPE TABLE OF ty_new WITH EMPTY KEY.ĭATA(it_new) = VALUE tty_new( ( f1 = 'A') It_old TYPE STANDARD TABLE OF ty_old WITH EMPTY KEY.ĪPPEND wa_old TO it_old. New Syntax DATA(WA_BOOKINGS) = IT_BOOKINGS[ KEY keyid COMPONENTS CARRID = 'AA'īefore Netweaver 7.4 we use APPEND syntax to append rows to the internal table, but with new release of Netweaver 7.4 SAP has introduced table expressions to initialize the internal table with brand new syntax. READ USING a TABLE KEY – Read the internal table by specifying table keys Old Syntax READ TABLE IT_BOOKINGS INTO WA_BOOKINGS WITH TABLE KEY CARRID = 'AA'ĬONNID = '17'. or READ TABLE itab into data(wa) WITH KEY field1 var1. or READ TABLE itab into wa WITH KEY field1 var1. DATA wa TYPE structure LOOP AT itab INTO wa. Declaration of the work area while operation on Internal Table, Old Syntax. New Syntax DATA(WA_BOOKINGS) = IT_BOOKINGS. INTO TABLE DATA(itab) WHERE fld1 var1 AND fld2 var2. Old Syntax READ TABLE IT_BOOKINGS INTO WA_BOOKINGS WITH KEY CARRID = 'AA'ĬUSTTYPE = 'P'. READ USING a FREE KEY – Read the internal table using the free key. READ INDEX – Read the internal table data using the table index Old Syntax READ TABLE IT_MARA INTO DATA(WA_MARA) INDEX 1. We can read the internal table data with 3 possible ways.You will learn how to use table expressions to read the internal table which is different from old syntax READ TABLE …. Internal Table ExpressionsĪ table expression consists of the internal table name, directly followed by square brackets READ TABLEīefore ABAP 7.4 we use READ TABLE syntax to read the internal table, but with new release of ABAP 7.4 SAP has introduced table expressions to read the internal table with brand new syntax. Please read our first blog on Inline Declarations for DATA and FIELD-SYMBOL. READ USING a TABLE KEY – Read the internal table by specifying table keys READ INDEX – Read the internal table data using the table index Source table, this method can be slower than copying the source tableĪnd deleting the surplus rows from the target table. If the result contains almost all rows in the The operator FILTER provides a shortened format for this special Table reduction with an iteration expression for table iterations withįOR. Table filtering can also be performed using a table comprehension or a The ABAP documentation 7.52 explains well the performance of FILTER and recommendations when to not use it ( ) : Of course, the building of an index has itself a cost, so you must balance its use versus the amount of filtering done. It would be logical that FILTER, being specialized for that task, is faster than other constructs which have an overhead cost to choose between many other possible operations.įILTER has also the advantage to force the developer to use an index. I didn't find any benchmark on the web, but it's so simple to make a test by yourself.
0 Comments
Leave a Reply. |