While creating function in prg unit there is an err
Oracle forms6i
Hai All
i have created a function using program unit i have an error
PDE-PPU107the program unit source must be declared as subprogram body or a package
Pls give me solutions
Thanks & regards
Srikkanth.M
Hai Baiq
this is my code
declare
bar_code varchar2(25);
bar_date date;
in_time varchar2(25);
out_time varchar2(25);
intr_in varchar2(25);
intr_out varchar2(25);
atd_in varchar2(25);
atd_out varchar2(25);
Cursor c1 is
Select count(*), BARCODE,BARDATE,BARTIME
From temp_attendance
group by barcode,bardate,bartime
ORDER BY BARCODE;
begin
For r1 in c1 loop
if r1.bartime between 0630 and 0930 or r1.bartime between 1100 and 1300 or r1.bartime between 1615 and1815 and in_time is null then
select barcode,attend_date,intime,outtime into bar_code,bar_date,in_time,out_time from dail_att;
insert into dail_att(barcode,intime,attend_date) values
(r1.barcode,r1.bartime,r1.bardate);
end if;
end loop;
commit;
exception
when others then
message(sqlerrm);
message(sqlcode);
end;
this is my code when i use select into statement for passing values into declared variable for the specified condition
it gives the error no data found
so i declared to use function and then i gives that error
Regards
Srikkanth.M
Similar Messages
-
Reg:form parameters while creating functions
Dear team,
While creating functions in Application developer responsiibility what are the form parameters.
for our custom application form parameters column in form tab while creating functions is
x_object=AppsServlet&x_source=menu&x_menuFunction=displayHomePage
are given
what is x_menufunction.
Pls explain
Regrds,
RadhaRadha,
Are you creating the function for OAF pages? In that case leave blank the form and form oarameters field.
Anoop -
Error while creating Function module extracter
Hello Guru's
I am getting error while FM extracter creating.
Have created FM and Extract structure and while creating datasource using these where i am getting error as given below
1> ZV_ZFRT_INVOICES(Datasource): TABLES-paramter E_T_DATA for extractor Z_ZFRGT_INVOICES(FM) is missing
2>(DS)ZV_ZFRT_INVOICES: Field ZEILE of the provider structure is missing in extract str. ZVZFRT_INVOICES(Extract structre)
3>(DS )ZV_ZFRT_INVOICES: Field EBELP of the provider structure is missing in extract str. ZVZFRT_INVOICESExtract structre)
Please some one can help me to get out of the issue.HI Aryan,
No need to create FM on your own. You can copy the FM from Function Group RSAX.
The procedure to create FM extractor is as follows:
1) Create an extract structure.
2) Go to SE80. Select Function Group RSAX , right click and then copy.
3) Give your own name to the function group to copy.
4) Select one appropriate FM from the list of FMs provided. eg FM RSAX_BIW_GET_DATA_SIMPLE.
5)Specify the name of new FM you want to create.
6) Go to SE37 and open the FM you have created by copying from Function Group RSAX.
7) no need to change the import tab.
8) On tables tab, for paramerter name E_T_DATA under asociate name specify the name of extract structure you hav created.
9) Under source code tab make the changes in the source code only to customise it to your requirement. eg: declare the database table you are using, make changes where datasource is in picture, etc.
I have created a generic DataSource with the help of above procedure.. I hope you will find it helpful...
Regards,
Geetanjali -
What is the best way, while creating Function Module based extractor
Hi Friends,
I am Sreekanth.
I have created a Functio Module based Extractor,
To fetch data from COPA tables.
In this extracton 3 tables are getting involved.
1) CE3OP01 2) CE4OP01 and 3) CE1OP01.
Logic required is as follow:
1) get data from CE3OP01 and for all entries of this data set,
get data from CE4OP01 and CE1OP01 and finally send the data set to BW after few manupulations.
I have implemented the whole logic and its working fine in DEVELOPMENT box where data volume is less.
But the same code is timing out in Quality Box, due to huge volues of data.
Below I am copying the code that i am using . Any body can suggest me how to proceed further so that my code works with huge volumes of data.
Now I am getting the time out error while selection data from CE3IOP01 table itself.
FUNCTION /ds1/c_bw_zds_copa_recon.
""Local interface:
*" IMPORTING
*" VALUE(I_REQUNR) TYPE SRSC_S_IF_SIMPLE-REQUNR
*" VALUE(I_DSOURCE) TYPE SRSC_S_IF_SIMPLE-DSOURCE OPTIONAL
*" VALUE(I_MAXSIZE) TYPE SRSC_S_IF_SIMPLE-MAXSIZE OPTIONAL
*" VALUE(I_INITFLAG) TYPE SRSC_S_IF_SIMPLE-INITFLAG OPTIONAL
*" VALUE(I_READ_ONLY) TYPE SRSC_S_IF_SIMPLE-READONLY OPTIONAL
*" TABLES
*" I_T_SELECT TYPE SRSC_S_IF_SIMPLE-T_SELECT OPTIONAL
*" I_T_FIELDS TYPE SRSC_S_IF_SIMPLE-T_FIELDS OPTIONAL
*" E_T_DATA STRUCTURE /DS1/FI_COPA_RECN OPTIONAL
*" EXCEPTIONS
*" NO_MORE_DATA
*" ERROR_PASSED_TO_MESS_HANDLER
PROGRAM INFORMATION *
RIEF ID.......: N/A *
PROGRAM.......: /DS1/C_BW_ZDS_COPA_RECON
PROGRAM FUNCTION: This Function Module Extracts Cost Center, Company *
Code, and all Amount fields form CE3OP01 table and sectaktbo "
* Current profitability segment (CO-PA) *
paobjnr " Profitability Segment Number (CO-PA) *
pasubnr " Profitability segment changes (CO-PA) *
bukrs " Company Code
kndnr " Customer from CE4Op01 table. *
Segrigate one record from CE3Op01 into 93 based on Value fields. *
PROGRAM TYPE..Function Module *
DEV. CLASS..../DS1/MI_01 *
LOGICAL DB.... N/A *
Conventions used in the Program *
* global variables --> g_* *
* local variables --> l_* *
* constants --> c_* *
* internal tables --> t_* *
* structures --> x_* *
* parameters --> p_* *
* select-options --> s_* *
* ranges --> r_* *
* workarea --> w_* *
* field symbol --> fs_* *
Declaration for Interface: Selection criteria
STATICS: s_s_if TYPE srsc_s_if_simple,
Maximum number of lines for DB table
ls_s_if TYPE srsc_s_if_simple, "Static Structure
counter
ls_counter_datapakid LIKE sy-tabix,"Static Counter
cursor
ls_cursor TYPE cursor,"Static Cursor.
ls_cursor1 TYPE cursor."Static Cursor.
*CONSTANTS
CONSTANTS: lc_datasource TYPE char14 VALUE 'ZDS_COPA_RECON',
" Data Source Name
lc_msgtype TYPE char1 VALUE 'E', "message type
lc_msgcls TYPE char2 VALUE 'R3', "message class
lc_msgnum TYPE char3 VALUE '009',"Message Number.
lc_001 TYPE char3 VALUE '001',
lc_b0 TYPE char2 VALUE 'B0',
lc_10 TYPE char2 VALUE '10',
lc_01 TYPE char2 VALUE '01',
lc_02 TYPE char2 VALUE '02',
lc_1 TYPE sy-tabix VALUE 1.
*Data Declaration.
DATA: lt_ce3op01 TYPE STANDARD TABLE OF x_ce3op01,
" Internal table for ce3op01
lt_ce3op02 TYPE STANDARD TABLE OF x_ce3op01,
lt_ce4op01 TYPE STANDARD TABLE OF x_ce4op01,
" Internal table for ce4op01
lw_ce3op01 TYPE x_ce3op01,
" Work area for ce3op01
lw_ce3op02 TYPE x_ce3op01, "MOD-002
lw_ce4op01 TYPE x_ce4op01,
" Work area for ce4op01
lw_e_t_data TYPE /ds1/fi_copa_recn,
" Work area for /ds1/fi_copa_recn.
*CE1op01
lt_ce1op01 TYPE STANDARD TABLE OF x_ce1op01,"Internaltable
lw_ce1op01 TYPE x_ce1op01,"Work area for CE1op01.
**CE1op01
lt_fldlist TYPE STANDARD TABLE OF lx_fldlist, "fields list
lw_fldlist TYPE lx_fldlist," FIELDS list work area
lt_flnmval TYPE STANDARD TABLE OF lx_flnmval,"table for splitting
lw_flnmval TYPE lx_flnmval,"work area for spilitting
l_index TYPE i VALUE 1, "to keep track of index.
l_len TYPE i,
l_s_no_recs TYPE sy-tabix VALUE 99,
l_s_loop_from TYPE sy-tabix, "from "MOD-002
l_s_loop_to TYPE sy-tabix, "to"MOD-002
l_norecs TYPE sy-tabix, "MOD-002
l_count TYPE sy-tabix. "MOD-002
*Field Symbols.
FIELD-SYMBOLS:
<fs_flnmval> TYPE lx_flnmval."Field symbol for fild values
Selection Ranges
RANGES: lr_bukrs FOR ce4op01-bukrs, " Range for company code
lr_versi FOR ce3op01-versi," Range for version
lr_paledger FOR ce3op01-paledger,"Range for paledger
lr_vrgar FOR ce3op01-vrgar,"Range for vrgar
lr_gjahr FOR ce3op01-gjahr,"Range for Fiscal year
lr_perbl FOR ce3op01-perbl."Range for perbl
Initialization mode (first call by SAPI) or data transfer mode
IF i_initflag = sbiwa_c_flag_on.
Initialization: check input parameters
buffer input parameters
prepare data selection
Check DataSource validity
IF ls_counter_datapakid = 0.
CASE i_dsource.
WHEN lc_datasource.
WHEN OTHERS.
IF 1 = 2. MESSAGE e009(r3). ENDIF. "#EC *
this is a typical log call. Please write every error message like this
log_write lc_msgtype "'E' "message type
lc_msgcls "'R3' "message class
lc_msgnum "'009' "message number
i_dsource "message variable 1
' '. "message variable 2
RAISE error_passed_to_mess_handler.
ENDCASE.
APPEND LINES OF i_t_select TO s_s_if-t_select.
APPEND LINES OF i_t_fields TO s_s_if-t_fields.
Fill parameter buffer for data extraction calls
ls_s_if-requnr = i_requnr.
ls_s_if-dsource = i_dsource.
ls_s_if-maxsize = i_maxsize.
ls_s_if-initflag = i_initflag.
Company Code
LOOP AT s_s_if-t_select INTO i_t_select WHERE fieldnm = c_bukrs.
MOVE: i_t_select-sign TO lr_bukrs-sign,
i_t_select-option TO lr_bukrs-option,
i_t_select-low TO lr_bukrs-low,
i_t_select-high TO lr_bukrs-high.
APPEND lr_bukrs.
ENDLOOP.
*Version (0)
*SRSC_S_IF_SIMPLE-T_SELECT
LOOP AT s_s_if-t_select INTO i_t_select WHERE fieldnm = c_versi.
LOOP AT i_t_select INTO s_s_if-t_select WHERE fieldnm = c_versi.
MOVE: i_t_select-sign TO lr_versi-sign,
i_t_select-option TO lr_versi-option,
i_t_select-low TO lr_versi-low,
i_t_select-high TO lr_versi-high.
APPEND lr_versi.
ENDLOOP.
*Currency Type (company code only)
LOOP AT s_s_if-t_select INTO i_t_select WHERE fieldnm = c_paledger.
MOVE: i_t_select-sign TO lr_paledger-sign,
i_t_select-option TO lr_paledger-option.
IF i_t_select-low = lc_b0.
MOVE lc_01 TO lr_paledger-low.
ELSEIF i_t_select-low = lc_10.
MOVE lc_02 TO lr_paledger-low.
ENDIF.
APPEND lr_paledger.
ENDLOOP.
*Record Type
LOOP AT s_s_if-t_select INTO i_t_select WHERE fieldnm = c_vrgar.
MOVE: i_t_select-sign TO lr_vrgar-sign,
i_t_select-option TO lr_vrgar-option,
i_t_select-low TO lr_vrgar-low,
i_t_select-high TO lr_vrgar-high.
APPEND lr_vrgar.
ENDLOOP.
*Fiscal Year
LOOP AT s_s_if-t_select INTO i_t_select WHERE fieldnm = c_gjahr.
MOVE: i_t_select-sign TO lr_gjahr-sign,
i_t_select-option TO lr_gjahr-option,
i_t_select-low TO lr_gjahr-low,
i_t_select-high TO lr_gjahr-high.
APPEND lr_gjahr.
ENDLOOP.
*Period Block/Year
LOOP AT s_s_if-t_select INTO i_t_select WHERE fieldnm = c_perbl.
MOVE: i_t_select-sign TO lr_perbl-sign,
i_t_select-option TO lr_perbl-option,
i_t_select-low TO lr_perbl-low,
i_t_select-high TO lr_perbl-high.
APPEND lr_perbl.
ENDLOOP.
*Value Field Name.
LOOP AT s_s_if-t_select INTO i_t_select WHERE fieldnm = c_fldnm.
MOVE:
i_t_select-sign TO gr_zfldnm-sign,
i_t_select-option TO gr_zfldnm-option,
i_t_select-low TO gr_zfldnm-low,
i_t_select-high TO gr_zfldnm-high.
APPEND gr_zfldnm.
ENDLOOP.
First data package -> OPEN CURSOR
IF ls_counter_datapakid = 0.
*Create 93 Field names in an internal table.
MOVE 'VV010' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV011' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV012' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV013' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV014' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV015' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV016' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV020' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV021' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV030' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV031' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV032' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV033' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV034' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV035' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV200' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV201' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV202' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV203' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV036' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV037' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV038' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV039' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV040' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV041' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV042' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV043' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV204' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV205' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV211' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV212' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV213' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV222' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV223' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV230' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV232' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV233' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV500' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV501' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV502' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV503' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV504' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV505' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV506' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV507' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV508' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV509' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV510' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV511' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV512' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV513' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV514' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV515' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV516' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV517' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV518' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV519' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV520' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV236' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV206' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV051' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV052' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV053' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV054' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV055' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV056' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV057' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV058' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV059' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV060' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV241' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV242' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV243' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV244' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV245' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV246' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV247' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV248' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV249' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV250' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV521' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV522' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV523' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV524' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV525' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV526' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV527' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV528' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV529' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV530' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV227' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV226' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV224' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
OPEN CURSOR WITH HOLD ls_cursor FOR
SELECT
paobjnr " Profitability Segment Number (CO-PA)
paledger " Currency type for an operating concern
vrgar " Record Type
versi " Plan version (CO-PA)
gjahr " Fiscal Year
perbl " Fiscal year/period block
pasubnr
vv010001 " List Price
vv011001 " Formula Price
vv012001 " Customer Price
vv013001 " Manual Price
vv014001 " Retail Pump Price
vv015001 " Markup
vv016001 " Net Proceeds Other
vv020001 " Excise Duty Offset
vv021001 " Duties & Government
vv030001 " Sales Discounts
vv031001 " Sales Surcharges
vv032001 " Sales Rebates
vv033001 " Agents Comm Paid
vv034001 " RBA CR Royalties
vv035001 " Other Revenues
vv200001 " Transfer PriceSupply
vv201001 " Prim Tran Tariff Sup
vv202001 " S&Handling TariffDis
vv203001 " Sec Trans Tariff Dis
vv036001 " Proceeds from Servic
vv037001 " Exchanges
vv038001 " Throughput fees
vv039001 " Output Tax Offset
vv040001 " CR comm & Oth Oil Pr
vv041001 " Supplier fees
vv042001 " RBA Fairshare Adjust
vv043001 " Contr Comm Paid IG
vv204001 " Sec Tran Tariff Supp
vv205001 " Comp Stock Obligatio
vv211001 " Prim Tran Tar Transf
vv212001 " S&Handling Tar Trans
vv213001 " Sec Trans TariffTran
vv222001 " DIS:S&Handl Tar OvUn
vv223001 " DIS:Sec Tr TarifOvUn
vv230001 " Transfer Price LSC
vv232001 " S&Handling Tar LSC
vv233001 " Sec Trans Tariff LSC
vv500001 " 3rd Party Purchases
vv501001 " Transf from Oth Sect
vv502001 " Purchases IG
vv503001 " Inter-Seg Transf Pur
vv504001 " Import Freight
vv505001 " Stock Variations
vv506001 " Other Product Cost
vv507001 " Pipeline Operat Exp
vv508001 " Primary Transp Expen
vv509001 " Manufacturing Expens
vv510001 " Supply /Process Exp
vv511001 " MK Processing Plants
vv512001 " S&Handling Expenses
vv513001 " Sec Transp Expenses
vv514001 " Point of Sale Expens
vv515001 " Contr Comm Rec IG
vv516001 " Assoc Inc Dividend
vv517001 " Marketing & Sell Exp
vv518001 " Other Rev from Dist
vv519001 " Other Rev Transferrd
vv520001 " Stock Write-Off
vv236001 " Oth cost Tar LSC SMP
vv206001 " Prim Trp tariff Dist
vv051001 " CR Net Turnover
vv052001 " Dummy Price 2
vv053001 " Dummy Price 3
vv054001 " Dummy Price 4
vv055001 " Dummy Price 5
vv056001 " Dummy Price 6
vv057001 " Dummy Price 7
vv058001 " Dummy Price 8
vv059001 " Dummy Price 9
vv060001 " Dummy Price10
vv241001 " DummyTariff 1
vv242001 " DummyTariff 2
vv243001 " DummyTariff 3
vv244001 " DummyTariff 4
vv245001 " DummyTariff 5
vv246001 " DummyTariff 6
vv247001 " DummyTariff 7
vv248001 " DummyTariff 8
vv249001 " DummyTariff 9
vv250001 " DummyTariff10
vv521001 " SD&A Rebates
vv522001 " Dummy Cost 2
vv523001 " Dummy Cost 3
vv524001 " Dummy Cost 4
vv525001 " Dummy Cost 5
vv526001 " Dummy Cost 6
vv527001 " Dummy Cost 7
vv528001 " Dummy Cost 8
vv529001 " Dummy Cost 9
vv530001 " Dummy Cost 10
vv227001 " Sec Tr TarifOvUn LSC
vv226001 " S&Handl Tar OvUn LSC
vv224001 " Pr Tra TariffOvU DIS
FROM ce3op01
WHERE paledger = lc_02 AND
vrgar IN lr_vrgar AND
versi IN lr_versi AND
perbl IN lr_perbl AND
gjahr IN lr_gjahr.
ENDIF.
For all other cursors.
FETCH NEXT CURSOR ls_cursor
APPENDING TABLE lt_ce3op02
PACKAGE SIZE ls_s_if-maxsize.
IF sy-subrc <> 0.
EXIT.
ENDIF.
SORT lt_ce3op02 BY paobjnr pasubnr paledger vrgar versi gjahr
perbl.
DELETE ADJACENT DUPLICATES FROM lt_ce3op02 COMPARING paobjnr.
*Begin of MODE-002
DESCRIBE TABLE lt_ce3op02 LINES l_norecs.
l_s_loop_from = lc_1.
DO.
l_s_loop_to = l_s_loop_from + l_s_no_recs.
LOOP AT lt_ce3op02 INTO lw_ce3op02
FROM l_s_loop_from TO l_s_loop_to .
APPEND lw_ce3op02 TO lt_ce3op01.
ENDLOOP.
SORT lt_ce3op01 BY paobjnr.
*End of MOS-002
SELECT
aktbo " Current profitability segment (CO-PA)
paobjnr " Profitability Segment Number (CO-PA)
pasubnr " Profitability segment changes (CO-PA)
kndnr " Customer
artnr
bukrs " Company Code
prctr
kokrs
FROM ce4op01
INTO TABLE lt_ce4op01
FOR ALL ENTRIES IN lt_ce3op01
WHERE paobjnr = lt_ce3op01-paobjnr AND
pasubnr = lt_ce3op01-pasubnr AND
bukrs IN lr_bukrs.
*CE1op01
SELECT
paledger
vrgar
versi
perio
paobjnr
pasubnr
belnr
posnr
rbeln
rposn
FROM ce1op01
INTO TABLE lt_ce1op01
FOR ALL ENTRIES IN lt_ce3op01
WHERE paledger = lt_ce3op01-paledger AND
vrgar = lt_ce3op01-vrgar AND
versi = lt_ce3op01-versi AND
perio = lt_ce3op01-perbl AND
paobjnr = lt_ce3op01-paobjnr AND
pasubnr = lt_ce3op01-pasubnr.
**CE1op01
LOOP AT lt_ce3op01 INTO lw_ce3op01.
MOVE:
lw_ce3op01-paobjnr TO lw_flnmval-paobjnr,
lw_ce3op01-paledger TO lw_flnmval-paledger,
lw_ce3op01-vrgar TO lw_flnmval-vrgar,
lw_ce3op01-versi TO lw_flnmval-versi,
lw_ce3op01-gjahr TO lw_flnmval-gjahr,
lw_ce3op01-perbl TO lw_flnmval-perbl.
*appending all 93 fields as records
MOVE lw_ce3op01-vv010001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv011001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv012001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv013001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv014001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv015001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv016001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv020001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv021001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv030001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv031001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv032001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv033001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv034001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv035001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv200001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv201001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv202001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv203001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv036001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv037001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv038001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv039001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv040001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv041001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv042001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv043001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv204001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv205001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv211001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv212001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv213001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv222001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv223001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv230001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv232001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv233001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv500001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv501001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv502001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv503001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv504001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv505001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv506001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv507001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv508001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv509001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv510001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv511001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv512001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv513001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv514001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv515001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv516001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv517001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv518001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv519001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv520001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv236001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv206001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv051001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv052001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv053001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv054001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv055001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv056001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv057001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv058001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv059001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv060001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv241001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv242001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv243001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv244001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv245001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv246001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv247001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv248001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv249001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv250001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv521001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv522001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv523001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv524001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv525001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv526001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv527001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv528001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv529001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv530001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv227001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv226001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv224001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
*Segrigating all one record into 102 records is complete
ENDLOOP.
LOOP AT lt_flnmval ASSIGNING <fs_flnmval>.
IF l_index > 93.
l_index = 1.
ENDIF.
READ TABLE lt_fldlist INTO lw_fldlist INDEX l_index.
IF sy-subrc = 0.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lw_fldlist-fldnam
IMPORTING
output = <fs_flnmval>-fldnam.
ENDIF.
l_index = l_index + 1.
ENDLOOP.
SORT lt_ce4op01 BY paobjnr.
SORT lt_ce1op01 BY paobjnr paledger vrgar versi.
SORT gr_zfldnm BY low.
DELETE lt_flnmval WHERE fldnam NOT IN gr_zfldnm.
LOOP AT lt_flnmval INTO lw_flnmval.
READ TABLE lt_ce4op01 INTO lw_ce4op01 WITH KEY
paobjnr = lw_flnmval-paobjnr BINARY SEARCH.
IF sy-subrc = 0.
MOVE : lw_flnmval-paledger TO lw_e_t_data-paledger,
lw_flnmval-vrgar TO lw_e_t_data-vrgar,
lw_flnmval-versi TO lw_e_t_data-versi ,
lw_flnmval-gjahr TO lw_e_t_data-gjahr,
lw_flnmval-perbl TO lw_e_t_data-perbl,
lw_ce4op01-bukrs TO lw_e_t_data-bukrs,
lw_ce4op01-kndnr TO lw_e_t_data-kndnr,
lw_ce4op01-artnr TO lw_e_t_data-artnr,
lw_ce4op01-prctr TO lw_e_t_data-prctr,
lw_ce4op01-kokrs TO lw_e_t_data-kokrs,
lw_flnmval-fldnam TO lw_e_t_data-zfldnm,
lw_flnmval-zamunt TO lw_e_t_data-zamount.
CE1op01
READ TABLE lt_ce1op01 INTO lw_ce1op01 WITH KEY
paobjnr = lw_flnmval-paobjnr
paledger = lw_flnmval-paledger
vrgar = lw_flnmval-vrgar
versi = lw_flnmval-versi BINARY SEARCH.
IF sy-subrc = 0.
MOVE: lw_ce1op01-rbeln TO lw_e_t_data-rbeln,
lw_ce1op01-rposn TO lw_e_t_data-rposn.
ENDIF.
CE1op01
APPEND lw_e_t_data TO gt_out_data.
ENDIF.
ENDLOOP.
*Begin of MOD-002
FREE lt_flnmval.
REFRESH :lt_ce3op01,lt_ce4op01,lt_ce1op01.
e_t_data[] = gt_out_data[].
DELETE e_t_data WHERE zfldnm NOT IN gr_zfldnm.
l_s_loop_from = l_s_loop_to + lc_1.
l_count = l_count + 20.
IF l_count GE l_norecs.
EXIT.
ENDIF.
ENDDO.
*End of MOD-002
ls_counter_datapakid = ls_counter_datapakid + 1.
ENDIF. "IF S_COUNTER_DATAPAKID = 0
ELSE.
IF i_maxsize IS INITIAL.
RAISE error_passed_to_mess_handler.
ENDIF.
IF g_start IS INITIAL.
g_start = 1.
ELSE.
g_start = g_end + 1.
ENDIF.
g_end = g_start + i_maxsize - 1.
Population of E_T_DATA based on Data records size
APPEND LINES OF gt_out_data FROM g_start TO g_end TO e_t_data.
DELETE e_t_data WHERE zfldnm NOT IN gr_zfldnm.
IF e_t_data[] IS INITIAL.
RAISE no_more_data.
ENDIF.
ls_counter_datapakid = ls_counter_datapakid + 1.
ENDIF.
ENDFUNCTION.
Thanks & regards,
Sreekanth
+91 9740091981Hello Sreekanth,
See this blog [Generic Extraction via Function Module|/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module]
Also see this
[Line Item Level Data Extraction for Financial Accounting and Controlling|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a7f2f294-0501-0010-11bb-80e0d67c3e4a]
Thanks
Chandran -
Problem while creating Function module
Hi All,
I created a TABLE and am using this table in a FUNCTION MODULE as a reference for declaring an internal table in TABLES tab in the function module .
But when i click on the table name its giving an error "TABLES parameters are obsolete! "
Can any one figure out the reasons .....and help me out!!!
Deepika KHi Deepika,
Tables option is said to be Obsolete because these days we use internal tables without header line...
Tables Option in FM considers internally that the table name you mentioned is with a header line and the structure of the internal table will be acting as work area.
It is still included in new version because for Upward compatibility...
As we still use the predefine function modules so they should be even compatible with newer versions so its still there..
But for normal practice it can be used but preferably not to use.. rather you use EXPORT parameter and include internal table like field...
Create a structure first and then a Table type which include the previously defined structure in SE11 and the assign the Table type to the field in EXPORT parameter with TYPE..
Hope this would help u.
Regards
Narin Nandivada. -
Error while creating function with record type as return type
Hi i tried the following code to get the nth highest sal using record type and function.
CREATE OR REPLACE PACKAGE pack_rec_cur AS
TYPE rec_type IS RECORD (
name EMP.ename%TYPE,
sal EMP.sal%TYPE);
END;The above package is created
CREATE OR REPLACE
FUNCTION fun_rec_cur(n INT) RETURN pack_rec_cur.rec_type AS
rec pack_rec_cur.rec_type;
CURSOR cur_rec IS
SELECT ename,sal
FROM emp
WHERE sal is not null
ORDER BY DESC;
BEGIN
OPEN cur_rec;
FOR i IN 1..n LOOP
FETCH cur_rec into rec;
EXIT WHEN cur_rec%NOTFOUND;
END LOOP;
CLOSE cur_rec;
RETURN rec;
END; The above function is giving errors
LINE/COL ERROR
4/7 PL/SQL: SQL Statement ignored
7/16 PL/SQL: ORA-00936: missing expression
SQL> Could you please correct me where i'm doing mistake
Thanks.You are missing the column name in order by clauase. Is it ename desc?
CREATE OR REPLACE
FUNCTION fun_rec_cur(n INT) RETURN pack_rec_cur.rec_type AS
rec pack_rec_cur.rec_type;
CURSOR cur_rec IS
SELECT ename,sal
FROM emp
WHERE sal is not null
ORDER BY ENAME DESC; ---added ename
BEGIN
OPEN cur_rec;
FOR i IN 1..n LOOP
FETCH cur_rec into rec;
EXIT WHEN cur_rec%NOTFOUND;
END LOOP;
CLOSE cur_rec;
RETURN rec;
END;
-OUTPUT
SQL> SET SERVEROUT ON
SQL>
SQL> DECLARE
2 rec pack_rec_cur.rec_type;
3 BEGIN
4 rec := fun_rec_cur (6); --you get the 6th record in order of ename desc
5 DBMS_OUTPUT.put_line ('ename::' || rec.NAME || ' sal ::' || rec.sal);
6 END;
7 /
ename::MARTIN sal ::1250
PL/SQL procedure successfully completed.
SQL> -
Error while creating Function.
Hii All,
I'm currently working on 10gR2 .I'm trying to dynamically pass a column and parse it but I've encountered following error.Please help me.
Create or replace Function r_return_col
p_table_name in varchar2,
p_column_name in varchar2
)return varchar2
is
l_count number;
l_clob clob;
l_count_str varchar2(32000);
l_column_value varchar2(32000);
l_str clob;
l_ret_str clob;
begin
l_count_str := ' select count('||p_column_name||') ' ;
l_count_str := l_count_str||' from '||p_table_name ;
execute immediate l_count_str into l_count;
for i in 1..l_count
loop
l_str := 'select '||p_column_name||' from ' ;
l_str := l_str||' ( ';
l_str := l_str||' select row_number() over(order by '||p_column_name||') rw,'||p_column_name||' from '||p_table_name;
l_str := l_str||' ) where rw = '||i ;
execute immediate l_str into l_column_value;
l_ret_str := l_column_value||','||l_column_value;
end loop;
return 'select l_ret_str from dual';
end;
show err;
SQL> @D:\raghu\oracle_docs\rows_to_columns.sql
Warning: Function created with compilation errors.
Errors for FUNCTION R_RETURN_COL:
LINE/COL ERROR
34/5 PL/SQL: Statement ignored
34/23 PLS-00382: expression is of wrong typeRegards
Raghu.I've modified my code as below
Create or replace Function r_return_col
p_table_name in varchar2,
p_column_name in varchar2
)return varchar2
is
l_count number;
l_clob clob;
l_count_str varchar2(32000);
l_column_value varchar2(32000);
l_str varchar2(32000);--clob;
l_ret_str clob;
begin
l_count_str := ' select count('||p_column_name||') ' ;
l_count_str := l_count_str||' from '||p_table_name ;
execute immediate l_count_str into l_count;
dbms_output.put_line('Count is : '||l_count);
for i in 1..l_count
loop
l_str := 'select '||p_column_name||' from ' ;
l_str := l_str||' ( ';
l_str := l_str||' select row_number() over(order by '||p_column_name||') rw,'||p_column_name||' from '||p_table_name;
l_str := l_str||' ) where rw = '||i ;
execute immediate l_str into l_column_value;
l_column_value := q'[']'||l_column_value||q'[']' ;
l_ret_str := l_ret_str||','||l_column_value;
end loop;
return 'select '||ltrim(l_ret_str,',')||' from dual';
end;
show err;But now instead of returning the query I'd like to return the rows retrived after executing the query.How could I accomplish this??Can this be done using refcursor?Please help me.
Regards
Raghu -
Error while creating function filter for SAP R3 destination
Hi All,
I am using SAP Portal Add-in 1.0 Patch 3 for Visual Studio 2003 with SAP Portal Runtime 1.0 Patch 3 for Microsoft .NET and SAPDotNetConnector2.0.
Portal server is successfully added to my server explorer.SAP R3 system destination is also added succesfully ,but when i create a function filter
for my destination function to add my RFC enabled function module it gives me an error message "Missing R3NAME=... or ASHOST=... in connect_param in RfcOpenEx",but when i log into the R3 system from portal system ,I am able to log successfully.
please see the attached jpg file for your reference.
what should I do,plz help me.3 things:
1. When you say "but when i log into the R3 system from portal system ,I am able to log successfully"... what do you mean exactly? Do you mean you tried to do a "test connection"?
2. Make sure the portal user mapping is set to "user & password" and not SSO. In order to work with the destination in design time you need to have it set to User and Password. Later, for run-time connection you can change it to SSO.
3. If number 2 failed, can you please click on the destination in the server explorer and look at the property grid for the connection string property? make sure it's correct (you can post it here if you don't know).
Regards,
Ofer -
Problem while creating Functional module
Hi Experts.
I was trying to create one FM for currency conversion purpose.The code as follows.
FUNCTION Z_TEST_CUR_RATE.
""Local Interface:
*" IMPORTING
*" VALUE(TYPE_OF_RATE) LIKE TCURR-KURST
*" VALUE(DATE) LIKE SY-DATUM
*" VALUE(FOREIGN_CURRENCY) LIKE TCURR-FCURR
*" VALUE(LOCAL_CURRENCY) LIKE TCURR-TCURR
*" EXPORTING
*" VALUE(RATE) TYPE TCURR-UKURS
*" VALUE(TEST) TYPE C
data: rate1 like TCURR-UKURS.
Select SINGLE UKURS from TCURR into RATE1
where KURST = 'TYPE_OF_RATE' and
FCURR = 'FOREIGN_CURRENCY' and
TCURR = 'LOCAL_CURRENCY' and
GDATU = DATE.
if sy-subrc = 0.
rate = rate1.
else.
rate = 1.
ENDFUNCTION.
When ever I try to run this program I am getting the output as rate = 1.I mean to say that the select statement is not at all executed....Can any expects help me out.....
Thanks In advance
Regards,
BalaHi
Try without using the variable RATE1,,and remove the quotes
Select SINGLE UKURS from TCURR into (TCURR-UKURS)
where KURST = TYPE_OF_RATE'and
FCURR = FOREIGN_CURRENCY and
TCURR = LOCAL_CURRENCY and
GDATU = DATE.
regards
Mahesh -
ORA-00439 while creating function based indexes.
Hi everybody
I'm working on Oracle 8.1.7 database, and try to create a function based index on a table.
Unfortunately I get the ORA-00439 error, that recommends me not to use this feature :-(
What should I do to activate this feature ?
ThanxTry.
SQL> select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bi
PL/SQL Release 10.1.0.2.0 - Production
CORE 10.1.0.2.0 Production
TNS for Solaris: Version 10.1.0.2.0 - Production
NLSRTL Version 10.1.0.2.0 - Production -
Seeking help(problem while create function)
hei..to everybody
I am having a peculiar problem . whenever i create a function , I don't get the acknowledge message and I don't get any response and the function is not getting created.
As we are running short of disk space , I was examing the disk space usage.I found that the oracle product disk space was about 65GB which is abnormal.
please send me syntax of checking the tablespace usage.
please help me to solve the problem
by
ravikumarIt is not to do with space usage.
Please copy & paste what you typed in SQL*Plus, for example here is what it should look like if you create an invalid function:
SQL> CREATE OR REPLACE FUNCTION testfun
2 RETURN VARCHAR2
3 AS
4 BEGIN
5 RETURN;
6 END;
7 /
Warning: Function created with compilation errors.
SQL> show errors
Errors for FUNCTION TESTFUN:
LINE/COL ERROR
5/5 PLS-00503: RETURN <value> statement required for this return from
function
SQL> ed
Wrote file afiedt.buf
1 CREATE OR REPLACE FUNCTION testfun
2 RETURN VARCHAR2
3 AS
4 BEGIN
5 RETURN 'Hello, world';
6* END;
SQL> /
Function created. -
Error while creating function anonumos bock
Hi ,,
I trying to write a function in a aninymous block to return the ename based on empo passed . but it throws me an error as follows :
where am i going wrong here .
SET SERVEROUTPUT ON
DECALRE
v_ename varchar2;
FUNCTION getename(p_no number)
RETURN varchar2
AS
SELECT ename from
scott.emp
WHERE empno=p_no;
BEGIN
v_ename :=getename(7369);
dbms_output.put_line(v_ename);
END;
ORA-06550: line 2, column 1:
PLS-00201: identifier 'V_ENAME' must be declared
ORA-06550: line 2, column 1:
PL/SQL: Statement ignored
ORA-06550: line 3, column 22:
PLS-00201: identifier 'V_ENAME' must be declared
ORA-06550: line 3, column 1:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:SQL> SET SERVEROUTPUT ON;
SQL>
SQL>
SQL> DECLaRE
2 v_ename varchar2(150);
3 FUNCTION getename(p_no number) RETURN varchar2 AS
4 RESULT VARCHAR2(10);
5 BEGIN
6 SELECT DUMMY INTO RESULT from DUAL WHERE 1=P_NO;
7 RETURN RESULT;
8 END;
9 BEGIN
10 v_ename := getename(1);
11 dbms_output.put_line(v_ename);
12 END;
13 /
X
PL/SQL procedure successfully completed
SQL>
Ramin Hashimzade -
Hi Team,
I am getting error message while creating Function script as below..
CREATE TYPE Book_t AS OBJECT
( name VARCHAR2(100),
AUTHOR VARCHAR2(30),
ABSTRACT VARCHAR2(1000));
CREATE TYPE BOOKSET_T AS TABLE OF BOOK_T;
CREATE TABLE Catalogs
( NAME VARCHAR2(30),
CAT CLOB);
CREATE or replace FUNCTION GetBooks(a CLOB) RETURN BookSet_t;
Error message :=
Error(1): PLS-00378: invalid compilation unit for this release of PL/SQL
But All object are valid state only.You cannot forward declare functions as database objects like you do in packages, you have to actually provide the body of the function as well..
SQL> CREATE or replace FUNCTION GetBooks(a CLOB) RETURN BookSet_t;
2 /
Warning: Function created with compilation errors.
SQL> sho err
Errors for FUNCTION GETBOOKS:
LINE/COL ERROR
0/0 PLS-00378: invalid compilation unit for this release of PL/SQL
SQL> CREATE or replace FUNCTION GetBooks(a CLOB) RETURN BookSet_t IS
2 BEGIN
3 NULL;
4 END;
5 /
Function created. -
Cnnection error while creating universe on Bex Query in BW
Hi
I am getting connection error while connecting to BW Bex query.
The error i am getting while creating universe is A runtime exception has occured Error getting levels for hierarchy dimension .....:Unknown error.
After this
Also while creating universe no key figures/measures are getting generated from Bex query to designer.
Also in Bex query which are created as mandatory variables comes as Prompts in webi.
But when I try to parse in Condition filter it is throwing error.
Currently that mandatory variable is From Date and To Date
Is we require to change the prompt syntax in Condition filter.
Also kindly suggest solution for Connection error as impemtation is getting affected.
Regards
Gaurav MangHi
R u saying allow external acces in BEX query.This option in Bex Query designer.
Or In whether while creating universes under properties tab there is use of OLAP universes option has to be made to Yes.
This both things we have tried
Let me know any other option to be tried.
Regards
gaurav mang -
Job is missing for the Position while creating Requisition in E-recruitment
Hi Gurus,
I have a situation when I create new job requisition on the ESS. When I select the vacant position while creating requisition, the org unit text box is populated automatically but not the Job text box. The is relationship between Position - Org unit and Position - Job is maintained in SAP recruitment system. can anyone help me get the Job Text box also filled just as Org Unit text box.
Thank youThere is a note 1818432 for this issue.
Maybe you are looking for
-
I can't find a simple answer to this question from Apples flashy "documentation" or from any online straighforward guides. There is an app called "Articulate Mobile Player" that we want to deploy to our fleet of iPads. These iPads do not have Apple I
-
A question about beepings.. this the ....
this is the beeping order before the bios screen shows up: beep beep beep beep *pause* beep beep *short pause* beep any idea what the message is supposed to mean? and now we're at it, how do i fixe it?
-
Exporting schema (Oracle 9i Solaris 9)
Hi Guys, I want to create a dev. database so that I can play around oracle so I have done an export of my production. I then created a user on my dev box but now when I try to import the data it says user does not exist. How do I create a schema if t
-
Word Stopped Printing the correct current page, prints page #1 instead
Word 2013 will no longer print the correct current page when asked to do so--it prints page 1 instead. There is no problem with the document(s) involved as they will print the correct current page with another user. If you highlight a selection, it
-
2 luns in the metadata storage pool
Hi, I am currently using Xsan ( for redundancy ) with a volume that requires high I/O. However, I am receiving poor performance at times, with the read latency mainly. I think this is caused by the metadata storage pool (RAID 1 on its own controller)