‎2007 Jun 22 6:47 PM
Hi Guys,
Can't we use in Select stament Source as an Internal table?The select statement which i wrote is here.
SELECT * from il1_REGUP into table il_REGUP where ( BELNR = il_bkpf_header-BELNR ).
If not how to do?My requiremnt is i have to get data from SAP databse table and based on condition where BKPF-BELNR must be equal to REGUP-BELNR i have to get data into my Final Internal table.
Thanks,
Gopi.
‎2007 Jun 22 6:51 PM
HI,
First select BELNR'S from BKPF into an internal table say IT_BKPF for a condition, then you do a select ..
SELECT * from il1_REGUP
into table il_REGUP
for all entries in IT_BKPF
where ( BELNR = IT_BKPF-BELNR ).
‎2007 Jun 22 6:51 PM
HI,
First select BELNR'S from BKPF into an internal table say IT_BKPF for a condition, then you do a select ..
SELECT * from il1_REGUP
into table il_REGUP
for all entries in IT_BKPF
where ( BELNR = IT_BKPF-BELNR ).
‎2007 Jun 22 6:52 PM
hi gopi,
Select * from bkpf into table it_bkpf.
if it_bkpf[] is not initial.
select * from regup into table it_regup for all entries in it_bkpf
where belnr = it_bkpf-belnr.
endif.
With Wishes
Jai
‎2007 Jun 22 7:29 PM
Hi Jai,
Does the logic what u told will get all the multiple entries of BELNR in REGUP table into my final REGUP Internal table?
Thanks,
Gopi.
‎2007 Jun 22 7:47 PM
‎2007 Jun 22 7:56 PM
Hi Jai,
I wrote the logic what u told.But its taking more time like 15minutes still the program didnot get executed , i mean its still running ans also there are more records in BKPF like 650987 this may be the one of he reason for more time .
.Do u think this is the best logic?
Thanks,
Gopi.
‎2007 Jun 22 8:14 PM
You have to give it the company code (BKPF-BUKRS) as well, otherwise it can't use the index.
Rob
‎2007 Jun 22 8:23 PM
Like:
SELECT * FROM il1_regup
INTO TABLE il_regup
FOR ALL ENTRIES IN it_bkpf
WHERE bukrs = it_bkpf-bukrs
AND belnr = it_bkpf-belnr.
Rob
‎2007 Jun 22 8:29 PM
Gopi,
BKPF is huge generally...you have to use the combination of BUKRS, BELNR and GJAHR as key combination. It is highly recommended. Then search REGUP for all entries using the above fileds. This may help.
SELECT * FROM il1_regup
INTO TABLE il_regup
FOR ALL ENTRIES IN it_bkpf
WHERE bukrs = it_bkpf-bukrs
AND belnr = it_bkpf-belnr
and gjahr = it_bkpf-gjahr.
Rgds,
Naren
Message was edited by:
Naren Someneni
‎2007 Jun 22 8:53 PM
Hi Naren,
I am doing like that only now but it took already 20mins still the program is running.I am running in Foreground.I will wait and see and i kept another program in background with only one where condiion that to BELNR it took nearly 30 mins but the program didnot got yet completed its running
Just waiting how long it takes.
Thanks,
Gopi.
‎2007 Jun 22 9:09 PM
This table is not in our system. Are you sure that BUKRS, BELNR and GJAHR are part of an index?
Rob
‎2007 Jun 22 10:08 PM
Hi Rob,
I am running two job one in Backgrond and other one in Fore ground both are different programs.Background job doesn't have BUKRS and GJAHR in where condition but Foreground one have in where condition these 2 ields.For foreground it took nearly 1/2hr but no output but still running for background not yet completed still running since 2 hrs.
Thanks,
Gopi.
‎2007 Jun 22 10:14 PM
Gopi,
There is no index available on those 3 fields. For faster response create an index with the following fields
mandt, bukrs, belnr, gjahr.
From the functional point of view I told you to use all those 3 fields to avoid duplicates.
Good luck
Rgds,
Naren
Message was edited by:
Naren Someneni
‎2007 Jun 22 10:34 PM
Hi Naren,
can you tell me how to create Index?I dont know how to do?
Thanks,
Gopi
‎2007 Jun 22 10:43 PM
Gopi,
In se11 on the tool bar, there is a 'INDEXES' button besides 'TECHNICAL SETTINGS' button. Click on that and then there is an option there to create an index. Let me know if you need more help.
Rgds,
Naren
Message was edited by:
Naren Someneni
‎2007 Jun 22 11:41 PM
hi Naren,
In my system its not activated so what to do?
Thanks,
Gopi.
‎2007 Jun 23 1:54 AM
Gopi,
In which system r u trying? Hope its in development right? Are those buttons disabled in your system? Let me know.
Rgds,
Naren
‎2007 Jun 23 2:13 AM
Hi Naren,
Yes they are Disabled and i am in Development system.
Thanks,
Gopi.
‎2007 Jun 23 2:17 AM
Gopi,
Then that is an authorization issue. You need to talk to basis team about proper authorizations. They should be enabled.
Rgds,
Naren
‎2007 Jun 23 2:23 AM
Hi Naren,
Is there any alternative for the problem which i arised in this thread.Becoz the logic which i wrote is running till now.Its already 6 hrs but no output stil running?The problem is when i am running in Sand Box that logic i am getting records but in Development system its taking too long.Why like that i dontknow other than more no. of records for BKPF in Development system.
Thanks,
Gopi.
‎2007 Jun 23 2:28 AM
Gopi,
True. Sandbox hardly has any data. May be in your project development could be a copy of prod. Can you tell me how many records are there in the table BKPF. You can know that by hitting 'number of entries' button in se16 for table BKPF.
Paste your code here. Let me check.
Rgds,
Naren
Message was edited by:
Naren Someneni
‎2007 Jun 23 3:00 AM
Hi Naren,
BKPF table has 650,000 records and REGUP has 980 records .
This is the code which i wrote and kept the program in Background.
sort il_bkpf_header Ascending BY BELNR.
if il_bkpf_header[] is not initial.
select * from regup into table il_regup for all entries in il_bkpf_header
where belnr = il_bkpf_header-belnr.
endif.
can't we use code like this
"select * from regup into table it1_regup.
loop at it1_regup.
*Read table it_bkpf index sy-index
SELECT * from it1_REGUP
into table it_REGUP
for all entries in IT_BKPF
where ( it1_regup-BELNR = IT_BKPF-BELNR ).
endloop." but i am getting error " "IT1_REGUP" is not defined in the ABAP Dictionary as a table, projection view, or database view. "
Thanks,
Gopi.
‎2007 Jun 23 3:27 AM
Hi Naren,
I made it naren.
the code is below.
select * from regup into table it1_regup.
loop at it1_regup.
Read table it_bkpf into wa_bkpf with key BELNR = it1_regup-BELNR.
if sy-subrc = 0.
Move-Corresponding it1_regup to it_regup.
append it_regup.
endif.
clear : it_regup , it1_regup.
endloop.
If there is anything which concerns you just let me know.Tommorow i will try this one with BSEG how it works.
If the logic is wrong just let me know.?Thanks for u reponses.
Thanks,
Gopi.
‎2007 Jun 24 8:38 PM
Hello Gopi,
The code looks good to me. But I have couple of suggestions to make to improve performance of the program.
1. Dont use select * xxxxxxx unless or ortherwise required.
2. When trying to read large internal tables try to use binary search. (SORT the internal table first).
I will not be available for the next coming 2 weeks and if you really wish to thank SDN users here then please do that by rewarding points to all helpful answers )
Good luck,
Naren