Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

ABAP 7.x New Features and Commands

1,092 views

Published on

ABAP 7.x brought a lot of new features and commands. This Sap Tech Ed presentation contains code samples for some of the most significant ones.

Published in: Software
  • Hello! Get Your Professional Job-Winning Resume Here - Check our website! https://vk.cc/818RFv
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

ABAP 7.x New Features and Commands

  1. 1. ABAP 7.x Dr. Kerem Köseoğlu www.keremkoseoglu.com
  2. 2. Variable definition
  3. 3. Data go_bapi->create_doc( EXPORTING iv_var1 = ‘SAMPLE’ iv_var2 = ‘SAMPLE’ IMPORTING ev_belnr = DATA(lv_belnr) ev_gjahr = DATA(lv_gjahr) ev_bukrs = DATA(lv_bukrs) ).
  4. 4. Data DATA(lv_name) = class=>get_name( lv_kunnr ).
  5. 5. Field symbol LOOP AT gt_itab ASSIGNING FIELD-SYMBOL(<ls_itab>). ENDLOOP.
  6. 6. Pointer LOOP AT gt_itab REFERENCE INTO DATA(lr_itab). ENDLOOP.
  7. 7. Value assignment
  8. 8. Value DATA(ls_kna1) = VALUE kna1( kunnr = ‘1234567890’ name1 = ‘SAMPLE’ ).
  9. 9. Value # DATA ls_kna1 TYPE kna1. ls_kna1 = VALUE #( kunnr = ‘1234567890’ name1 = ‘SAMPLE’ ).
  10. 10. Value # with method DATA ls_kna1 TYPE kna1. ls_kna1 = VALUE #( kunnr = lv_kunnr1 name1 = get_name( kunnr = lv_kunnr1 ) ).
  11. 11. Conv check_doc( iv_xblnr = CONV #( lv_aufnr ) ).
  12. 12. Cond get_date_interval( IMPORTING !ev_begin = DATA(lv_begin) !ev_end = DATA(lv_end) ). DATA(lv_status) = COND char5( WHEN sy-datum LT lv_begin THEN ‘EARLY’ WHEN sy-datum GT lv_end THEN ‘LATE’ ELSE ‘OK’ ).
  13. 13. Switch DATA(lv_status) = SWITCH char10( sy-msgty WHEN ‘S’ THEN ‘PERFECT’ WHEN ‘W’ THEN ‘OK’ ELSE ‘ERROR’ ).
  14. 14. String templates DATA(lv_string) = |Today is { sy-datum }| && | ,time is { sy-uzeit }| && | ,system status: { get_status( ) }|.
  15. 15. XSDBOOL rv_result = XSDBOOL( sy-subrc eq 0 ).
  16. 16. Pointer DATA(lr_ref) = REF #( lv_value ).
  17. 17. Internal tables
  18. 18. Assign / Index ASSIGN lt_itab[ 3 ] TO FIELD-SYMBOL(<ls_itab>).
  19. 19. Assign / Key ASSIGN lt_itab[ bukrs = ’1234’ belnr = ‘1234567890’ gjahr = ‘2018’ ] TO FIELD-SYMBOL(<ls_itab>).
  20. 20. Assign / Hashed key ASSIGN lt_itab[ KEY primary_key COMPONENTS bukrs = ’1234’ belnr = ‘1234567890’ gjahr = ‘2018’ ] TO FIELD-SYMBOL(<ls_itab>).
  21. 21. Reference DATA(lr_ref) = REF #( lt_itab[ bukrs = ’1234’ belnr = ‘1234567890’ gjahr = ‘2018’ ] ).
  22. 22. Default DATA(lv_name1) = CONV name1_gp( lt_kna1[ kunnr = lv_kunnr ]-name1 DEFAULT space ).
  23. 23. Line check IF line_exists( lt_itab[ kunnr = lv_kunnr ] ). " ... ENDIF.
  24. 24. Corresponding DATA(lt_malzeme) = CORRESPONDING tt_malz( lt_mara ).
  25. 25. Corresponding / Mapping / Except DATA(lt_malzeme) = CORRESPONDING tt_malz( lt_mara MAPPING material = matnr EXCEPT meins ).
  26. 26. For DATA(lt_liste) = VALUE tt_liste( FOR ls_mara IN lt_mara WHERE ( mtart EQ ‘ABCD’ ) ( material = ls_mara-matnr text = ls_mara-maktx ) ).
  27. 27. For Groups DATA(lt_bukrs) = VALUE tt_bukrs( FOR GROUPS grp OF ls_bkpf IN lt_bkpf WHERE ( gjahr EQ lv_gjahr ) GROUP BY ls_bkpf-bukrs ( bukrs = grp ) ).
  28. 28. Reduce lv_sum = REDUCE #( INIT x TYPE menge_d FOR ls_mseg IN lt_mseg WHERE ( matnr EQ lv_matnr ) NEXT x = x + ls_mseg-menge ).
  29. 29. Secondary index TYPES: tt_bkpf TYPE STANDARD TABLE OF bkpf WITH DEFAULT KEY WITH UNIQUE HASHED KEY k1 COMPONENTS bukrs belnr gjahr WITH NON-UNIQUE SORTED KEY k2 COMPONENTS xblnr.
  30. 30. Queries
  31. 31. Select into dynamic itab SELECT matnr, mtart, matkl FROM mara WHERE matnr IN @s_matnr INTO TABLE @DATA(lt_mat).
  32. 32. Select into dynamic variable SELECT SINGLE name1 FROM kna1 WHERE kunnr eq @lv_kunnr INTO @DATA(lv_name1).
  33. 33. Literals DATA lt_werks_rng TYPE RANGE OF werks_d. SELECT ‘I’ AS sign, ‘EQ’ AS option, werks AS low FROM t001w INTO CORRESPONDING FIELDS OF TABLE @lt_werks_rng.
  34. 34. Select all fields SELECT marc~*, t001w~name1 FROM marc INNER JOIN t001w ON t001w~werks EQ marc~werks INTO TABLE @DATA(lt_marc).
  35. 35. Select Case SELECT CASE WHEN strkorr NE @space THEN strkorr ELSE trkorr END AS request_no FROM e070 INTO TABLE @DATA(lt_request).
  36. 36. Select Calculation SELECT brgew, ntgew, gewei, ABS( brgew – ntgew ) AS diff FROM mara INTO TABLE @DATA(lt_material).
  37. 37. Union All SELECT name1 FROM kna1 WHERE loevm EQ @abap_false UNION ALL SELECT name1 FROM lfa1 WHERE loevm eq @abap_false INTO TABLE @DATA(lt_names).
  38. 38. Union Distinct SELECT stcd1, stcd2 FROM kna1 WHERE loevm EQ @abap_false UNION DISTINCT SELECT stcd1, stcd2 FROM lfa1 WHERE loevm eq @abap_false INTO TABLE @DATA(lt_tax).
  39. 39. Object Oriented
  40. 40. New DATA(lo_obj) = NEW zcl_class( ).
  41. 41. New # DATA lo_obj TYPE REF TO zcl_class. lo_obj = NEW #( ).
  42. 42. Cast DATA(lo_obj2) = CAST zcl_002( lo_obj1 ).
  43. 43. Is Instance Of IF lo_obj2 IS INSTANCE OF lo_obj1. " ... ENDIF.
  44. 44. Default Ignore INTERFACE zif_demo PUBLIC. METHODS: method1 DEFAULT IGNORE, method2.
  45. 45. Final
  46. 46. Yeni ABAP Avantaj • Kısa & net kod • Hızlı geliştirme • Hatalarda azalma • Performans Dezavantaj • Acemilik • Anlaşılırlık • Taşınabilirlik • IDE
  47. 47. Teşekkürler! Dr. Kerem Köseoğlu www.keremkoseoglu.com Sunum: slideshare.net/DrKeremKoseoglu

×