Berhasil mencoba ‘Tutorial 3 – Navigation’ dari Web Dynpro for ABAP: Tutorials for Beginners. Berikut adalah penerbangan dan SAN FRANSISCO menuju SINGAPORE:

Setelah dicoba ternyata tidak ada penerbangan dari JAKARTA menuju SINGAPORE:

Namun saya mendapatkan kejutan kejutan pada saat mengikuti petunjuk tutorial tersebut. Terkadang tutorial tidak menunjukkan secara detil tentang suatu operasi atau tidak diberi contoh gambar. Kesulitan yang saya alami dan terpecahkan adalah sebagai berikut:
1. Pada halaman 6 bagian atas terdapat teks:
Copy the Web Dynpro component ZZ_00_BAPIFLIGHT from Tutorial 2 to a new component with name ZZ_00_BAPINAV.
Adjust the name of the window according to the component name.
Setelah mencoba mengikuti instruksi tersebut, saya mendapatkan error:
RFC system error for destination GTADIR_SERVER
Namun proses peng-copy-an tetap berhasil.
1. Pada halaman 6 bagian atas terdapat teks:
Copy the Web Dynpro component ZZ_00_BAPIFLIGHT from Tutorial 2 to a new component with name ZZ_00_BAPINAV. Adjust the name of the window according to the component name.
Setelah mencoba mengikuti instruksi tersebut, saya mendapatkan error:
RFC system error for destination GTADIR_SERVER
Namun proses peng-copy-an tetap berhasil. Lain kali akan googling dulu mengapa error itu muncul.
2. Pada halaman 17 bagian bawah terdapat teks:
You can use the code wizard to generate the access to the attribute CITY of node DESTINATION_FROM and modify it for the second attribute. The concatenate statement assembles the string together. The method set_attribute links the message to UI element.
Dalam tutorial tidak ditunjukkan secara visual tentang cara menggunakan code wizard. Berikut adalah cara saya menggunakan wizard pembuatan kode untuk mendapatan kota asal penerbangan (perhatikan urutan angkanya):

Lalu kode akan dibuat secara otomatis. Ralat: urutan yang benar dari gambar di atas adalah (1) taruh cursor di sini, (2) klik wizard. Variabel lv_city saya ganti menjadi lv_city_from dengan cara berikut:

Kembali ke editor dan taruh cursor di atas endmethod. Lakukan hal yang sama untuk DESTINATION_TO.
Setelah selesai, kode lengkapnya adalah sebagai berikut. Dibawah komentar ’set text message’ adalah hasil ketikan manual. Memang hasil kodenya lebih panjang dari tutorial, namun saya ingin tahu konstruksi kode yang dibuat secara otomatis ini.
method HANDLENO_FLIGHTS_FOUND .
***************************
* get destination from city
***************************
data lo_nd_destination_from type ref to if_wd_context_node.
data lo_el_destination_from type ref to if_wd_context_element.
data ls_destination_from type wd_this->element_destination_from.
data lv_city_from like ls_destination_from-city.
* navigate from <CONTEXT> to <DESTINATION_FROM> via lead selection
lo_nd_destination_from = wd_context->get_child_node( name = wd_this->wdctx_destination_from ).
* get element via lead selection
lo_el_destination_from = lo_nd_destination_from->get_element( ).
* get single attribute
lo_el_destination_from->get_attribute(
exporting
name = `CITY`
importing
value = lv_city_from ).
*************************
* get destination to city
*************************
data lo_nd_destination_to type ref to if_wd_context_node.
data lo_el_destination_to type ref to if_wd_context_element.
data ls_destination_to type wd_this->element_destination_to.
data lv_city_to like ls_destination_to-city.
* navigate from <CONTEXT> to <DESTINATION_TO> via lead selection
lo_nd_destination_to = wd_context->get_child_node( name = wd_this->wdctx_destination_to ).
* get element via lead selection
lo_el_destination_to = lo_nd_destination_to->get_element( ).
* get single attribute
lo_el_destination_to->get_attribute(
exporting
name = `CITY`
importing
value = lv_city_to ).
*************************
* set text message
*************************
data text type string.
CONCATENATE 'no flights available from' lv_city_from 'to' lv_city_to INTO text SEPARATED BY ' '.
wd_context->set_attribute( name = 'TEXT' value = text ).
endmethod.
secara otomatis ini. Awas, perhatikan penggunaan kurung. Berikut akan menghasilkan 'syntax error' karena 'text' dan ')' tersambung:
wd_context->set_attribute( name = 'TEXT' value = text).
Ok, Sampai jumpa di Mencoba Tutorial berikutnya.