POPULATE_TABLE
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
DG
Using 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.
Similar Messages
-
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 -
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.
-
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
*&---------------------------------------- -
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 -
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.
-
ABAP - Editable report using Excel view
hi friends
In my report i am using REUSE_ALV_GRID_DISPLAY
Function module to display the data in alv format. I am using the view in
Excel format.
My requirement is,
If i change the data in the
excel sheet that should reflect in the internal table.
I am able to do changes, but the data is not getting change in the internal
table.
The purpose of this is, the output of this report will be the
input of another program after changing the output in excel(only, bcoz in
excel they will change using some formulas).
Note:
I am
getting the changes to internal table if i use grid display not in excel
format.
Can anyone suggest me how to solve this problem?Hi u can esily do this using Object oriented ALVs. Heres the code :
*& ALV using objects : ADD, MODIFY RECORDS
Data Declaration
DATA : ITAB1 TYPE TABLE OF SFLIGHT,
G_CUST1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
G_GRID1 TYPE REF TO CL_GUI_ALV_GRID,
LT_FCAT1 TYPE LVC_T_FCAT,
LS_FCAT TYPE LVC_S_FCAT.
Start of selection
START-OF-SELECTION.
PERFORM POPULATE_TABLE.
END-OF-SELECTION.
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
PBO module
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'ZSAB1'.
SET TITLEBAR 'xxx'.
IF G_CUST1 IS INITIAL.
CREATE OBJECT G_CUST1
EXPORTING
CONTAINER_NAME = 'CC1'.
CREATE OBJECT G_GRID1
EXPORTING
I_PARENT = G_CUST1.
ENDIF.
PERFORM FCAT_SFLIGHT.
to display the ALV Grid
CALL METHOD G_GRID1->SET_TABLE_FOR_FIRST_DISPLAY
CHANGING
IT_OUTTAB = ITAB1
IT_FIELDCATALOG = LT_FCAT1.
transfering the grid from display mode to editable mode
CALL METHOD G_GRID1->SET_READY_FOR_INPUT
EXPORTING
I_READY_FOR_INPUT = 1.
ENDMODULE. " STATUS_0100 OUTPUT
*& Form fcat_sflight
Filling Field Catalog
FORM FCAT_SFLIGHT.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_STRUCTURE_NAME = 'SFLIGHT'
I_CLIENT_NEVER_DISPLAY = 'X'
I_BYPASSING_BUFFER = 'X'
CHANGING
CT_FIELDCAT = LT_FCAT1.
LOOP AT LT_FCAT1 INTO LS_FCAT.
IF LS_FCAT-FIELDNAME EQ 'PRICE'
OR LS_FCAT-FIELDNAME EQ 'PLANETYPE'
OR LS_FCAT-FIELDNAME EQ 'FLDATE'.
LS_FCAT-EDIT = 'X'.
LS_FCAT-CHECKTABLE = '!'. "do not check foreign key relations
MODIFY LT_FCAT1 FROM LS_FCAT.
ENDIF.
ENDLOOP.
ENDFORM. " fcat_sflight
*& Module USER_COMMAND_0100 INPUT
PAI module
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'SAVE'.
PERFORM SAVE_DATA.
WHEN 'LEAV' OR 'CANC' OR 'BACK'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. "USER_COMMAND_0100 INPUT
*& Form save_data
checking the changed or added data is consistent
FORM SAVE_DATA.
DATA: L_VALID TYPE C.
CALL METHOD G_GRID1->CHECK_CHANGED_DATA
IMPORTING
E_VALID = L_VALID.
IF L_VALID IS NOT INITIAL.
PERFORM UPDATE_DATABASE.
MESSAGE S000(0K) WITH TEXT-S01.
ENDIF.
ENDFORM. "save_data
*& Form update_database
Update records to DB table
FORM UPDATE_DATABASE.
DATA: LS_SFLIGHT TYPE SFLIGHT,
LS_OUTTAB LIKE LINE OF ITAB1,
LT_INSTAB TYPE TABLE OF SFLIGHT.
LOOP AT ITAB1 INTO LS_OUTTAB.
MOVE-CORRESPONDING LS_OUTTAB TO LS_SFLIGHT.
APPEND LS_SFLIGHT TO LT_INSTAB.
ENDLOOP.
MODIFY SFLIGHT FROM TABLE LT_INSTAB.
ENDFORM. "update_database
*& Form POPULATE_TABLE
POPULATE TABLE I_KNA1
FORM POPULATE_TABLE .
SELECT * FROM SFLIGHT INTO TABLE ITAB1.
ENDFORM. " POPULATE_TABLE -
How to Use mulitple fieldcatlogs in ALV.
Hello Abapers,
I need to display my output in the given format.
LOCAL CUSTOMER STATEMENT
Customer Code : 11111
Customer : ABC
Include Paid invoices :Y
Date||MTK Ref||SAP Inv No||Payment Doc No||Payment Date||Dr||Cr||Payment
Ageing :
0-30 days 31-60 days 61-90 days 91-120 days> 120 days Total
61,550.00 231,825.000 293,375.000
For this,how can i achieve this format by using ALV.
Waiting for your favourable replies
Regards
Maruthi+Hi Maruthi,
I think you need to use the split screen to display multiple alv on the same screen.
Please see below for the demo program for the multiple alv on the single screen.
For any more queries feel free to contact me.+
Cheers,
Chidanand.
*& 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
*& Form CREATE_SECOND_OBJ_CONTAINER
* text
* --> p1 text
* <-- p2 text
FORM create_second_obj_container .
CREATE OBJECT gr_ccontainer_2
EXPORTING
container_name = gc_custom_control_name_2
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_SECOND_OBJ_CONTAINER
*& Form CREATE_FIRST_ALVGRID
* text
* --> p1 text
* <-- p2 text
FORM create_first_alvgrid .
CREATE OBJECT gr_alvgrid
EXPORTING
i_parent = gr_ccontainer
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_ALVGRID
*& Form CREATE_SECOND_ALVGRID
* text
* --> p1 text
* <-- p2 text
FORM create_second_alvgrid .
* Creating ALV Grid instance
CREATE OBJECT gr_alvgrid_2
EXPORTING
i_parent = gr_ccontainer_2
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_SECOND_ALVGRID
*& Form CALL_MTHD_DISPLAY_BOTH_GRID
* text
* --> p1 text
* <-- p2 text
FORM call_mthd_display_both_grid .
CALL METHOD gr_alvgrid->set_table_for_first_display
EXPORTING
i_structure_name = 'Y_PO_ITEM'
CHANGING
it_outtab = t_y_po_item[]
it_fieldcatalog = gt_fieldcat.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD gr_alvgrid_2->set_table_for_first_display
EXPORTING
i_structure_name = 'Z7CC_PO_HEADER'
CHANGING
it_outtab = t_gt_list_2[]
it_fieldcatalog = gt_fieldcat_2.
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. " CALL_MTHD_DISPLAY_BOTH_GRID
*& Form CALL_MTHD_ALV_REFRESH
* text
* --> p1 text
* <-- p2 text
FORM call_mthd_alv_refresh .
CALL METHOD gr_alvgrid->refresh_table_display
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD gr_alvgrid_2->refresh_table_display
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. " CALL_MTHD_ALV_REFRESH
*& Form FIELD_CATALOG
* text
* --> p1 text
* <-- p2 text
*FORM field_catalog .
* FIELD-SYMBOLS <l_fieldcat> TYPE lvc_s_fcat.
* CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
* EXPORTING
** I_BUFFER_ACTIVE =
* i_structure_name = 'Y_PO_ITEM'
** I_CLIENT_NEVER_DISPLAY = 'X'
** I_BYPASSING_BUFFER =
** I_INTERNAL_TABNAME =
* CHANGING
* ct_fieldcat = gt_fieldcat[]
** EXCEPTIONS
** INCONSISTENT_INTERFACE = 1
** PROGRAM_ERROR = 2
** OTHERS = 3
* IF sy-subrc <> 0.
** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
** WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
* ELSE.
** Assigining hotspot to certain columns on the report.
* LOOP AT gt_fieldcat ASSIGNING <l_fieldcat>.
* CASE <l_fieldcat>-fieldname.
* WHEN 'EBELN'.
* <l_fieldcat>-hotspot = 'X'.
* WHEN 'BUKRS'.
* <l_fieldcat>-edit = 'X'.
* ENDCASE.
* ENDLOOP.
* ENDIF.
*ENDFORM. " FIELD_CATALOG
*& Form FIELD_CAT
* text
* <--P_GT_FIELDCAT text
FORM field_cat CHANGING p_gt_fieldcat TYPE lvc_t_fcat.
DATA ls_fcat TYPE lvc_s_fcat .
ls_fcat-fieldname = 'EBELN' .
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '20' .
ls_fcat-hotspot = 'X'.
ls_fcat-coltext = 'PO Number' .
ls_fcat-seltext = 'PO Number' .
APPEND ls_fcat TO p_gt_fieldcat .
CLEAR ls_fcat .
ls_fcat-fieldname = 'EBELP' .
* ls_fcat-ref_table = 'Z7CC_PO_HEADER' .
ls_fcat-ref_table = 'EBELP' .
ls_fcat-outputlen = '10' .
ls_fcat-coltext = 'LINE ITEMS' .
ls_fcat-seltext = 'LINE ITEMS'.
APPEND ls_fcat TO p_gt_fieldcat .
ls_fcat-fieldname = 'MATNR' .
ls_fcat-ref_table = 'MATNR' .
ls_fcat-outputlen = '18' .
ls_fcat-coltext = 'MATERIAL NUMBER' .
ls_fcat-seltext = 'MATERIAL NUMBER'.
APPEND ls_fcat TO p_gt_fieldcat .
ls_fcat-fieldname = 'NETPR' .
ls_fcat-ref_table = 'NETPR' .
ls_fcat-outputlen = '10' .
ls_fcat-coltext = 'PRICE / UNIT' .
ls_fcat-seltext = 'PRICE / UNIT'.
APPEND ls_fcat TO p_gt_fieldcat .
ls_fcat-fieldname = 'MENGE' .
ls_fcat-ref_table = 'MENGE' .
ls_fcat-outputlen = '10' .
ls_fcat-coltext = 'QUANTITY' .
ls_fcat-seltext = 'QUANTITY'.
APPEND ls_fcat TO p_gt_fieldcat .
ls_fcat-fieldname = 'NETWR' .
ls_fcat-ref_table = 'NETWR' .
ls_fcat-outputlen = '10' .
ls_fcat-coltext = 'NET ORDER' .
ls_fcat-seltext = 'NET ORDER'.
APPEND ls_fcat TO p_gt_fieldcat .
ls_fcat-fieldname = 'MEINS' .
ls_fcat-ref_table = 'MEINS' .
ls_fcat-outputlen = '10' .
ls_fcat-coltext = 'UOM' .
ls_fcat-seltext = 'UOM'.
APPEND ls_fcat TO p_gt_fieldcat .
ENDFORM. " FIELD_CAT
*&------------DECLAREATION OF THE SUBROUTINES OF CLASS -----------------
*& Form show_top_of_page
* text
* -->P_E_DYNDOC_ID text
* -->P_W_CONTAINER_1 text
FORM show_top_of_page USING p_e_dyndoc_id
p_w_container_1.
WRITE:/.
ENDFORM. " show_top_of_page
*& Form show_hotspot_click_details
* text
* -->P_E_ROW_ID text
FORM show_hotspot_click_details USING p_e_row_id.
READ TABLE t_gt_list_2 ASSIGNING <fs_gt_list_2> INDEX p_e_row_id.
DATA: v_ebeln LIKE z7cc_po_header-ebeln.
v_ebeln = <fs_gt_list_2>-ebeln.
REFRESH t_y_po_item.
SELECT ebeln ebelp matnr netpr menge netwr meins INTO CORRESPONDING FIELDS OF TABLE t_y_po_item
FROM ekpo WHERE ebeln = v_ebeln.
CALL METHOD gr_alvgrid->refresh_table_display
EXPORTING
i_soft_refresh = 'X'.
* SET PARAMETER ID 'AUN' FIELD <fs_vbap>-vbeln.
* CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
ENDFORM. " show_hotspot_click_details
*& Form create_alv_toolbar
* text
* -->P_E_OBJECT text
FORM create_alv_toolbar USING p_e_object.
WRITE:/.
ENDFORM. " create_alv_toolbar
*& Form EVENT_HANDLING
* text
* --> p1 text
* <-- p2 text
FORM event_handling .
* * Create a object for event receiver.
CREATE OBJECT w_event_receiver.
SET HANDLER : w_event_receiver->handle_hotspot_click FOR gr_alvgrid_2.
SET HANDLER : w_event_receiver->handle_top_of_page FOR gr_alvgrid_2.
SET HANDLER : w_event_receiver->handle_toolbar_event FOR gr_alvgrid_2.
SET HANDLER : w_event_receiver->handle_user_command FOR gr_alvgrid_2.
ENDFORM. " EVENT_HANDLING
*& Form handle_user_command
* Description :
* Handling user actions performed on the ALV grid.
FORM handle_user_command USING p_e_ucomm TYPE sy-ucomm.
DATA : wal_et_row_no TYPE lvc_t_roid ,
wal_selected_row TYPE lvc_s_roid .
FIELD-SYMBOLS <l_selected_row> TYPE lvc_s_roid .
* Get the row number selected by the user on the screen.
CALL METHOD w_grid->get_selected_rows
IMPORTING
et_row_no = wal_et_row_no.
ENDFORM. " handle_user_command
*& Form FIELD_CAT_1
* text
* <--P_GT_FIELDCAT text
FORM field_cat_1 CHANGING p_gt_fieldcat_2 TYPE lvc_t_fcat.
DATA ls_fcat TYPE lvc_s_fcat .
ls_fcat-fieldname = 'EBELN' .
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '20' .
ls_fcat-hotspot = 'X'.
ls_fcat-coltext = 'PO Number' .
ls_fcat-seltext = 'PO Number' .
APPEND ls_fcat TO p_gt_fieldcat_2 .
CLEAR ls_fcat .
ls_fcat-fieldname = 'EBELP' .
* ls_fcat-ref_table = 'Z7CC_PO_HEADER' .
ls_fcat-ref_table = 'BUKRS' .
ls_fcat-outputlen = '10' .
ls_fcat-coltext = 'COMPANY CODE' .
ls_fcat-seltext = 'COMPANY CODE'.
APPEND ls_fcat TO p_gt_fieldcat_2 .
ls_fcat-fieldname = 'AEDAT' .
ls_fcat-ref_table = 'AEDAT' .
ls_fcat-outputlen = '18' .
ls_fcat-coltext = 'CREATION DATE' .
ls_fcat-seltext = 'CREATION DATE'.
APPEND ls_fcat TO p_gt_fieldcat_2 .
ls_fcat-fieldname = 'ERNAM' .
ls_fcat-ref_table = 'ERNAM' .
ls_fcat-outputlen = '10' .
ls_fcat-coltext = 'NAME OF PERSON' .
ls_fcat-seltext = 'NAME OF PERSON'.
APPEND ls_fcat TO p_gt_fieldcat_2 .
ls_fcat-fieldname = 'ZTERM' .
ls_fcat-ref_table = 'ZTERM' .
ls_fcat-outputlen = '10' .
ls_fcat-coltext = 'TERMS OF PAYMENT' .
ls_fcat-seltext = 'QUANTITY'.
APPEND ls_fcat TO p_gt_fieldcat_2 .
ls_fcat-fieldname = 'ANGNR' .
ls_fcat-ref_table = 'ANGNR' .
ls_fcat-outputlen = '10' .
ls_fcat-coltext = 'QUOTATION NO' .
ls_fcat-seltext = 'QUOTATION NO'.
APPEND ls_fcat TO p_gt_fieldcat_2 .
ENDFORM. " FIELD_CAT_1 -
Less Trip to Database through Package(Discarded thread repeat twice)
Hi Freineds,
I want to improve performance of my forms(10g rel2).
I have created one package in database and call it in forms.
Just check it:-
Package Creation in Database--
CREATE OR REPLACE PACKAGE TEST
IS
TYPE tic_rec IS RECORD(
vc_job_ticket_no hd_job_ticket.vc_job_ticket_no%TYPE,
dt_job_ticket_date hd_job_ticket.dt_job_ticket_date%TYPE,
ch_stat_flag hd_job_ticket.ch_stat_flag%TYPE
TYPE tic_cursor IS REF CURSOR RETURN tic_rec;
PROCEDURE Populate_tic ( comp_code in varchar2,from_date in date,to_date in date,tic_data in out tic_cursor ) ;
END TEST ;
CREATE OR REPLACE PACKAGE BODY TEST
IS
PROCEDURE Populate_tic ( comp_code in varchar2,from_date in date,to_date in date,tic_data in out tic_cursor )
Is
Begin
OPEN tic_data FOR SELECT vc_job_ticket_no,dt_job_ticket_date,ch_stat_flag
FROM hd_job_ticket
where vc_comp_code=comp_code
and dt_job_ticket_date between from_date and to_date
ORDER BY dt_job_ticket_date;
End Populate_tic ;
END TEST ;
/Now calling this procedure in Oracle Forms(when button pressed):--
declare
cur TEST.tic_cursor ;
rec TEST.tic_rec ;
begin
TEST.Populate_tic(:global.vc_comp_code,:blk_ctl.f_date,:blk_ctl.t_date,cur ) ;
go_block('b1');
clear_block;
loop
fetch cur into rec ;
exit when cur%notfound ;
:b1.vc_job_ticket_no:=rec.vc_job_ticket_no;
:b1.dt_job_ticket_date:=rec.dt_job_ticket_date;
:b1.ch_stat_flag:=rec.ch_stat_flag;
next_record;
end loop ;
end ; Everythin working fine upto here but
I have to use some other table(9-10 tables) on the basis of column(ch_stat_flag) value.
i.e.
if ch_stat_flag='D' then
will use Design tables
elsif ch_stat_flag='P' then
will use press table
elsif
end if;My Worry is if i use this calling in forms it means if i have 10000 of records from Populate_tic so my call to different tables would be 10000 times.
Means my forms call database 10000 times.
can't it possible at database level too.
Hope u understand it.
Regards
KarTiK PareeK.
Edited by: KarTiK on May 29, 2010 6:09 PMApparently you were to f... lazy to look up BULK COLLECT in the online documentation at http://tahiti.oracle.com
That is why you reposted the very reqiuest: you want to be spoon fed, and you don't want to anything yourself.
To use the well known question of people from your locale:
What is reason?
Rest assured I have you blacklisted now. I don't want to help people who don't want to learn to fish, but who want to cheat themselves out, earning as much money as possible, doing as less as possible.
The result of this is your current 'application' is already fully out of control.
Sybrand Bakker
Senior Oracle DBA -
Less Trip to Database through Package
Hi Freineds,
I want to improve performance of my forms(10g rel2).
I have created one package in database and call it in forms.
Just check it:-
Package Creation in Database--
CREATE OR REPLACE PACKAGE TEST
IS
TYPE tic_rec IS RECORD(
vc_job_ticket_no hd_job_ticket.vc_job_ticket_no%TYPE,
dt_job_ticket_date hd_job_ticket.dt_job_ticket_date%TYPE,
ch_stat_flag hd_job_ticket.ch_stat_flag%TYPE
TYPE tic_cursor IS REF CURSOR RETURN tic_rec;
PROCEDURE Populate_tic ( comp_code in varchar2,from_date in date,to_date in date,tic_data in out tic_cursor ) ;
END TEST ;
CREATE OR REPLACE PACKAGE BODY TEST
IS
PROCEDURE Populate_tic ( comp_code in varchar2,from_date in date,to_date in date,tic_data in out tic_cursor )
Is
Begin
OPEN tic_data FOR SELECT vc_job_ticket_no,dt_job_ticket_date,ch_stat_flag
FROM hd_job_ticket
where vc_comp_code=comp_code
and dt_job_ticket_date between from_date and to_date
ORDER BY dt_job_ticket_date;
End Populate_tic ;
END TEST ;
/Now calling this procedure in Oracle Forms(when button pressed):--
declare
cur TEST.tic_cursor ;
rec TEST.tic_rec ;
begin
TEST.Populate_tic(:global.vc_comp_code,:blk_ctl.f_date,:blk_ctl.t_date,cur ) ;
go_block('b1');
clear_block;
loop
fetch cur into rec ;
exit when cur%notfound ;
:b1.vc_job_ticket_no:=rec.vc_job_ticket_no;
:b1.dt_job_ticket_date:=rec.dt_job_ticket_date;
:b1.ch_stat_flag:=rec.ch_stat_flag;
next_record;
end loop ;
end ; Everythin working fine upto here but
I have to use some other table(9-10 tables) on the basis of column(ch_stat_flag) value.
i.e.
if ch_stat_flag='D' then
will use Design tables
elsif ch_stat_flag='P' then
will use press table
elsif
end if;My Worry is if i use this calling in forms it means if i have 10000 of records from Populate_tic so my call to different tables would be 10000 times.
Means my forms call database 10000 times.
can't it possible at database level too.
Hope u understand it.
Regards
KarTiK PareeK.Well, i don't think you improve performance by just putting the cursor-definition into a package.
I would guess that performance may even the worse, for you read the record one by one, whereas forms might optimize the query fetch size.
Regarding the lookup to another table... To improve performance or "reduce" network trips, read the lookup by inclduing the column in your query using a join. You could do so by either creating a view and base your forms-block on that view, or base your blcok on a "Query FROM clause" -
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, How to stop the open new view when i click button in OnClick event
Hi,
I have the popup window[window.showodelDialog] with one button called confirm.and table control values
Actual requirement: when i click confirm button it saves the tablecontrol value in the internal table. it is fine.It saves.
Currently working is : When i click the confirm button in the onClick event ,the new view is opening with empty tablecontrol popupin the new window.I don't want that one.
my requirement is: When i click the confirm button through onclick event ,i want to close the currently showing popupwindow and it should come to main page.How to do that?
view1.htm
=======
<htmlb:button id = "sub1"
onClick =""
text = "Confirm" />
Do_handle_data
============
LOOP AT lt_form_fields INTO lw_form_field WHERE name CS
't_confirm' .
CALL METHOD /ds1/cl_mdm_tablecontrol=>populate_table(
EXPORTING
im_id = 't_confirm'
im_request = me->request
CHANGING
ch_table = me->r_asset_data->t_maintain ).
EXIT.
ENDLOOP.
t_maintain it stores the changed values.. It is fine..Hi raja,
1.I have a main page like req_asset_create.htm. In this page one button called maintain. If i click the maintain button the popup window is opening using window.showModelDialog.
2. In this popup i have a Editable tableview and one button called confirm. User can edit the values. After editing he is clicking the confirm button.
3.when he click the confirm button two things should happen a)Popup should vanish and it should go to main page ie req_asset_create.htm.The editrd values should store in to the internal table (t_maintain).it is in model class.
What heppenings for me using this code
=============================
<%----
confirm -
--%>
<htmlb:button id = "con"
onClientClick = "self.close();"
text = "confirm"
onClick = "confirm"/>
When i click the confirm button ->popup is closing ->thats 100% fine and again one new view is coming with popupdisplay values.This should not happen.
a)The server event is not happening.It should happen.
b) The edited values are not stored in the internal table..
Do_handle_data : for storing the edited tableview values
===========
confirm
LOOP AT lt_form_fields INTO lw_form_field WHERE name CS
'con' .
CALL METHOD /ds1/cl_mdm_tablecontrol=>populate_table(
EXPORTING
im_id = 'tv1'
im_request = me->request
CHANGING
ch_table = me->r_asset_data->t_maintain ).
EXIT.
ENDLOOP.
What should i do to happen for the server event to update the edited records.
How can i achieve? ow to control the new opening view?
Maybe you are looking for
-
How do I change my @icloud e-mail address associated with my apple ID
My apple ID is not an @icloud address (it is @yahoo.com). Curretnly I have an @icloud e-mail address associated with this account. If I log onto icloud.com with my @yahoo Aplle ID, it will show the emails that I have received from my current @iclo
-
Does anyone know how to recover songs that itunes has "lost"? I downloaded them, synced my ipod, songs were added and I was able to play them. On a recent sync the songs are suddenly "not found" according to itunes. I can't locate them in the itunes
-
How to use thunderbolt to gigabit ethernet adapter
hi mates. i just purchase the Thunderbolt to Gigabit Ethernet Adapter last week for my Mac Book Pro Retina. but i have no idea how it work. i tried just plug in the adapter and the LAN cable in but no luck... Any idea how it works?
-
Hello Experts... i have a problem when using ACS 5.1 with AP1141 through EAP-TLS authentication method. when i try to connect my laptop , it's authenticated sucessfully , but when i try to authenticate third party Black Box using EAP-TLS , i have an
-
Why not passing only one XML String parameter to Axis Web Service interface
Hi, I am a newbie of axis and this is the first post in SUN site. I am writing a web service. I am considering this question after trying some examples in Axis: Why not defined parameters of our service interface (Service method.) as a XML String? -W