5.29.2007

Hello World in ABAP

Dulu, saya koding pascal, c++, delphi, VB, LISP, assembly, PL/ SQL, java, dotnet. Ndak sempat menyimpan coretan pertama saya dikancah per-debug-an dan per-running-an mereka masing-masing. Sekarang, saya koding ABAP, dan inilah coretan pertamanya.
Selamat datang di dunia ABAP, pakai sabuk pengaman dan nikmatilah pengalaman baru.

FORM f_get_i_dn.

DATA: i_dn_vbuk TYPE zvdn OCCURS 0 with header line,
i_dn_vbak TYPE zvdn OCCURS 0 with header line,
i_dn_with_hl TYPE zvdn OCCURS 0 with header line.

FIELD-SYMBOLS LIKE zvdn.

REFRESH i_dn_tmp.

SELECT likp~vbeln lips~posnr likp~vkorg lips~werks likp~knump
likp~kunag likp~kunnr likp~wadat_ist lips~vtweg
lips~spart likp~erdat likp~wadat lips~matnr lips~arktx
lips~vgbel lips~vgpos lips~vrkme lips~lfimg lips~prodh
likp~route likp~vstel lips~oic_truckn
likp~ernam lips~lgort
INTO CORRESPONDING FIELDS OF TABLE i_dn_with_hl
FROM likp
INNER JOIN lips
ON lips~vbeln EQ likp~vbeln
WHERE likp~vbeln IN s_vbeln
AND likp~ernam IN s_ernam
AND likp~erdat IN s_erdat
AND likp~vstel IN s_vstel
AND likp~vkorg IN s_vkorg
AND likp~wadat IN s_wadat
AND likp~vbtyp EQ c_dlvr_typ
AND likp~route IN s_route
AND likp~kunag IN s_kunag
AND likp~kunnr IN s_kunnr
AND likp~wadat_ist IN s_wadat1
AND lips~matnr IN s_matnr
AND lips~werks IN s_werks
AND lips~lgort IN s_lgort
AND lips~vtweg IN s_vtweg
AND lips~spart IN s_spart.

i_dn_tmp[] = i_dn_with_hl[].
SORT i_dn_tmp BY vbeln vgbel.
DELETE ADJACENT DUPLICATES FROM i_dn_tmp COMPARING vbeln vgbel.

SELECT vbuk~vbeln vbuk~wbstk
INTO CORRESPONDING FIELDS OF TABLE i_dn_vbuk
FROM vbuk
FOR ALL ENTRIES IN i_dn_tmp
WHERE vbuk~vbeln EQ i_dn_tmp-vbeln
AND vbuk~wbstk IN s_wbstk.

CLEAR i_dn_with_hl-wbstk.
Modify i_dn_with_hl transporting wbstk.

LOOP AT i_dn_vbuk ASSIGNING . "Faster in loop
i_dn_with_hl-wbstk = -wbstk.
Modify i_dn_with_hl transporting wbstk where vbeln = -vbeln.
ENDLOOP.

DELETE i_dn_with_hl WHERE wbstk is INITIAL.

SELECT vbak~vgbel vbak~waerk
INTO CORRESPONDING FIELDS OF TABLE i_dn_vbak
FROM vbak
FOR ALL ENTRIES IN i_dn_tmp
WHERE vbak~vbeln EQ i_dn_tmp-vgbel.

CLEAR i_dn_with_hl-waerk.
Modify i_dn_with_hl transporting waerk.

LOOP AT i_dn_vbak ASSIGNING . "Faster in loop
i_dn_with_hl-waerk = -waerk.
Modify i_dn_with_hl transporting waerk where vgbel = -vgbel.
ENDLOOP.

i_dn[] = i_dn_with_hl[].

ENDFORM. " f_get_i_dn

0 comments:

 
Template by yummylolly.com