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: 

LDB REPORT

Former Member
0 Kudos

HI FRIENDS

I NEED A HELP REGARDING LDB THAT I WANT TO USE IN MY REPORT FOR PERFORMANCE ENHANCEMENT . CAN YOU PLEASE SEND ME A REPORT THAT HAVE USED LDB .ACTUALLY I HAVE NEVER USED LDB .

THANKS IN ADVANCE

10 REPLIES 10

hymavathi_oruganti
Active Contributor
0 Kudos

u can attach LDB in ur report in attributes.

iam not having example program but i can guide u steps.

1. in se36 create an LDB

2. in se38, attach ldb to the probram in attributes

3. in the program , declare TABLES statement and use

GET <TABLE NAME>.

4. u can see the o/p

IF U WANT TO ATTACH MORE THAN ONE ldb TO UR PROGRAM, CALL FN MODULE "LDB_PROCESS"

Former Member
0 Kudos

it just simplies the select statements...LDB tcode= se36

  • Work areas

TABLES: CUSTOMERS, BOOKINGS.

  • Reading data

GET CUSTOMERS.*select statement for table customers

WRITE / CUSTOMERS-NAME.

GET BOOKINGS.*select statement for table bookings

WRITE: AT /3 BOOKINGS-FLDATE.

reward if useful...

Message was edited by: Ashok Kumar Prithiviraj

Former Member
0 Kudos

Hai manish,

Here is an LDB program....

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.

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.

The program is written to read data using the logical database F1S. The structure of F1S is:

A program-specific selection screen is defined at the beginning of the program. This requires the TABLES statement. Next, the required variables are defined for the interface.

The internal table CALLBACK is filled so that various callback routines are called in the program for the two nodes SPFLI and SFLIGHT. For SPFLI, the routine is to be called for GET and GET_LATE, for SFLIGHT, only at the GET event.

The internal table SELTAB is filled with values for the node SPFLI from the selection table S_CARR from the program-specific selection screen.

The program then calls the function module LDB_PROCESS with these parameters.

The subroutines CALLBACK_SPFLI and CALLBACK_SFLIGHT serve as callback routines. The interface parameter WA is fully typed, so you can address the individual components of the work areas. The events GET and GET LATE are handled differently in CALLBACK_SPFLI.

This link may help you...........

http://help.sap.com/saphelp_nw04/helpdata/en/64/237f8cd43711d1950b0000e8353423/frameset.htm

Regards,

Srikanth.

Reward points if at all it is useful.

Former Member
0 Kudos

hi Manish,

se36 is where you create an LDB..

there you use the PUT event..

something like this..

FORM PUT_LFA1. 
 		 SELECT * FROM LFA1 
			WHERE LIFNR IN SLIFNR. 
    		    <b>PUT LFA1.</b> 
  		ENDSELECT. 
	ENDFORM.

and then in your program.. you use the counterpart event GET like this

REPORT Z_LOG_DATA_EXP1 .

TABLES: LFA1.

*Get the data from the LDB

GET LFA1.

then you can very well use it in your program...

IF SY-SUBRC EQ 0.

*Write purchasing document number

WRITE: / LFA1-<field>.

ENDIF

hope you get it...

regards

satesh

Former Member
0 Kudos

here are some sample-reports from ldb F1S:

DEMO_PROGRAM_CHECK_1

DEMO_PROGRAM_CHECK_2

DEMO_PROGRAM_END_OF_SELECTION

DEMO_PROGRAM_EXIT_1

DEMO_PROGRAM_EXIT_2

DEMO_PROGRAM_GET

DEMO_PROGRAM_GET_LATE

-or search with se38 to device class SABAPDOCU

Former Member
0 Kudos

Hi Manish,

Check whether U are given any Report class.

In the attributes of the program give the LDB name.

(say PNP).

In the program give

This is for HR Programming

Tables : PERNR.

Infotypes : 0000 , 0001 , 0002. (If U want only data

from these)

start-of-selection.

GET PERNR.

*Here U can use macros to read data from P0000 , P0001

P0002.

*this gets the last record for the pernr from PA0000

rp-provide-from-last p0000 space pn-begda pn-endda.

write 😕 p0000-pernr, p0000-begda.

*this gets the last record for the pernr from PA0002

rp-provide-from-last p0002 space pn-begda pn-endda.

write 😕 p0002-pernr, p0002-begda.

End-of-selection.

Regards,

GSR.

Former Member
0 Kudos

Hi,

Try this simple example.

Most important point to remember is that try to mention the LDB used in the program in the attributes of the program.Otherwise the root node will not be recognized.

Try also for standard program RPLMIT00.

*************************************

TABLES: pernr.

INFOTYPES: 0001, "Organizational Assignment

2005 MODE n. "Overtime

TYPES: BEGIN OF overtime,

bukrs LIKE p0001-bukrs,

werks LIKE p0001-werks,

btrtl LIKE p0001-btrtl,

stdaz LIKE p2005-stdaz,

count TYPE p,

END OF overtime.

DATA: ot_tab TYPE TABLE OF overtime WITH HEADER LINE.

DATA: average TYPE p DECIMALS 2,

filled_lines LIKE sy-index.

GET pernr.

rp_provide_from_last p0001 space pn-begda pn-endda.

rp_read_all_time_ity pn-begda pn-endda.

DESCRIBE TABLE p2005 LINES filled_lines.

IF filled_lines GT 0.

MOVE-CORRESPONDING: p0001 TO ot_tab.

ADD 1 TO ot_tab-count.

LOOP AT P2005.

IF p2005-stdaz GT 0.

MOVE-CORRESPONDING: p0001 TO ot_tab.

COLLECT ot_tab.

CLEAR ot_tab-count.

ENDIF.

ENDLOOP.

ENDIF.

********************

If your question is answered , please close the thread and award suitable point.

Regards,

Irfan

Lakshmant1
Active Contributor
0 Kudos

Hi manish,

Have a look at url

http://help.sap.com/saphelp_47x200/helpdata/en/25/37e0343734cf72e10000009b38f83b/frameset.htm

Check Report Programming in HR->Report Structure (PA-PAD) for simple report.

Hope this helps.

Thanks

Lakshman

Former Member
0 Kudos

if u have any e-mail is let me know i can send some good material and sample programs to u

0 Kudos

MY EMAIL ID IS- sap.manish@gmail.com

thanks if you can send me some material.