Plsql_table.populate_table
the populate_table proc has update_records and insert_records methods that pass back from the forms block
to a plsql table what records on that form block where updated or inserted into the form. Is there a method that passes back every record on the form, whether it was updated, inserted or unchanged?
Just a warning: PLSQL_POPULATE table is for use by Forms internally and is not supported or documented for use in custom PL/SQL code.
Similar Messages
-
Data block and storage procedure
Hi,
I have problem with form that is build on storage procedure.
When I compile form i get error:
Compilation error on DELETE-PROCEDURE trigger on BLOCK22 data block:
ERROR PL/SQL 306 in line 7, column 1
wrong number or types of arguments in call to 'POPULATE_TABLE'
ERROR PL/SQL 0 in line 7, kcolumn 1
Statement ignored
Table:
CREATE TABLE LOKALIZACJE
( ID_LOK INTEGER,
ADRES VARCHAR2(40),
OPIS VARCHAR2(80));
Package:
create or replace package pkg_lok_1 is
type lok_rec is record
(id_lok lokalizacje.id_lok%type,
adres lokalizacje.adres%type,
opis lokalizacje.opis%type);
TYPE return_cur IS REF CURSOR RETURN lokalizacje%ROWTYPE;
TYPE return_tab IS TABLE OF lok_rec;
PROCEDURE wyswietl (param_return_rec IN OUT return_cur);
PROCEDURE usun (p_emp_table IN OUT return_tab);
END pkg_lok_1;
CREATE OR REPLACE PACKAGE BODY pkg_lok_1 AS
PROCEDURE wyswietl (param_return_rec IN OUT return_cur) IS
BEGIN
OPEN param_return_rec FOR
SELECT * FROM lokalizacje;
END wyswietl;
PROCEDURE usun (p_emp_table IN OUT return_tab) is
BEGIN
delete lokalizacje
where id_lok=p_emp_table(0).id_lok;
END usun;
END pkg_lok_1;
end trigger delete-procedure
DECLARE
bk_data PKG_LOK_1.RETURN_TAB;
BEGIN
PLSQL_TABLE.POPULATE_TABLE(bk_data, 'BLOCK22', PLSQL_TABLE.DELETE_RECORDS);
PKG_LOK_1.USUN(bk_data);
END;
Procedure wyswietl work fine but form doesn't comiple when I use procedure usun.
Where is problem? Colud someone help me?
jamesPerhaps, you block have a non database items but they is declared as database.
-
Forms based on PL/SQL Package
Hi all
I investigate Forms Blocks with DML Data Target Type = "Procedure". We want move business logic that is currently located in various row-level-triggers on the DB into PL/SQL-packages.
I wonder if DML Returning Value really does not work when I insert the data through a Procedure. I found no statement about it in the documentation (clearly, it works only with DB 8i and newer, but we are on 11g now). The Signature of the PL/SQL Procedure for Insert
procedure do_insert (p_tab_test in out tab_test) is...
with it's in out parameter suggests somewhat Returning DML to work. I wonder if it should be possible to expand the Oracle-generated insert procedure like
DECLARE
bk_data PA_TEST.TAB_TEST;
BEGIN
PLSQL_TABLE.POPULATE_TABLE(bk_data, 'BLOCK2', PLSQL_TABLE.INSERT_RECORDS);
PA_TEST.DO_INSERT(bk_data);
PLSQL_TABLE.POPULATE_BLOCK(bk_data, 'BLOCK2') ; -- <-----------------------suggested new line
END;I will try to clarify:
My expectations:
I make inserts into a DB-table using a PL/SQL Procedure. In the examples (e.g [http://www.dulcian.com/papers/ODTUG/2000/What-Do-You-Base-Your-Block-On.htm] ) ,with DML Data Target Type = Procedure, the table of records used to pass on the data to the package is declared as in-out parameter. So, if I
- change the data in the table of records in the package during insert-processing (1)
- and set the block property DML Returning Value to Yes (2)
I expect forms to update the data in the block/items after the insert processing to reflect the changes made in step 1 (3)
Every thing works well except (3).
The Background:
We've got an application with DML Data Target Type = Table with almost all blocks. There are a couple of DB-Triggers on these tables implementing business-logic, which we would like to transfer into packages (so change DML Data Target Type to Procedure). But the application uses Returning DML here and there, which seems not to work togethter with DML Data Target Type = Procedure. Before dropping this idea, I would like to be sure that this is not intended to work.
It seems to me that if the insert-procedure generated by forms builder contained an additional line
PLSQL_TABLE.POPULATE_BLOCK(bk_data, 'BLOCK2');+
at the end, this should work.
Thank you for your effort
Pascal -
Hi, the forms procedure POPULATE_TABLE is automatically invoked within the block trigger (QUERY-PROCEDURE) when querying procedure based blocks. This procedure fails when an empty recordset is returned.
To aviod this error, in these cases I return a null record. This in turn causes problems with the update/insert procedures (as now this record is modified as an update - rather than insert procedure when changes are made to it).
I have worked around this problem but wonder whether there is something I am un aware of which would simplify the problem.
TIA
DGUsing DefaultTable model you have addRow
DeleteRow methods.
http://www.codetoad.com/java_jtable.asp
There in createBlankElement() method
7 blank values are for 7 columns. Just
put your database values there. -
Form Builder. Error 306 wrong number or types of arguments in call to populate_table
Hi ! I'm trying to build a simple form based on a procedure.
the error that i get:
error 306 - wrong number or types of arguments in call to populate_table
When I use the Data block
wizard, I specify the procedure with a ref cursor argument. the procedure code:
open ind_prof for select i.nome, i.idade, p.nome
from individuo i, individuo_profissao ip, profissao p
where i.cod_individuo=ip.cod_individuo
and ip.cod_profissao=p.cod_profissao;
The error that i get 'points' to this procedure. I checked the cursor type, the record
type and everything seems ok.
I'm using a ref cursor to query.
I have the same proble either using a procedure or a function.
There is another method to load the data into the block. That procedure is called
automatically and it has a table of the same record type as the ref cursor as an
argument. What code should I write on it ?
what should I write in both of them ?
Thanks !<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Instructor:
The procedure most likely requires an argument when executed.
To specify the argument in forms, you need to go to BLOCK property QUERY DATA SOURCE ARGUMENTS and if performing DML...use INSERT PROCEDURE ARGUMENTS, UPDATE PROCEDURE ARGUMENTS, and DELETE PROCEDURE ARGUMENTS.
Hope this helps.<HR></BLOCKQUOTE>
thanks, I will check it out !
null -
Urgent:-error - PLsql_table.populate_block fails
Hi,
I am trying Block based on Stored Procedures (table Of Records)
in forms 6i i followed all the steps given in Note 66887.1 in metalink.
But when i query in the form it gives error FRM-40733 : PLsql_table.populate_block fails. Where is the proble?
Thx in advance
NamrataIn forms I set up a data block based on this procedure. What steps did you follow to set up your data block? If you are setting the block properties manually, I recommend you use the Data Block Wizard instead. Doing this manually is just too complicated.
when I run the form in EBS is get the error FRM-40733:PL/SQL built-in PLSQL_TABLE.POPULATE_BLOCK FAILED.What is your Forms Version? More than likely, the PLSQL_TABLE package is doing something that is not supported by your Forms version. The fact that you are working with the EBS implies you likely have a support contact with Oracle. If this is the case, I recommend you look at My Oracle Support article *Basing a Block on a Stored Procedure - Sample Code [ID 66887.1].* The method demonstrated in this document is support Forms 5.0 and higher.
Hope this helps,
Craig B-)
If someone's response is helpful or correct, please mark it accordingly. -
I've just encountered this builtin in a program that is generated from Designer6i.
I'm getting error messages.
Where can I find documentation on this
builtin?
Can't find anything in PL/SQL docs or
Forms docs.
Help?
Haakon
nullThere are some rather misleading statements about varrays in the www.java2s.com document, e.g. +"Elements in a varray can only be modified as a whole, not individually"+ and +"You can change the size of a varray later."+ Then again, nobody in their right mind would use a varray anyway.
-
Assign value to a record in a loop?
I have the record as following:
TYPE Curr_Select_Rec IS RECORD
ser_date date,
blk_route varchar210)
p_select Curr_Select_Rec;
How do I assign value to it in a loop?
I know I can do this
p_select.blk_route := 'aaaa';
but in the loop
Loop
How??????
end loop;
NEXT, LAST, FIRST Did not work
nullHi,
here a little package I wrote to select a table into a plsql_table and to work with the pl/sql table .
Package STIL_utils
IS
type r_export_tags is record
(bezeichnung stilvorlagen.bezeichnung%TYPE,
start_tag stilvorlagen.text_beginn%TYPE,
end_tag stilvorlagen.text_ende%TYPE);
type t_export_tags is table of r_export_tags
index by binary_integer;
procedure fill_tag_table(p_export_tags in out t_export_Tags,
p_export_typ in varchar2);
procedure show_tag_table(p_export_tags in t_export_Tags);
procedure find_tag(p_export_tags in out t_export_tags,
p_export_typ in varchar2,
p_tag_typ in varchar2,
p_start_tag in out stilvorlagen.text_beginn%TYPE,
p_end_tag in out stilvorlagen.text_ende%TYPE);
END; -- Package Specification UTL_STIL
Package Body STIL_utils
IS
-- Stilvorlagen Array
procedure show_tag_table(p_export_tags in t_export_tags)
is
v_index number;
v_index_last number;
begin
v_index := p_export_tags.first;
v_index_last := p_export_tags.last;
loop
dbms_output.put_line(p_export_Tags(v_index).bezeichnung);
dbms_output.put_line(p_export_Tags(v_index).start_tag);
dbms_output.put_line(p_export_Tags(v_index).end_tag);
exit when v_index = v_index_last;
v_index := p_export_Tags.next(v_index);
end loop;
end;
procedure fill_tag_table(p_export_tags in out t_export_Tags,
p_export_typ in varchar2)
is
cursor tags is
select bezeichnung,text_beginn,text_ende
from stilvorlagen
where bezeichnung like p_export_typ| |'_%'
and loesch_kz is null;
v_count number := 0;
--Prozedur zur Ermittlung welche Tags verwendet werden sollen.
-- Aus der Tabelle Stilvorlagen wird ein Array mit den Start und
--Ende Tags des entsprechenden Export Typs gef|llt.
begin
for rec in tags
loop
p_export_tags(v_count).bezeichnung := rec.bezeichnung;
p_export_tags(v_count).start_tag := rec.text_beginn;
p_export_tags(v_count).end_tag := rec.text_ende;
v_count := v_count + 1;
end loop;
--show_tag_table(p_export_tags);
end;
procedure find_tag(p_export_tags in out t_export_tags,
p_export_typ in varchar2,
p_tag_typ in varchar2,
p_start_tag in out stilvorlagen.text_beginn%TYPE,
p_end_tag in out stilvorlagen.text_ende%TYPE)
is
v_index number;
v_index_last number;
v_bezeichnung stilvorlagen.bezeichnung%TYPE;
begin
v_index := p_export_tags.first; --Arrayindex setzen
v_index_last := p_export_Tags.last; --Abbruchkriterium ermitteln
p_start_tag := null;
p_end_tag := null;
loop
v_bezeichnung := p_export_tags(v_index).bezeichnung;
-- Ist das der richtige Tag?
if v_bezeichnung = p_export_typ| |'_'| |p_tag_typ then
p_start_Tag := p_export_tags(v_index).start_Tag;
p_end_Tag := p_export_tags(v_index).end_Tag;
-- Tag gefunden also raus
exit;
else
-- Wenn alle getestet, dann raus
exit when v_index = v_index_last;
-- Ndchstes Feld aus Array
v_index := p_export_Tags.next(v_index);
end if;
end loop;
end;
END; -- Package Body UTL_STIL
Hope that helps
Detlev
null -
Selection using check box in std ALV grid!
Hi all,
I have written a custom report to show the O/p in ALV grid.
This is my code:
TABLES :zpo_loi.
TYPE-POOLS : slis.
TYPE-POOLS: icon.
TABLES : sscrfields.
DATA : ls_composer TYPE ssfcompop,
ls_control TYPE ssfctrlop.
DATA : wa_return TYPE TABLE OF bapiret2 ,
wa_address TYPE bapiaddr3.
DATA : wa_crmd_orderadm_h TYPE zpo_loi,
it_po TYPE TABLE OF crmd_orderadm_h,
wa_po TYPE bbp_pds_header.
DATA : it_tab TYPE TABLE OF zpo_loi.
DATA : it_data TYPE TABLE OF crmd_orderadm_h,
wa_data TYPE bbp_pds_header,
et_data TYPE bbps_sf_po_output.
DATA : w_formname TYPE tdsfname ,
w_sfname TYPE rs38l_fnam.
DATA :it_po_no TYPE TABLE OF select_be_obj_id,
wa_it_po_no LIKE LINE OF it_po_no.
DATA :r_itab TYPE ddshretval OCCURS 0.
DATA : it_output LIKE TABLE OF zloi,
wa_output TYPE zloi.
DATA : w_answer TYPE c.
DATA : g_repid LIKE sy-repid,
g_title TYPE lvc_title,
g_set_pf_stat TYPE slis_formname VALUE 'SET_PF_STATUS',
g_user_command TYPE slis_formname VALUE 'USER_COMMAND',
g_layout TYPE slis_layout_alv,
g_print_alv TYPE slis_print_alv,
g_variant LIKE disvariant,
c_char_a(1) VALUE 'A',
c_char_x(1) VALUE 'X',
itab_alv_sort TYPE slis_t_sortinfo_alv,
itab_alv_fcat TYPE slis_t_fieldcat_alv.
* Internal tables Begin with IT_ *
DATA : it_fcat TYPE slis_t_fieldcat_alv, "---ALV
it_disp TYPE TABLE OF zloi.
* Work Area for Internal tables Begin with WA_ *
DATA : wa_fcat TYPE slis_fieldcat_alv , "---ALV
wa_layout TYPE lvc_s_layo, "---ALV
wa_it_disp LIKE LINE OF it_disp.
DATA : it_sf_po TYPE TABLE OF crmd_orderadm_h,
wa_sf_po TYPE bbp_pds_header.
*SELECTION-SCREEN:
* BEGIN OF SCREEN 500 AS WINDOW TITLE title,
* END OF SCREEN 500.
*DATA : functxt TYPE smp_dyntxt.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS sel_po FOR zpo_loi-zobject_id.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS : pr_loi RADIOBUTTON GROUP grp1 USER-COMMAND ucom,
pr_fondo RADIOBUTTON GROUP grp1.
SELECTION-SCREEN END OF BLOCK b2.
* At selection-screen output *
AT SELECTION-SCREEN OUTPUT.
IF pr_fondo = 'X'.
REFRESH sel_po.
LOOP AT SCREEN.
IF screen-name = text-003 OR screen-name = text-004.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSEIF pr_loi = 'X'.
LOOP AT SCREEN.
IF screen-name = text-003 OR screen-name = text-004.
screen-input = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
* At selection-screen on radiobutton *
AT SELECTION-SCREEN ON RADIOBUTTON GROUP grp1.
IF pr_fondo = 'X'.
REFRESH sel_po.
LOOP AT SCREEN.
IF screen-name = text-003 OR screen-name = text-004.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSEIF pr_loi = 'X'.
LOOP AT SCREEN.
IF screen-name = text-003 OR screen-name = text-004.
screen-input = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR sel_po-low.
PERFORM populate_table.
PERFORM f4_help.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR sel_po-high.
PERFORM populate_table.
PERFORM f4_help.
* At selection-screen *
AT SELECTION-SCREEN.
*---CHECKING THE INPUT >>>
IF sy-ucomm = 'ONLI'.
PERFORM f002-check_input.
PERFORM f001-check.
ENDIF.
*& Form POPULATE_TABLE
* text
* --> p1 text
* <-- p2 text
FORM populate_table .
SELECT zobject_id
description
FROM zpo_loi
INTO CORRESPONDING FIELDS OF TABLE it_tab.
SORT it_tab BY zobject_id ASCENDING.
ENDFORM. " POPULATE_TABLE
*& Form F4_HELP
* text
* --> p1 text
* <-- p2 text
FORM f4_help .
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
ddic_structure = ' '
retfield = 'ZOBJECT_ID'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'A'
value_org = 'S'
TABLES
value_tab = it_tab
return_tab = r_itab.
ENDFORM. " F4_HELP
*& Form F001-CHECK
* text
* --> p1 text
* <-- p2 text
FORM f001-check .
IF pr_fondo = 'X'.
PERFORM display_expiring_fondos.
ELSEIF pr_loi = 'X'.
PERFORM fetch_po_det.
PERFORM build_fcat.
PERFORM alv_display.
ENDIF.
ENDFORM. " F001-CHECK
*& Form F002-CHECK_INPUT
* text
* --> p1 text
* <-- p2 text
FORM f002-check_input .
IF pr_loi = 'X'.
REFRESH it_po.
IF sel_po-low IS NOT INITIAL.
SELECT object_id
FROM crmd_orderadm_h
INTO CORRESPONDING FIELDS OF TABLE it_po
WHERE object_type = 'BUS2201'
AND object_id = sel_po-low.
IF sy-subrc NE 0.
IF sel_po-high IS NOT INITIAL.
SELECT object_id
FROM crmd_orderadm_h
INTO CORRESPONDING FIELDS OF TABLE it_po
WHERE object_type = 'BUS2201'
AND object_id = sel_po-high.
IF sy-subrc NE 0.
MESSAGE e009(zsrm).
ENDIF.
ENDIF.
MESSAGE e007(zsrm).
ENDIF.
ELSE.
MESSAGE e010(zsrm).
ENDIF.
IF sel_po-high IS NOT INITIAL.
SELECT object_id
FROM crmd_orderadm_h
INTO CORRESPONDING FIELDS OF TABLE it_po
WHERE object_type = 'BUS2201'
AND object_id = sel_po-high.
IF sy-subrc NE 0.
MESSAGE e008(zsrm).
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " F002-CHECK_INPUT
*& Form FETCH_PO_DET
* text
* --> p1 text
* <-- p2 text
FORM fetch_po_det .
REFRESH it_po.
it_po_no[] = sel_po[].
DATA : w_count TYPE i,
w_lines TYPE c,
wa_header TYPE bbp_pds_po_header_d.
REFRESH : it_po,it_output.
IF sel_po-high IS NOT INITIAL.
SELECT object_id
description
posting_date
created_by
FROM crmd_orderadm_h
INTO CORRESPONDING FIELDS OF TABLE it_po
WHERE object_type = 'BUS2201'
AND object_id BETWEEN sel_po-low AND sel_po-high.
ELSE.
SELECT object_id
description
posting_date
created_by
FROM crmd_orderadm_h
INTO CORRESPONDING FIELDS OF TABLE it_po
WHERE object_type = 'BUS2201'
AND object_id = sel_po-low.
ENDIF.
w_lines = sy-dbcnt.
w_count = 1.
DO.
IF w_count LE w_lines.
READ TABLE it_po INTO wa_po INDEX w_count.
MOVE wa_po-object_id TO wa_output-zzpono.
MOVE wa_po-description TO wa_output-zzpodesc.
MOVE wa_po-posting_date TO wa_output-zzpodate.
MOVE wa_po-created_by TO wa_output-zzpocreator.
CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
EXPORTING
i_object_id = wa_output-zzpono
IMPORTING
e_header = wa_header.
CALL FUNCTION 'BAPI_USER_GET_DETAIL'
EXPORTING
username = wa_output-zzpocreator
IMPORTING
address = wa_address
TABLES
return = wa_return.
CLEAR wa_output-zzpocreator.
CONCATENATE wa_address-firstname ' ' wa_address-lastname INTO wa_output-zzpocreator .
MOVE wa_header-total_value TO wa_output-zzpoval.
MOVE wa_header-currency TO wa_output-zzpocur.
APPEND wa_output TO it_output.
w_count = w_count + 1.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDFORM. " FETCH_PO_DET
*& Form BUILD_FCAT
* text
* --> p1 text
* <-- p2 text
FORM build_fcat .
g_repid = sy-repid.
g_title = 'Print LOI details'.
g_print_alv-no_print_listinfos = 'X'.
g_variant-report = sy-repid.
g_variant-variant = sy-title.
CLEAR g_layout.
g_layout-f2code = ' '.
wa_layout-zebra = 'X'.
g_layout-flexible_key = 'X'.
g_layout-colwidth_optimize = 'X'.
g_layout-detail_initial_lines = 'X'.
g_layout-box_fieldname = 'ZZCHECK'.
REFRESH it_fcat.
*Po no
CLEAR wa_fcat.
wa_fcat-fieldname = 'ZZPONO' .
wa_fcat-tabname = 'IT_DISP'.
wa_fcat-seltext_m = 'Purchase Order'.
*wa_fcat-seltext_s = 'Purchase Order.
wa_fcat-icon = 'X'.
wa_fcat-col_pos = '2'.
wa_fcat-outputlen = 10.
APPEND wa_fcat TO it_fcat.
*Description
CLEAR wa_fcat.
wa_fcat-fieldname = 'ZZPODESC' .
wa_fcat-tabname = 'IT_DISP'.
*wa_fcat-seltext_l = 'Description'.
wa_fcat-seltext_m = 'Description'.
*wa_fcat-seltext_s = 'Description'.
wa_fcat-col_pos = '3'.
wa_fcat-outputlen = 10.
APPEND wa_fcat TO it_fcat.
*Posting date
CLEAR wa_fcat.
wa_fcat-fieldname = 'ZZPODATE' .
wa_fcat-tabname = 'IT_DISP'.
wa_fcat-seltext_l = 'Posting Date'.
wa_fcat-seltext_m = 'Posting Date'.
*wa_fcat-seltext_s = 'Posting Date'.
wa_fcat-col_pos = '4'.
wa_fcat-outputlen = 8.
APPEND wa_fcat TO it_fcat.
*value
CLEAR wa_fcat.
wa_fcat-fieldname = 'ZZPOVAL' .
wa_fcat-tabname = 'IT_DISP'.
*wa_fcat-seltext_l = 'PO value'.
wa_fcat-seltext_m = 'PO value'.
*wa_fcat-seltext_s = 'PO value'.
wa_fcat-col_pos = '5'.
wa_fcat-outputlen = 15.
wa_fcat-no_zero = 'X'.
APPEND wa_fcat TO it_fcat.
*Currency
CLEAR wa_fcat.
wa_fcat-fieldname = 'ZZPOCUR' .
wa_fcat-tabname = 'IT_DISP'.
*wa_fcat-seltext_l = 'PO Currency'.
wa_fcat-seltext_m = 'PO Currency'.
*wa_fcat-seltext_s = 'PO Currency'.
wa_fcat-col_pos = '6'.
wa_fcat-outputlen = 5.
APPEND wa_fcat TO it_fcat.
*Creator
CLEAR wa_fcat.
wa_fcat-fieldname = 'ZZPOCREATOR' .
wa_fcat-tabname = 'IT_DISP'.
*wa_fcat-seltext_l = 'Buyer'.
wa_fcat-seltext_m = 'Buyer'.
*wa_fcat-seltext_s = 'Buyer'.
wa_fcat-col_pos = '7'.
wa_fcat-outputlen = 12.
APPEND wa_fcat TO it_fcat.
ENDFORM. " BUILD_FCAT
*& Form ALV_DISPLAY
* text
* --> p1 text
* <-- p2 text
FORM alv_display .
SORT it_output BY zzpono.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_callback_pf_status_set = g_set_pf_stat
i_callback_user_command = g_user_command
i_grid_title = g_title
is_layout = g_layout
it_fieldcat = it_fcat[]
is_variant = g_variant
is_print = g_print_alv
TABLES
t_outtab = it_output[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
ENDFORM. " ALV_DISPLAY
*& Form user_command
* text
* -->R_UCOMM text
* -->RS_SELFIELD text
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield. "#EC CALLED
DATA: gd_repid LIKE sy-repid, "Exists
ref_grid TYPE REF TO cl_gui_alv_grid.
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF NOT ref_grid IS INITIAL.
CALL METHOD ref_grid->check_changed_data .
ENDIF.
rs_selfield-refresh = 'X'.
CASE r_ucomm.
WHEN 'PRINTLOI'.
PERFORM call_sf.
WHEN 'BACK'.
CALL SELECTION-SCREEN 1000.
WHEN 'CANCEL'.
CALL SELECTION-SCREEN 1000.
WHEN 'EXIT'.
CALL SELECTION-SCREEN 1000.
ENDCASE.
ENDFORM. "user_command
*& Form set_pf_status
* text
* -->RT_EXTAB text
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZALV' EXCLUDING rt_extab.
SET TITLEBAR 'ZALV'.
ENDFORM. "set_pf_status
*& Form CALL_SF
* text
* --> p1 text
* <-- p2 text
FORM call_sf .
REFRESH it_sf_po.
LOOP AT it_output INTO wa_output WHERE zzcheck = 'X'.
wa_sf_po-object_id = wa_output-zzpono.
APPEND wa_sf_po TO it_sf_po.
ENDLOOP.
w_formname = 'ZSR_EBP_DOCU_LETTEROFINTENT1'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = w_formname
IMPORTING
fm_name = w_sfname
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
ENDIF.
ls_composer-tdnewid = 'X'.
ls_control-no_dialog = 'X'.
LOOP AT it_sf_po INTO wa_sf_po.
CALL FUNCTION w_sfname
EXPORTING
control_parameters = ls_control
output_options = ls_composer
wa_object = wa_sf_po
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
ENDIF.
ENDLOOP.
ENDFORM. " CALL_SF
*& Form DISPLAY_EXPIRING_FONDOS
* text
* --> p1 text
* <-- p2 text
FORM display_expiring_fondos .
SET PF-STATUS 'ZLOI'.
SET TITLEBAR 'ZLOI'.
TYPES : BEGIN OF ty_output1,
guid TYPE bbp_guid,
object_id TYPE crmt_object_id_db,
description TYPE crmt_process_description,
posting_date TYPE crmt_posting_date,
zzfondo_dat TYPE zfondo_dat,
created_by TYPE crmt_created_by,
END OF ty_output1.
DATA : it_output1 TYPE TABLE OF ty_output1,
wa_output1 TYPE ty_output1,
w_lines,
w_count,
it_fondo TYPE TABLE OF zsr_fondo,
it_temp_fondo TYPE TABLE OF zsr_fondo,
wa_temp_fondo TYPE zsr_fondo,
wa_fondo TYPE zsr_fondo,
w_diff TYPE p,
wa_header1 TYPE bbp_pds_po_header_d.
CONSTANTS : c_otype(8) VALUE 'BUS2201'.
REFRESH : it_output1,it_temp_fondo,it_fondo.
SELECT b~zzfondo_dat
a~guid
a~object_id
a~description
a~posting_date
a~created_by
INTO CORRESPONDING FIELDS OF TABLE it_output1
FROM bbp_pdhsc AS b
LEFT OUTER JOIN crmd_orderadm_h AS a ON b~guid = a~guid
AND a~object_type = c_otype.
LOOP AT it_output1 INTO wa_output1.
CALL FUNCTION '/SDF/CMO_DATETIME_DIFFERENCE'
EXPORTING
date1 = sy-datum
date2 = wa_output1-zzfondo_dat
IMPORTING
datediff = w_diff
EXCEPTIONS
invalid_datetime = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
IF w_diff <= '7'.
wa_temp_fondo-zzpono = wa_output1-object_id.
APPEND wa_temp_fondo TO it_temp_fondo.
ENDIF.
ENDLOOP.
*select the final entries for PO whose FONDO is expiring
DESCRIBE TABLE it_temp_fondo LINES w_lines.
w_count = 1.
DO.
IF w_count LE w_lines.
READ TABLE it_temp_fondo INTO wa_temp_fondo INDEX w_count.
IF sy-subrc = 0.
CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
EXPORTING
i_object_id = wa_temp_fondo-zzpono
IMPORTING
e_header = wa_header1.
wa_fondo-zzpono = wa_temp_fondo-zzpono.
wa_fondo-zzpodesc = wa_header1-description.
wa_fondo-zzpodate = wa_header1-posting_date.
wa_fondo-zzexpdate = wa_header1-zzfondo_dat.
wa_fondo-zzpoval = wa_header1-total_value.
wa_fondo-zzpocur = wa_header1-currency.
wa_fondo-zzpocreator = wa_header1-created_by.
CLEAR : wa_address.
REFRESH wa_return.
CALL FUNCTION 'BAPI_USER_GET_DETAIL'
EXPORTING
username = wa_header1-created_by
IMPORTING
address = wa_address
TABLES
return = wa_return.
CLEAR wa_fondo-zzpocreator.
CONCATENATE wa_address-firstname ' ' wa_address-lastname INTO wa_fondo-zzpocreator .
w_count = w_count + 1.
APPEND wa_fondo TO it_fondo.
ENDIF.
ELSE.
EXIT.
ENDIF.
ENDDO.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_structure_name = 'ZSR_FONDO'
i_grid_title = 'EXPIRING FONDOS'
TABLES
t_outtab = it_fondo[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
ENDFORM. " DISPLAY_EXPIRING_FONDOS
Now in my ALV grid o/p i can see the check box but if i select one row and then try to select another the first one gets deselected.
Can anybody tell me what is missing?Hi,
Try like changing this
insted of
g_layout-f2code = ' '.
use this
g_layout-f2code = 'DISP'. " Sets fcode for when double
and
g_layout-f2code = '&ETA'. " it will display POPUP screen
Best Regards
Ranga
Edited by: Ranga Swamy on Nov 1, 2008 11:07 PM
Edited by: Ranga Swamy on Nov 1, 2008 11:17 PM -
Calling a procedure from within a trigger
Hi,
I have a table (table1) which when a row is inserted into this table I need to populate a number of tables based upon gathering information from multiple tables using three fields passed in from table 1.
I therefore proposed to create a before insert trigger on table1 calling a procedure which passes in the three new values as follows:
CREATE OR REPLACE TRIGGER trigger1
BEFORE INSERT ON table1
FOR EACH ROW
BEGIN
package1.populate_tables(:new.col1, :new.col2, :new.col3) ;
END;
This compiles fine, but when I actually insert data in table1 then I receive the following message and do not know how to get round it:
ORA-04091: table table1 is mutating, trigger/function may not see it.
I am using other fields in table1 to insert values into other tables (confusing I know).
If anyone can help me I would appreciate it, or if you require any more information I would be very happy to provide it.
Thanks in advance.Hi,
You triggered in fired on table and you procedure in acting is on the same table which rasing the exception.
Go throw this link you will understand
http://asktom.oracle.com/tkyte/Mutate/
- Pavan Kumar N -
Two ALV Grid in the same screeen
Hi,
I have created a module pool with a screen.
In this screen I have defined two customer objects and I dipslay two different ALV grid.
DATA: grid_1 TYPE REF TO cl_gui_alv_grid,
grid_2 TYPE REF TO cl_gui_alv_grid.
When the user puts the values into the field in both lists and pushes "enter", the program gets the input value by method
"get_selected_rows". It works only for the list where there is the cursor.
I need to read the value of each list at the same moment.
Thanks in advance
Marco*& Report Z7CC_ALV_OOPS_TWO_ALV_SCREENS *
report z7cc_alv_oops_two_alv_screens .
* TEMP DECLARATION TYPE DECLARATIONS
* Structure for Sales Order
types: begin of y_vbak ,
vbeln type vbeln_va ,
end of y_vbak ,
* Structure for Sales Order Details.
begin of y_vbap ,
vbeln type vbeln_va ,
posnr type posnr_va ,
matnr type matnr ,
charg type charg_d ,
arktx type arktx ,
end of y_vbap ,
*& Structure of line item ----------
begin of y_po_item,
ebeln type ekko-ebeln, " PO NUMBER
ebelp type ekpo-ebelp, "LINE ITEM
matnr like ekpo-matnr, " Material Number
netpr like ekpo-netpr, " Price per unit.
menge like ekpo-menge, " Purchase order quantity.
netwr like ekpo-netwr, " Net order in Purchase order currency
meins like ekpo-meins, " UOM
end of y_po_item.
data: t_y_po_item type standard table of y_po_item.
data: w_container_1 type ref to cl_gui_container .
data: t_vbap type standard table of y_vbap.
*--------- END OF TEMP DECLARATION ------------
data: ok_code like sy-ucomm.
*-- Global data definitions for ALV
*--- ALV Grid instance reference
data gr_alvgrid type ref to cl_gui_alv_grid .
*--- Name of the custom control added on the screen
data gc_custom_control_name type scrfname value 'Z7CC_ALV2' .
*--- Custom container instance reference
data gr_ccontainer type ref to cl_gui_custom_container .
*--- Field catalog table
data gt_fieldcat type lvc_t_fcat .
data gt_fieldcat_2 type lvc_t_fcat .
*--- Layout structure
data gs_layout type lvc_s_layo .
*&------- DECLARATION FOR THE NEXT SCREEN ------------------
*--- ALV Grid instance reference
data gr_alvgrid_2 type ref to cl_gui_alv_grid .
*--- Name of the custom control added on the screen-----------
data gc_custom_control_name_2 type scrfname value 'Z7CC_ALV' .
*--- Custom container instance reference
data gr_ccontainer_2 type ref to cl_gui_custom_container .
*Declare your internal table which is supposed to hold the list data.
*&Lets name it gt_list.
*Here is an example declaration.
*--- Internal table holding list data
data begin of gt_list occurs 0.
data matnr like mara-matnr.
data maktx like makt-maktx.
data end of gt_list .
data: begin of gt_list_2 occurs 0.
include structure z7cc_po_header.
data: linecolor(4) type c, "Color for corresponding line
end of gt_list_2.
data: t_gt_list_2 type standard table of z7cc_po_header.
*----- CLASS DECLARATION ------
* FIELD-SYMBOLS
field-symbols <fs_vbap> type y_vbap.
field-symbols <fs_gt_list_2> type z7cc_po_header.
class lcl_event_receiver definition deferred.
data w_event_receiver type ref to lcl_event_receiver.
* Creating a class definition for handling events on the ALV Grid.
class lcl_event_receiver definition.
public section.
methods: handle_top_of_page for event top_of_page
of cl_gui_alv_grid
importing e_dyndoc_id,
handle_hotspot_click for event hotspot_click
of cl_gui_alv_grid
importing e_row_id,
handle_toolbar_event for event toolbar
of cl_gui_alv_grid
importing e_object,
handle_user_command for event user_command
of cl_gui_alv_grid
importing e_ucomm.
endclass. "lcl_event_receiver DEFINATION
* Implementing the Class for handling events on the ALV Grid.
class lcl_event_receiver implementation.
method handle_top_of_page.
perform show_top_of_page using e_dyndoc_id w_container_1.
endmethod. "handle_top_of_page
method handle_hotspot_click.
perform show_hotspot_click_details using e_row_id.
endmethod. "lcl_event_receiver
method handle_toolbar_event.
perform create_alv_toolbar using e_object.
endmethod. "handle_toolbar_event
method handle_user_command.
perform handle_user_command using e_ucomm.
endmethod. "handle_user_command
endclass. "lcl_event_receiver IMPLEMENTATION
data: w_grid type ref to cl_gui_alv_grid .
*-------- END OF CLASS DECLARATION -------------
start-of-selection.
perform populate_table.
call screen 100.
*& Module STATUS_0100 OUTPUT
* text
module status_0100 output.
set pf-status 'Z7CC_ALV1'.
* SET TITLEBAR 'xxx'.
endmodule. " STATUS_0100 OUTPUT
*& Module DISPLAY_ALV OUTPUT
* text
module display_alv output.
perform display_alv.
endmodule. " DISPLAY_ALV OUTPUT
*& Form POPULATE_TABLE
* text
* --> p1 text
* <-- p2 text
form populate_table .
select ebeln ebelp matnr netpr menge netwr meins into corresponding fields of table t_y_po_item
from ekpo.
select ekko~ebeln ekko~bukrs ekko~aedat ekko~ernam
ekko~lifnr ekko~zterm ekko~angnr into corresponding fields of
table t_gt_list_2 from ekko .
endform. " POPULATE_TABLE
*& Form DISPLAY_ALV
* text
* --> p1 text
* <-- p2 text
form display_alv .
if gr_alvgrid is initial .
perform create_first_obj_container.
*&----------- ONE MORE CONTROL ON THE SCREEN-------------------
perform create_second_obj_container.
" DISPLAY_ALV
* Creating ALV Grid instance
perform create_first_alvgrid.
perform create_second_alvgrid.
* PERFORM FIELD_CATALOG. " CREATE A FIELD CATALOG.
perform field_cat changing gt_fieldcat.
perform field_cat_1 changing gt_fieldcat_2.
*----Here will be additional preparations
*--e.g. initial sorting criteria, initial filtering criteria, excluding
*--functions
perform call_mthd_display_both_grid.
*&--------- create a field catalog.------------
perform event_handling.
else.
*&-----------CALL ALV GRID REFRESH TABLE DISPLAY
perform call_mthd_alv_refresh.
endif.
endform. "DISPLAY_ALV
*& Module USER_COMMAND_0100 INPUT
* text
module user_command_0100 input.
endmodule. " USER_COMMAND_0100 INPUT
*& Form EXIT_PROGRAM
* text
* --> p1 text
* <-- p2 text
form exit_program .
leave program.
endform. " EXIT_PROGRAM
*& Module PAI INPUT
* text
module pai input.
case ok_code.
when '&EXT'.
perform exit_program.
when others.
* do nothing
endcase.
clear ok_code.
endmodule. " PAI INPUT
*& Form CREATE_FIRST_OBJ_CONTAINER
* text
* --> p1 text
* <-- p2 text
form create_first_obj_container .
create object gr_ccontainer
exporting
container_name = gc_custom_control_name
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " CREATE_FIRST_OBJ_CONTAINER
*&---------------------------------------- -
To connect a datablock to a query - stored procedure: problem
I have the following table...
CREATE TABLE I_TIPOLOGIA (
CODICE NUMBER(6),
DESCRIZIONE VARCHAR2(100),
CONSTRAINT I_TIPOLOGIA_PK PRIMARY KEY (CODICE) );
and the following package to connect a datablock to
previous table with a stored procedure...
CREATE or REPLACE PACKAGE DATABANKER_TIPOLOGIE AS
TYPE TipTableOfRec IS TABLE OF I_TIPOLOGIA%ROWTYPE;
PROCEDURE leggi(resultset IN OUT TipTableOfRec);
END DATABANKER_TIPOLOGIE;
CREATE or REPLACE PACKAGE BODY DATABANKER_TIPOLOGIE AS
PROCEDURE leggi(resultset IN OUT TipTableOfRec) AS
BEGIN
SELECT * BULK COLLECT INTO resultset
FROM I_TIPOLOGIA;
END leggi;
END DATABANKER_TIPOLOGIE;
When I compile the form I receive in QUERY-PROCEDURE trigger
en error 306: "number or type of arguments are wrong in POPULATE_BLOCK"
I post the trigger auto generated by Forms Builder 6i...
DECLARE
bk_data DATABANKER_TIPOLOGIE.TIPTABLEOFREC;
BEGIN
DATABANKER_TIPOLOGIE.leggi3(bk_data);
PLSQL_TABLE.POPULATE_BLOCK(bk_data, 'BLOCCO50'); -- <- error here
END;
How can I solve this problem? Maybe there is a bug?
P.S. I'm using Oracle Database 9iCREATE or REPLACE PACKAGE DATABANKER_TIPOLOGIE AS
TYPE TipTableOfRec IS TABLE OF I_TIPOLOGIA%ROWTYPE;
PROCEDURE leggi(resultset IN OUT TipTableOfRec);
END DATABANKER_TIPOLOGIE;I have solved with this replacement 1) -> 2)
1) TYPE TipTableOfRec IS TABLE OF I_TIPOLOGIA%ROWTYPE;
2) TYPE TipTableOfRec IS TABLE OF I_TIPOLOGIA%ROWTYPE
INDEX BY BINARY_INTEGER;
with 2) now works.
Now I have stored-procedures for query, insert, delete
and update.
I have some problems with delete and update of the records
because it seems that they are locked.
I think that it is due to the absence of lock
stored-procedure... there's someone that can help me with
the lock SP implementation? -
Sqlerrm in an insert statement
From the code segment below I am getting the following error..
Error(44,78): PL/SQL: ORA-00984: column not allowed here
exception
when no_data_found then
null;
when others then
insert into messages values(to_char(sysdate, 'hh24:mi:ss, DD-Month-YYYY'), sqlerrm);
end populate_tables;When i replace SQLERRM with a varchar2 variable it runs with no error, just wondering what it is I am doing wrong.
GusUse SQLERRM as shown in the example below:
SQL> begin
2 insert into t values(sqlerrm);
3 end;
4 /
insert into t values(sqlerrm);
ERROR at line 2:
ORA-06550: line 2, column 22:
PL/SQL: ORA-00984: column not allowed here
ORA-06550: line 2, column 1:
PL/SQL: SQL Statement ignored
SQL> declare
2 l_err varchar2(500);
3 begin
4 l_err := sqlerrm;
5 insert into t values(l_err);
6 end;
7 /
PL/SQL procedure successfully completed.Mike was quick at it ;)
Message was edited by:
Citrus -
Help: using a stored procedure to insert a record in DB
A stored procedure:
PROCEDURE db_insert
db_block IN OUT plsql_table)
is created in DB.
db_select and db_update are created too. They both work fine as
db_select is called by go_block execute_query (block populated) and
db_update is called by commit (DB updated);
I am trying to have db_insert called as:
1. DO_KEY('Create_Record');
2. fill in fields and then
3. commit.
These 3 steps do not cause the call of the auto generated block trigger insert_procedure. I think that after filling in the fields and there should be a way to call this insert_procedure trigger. I am not sure how this will work.
Any suggestions are greatly appreciated.I went through quite a deep search and yet not found any good answers. Knowing that select and update all done well with execute_query(stored procedure is called) and commit(stored procedure is called), but not insert.
Logically there must be some FORM build in that will trigger the call of stored procedure insert.
I am still looking for answers and just to remind that there are quite number of similar posts and I do not think that any clear answers were delivered.
Please help. -
Hi All,
I am using Oracle 8i. I have created a dynamic PL/SQL table in my procedure. Now i need to select rows and sort the data in that PL/SQL table. How do i do it? I
I appreciate any help on this.
Thanks,
VijiSQL> select count(1) from emp;
COUNT(1)
14
SQL> create or replace type emp_row is OBJECT
2 (
3 EMPNO NUMBER(4),
4 ENAME VARCHAR2(10),
5 JOB VARCHAR2(9),
6 MGR NUMBER(4),
7 HIREDATE DATE,
8 SAL NUMBER(7,2),
9 COMM NUMBER(7,2),
10 DEPTNO NUMBER(2)
11* )
SQL> /
Type created.
SQL> set serveroutput on
SQL> declare type emp_table is table of emp_row index by binary_integer;
2 plsql_tab emp_table;
3 rec_num number;
4 begin
5 select emp_row(EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO)
6 BULK COLLECT into plsql_tab
7 from scott.emp;
8 select count(1) into rec_num
9 from scott.emp;
10 DBMS_OUTPUT.PUT_LINE(rec_num||' records in SCOTT.EMP');
11 DBMS_OUTPUT.PUT_LINE(plsql_tab.count||' records in plsql_table');
12 end;
13 /
14 records in SCOTT.EMP
14 records in plsql_table
PL/SQL procedure successfully completed.
Maybe you are looking for
-
Back end and front end rebates from manufacturers
Good <Time_Of_Day> dear B1Pros, I have a good one for you I hope. We are getting ready to deploy our manufacturing and VAR portion of the business into B1, we ran into this. We sometimes get rebates from the manufacturers or providers, for say educat
-
Error 9 pops up when trying to restore Ipod 5. The problem seems to be that my ipod disconnects during the restore process. My ipod is stuck in restore mode so I can't access its update serever. I have already updated my pc and its security settings.
-
FM : DATE_TO_PERIOD_CONVERT
Hi, In the FM DATE_TO_PERIOD_CONVERT What is 'I_PERIV' represents Thanks
-
Volume keys in combination with external soundcard; How?
Hi folks, I recently bought a new MBP alongside a Focusrite Saffire 6 USB external soundcard, and an Apple wireless keyboard. As of now, if i want to adjust the volume of the music I'm playing I have to turn the knob on my Focusrite Soundcard, since
-
Hi I am not able to find Interactive View Mode for WEBI in BI LaunchPad's Preferences. It used to be there for BOXI R3. Is this feature has been revoked by SAP in this new release. Please confirm and clarify. Thanks!!