08-16-2005 11:32 AM
can i read SQL tables using my ABAP Programming in SAP.
if so how pl. quote with some example.
08-16-2005 11:38 AM
08-16-2005 2:24 PM
Connect to the server which must be configured in table DBCON. Check OSS as there is note for this as the DNS name must be updated.
Define a connection parameter called P_NAME.
PARAMETER: P_NAME type DBCON-CON_NAME.
select-options: s_matnr for mara-matnr.
*--- Check if connection has already been opened
EXEC SQL.
SET CONNECTION :P_NAME
ENDEXEC.
IF SY-SUBRC <> 0.
*--- Connection not yet opened
EXEC SQL.
CONNECT TO :P_NAME
ENDEXEC.
*--- Can't open connection
IF SY-SUBRC <> 0.
MESSAGE E025(Q2).
ENDIF.
ENDIF.
Selects the data
loop at s_matnr.
EXEC SQL PERFORMING APPEND_DATA. "This is a form
SELECT extable1.product,
extable1.uom
INTO
:I_MAT-LCLCODE,
:I_MAT-UOM
FROM extable1
WHERE extable1.product = :S_MATNR-LOW
ENDEXEC.
ENDLOOP.
form append_data.
append i_mat.
endform.