Application Development 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: 

doubt in extract program

Former Member
0 Kudos

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').

1 ACCEPTED SOLUTION

naimesh_patel
Active Contributor
0 Kudos

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

7 REPLIES 7

naimesh_patel
Active Contributor
0 Kudos

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

0 Kudos

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

0 Kudos

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

ferry_lianto
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

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

0 Kudos

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