‎2009 Jun 05 10:53 AM
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
‎2009 Jun 05 10:57 AM
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
‎2009 Jun 05 10:58 AM
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.
‎2009 Jun 05 11:00 AM
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
‎2009 Jun 05 11:01 AM
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
‎2009 Jun 05 11:02 AM
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