可以看到如下代码中,查询了底表zdbconn,又查了中间表ZTFI0072
DATA: gv_dbs(20) ,go_exc_ref TYPE REF TO cx_sy_native_sql_error,gv_error_text TYPE string,lv_count TYPE syst_index.SELECT SINGLE conntxtFROM zdbconn INTO gv_dbsWHERE sysname = 'EDSAP'.TRY.EXEC SQL.CONNECT TO :gv_dbsENDEXEC.IF sy-subrc <> 0.RAISE EXCEPTION TYPE cx_sy_native_sql_error.ENDIF.EXEC SQL .SELECT COUNT( * ) INTO :lv_count FROM ZTFI0072 WHERE mandt = :sy-mandtAND zzllx = :p_ZZLLX AND ZHTBH = :p_ZHTBHAND zhtbb = :p_zhtbbENDEXEC.EXEC SQL.COMMIT WORK.DISCONNECT :gv_dbsENDEXEC.CATCH cx_sy_native_sql_error INTO go_exc_ref.CLEAR: gv_error_text.gv_error_text = go_exc_ref->get_text( ).ps_return-msg = gv_error_text.ENDTRY.
ENDFORM.
查到了链接名DB_EDC
进入T-CODE,DBCO,可以看到链接信息,但看不到密码
进入程序:ADBC_QUERY
输入数据库链接名、中间表名
可以查到中间表的字段信息
输入条件可以查到其中的内容
参考链接:
SAP 数据库直连的配置和代码_sap 数据库 设置-CSDN博客