Application Development and Automation 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: 
Read only

GET & Open Cursor

Former Member
0 Likes
552

Hello All,

Currently i am using LDBs KDF and following is the code :

OPEN CURSOR WITH HOLD DB_CURSOR FOR <----


GET BKPF FIELDS

BUKRS "Company code

BELNR "Document No.

GJAHR "FY

BLDAT "DocumentDate

BUDAT "PostingDate

MONAT "FiscalPeriod

XBLNR. "Reference Document No.

CHECK ( BKPF-MONAT IN S_MONAT AND BKPF-BLDAT IN S_BLDAT ).

DO.

FETCH NEXT CURSOR DB_CURSOR

APPENDING TABLE T_BKPF PACKAGE SIZE 10000.

IF SY-SUBRC NE 0.

CLOSE CURSOR DB_CURSOR.

EXIT.

ENDIF.

ENDDO.

COMMIT WORK.

I receive the message that SELECT is required for OPEN CURSOR.

I cannot use the SELECT as for Accessing the Archived data LDB had to be used and GET statements are used.

Can you please correct/propose new code for the above.

Thankyou,

- PSK

2 REPLIES 2
Read only

jayanthi_jayaraman
Active Contributor
Read only

Former Member
0 Likes
431

Hi,

GET

Event keyword that defines event blocks for reporting events.

Syntax

<b>GET <node> [FIELDS <f1> <f 2>...].</b>

Only occurs in executable programs. When the logical database has passed a line of the node <node> to the program, the runtime environment triggers the GET event, and the corresponding event block is executed. The FIELDS addition allows you to specify explicitly the columns of the node that the logical database should retrieve.

CLOSE CURSOR

Closes a database cursor.

Syntax

<b>CLOSE CURSOR</b> <c>.

Closes a cursor opened using the OPEN CURSOR statement.

OPEN CURSOR

Opens a database cursor.

Syntax

<b>OPEN CURSOR</b> [WITH HOLD] <c> FOR SELECT <result>

FROM <source>

[WHERE <condition>]

[GROUP BY <fields>]

[HAVING <cond>]

[ORDER BY <fields>].

<b>Opens a cursor <c> with type CURSOR for a SELECT statement. All of the clauses of the SELECT statement apart from the INTO clause can be used. The INTO clause is set in the FETCH statement. If you use the WITH HOLD addition, the cursor is not closed when a database commit occurs.</b>

Thanks & Regards,

Judith.