Sunday, March 4, 2018

Table Expressions



Internal table of Invoices.

Now you want to build a range table of materials from above invoice table.

traditional

loop at lt_invoice into ls_invoice.
  ls_matnr_r-sign = 'I'.
  ls_matnr_r-low= 'EQ'.
  ls_matnr_r-low = ls_invoice-matnr.
 append ls_matnr
endloop.


https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/index.htm



    DATA(out) = cl_demo_output=>new( ).

    DATA(itab1) = VALUE itab1(
      FOR j = 41 THEN j - 10 UNTIL j < 10
      ( col1 = j col2 = j + 1 col3 = j + 2 col4 = j + 3 ) ).
    out->write( itab1 ).

    DATA(itab2) = VALUE itab2(
      FOR wa IN itab1 WHERE ( col1 < 30 )
        ( wa ) ).
    out->write( itab2 ).

    DATA(itab3) = VALUE itab3(
      FOR wa IN itab1 INDEX INTO idx WHERE ( col1 = 21 ) ##PRIMKEY[key]
        ( LINES OF itab1 from idx ) ).
    out->write( itab3 ).

    DATA(itab4) = VALUE itab4(
       FOR wa IN itab1 FROM 2 TO 3
         ( col1 = wa-col2 col2 = wa-col3 ) ).
    out->write( itab4 ).

    DATA(base)  = VALUE itab5( ( 1 ) ( 2 ) ( 3 ) ).
    DATA(itab5) = VALUE itab5(
       BASE base
       FOR wa IN itab1 USING KEY key
          ( wa-col1 ) ).
    out->write( itab5 ).

    out->display( ).



From an internal table itab1, the content of new internal tables is created in constructor expressions with one FOR expression each:
  • itab2 has the same row type as itab1. All columns of all rows are assigned that meet a WHERE condition.
  • itab3 has the same row type as itab1. All rows are assigned that meet a WHERE condition from a row.
  • itab4 has fewer columns than itab1. Only certain columns of a restricted number of rows are assigned.
  • itab5 has only one column. The addition BASE is used to first assign the table base and then the first column of itab1. This demonstrates the effect of specifying a sorted secondary key for this column.


Challenges in any SAP Project


1) Long project duration, SAP releases newer versions and by the time you are in Production you are already late by a year.

2) Reports are postponed to the end , instead this should be the first to be visited.

3) End-user involvement at the end.

4) Let project teams transport changes fastly.

5) HANA code remediation, reduce up to 30%  lines of code and improve application server performance by using features like
  Table Expressions, instead of doing expensive LOOP
  in the API world, each second is a light year.

6) Instead of running at full capacity after go-live, gradually increase the capacity. If the system is running 24x7, you won't have downtime to fix the issues immediately. And also problems get added.

7) Data Migrations: Do not make Warehouse layout changes with new systems. First, migrate the data as it is, and then make the layout changes if needed.

Direct links to ABAP Documentation by Release

Release specific changes in ABAP


If you are trying to see from what version a new ABAP feature is available, look at the below link..


https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/index.htm?file=abennews-750.htm

How many ABAP Developers are in the world


Check this


4.5 Million ABAP Developers