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

offset

Former Member
0 Likes
783

hi all,

i need to fetch the data from database table using offset.

the select query is below.but the offset is not working.

please suggest do i need to change anything.

select SAP_OBJECT

OBJECT_ID

ARCHIV_ID

ARC_DOC_ID

AR_DATE

RESERVE

from toa

into table gt_toa

for all entries in gt_bkpf

where SAP_OBJECT eq 'BKPF'

AND OBJECT_ID+0(4) EQ gt_bkpf-bukrs

AND OBJECT_ID+4(14) EQ gt_bkpf-belnr

AND OBJECT_ID+14(8) EQ gt_bkpf-gjahr.

thanks in advance

5 REPLIES 5
Read only

Former Member
0 Likes
742

Fetch all the data to internal table and do offset. I guess it will be huge.

Edited by: Phanindra Annaparthi on Jun 5, 2009 11:58 AM

Read only

Former Member
0 Likes
742

Use the following logic-

select SAP_OBJECT

OBJECT_ID

ARCHIV_ID

ARC_DOC_ID

AR_DATE

RESERVE

from toa

into table gt_toa

for all entries in gt_bkpf

where SAP_OBJECT eq 'BKPF'.

loop at table gt_toa.

if OBJECT_ID+0(4) EQ gt_bkpf-bukrs

ur coding.....

elseif OBJECT_ID+4(14) EQ gt_bkpf-belnr

ur coding.....

elseif OBJECT_ID+14(8) EQ gt_bkpf-gjahr.

ur coding.....

endif.

endloop.

Read only

Former Member
0 Likes
742

Concatenate gt_bkpf-bukrs gt_bkpf-belnr gt_bkpf-gjahr into l_variable.

select SAP_OBJECT

OBJECT_ID

ARCHIV_ID

ARC_DOC_ID

AR_DATE

RESERVE

from toa

into table gt_toa

for all entries in gt_bkpf

where SAP_OBJECT eq 'BKPF'

AND OBJECT_ID+0(4) EQ l_variable.

Can u try like this

Read only

0 Likes
742

Sorry mistakenly written the offset

Concatenate gt_bkpf-bukrs gt_bkpf-belnr gt_bkpf-gjahr into l_variable.

select SAP_OBJECT

OBJECT_ID

ARCHIV_ID

ARC_DOC_ID

AR_DATE

RESERVE

from toa

into table gt_toa

for all entries in gt_bkpf

where SAP_OBJECT eq 'BKPF'

AND OBJECT_ID EQ l_variable.

Can u try like this

Read only

Former Member
0 Likes
742

HI,

Take the object_id field in the gt_bkpf table..

LOOP AT gt_bkpf.
   GT_BKPF-OBJECT_ID(4)       = gt_bkpf-bukrs.
   GT_BKPF-OBJECT_ID+4(14)  = gt_bkpf-belnr.
   GT_BKPF-OBJECT_ID+14(18)  = gt_bkpf-gjahr.
   MODIFY GT_BKPF.
ENDOLOOP


select SAP_OBJECT 
OBJECT_ID 
ARCHIV_ID 
ARC_DOC_ID 
AR_DATE 
RESERVE 
from toa
into table gt_toa
for all entries in gt_bkpf
where SAP_OBJECT eq 'BKPF'
AND OBJECT_ID EQ gt_bkpf-OBJECT_ID