通过LDB_PROCESS函数使用逻辑数据库
时间:2021-07-01 10:21:17
帮助过:24人阅读
TABLES spfli.
2 SELECT-OPTIONS s_carr
FOR spfli-
carrid.
3
4 TYPE-POOLS: rsds, rsfs.
5
6 DATA: callback
TYPE TABLE OF ldbcb,
7 callback_wa
LIKE LINE OF callback.
8
9 DATA: seltab
TYPE TABLE OF rsparams,
10 seltab_wa
LIKE LINE OF seltab.
11
12 DATA: texpr
TYPE rsds_texpr,
13 fsel
TYPE rsfs_fields.
14
15 *设置需要回调的数据节点和回调对应的子程序
16 callback_wa-ldbnode =
‘SPFLI‘.
17 callback_wa-get =
‘X‘.
18 callback_wa-get_late =
‘X‘.
19 callback_wa-cb_prog = sy-
repid.
20 callback_wa-cb_form =
‘CALLBACK_SPFLI‘.
21 APPEND callback_wa
TO callback.
22
23 CLEAR callback_wa.
24 callback_wa-ldbnode =
‘SFLIGHT‘.
25 callback_wa-get =
‘X‘.
26 callback_wa-cb_prog = sy-
repid.
27 callback_wa-cb_form =
‘CALLBACK_SFLIGHT‘.
28 APPEND callback_wa
TO callback.
29
30 *设置对应的选择屏幕的参数的传入值
31 seltab_wa-kind =
‘S‘.
32 seltab_wa-selname =
‘CARRID‘.
33
34 LOOP AT s_carr.
35 MOVE-CORRESPONDING s_carr
TO seltab_wa.
36 APPEND seltab_wa
TO seltab.
37 ENDLOOP.
38
39 *调用函数
40 CALL FUNCTION ‘LDB_PROCESS‘
41 EXPORTING
42 ldbname =
‘F1S‘
43 variant =
‘ ‘
44 expressions =
texpr
45 field_selection =
fsel
46 TABLES
47 callback =
callback
48 selections =
seltab
49 EXCEPTIONS
50 ldb_not_reentrant =
1
51 ldb_incorrect =
2
52 ldb_already_running =
3
53 ldb_error =
4
54 ldb_selections_error =
5
55 ldb_selections_not_accepted =
6
56 variant_not_existent =
7
57 variant_obsolete =
8
58 variant_error =
9
59 free_selections_error =
10
60 callback_no_event =
11
61 callback_node_duplicate =
12
62 OTHERS =
13.
63
64 IF sy-subrc <>
0.
65 WRITE:
‘Exception with SY-SUBRC‘, sy-
subrc.
66 ENDIF.
67
68 *SPFLI节点对应的回调处理函数
69 FORM callback_spfli
USING name
TYPE ldbn-
ldbnode
70 wa
TYPE spfli
71 evt
TYPE c
72 check
TYPE c.
73 CASE evt.
74 WHEN
‘G‘.
75 WRITE: / wa-carrid, wa-connid, wa-cityfrom, wa-
cityto.
76 ULINE.
77 WHEN
‘L‘.
78 ULINE.
79 ENDCASE.
80 ENDFORM.
"CALLBACK_SPFLI
81
82 *SFIGHT节点对应的回调处理函数
83 FORM callback_sflight
USING name
TYPE ldbn-
ldbnode
84 wa
TYPE sflight
85 evt
TYPE c
86 check
TYPE c.
87 WRITE: / wa-fldate, wa-seatsocc, wa-
seatsmax.
88 ENDFORM.
"CALLBACK_SFLIGHT
注意:通过‘LDB_PROCESS‘函数访问逻辑数据库时,请不要在程序属性里绑定逻辑数据库,否则会出LDB_ALREADY_RUNNING错误。
资料来源sap library.
通过LDB_PROCESS函数使用逻辑数据库
标签:rect space 资料 called write others required pass efi