前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ABAP 通过LDB_PROCESS函数使用逻辑数据库

ABAP 通过LDB_PROCESS函数使用逻辑数据库

作者头像
matinal
发布2020-11-27 10:37:04
4810
发布2020-11-27 10:37:04
举报
文章被收录于专栏:SAP Technical

样例代码及说明 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.

*设置需要回调的数据节点和回调对应的子程序 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.

*设置对应的选择屏幕的参数的传入值 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.

*调用函数 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节点对应的回调处理函数 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节点对应的回调处理函数 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.

注意:通过'LDB_PROCESS'函数访问逻辑数据库时,请不要在程序属性里绑定逻辑数据库,否则会出LDB_ALREADY_RUNNING错误。

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020/01/07 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档