Google Search - Blog...........

ABAP- Display Data From Different Tables In The LDB (Logical Database) Separately.

report ztests.

tables spfli.
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.

*--selection screen design (this should be the common field for all the tables)

select-options s_carr for spfli-carrid.


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.


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.


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.

No comments:

Post a Comment