Nkedo na mmemme ABAP

NKWUO Klas a1.
 Ngalaba Ọhaneze.
 Data: num1 TYPE na VALUE 100.
 UZO: m1.
 EKWU agwụ.
 Klas a1 mmejuputa iwu.
 Uzo m1.
 DEE: 'a1:', ọnụọgụ1.
 NDỤMỌDỤ.
 EKWU agwụ.
 Klassị b1 Nkọwa nketa sitere na a1.
 Ngalaba Ọhaneze.
 UZỌ: m2, m1 NKWUO.
 EKWU agwụ.
 Klas b1 mmejuputa iwu.
 Uzo m1.
 nọmba 1 = nọmba 1 .
 DEE: 'b1:', ọnụọgụ1.
 NDỤMỌDỤ.
 Uzo m2.
 dee: 'M2 na klaasị b1'.
 NDỤMỌDỤ.
 EKWU agwụ.
 Mmalite-Nhọrọ.
 DATA: Ụdị REF TO a1.
 DATA: b NDỊ REF TO b1.
 *data: c pịnye REF TO c1.
 ************************************** ************** Mepụta ihe b.
 a = b.  "Ụzọ oku na-akwalite a-> m1 ( ).
 * kpọọ METHOD a->m2( ).  "Anyị enweghị ike ịnweta usoro sub klas nke onwe site na iji super class ref.
 ỌHỤRỤ ọhụrụ.
 b?= a.  " usoro nkedo oku b->m1 ( ).
 ỌHỤRỤ ọhụrụ.
 Kpọọ usoro b->m2 ( ).
 ************************************** *************** " njehie null ref mepụta OBJECT a.
 b?= a.  "Na-agbada nkedo ka na-enye ihe mkpofu ya na-akpọ METHOD b->m1 ( ).
 *********************************** *************** Mepụta ihe a.
 Gbalịa.
 b?= a.  "ur nwara iji 'NULL' ihe ntụnye mkpofu CATCH cx_sy_move_cast_error.
 Kpọọ usoro b->m1 ( ).
 Nkwụsị.
 *********************************** *************** Mepụta ihe a.
 Mepụta ihe b.
 Gbalịa.
 b?= a.
 CATCH cx_sy_move_cast_error.
 Kpọọ usoro b->m1 ( ).
 kpọọ METHOD b->m2 ( ).
 Nkwụsị.
 CLASS lcl_ụdị nkọwa.
 Ngalaba Ọhaneze.
 Ụzọ ise.
 EKWU agwụ.
 KLASS lcl_circle Nkọwa nketa sitere na lcl_shape.
 Ngalaba Ọhaneze.
 UZỌ: see REDEFINITION, calc_omrade.
 EKWU agwụ.
 CLASS lcl_ụdị IMPLEMENTATION.
 Ụzọ ise.
 dee:/ 'Na-ese ụdị ọ bụla'.
 NDỤMỌDỤ.
 EKWU agwụ.
 CLASS lcl_circle IMPLEMENTATION.
 Ụzọ ise.
 Dee:/ 'Na-esepụta ụdịdị: okirikiri'.
 NDỤMỌDỤ.
 METHOD calc_mpaghara.
 DEE :/ 'Apaka nke Crcle = 2iiR'.
 NDỤMỌDỤ.
 EKWU agwụ.
 Mmalite-Nhọrọ.
 DATA: o_cir TYPE REF TO lcl_circle.
 Mepụta ihe o_cir.
 Kpọọ usoro o_cir-> sere( ).  " na-akpọ subclass Draw() usoro Kpọọ METHOD o_cir->calc_area( ).
 ULINE.
 "-------- Ihe nkedo dị warara(Upcast)---------------" DATA : o_shp TYPE REF TO lcl_shape.
 o_shp = o_cir.  " Usoro nkedo dị warara(Upcast) Kpọọ o_shp-> sere( ).  " akpọ sub class Draw() usoro "kpọọ METHOD o_shp->calc_area( ) .  " mperi nchịkọta ULINE.
 "------- Ihe nkedo na-agbasawanye (Downcast) -----------" DATA : o_cir1 TYPE REF TO lcl_circle.
 "o_cir1 = o_shp.  " njehie mgbagwoju anya o_cir1 ?= o_shp.  " Ịgbasa nkedo(Downcast) Kpọọ usoro o_cir1-> sere( ).  " na-akpọ subclass Draw() usoro Kpọọ METHOD o_cir1->calc_area( ).
 NKWUO Klas a1.
 Ngalaba Ọhaneze.
 Data: num1 TYPE na VALUE 100.
 UZO: m1.
 EKWU agwụ.
 Klas a1 mmejuputa iwu.
 Uzo m1.
 DEE: 'a1:', ọnụọgụ1.
 NDỤMỌDỤ.
 EKWU agwụ.
 Klassị b1 Nkọwa nketa sitere na a1.
 Ngalaba Ọhaneze.
 UZỌ: m2, m1 NKWUO.
 EKWU agwụ.
 Klas b1 mmejuputa iwu.
 Uzo m1.
 nọmba 1 = nọmba 1 .
 DEE: 'b1:', ọnụọgụ1.
 NDỤMỌDỤ.
 Uzo m2.
 dee: 'M2 na klaasị b1'.
 NDỤMỌDỤ.
 EKWU agwụ.
 Mmalite-Nhọrọ.
 DATA: Ụdị nne na nna REF TO a1.
 DATA: Ụdị nwatakịrị REF TO b1.
 *data: c pịnye REF TO c1.
 ************************************** ************** Mepụta ihe nwa.
 nne na nna = nwa.  "Ụzọ oku na-akwalite nne na nna->m1( ).
 Kpọọ usoro nwa->m1 ( ).
 Kpọọ usoro nwa->m2 ( ).
 * kpọọ METHOD a->m2( ).  "Anyị enweghị ike ịnweta usoro sub klas nke onwe site na iji super class ref.
 ỌHỤRỤ ọhụrụ.
 nwa ?= nne na nna.  " ala nkedo usoro oku nwa->m1 ( ).
 ỌHỤRỤ ọhụrụ.
 Kpọọ usoro nwa->m2 ( ).
 ************************************** ***************** *" njehie null ref * mepụta ihe a.
 *b?= a.  "gbada nkedo ka na-enye ihe mkpofu * kpọọ METHOD b->m1 ( ).
 ************************************** *************** * Mepụta ihe a.
 Gbalịa.
 b?= a.  "ur nwara iji 'NULL' ihe ntụnye mkpofu CATCH cx_sy_move_cast_error.
 Kpọọ usoro b->m1 ( ).
 Nkwụsị.
 ************************************** *************** * Mepụta ihe a.
 Mepụta ihe b.
 Gbalịa.
 b?= a.
 CATCH cx_sy_move_cast_error.
 Kpọọ usoro b->m1 ( ).
 kpọọ METHOD b->m2 ( ).
 Nkwụsị.
 ****** Uru Pụrụ Iche****************** DATA : lv_string TYPE string, lv_string2 TYPE string, lv_string_final TYPE string.
 Ụdị: mmalite nke ty_data, auth TYPE c, Ọgwụgwụ nke ty_data.
 DATA: ls_user TYPE ty_data, ls_user2 TYPE ty_data, lt_user2 ỤDỊ TABLE nke ty_data, lt_user Ụdị TABLE nke ty_data.
 lv_string = 'a,b,c,a'.
 lv_string2 = 'd,b,c,a'.
 Kewaa lv_string NA ',' banye TABLE lt_user.
 Kewaa lv_string2 AT ',' banye TABLE lt_user2.
 LOOP NA lt_user2 na-enyefe mpaghara-akara( ).
 Tinye INTO TABLE lt_user.
 agwụcha.
 SORT lt_user BY auth.
 Hichapụ ADJACENT ABỤỌ NKE lt_user TỤRỤ auth.
 Ọ BỤRỤ na sy-subrc = 0.
 LOOP AT lt_user ASSIGNING FIELD-SYMBOL( ).
 Ọ BỤRỤ na lv_string_final BỤ MBỤ.
 lv_string_final = -auth.
 ỌZỌ.
 CONCATENATE lv_string_final -auth INTO lv_string_final KEwapụrụ ','.
 ỌJỤRỤ.
 agwụcha.
 ỌJỤRỤ.

 

Hapụ ikwu

Ebe a na-eji Akismet iji belata spam. Mụta otu esi etinye usoro data gị.