Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to use a Logical Database in Function Module.

Former Member
0 Kudos
434

Hi Experts,

I want to use a logical database in a Function Module to fetch data from a standard SAP table into a Internal table for certain filter conditions.

How can I get get this done????

I called LDB_PROCESS FM in my FM, but I could not figure out how to store the extract in my IT table since we cant use GET in FM.

Please provide me a sample code if possible.

Thanks in Advance,

Alex.

4 REPLIES 4

former_member194669
Active Contributor
0 Kudos
77

Please check demo program

DEMO_LOGICAL_DATABASE

Former Member
0 Kudos
77

Hi,

i had an example program like this ,in this i want to get the data using pnp logical database with 5 fields in an interface program.

data: begin of it_final occurs 0,

pernr like pa0002-pernr,

vorna like pa0002-vorna,

nachn like pa0002-nachn,

usrid like pa0105-usrid,

usrid_long like pa0105-usrid_long,

end of it_final.

get pernr.

clear : p0000,p0002,p0105.

rp-provide-from-last p0000 space p_date p_date.

if p0000-stat2 = '3'.

v_pernr = pnppernr-low.

else.

reject.

endif.

*---Get employee pernr, First name ,Last name into final table

rp-provide-from-last p0002 space p_date p_date.

if pnp-sw-found = '1'.

it_final-pernr = p0002-pernr.

it_final-vorna = p0002-vorna.

it_final-nachn = p0002-nachn.

else.

*---Error message if not infotype 0002 maintained

T_ERROR-PERNR = pnppernr-low.

CONCATENATE TEXT-EMI '0002'

INTO T_ERROR-MESSAGE SEPARATED BY SPACE.

APPEND T_ERROR.

CLEAR T_ERROR.

endif.

**--Get SYSTEM USERNAME to final table

rp-provide-from-last p0105 0001 p_date p_date.

if pnp-sw-found = '1'.

it_final-usrid = p0105-usrid.

else.

*---Error message if not SYSTEM USERNAME maintained

T_ERROR-PERNR = pnppernr-low.

CONCATENATE TEXT-003 '0105'

INTO T_ERROR-MESSAGE SEPARATED BY SPACE.

APPEND T_ERROR.

CLEAR T_ERROR.

endif.

**--Get Email ID to final table

rp-provide-from-last p0105 0010 p_date p_date.

if pnp-sw-found = '1'.

it_final-usrid_long = p0105-usrid_long.

else.

*---Error message if not Email ID maintained

T_ERROR-PERNR = pnppernr-low.

CONCATENATE TEXT-004 '0105'

INTO T_ERROR-MESSAGE SEPARATED BY SPACE.

APPEND T_ERROR.

CLEAR T_ERROR.

endif.

append it_final.

clear it_final.

reward points if useful,

venkat.

Former Member
0 Kudos
77

Hi a®s,

I did checked this program already but even in that case It used only to WRITE and not to hold in IT table.

I want the dat to be in internal table for further process.

thanks,

Alex

0 Kudos
77

Check this lines in the above said program


form callback_sflight using name  type ldbn-ldbnode
                            wa    type sflight
                            evt   type c
                            check type c.
*  write: / wa-fldate, wa-seatsocc, wa-seatsmax."Command this
  move wa to i_wa. " Add this line
  append i_wa.     " Add this line  
 
endform.

Here we are moving values from WA to I_WA and append in I_WA.