11-17-2007 10:03 PM
hi,
i am trying to extract po from sap 4.7 using this code..
I am passing EKORG and lifnr as input..
but it is taking time to run..
i am not getting output
plz help me
*"Local interface:
*" IMPORTING
*" VALUE(I_EKORG) TYPE EKKO-EKORG OPTIONAL
*" VALUE(I_LIFNR) TYPE LFA1-LIFNR OPTIONAL
*" TABLES
*" LT_EKKO STRUCTURE ZPO_DATA_47 OPTIONAL
*" LT_EKPO STRUCTURE ZPO_ITEM_47 OPTIONAL
*" LT_EKET STRUCTURE ZPO_EKET_47 OPTIONAL
*" LT_ADRC STRUCTURE ZPO_ADRC_47 OPTIONAL
*" LT_EKKN STRUCTURE ZPO_EKKN_47 OPTIONAL
*" LT_EKBE STRUCTURE ZPO_EKBE_47 OPTIONAL
*" EXCEPTIONS
*" INVALID_PO
*" NOT_ORACLE_PO
*"----
Types declaration for PO history
TYPES : BEGIN OF ty_s_ekbe,
ebeln TYPE ekko-ebeln,
ebelp TYPE ekpo-ebelp,
menge TYPE ekpo-menge,
vgabe TYPE vgabe,
qty TYPE ekpo-menge,
END OF ty_s_ekbe.
data : it_ekbe type standard table of ty_s_ekbe.
Types declaration of Address data
TYPES: BEGIN OF ty_s_adrc,
adrnr TYPE ekko-adrnr,
END OF ty_s_adrc.
Tables
DATA: lt_tline_read TYPE STANDARD TABLE OF tline,
gt_adrc TYPE STANDARD TABLE OF ty_s_adrc,
gt_ekbe TYPE STANDARD TABLE OF ty_s_ekbe.
Local structures
DATA: ls_ekko TYPE zpo_data_47,
ls_ekpo TYPE zpo_item_47,
ls_adrc TYPE zpo_adrc_47,
ls_ekkn TYPE zpo_ekkn_47,
ls_tline TYPE tline,
ls_ekbe TYPE ty_s_ekbe.
Local variables
DATA: lv_adrnr TYPE adrnr,
lv_id TYPE thead-tdname,
lv_str TYPE stxh.
Data l_rec type I value 10000.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = i_lifnr
IMPORTING
OUTPUT = i_lifnr
.
*if not i_ekorg is INITIAL and not i_lifnr is INITIAL.
Select Purchasing Document Header data
ELSE.
SELECT ebeln
bukrs
bsart
lifnr
zterm
ekorg
ekgrp
waers
bedat
wkurs
inco1
inco2
ltex1
adrnr
FROM ekko
INTO TABLE lt_ekko package size l_rec
where ekorg = i_ekorg and lifnr eq i_lifnr.
WHERE bsart in ('OR1', 'OR2').
11-17-2007 10:09 PM
It looks like you forgot to include the LIFNR and EKORG in your selection of the EKKO
SELECT ebeln
bukrs
bsart
lifnr
zterm
ekorg
ekgrp
waers
bedat
wkurs
inco1
inco2
* ltex1
adrnr
FROM ekko
INTO TABLE lt_ekko package size l_rec
* where ekorg = i_ekorg and lifnr eq i_lifnr.
WHERE lifnr = i_lifnr " << LIFNR
and ekorg = i_ekorg " <<<
and bsart in ('OR1', 'OR2'),
Regards,
Naimesh Patel
11-17-2007 10:09 PM
It looks like you forgot to include the LIFNR and EKORG in your selection of the EKKO
SELECT ebeln
bukrs
bsart
lifnr
zterm
ekorg
ekgrp
waers
bedat
wkurs
inco1
inco2
* ltex1
adrnr
FROM ekko
INTO TABLE lt_ekko package size l_rec
* where ekorg = i_ekorg and lifnr eq i_lifnr.
WHERE lifnr = i_lifnr " << LIFNR
and ekorg = i_ekorg " <<<
and bsart in ('OR1', 'OR2'),
Regards,
Naimesh Patel
11-17-2007 10:39 PM
hi,
LIFNR and EKORG is optional input parameters in my ZRFC
i have to get only OR1 and OR2 order type from EKKO and EKPO table.
Check if the given Purchase order number is valid or not
IF lt_ekko[] IS INITIAL.
raise and error message if the purchase order number is invalid
RAISE invalid_po.
ELSE.
Select Scheduling Agreement Schedule Lines data
SELECT ebeln
ebelp
eindt
slfdt
FROM eket
INTO TABLE lt_eket
FOR ALL ENTRIES IN lt_ekko
WHERE ebeln = lt_ekko-ebeln.
Select item data for the purchase order
SELECT ebeln
ebelp
txz01
matnr
werks
lgort
matkl
idnlf
menge
meins
bprme
bpumz
bpumn
umrez
umren
netpr
peinh
mahnz
mahn1
mahn2
mahn3
uebtk
elikz
erekz
knttp
wepos
weunb
repos
webre
kzabs
labnr
plifz
mhdrz
FROM ekpo
INTO TABLE lt_ekpo
FOR ALL ENTRIES IN lt_ekko
WHERE ebeln = lt_ekko-ebeln.
u can see other extract also..
it was working yesterday
today only i am facing this problem
if i run with out any input parameters..
it was taking long time to fetch the data...
plz advise me
11-17-2007 10:47 PM
hi,
i uncommednted that ekorg and ekort in where condition
that is working fine
plz adivice me what ever aksed u
this is conversion project
11-17-2007 10:57 PM
Hi,
Please try this.
IF I_EKORG IS INITIAL AND I_LIFNR IS INITIAL.
* Select item data for the purchase order
SELECT ebeln
ebelp
txz01
matnr
werks
lgort
matkl
idnlf
menge
meins
bprme
bpumz
bpumn
umrez
umren
netpr
peinh
mahnz
mahn1
mahn2
mahn3
uebtk
elikz
erekz
knttp
wepos
weunb
repos
webre
kzabs
labnr
plifz
mhdrz
FROM ekpo
INTO TABLE lt_ekpo
FOR ALL ENTRIES IN lt_ekko
WHERE ebeln = lt_ekko-ebeln
AND EKORG NE SPACE
AND LIFNR NE SPACE
AND bsart in ('OR1', 'OR2').
ELSE.
* Select item data for the purchase order
SELECT ebeln
ebelp
txz01
matnr
werks
lgort
matkl
idnlf
menge
meins
bprme
bpumz
bpumn
umrez
umren
netpr
peinh
mahnz
mahn1
mahn2
mahn3
uebtk
elikz
erekz
knttp
wepos
weunb
repos
webre
kzabs
labnr
plifz
mhdrz
FROM ekpo
INTO TABLE lt_ekpo
FOR ALL ENTRIES IN lt_ekko
WHERE ebeln = lt_ekko-ebeln
AND EKORG = I_EKORG
AND LIFNR = I_LIFNR
AND bsart in ('OR1', 'OR2').
ENDIF.
Regards,
Ferry Lianto
11-18-2007 3:06 AM
You'll either have to make lifnr obligatory or accept that it will take time to run.
Another alternative is to add other secondary index fields to the interface. But you'll have to ensure that enough index fields are passed so that an index can be used.
Rob
Message was edited by:
Rob Burbank
11-18-2007 3:38 AM
hi,
Thanks for ur reply.
there should not be any input parameters in my zrfc program.
If i try to run my program, it is taking lot of time with out any output for more than 5 hrs
informatica guy(middle warel too ) is going to use my load and extract zrfc to do this complete conversion..
I am going to pull all the extract header data , item data , address data, schedule line data, account data from ekko, ekpo, adrc, ekbe, ekkn tables..
for extracting i have developed my own zrfc and load zrfc , i used bapi_po_create1
plz advice me in this case how to do my program
thanks
Ruban
11-18-2007 4:01 PM
You can take my advice or not on how to speed up your program, but it looks like the real problem is that it doesn't produce output. If the rest of the program isn't too large, could you post it please?
Rob