Abap Native SQL Func

Global Data
FUNCTION-POOL zduromont. “MESSAGE-ID ..
DATA: return LIKE TABLE OF ZDUROMONT_TEST WITH HEADER LINE.
DATA: connection LIKE dbcon-con_name VALUE ‘UTKU_TEST’.
DATA: isim(200).

* INCLUDE LZDUROMONTD… ” Local class definition

Function Module:

FUNCTION zduromont_test_connect.
*”———————————————————————-
*”*”Local Interface:
*” IMPORTING
*” VALUE(I_OKU) TYPE CHAR1 OPTIONAL
*” VALUE(I_YAZ) TYPE CHAR1 OPTIONAL
*” VALUE(I_ISIM) TYPE CHAR50 OPTIONAL
*” VALUE(I_SOYISIM) TYPE CHAR50 OPTIONAL
*” EXPORTING
*” VALUE(ISIM) TYPE CHAR50
*” VALUE(SOYISIM) TYPE CHAR50
*” TABLES
*” T_RETURN STRUCTURE ZDUROMONT_TEST OPTIONAL
*”———————————————————————-

EXEC SQL.
CONNECT TO :CONNECTION
ENDEXEC.

IF sy-subrc = 0.
EXEC SQL.
SET CONNECTION :CONNECTION
ENDEXEC.

IF i_yaz IS NOT INITIAL.
EXEC SQL.
insert into OmerEksi (Isim,Soyisim) values (:i_isim, :i_soyisim)
ENDEXEC.
ENDIF.
IF i_oku IS NOT INITIAL.
EXEC SQL PERFORMING loop_output.
select t1.RecId, t1.Isim, t1.Soyisim
INTO structure :return
FROM OmerEksi AS t1
–insert into OmerEksi (Isim,Soyisim) values (:i_isim, :i_soyisim)
ENDEXEC.
ENDIF.

EXEC SQL.
COMMIT
ENDEXEC.

EXEC SQL.
SET CONNECTION DEFAULT
ENDEXEC.

EXEC SQL.
DISCONNECT :CONNECTION
ENDEXEC.
ENDIF.

t_return[] = return[].

ENDFUNCTION.
*&———————————————————————*
*& Form loop_output
*&———————————————————————*
* text
*———————————————————————-*
FORM loop_output.
APPEND return.
* WRITE: / isim.
ENDFORM. “loop_output

09-04-2014 14-38-00



You must be logged in to post a comment.

This entry was posted on 09 Nisan 2014 and is filed under Abap Module. Written by: . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.