通过LDB_PROCESS函数使用逻辑数据库
TABLES SPFLI.
SELECT-OPTIONS S_CARR FOR SPFLI-CARRID.
TYPE-POOLS: RSDS, RSFS.
DATA: CALLBACK TYPE TABLE OF LDBCB,
??? CALLBACK_WA LIKE LINE OF CALLBACK.
DATA: SELTAB TYPE TABLE OF RSPARAMS,
????? SELTAB_WA LIKE LINE OF SELTAB.
DATA: TEXPR TYPE RSDS_TEXPR,
????? FSEL? TYPE RSFS_FIELDS.
??? *設(shè)置需要回調(diào)的數(shù)據(jù)節(jié)點(diǎn)和回調(diào)對(duì)應(yīng)的子程序
??? CALLBACK_WA-LDBNODE???? = 'SPFLI'.
??? CALLBACK_WA-GET???????? = 'X'.
??? CALLBACK_WA-GET_LATE??? = 'X'.
??? CALLBACK_WA-CB_PROG???? = SY-REPID.
??? CALLBACK_WA-CB_FORM???? = 'CALLBACK_SPFLI'.
??? APPEND CALLBACK_WA TO CALLBACK.
??? CLEAR CALLBACK_WA.
??? CALLBACK_WA-LDBNODE???? = 'SFLIGHT'.
??? CALLBACK_WA-GET???????? = 'X'.
??? CALLBACK_WA-CB_PROG???? = SY-REPID.
??? CALLBACK_WA-CB_FORM???? = 'CALLBACK_SFLIGHT'.
??? APPEND CALLBACK_WA TO CALLBACK.
??? *設(shè)置對(duì)應(yīng)的選擇屏幕的參數(shù)的傳入值
??? SELTAB_WA-KIND = 'S'.
??? SELTAB_WA-SELNAME = 'CARRID'.
??? LOOP AT S_CARR.
??? MOVE-CORRESPONDING S_CARR TO SELTAB_WA.
??? APPEND SELTAB_WA TO SELTAB.
??? ENDLOOP.
??? *調(diào)用函數(shù)
CALL FUNCTION 'LDB_PROCESS'
???? EXPORTING
????????? LDBNAME???????????????????? = 'F1S'
????????? VARIANT???????????????????? = ' '
????????? EXPRESSIONS???????????????? = TEXPR
????????? FIELD_SELECTION???????????? = FSEL
???? TABLES
????????? CALLBACK??????????????????? = CALLBACK
????????? SELECTIONS????????????????? = SELTAB
???? EXCEPTIONS
????????? LDB_NOT_REENTRANT?????????? = 1
????????? LDB_INCORRECT?????????????? = 2
????????? LDB_ALREADY_RUNNING???????? = 3
????????? LDB_ERROR?????????????????? = 4
????????? LDB_SELECTIONS_ERROR??????? = 5
????????? LDB_SELECTIONS_NOT_ACCEPTED = 6
????????? VARIANT_NOT_EXISTENT??????? = 7
????????? VARIANT_OBSOLETE??????????? = 8
????????? VARIANT_ERROR?????????????? = 9
????????? FREE_SELECTIONS_ERROR?????? = 10
????????? CALLBACK_NO_EVENT?????????? = 11
????????? CALLBACK_NODE_DUPLICATE???? = 12
????????? OTHERS????????????????????? = 13.
IF SY-SUBRC <> 0.
? WRITE: 'Exception with SY-SUBRC', SY-SUBRC.
ENDIF.
*SPFLI節(jié)點(diǎn)對(duì)應(yīng)的回調(diào)處理函數(shù)
FORM CALLBACK_SPFLI USING NAME? TYPE LDBN-LDBNODE
????????????????????????? WA??? TYPE SPFLI
????????????????????????? EVT?? TYPE C
????????????????????????? CHECK TYPE C.
? CASE EVT.
?? WHEN 'G'.
????? WRITE: / WA-CARRID, WA-CONNID, WA-CITYFROM, WA-CITYTO.
????? ULINE.
??? WHEN 'L'.
????? ULINE.
? ENDCASE.
ENDFORM.
*SFIGHT節(jié)點(diǎn)對(duì)應(yīng)的回調(diào)處理函數(shù)
FORM CALLBACK_SFLIGHT USING NAME? TYPE LDBN-LDBNODE
??????????????????????????? WA??? TYPE SFLIGHT
??????????????????????????? EVT?? TYPE C
??????????????????????????? CHECK TYPE C.
? WRITE: / WA-FLDATE, WA-SEATSOCC, WA-SEATSMAX.
ENDFORM.
??? 注意:通過(guò)'LDB_PROCESS'函數(shù)訪問(wèn)邏輯數(shù)據(jù)庫(kù)時(shí),請(qǐng)不要在程序?qū)傩岳锝壎ㄟ壿嫈?shù)據(jù)庫(kù),否則會(huì)出LDB_ALREADY_RUNNING錯(cuò)誤。
總結(jié)
以上是生活随笔為你收集整理的通过LDB_PROCESS函数使用逻辑数据库的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: FUNCTION MODULE 'LDB
- 下一篇: 这是神马意思?