‎2008 Jul 03 8:10 AM
Hi All
I am new to Logical Databases. I found on net that I can use a dynamic call to a Logical Database using Function Module
"LDB_PROCESS".
I tried implementing the same using the following logic.
REPORT zsa_test2.
TABLES: pernr.
SELECT-OPTIONS s_pernr FOR pernr-pernr.
DATA: callback TYPE TABLE OF ldbcb,
callback_wa LIKE LINE OF callback.
callback_wa-ldbnode = 'PERNR'.
callback_wa-get = 'X'.
callback_wa-cb_prog = sy-repid.
callback_wa-cb_form = 'CALLBACK_PERNR'.
APPEND callback_wa TO callback.
START-OF-SELECTION.
CALL FUNCTION 'LDB_PROCESS'
EXPORTING
ldbname = 'PNP'
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
&----
text
----
-->NAME text
-->WA text
-->EVT text
-->CHECK text
----
FORM callback_pernr USING name TYPE ldbn-ldbnode
wa TYPE pernr
evt TYPE c
check TYPE c.
BREAK-POINT.
WRITE: / wa-pernr.
ULINE.
ENDFORM. "CALLBACK_SPFLI
But I am unable to transfer the control to the subroutine. The break-point isn't reached.
Can someone please guide me? Am I using the wrong node or something??
‎2008 Jul 03 9:07 AM
‎2008 Jul 03 9:40 AM
look at the below code ..
pass sstab to the selection in the FM
data cbtab type table of ldbcb.
data wa_cbtab like line of cbtab.
data sstab type table of rsparams.
data wa_sstab like line of sstab.
wa_cbtab-ldbnode = 'SPFLI'.
wa_cbtab-get = 'X'.
wa_cbtab-get_late = ' '.
wa_cbtab-cb_prog = sy-cprog.
wa_cbtab-cb_form = 'CB_SPFLI'.
append wa_cbtab to cbtab.
wa_cbtab-ldbnode = 'SFLIGHT'.
wa_cbtab-get = 'X'.
wa_cbtab-get_late = ' '.
wa_cbtab-cb_prog = sy-cprog.
wa_cbtab-cb_form = 'CB_SFLIGHT'.
append wa_cbtab to cbtab.
wa_sstab-selname = 'AIRP_FR'.
wa_sstab-kind = 'S'.
wa_sstab-sign = 'I'.
wa_sstab-option = 'EQ'.
wa_sstab-low = 'FRA'.
append wa_sstab to sstab.
call function 'LDB_PROCESS'
exporting
ldbname = 'F1S'
tables
callback = cbtab
selections = sstab .
form cb_spfli using nodename type ldbn-ldbnode
wa_spfli type spfli
mode type c
selected type c.
write: / wa_spfli-carrid,
wa_spfli-connid,
wa_spfli-airpfrom,
wa_spfli-airpto.
endform.
form cb_sflight using nodename type ldbn-ldbnode
wa_sflight type sflight
mode type c
selected type c.
write: /3 wa_sflight-fldate,
wa_sflight-seatsmax,
wa_sflight-seatsocc.
endform.
‎2008 Jul 03 10:05 AM
Thanks guys,
But the SELECTIONS parameter is not mandatory.
The code can work without that as well...I have seen this code already and if you try to comment that parameter from the Logical database it will still run...You can try the same thing by putting the breakpoint in the subroutine and commenting the SELECTIONS parameter. The control will still move to the subroutine and hence to the breakpoint.
But my problem is that the subroutine doesn't get called at all.
And about using the logical DB in the attributes of the program. I don't want to do that coz I may wanna use more than one Logical DB in my code.
Edited by: Sahil Arora on Jul 3, 2008 11:06 AM