Data base trigger gone wild
Hello guys, i need your help, so whats going on is that i have builded a database trigger and it fires "before update".When im testing that trigger and try to update a certain field (in my case,the end_date) , the data base blocks and..it does nothing.
I put here an excert of the trigger
CREATE OR REPLACE TRIGGER APPS.JE_UBS_TAX_BANK_ACCOUNT_TRG
BEFORE UPDATE
OF START_DATE
,END_DATE
ON AP.AP_BANK_ACCOUNT_USES_ALL
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
tmpvar NUMBER;
n_org_id ubs.je_ubs_tax_pay_method.org_id%type :=null;
-- Declaração das variáveis de JE_UBS_TAX_PAY_METHOD
n_start_date ubs.je_ubs_tax_pay_method.start_date%type :=null;
n_end_date ubs.je_ubs_tax_pay_method.end_date%type :=null;
-- Cursor À JE_UBS_TAX_PAY_METHOD
cursor c_pay_methods is
SELECT start_date, end_date
FROM ubs.je_ubs_tax_pay_method
WHERE bank_account_id = :NEW.external_bank_account_id
AND org_id = n_org_id;
-- Declaração de Excepcoes
-- exception_general exception; -- Excepcao
BEGIN
apps.je_ubs_all_debug_api.insert_log ('Inicio do trigger' || SQLERRM, ' JE_UBS_TAX_BANK_ACCOUNT_TRG');
n_org_id := apps.fnd_profile.VALUE ('ORG_ID');
open c_pay_methods;
fetch c_pay_methods into n_start_date,
n_end_date;
loop
IF UPDATING (:old.end_date)
THEN
IF (n_end_date > :new.end_date)
THEN
BEGIN
UPDATE ubs.je_ubs_tax_pay_method
SET end_date = :NEW.end_date
WHERE bank_account_id = :new.external_bank_account_id
AND org_id = n_org_id;
EXCEPTION
WHEN OTHERS
THEN
apps.je_ubs_all_debug_api.insert_log ('Error at Update end_date of je_ubs_tax_pay_method' || SQLERRM, ' JE_UBS_TAX_BANK_ACCOUNT_TRG');
RAISE;
apps.je_ubs_all_debug_api.insert_log ('Updated end_date at je_ubs_tax_pay_method ' || SQLERRM, ' JE_UBS_TAX_BANK_ACCOUNT_TRG');
END;
END IF;
END IF;
I think the problem must be insuficient privilegies but im not sure. I saved the trigger at the "apps" schema,the trigger table is at the "ap" schema, and the cursor table is at another schema, the "ubs"
I didn´t saved the trigger at the same schema as the trigger table ("AP"), because i did not have priviliges.
Help me if you can.
eheh ! no guys, i just posted a little of the trigger. but ill post everything:
CREATE OR REPLACE TRIGGER APPS.JE_UBS_TAX_BANK_ACCOUNT_TRG
BEFORE UPDATE
OF START_DATE
,END_DATE
ON AP.AP_BANK_ACCOUNT_USES_ALL
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
NAME: JE_UBS_TAX_BANK_ACCOUNT_TRG
PURPOSE:
REVISIONS:
Ver Date Author Description
1.0 18-08-2008 José Fernandes 1. Created this trigger.
tmpvar NUMBER;
n_org_id ubs.je_ubs_tax_pay_method.org_id%type :=null;
-- Declaração das variáveis de JE_UBS_TAX_PAY_METHOD
n_start_date ubs.je_ubs_tax_pay_method.start_date%type :=null;
n_end_date ubs.je_ubs_tax_pay_method.end_date%type :=null;
-- Cursor À JE_UBS_TAX_PAY_METHOD
cursor c_pay_methods is
SELECT start_date, end_date
FROM ubs.je_ubs_tax_pay_method
WHERE bank_account_id = :NEW.external_bank_account_id
AND org_id = n_org_id;
-- Declaração de Excepcoes
-- exception_general exception; -- Excepcao
BEGIN
apps.je_ubs_all_debug_api.insert_log ('Inicio do trigger' || SQLERRM, ' JE_UBS_TAX_BANK_ACCOUNT_TRG');
n_org_id := apps.fnd_profile.VALUE ('ORG_ID');
open c_pay_methods;
fetch c_pay_methods into n_start_date,
n_end_date;
loop
IF UPDATING (:old.end_date)
THEN
IF (n_end_date > :new.end_date)
THEN
BEGIN
UPDATE ubs.je_ubs_tax_pay_method
SET end_date = :NEW.end_date
WHERE bank_account_id = :new.external_bank_account_id
AND org_id = n_org_id;
EXCEPTION
WHEN OTHERS
THEN
apps.je_ubs_all_debug_api.insert_log ('Error at Update end_date of je_ubs_tax_pay_method' || SQLERRM, ' JE_UBS_TAX_BANK_ACCOUNT_TRG');
RAISE;
apps.je_ubs_all_debug_api.insert_log ('Updated end_date at je_ubs_tax_pay_method ' || SQLERRM, ' JE_UBS_TAX_BANK_ACCOUNT_TRG');
END;
END IF;
END IF;
IF UPDATING (:old.start_date)
THEN
IF (n_start_date < :new.start_date)
THEN
BEGIN
UPDATE ubs.je_ubs_tax_pay_method
SET start_date = :new.start_date
WHERE bank_account_id = :new.external_bank_account_id
AND org_id = n_org_id;
EXCEPTION
WHEN OTHERS
THEN
apps.je_ubs_all_debug_api.insert_log ('Error at Update start_date of je_ubs_tax_pay_method ' || SQLERRM, ' JE_UBS_TAX_BANK_ACCOUNT_TRG');
RAISE;
apps.je_ubs_all_debug_api.insert_log ('Updated start_date of je_ubs_tax_pay_method ' || SQLERRM, ' JE_UBS_TAX_BANK_ACCOUNT_TRG');
END;
END IF;
END IF;
end loop;
apps.je_ubs_all_debug_api.insert_log ('Success - End of trigger ' || SQLERRM, ' JE_UBS_TAX_BANK_ACCOUNT_TRG');
EXCEPTION
WHEN OTHERS
THEN
apps.je_ubs_all_debug_api.insert_log ('Exception - When Others ' || SQLERRM, ' JE_UBS_TAX_BANK_ACCOUNT_TRG');
RAISE;
END je_ubs_tax_bank_account_trg;
***************************************************
Similar Messages
-
How to trigger pop-up window in report and update data base from report
Hi All,
I have a requirement, in a report output list to trigger a pop up window with some rejection codes corresponding to each sales order when i select from the output list. Also i need to update data base by selecting one of the rejection code in the pop-up window list for that sales order. Can any one please let me know how to achive this.
Also, i have check boxes for each record in the output list. Also, i have added one more check box as "Select All'. When select 'Sleect All' check box , all check boxes need to be checked, how to achieve this. PLease let me know.
Thanks in advance.
Regards,
RajeshHi check this code of editable ALV report... I updated the data base with the changes made..in the editable ALV
*& Report ZJAY_EDIT_ALV
REPORT zjay_edit_alv.
* TYPE-POOLS *
TYPE-POOLS: slis.
* INTERNAL TABLES/WORK AREAS/VARIABLES
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
w_field TYPE slis_fieldcat_alv,
p_table LIKE dd02l-tabname,
dy_table TYPE REF TO data,
dy_tab TYPE REF TO data,
dy_line TYPE REF TO data.
* FIELD-SYMBOLS *
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
<dyn_wa> TYPE ANY,
<dyn_field> TYPE ANY,
<dyn_tab_temp> TYPE STANDARD TABLE.
* SELECTION SCREEN *
PARAMETERS: tabname(30) TYPE c DEFAULT 'MARA',
lines(5) TYPE n DEFAULT 7.
* START-OF-SELECTION *
START-OF-SELECTION.
* Storing table name
p_table = tabname.
* Create internal table dynamically with the stucture of table name
* entered in the selection screen
CREATE DATA dy_table TYPE STANDARD TABLE OF (p_table).
ASSIGN dy_table->* TO <dyn_table>.
IF sy-subrc <> 0.
MESSAGE i000(z_zzz_ca_messages) WITH ' No table found'.
LEAVE TO LIST-PROCESSING.
ENDIF.
* Create workarea for the table
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
ASSIGN dy_line->* TO <dyn_wa>.
* Create another temp. table
CREATE DATA dy_tab TYPE STANDARD TABLE OF (p_table).
ASSIGN dy_tab->* TO <dyn_tab_temp>.
SORT i_fieldcat BY col_pos.
* Select data from table
SELECT * FROM (p_table)
INTO TABLE <dyn_table>
UP TO lines ROWS.
REFRESH <dyn_tab_temp>.
* Display report
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = p_table
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'SET_PF_STATUS'
TABLES
t_outtab = <dyn_table>
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
*& Form SET_PF_STATUS
* Setting custom PF-Status
* -->RT_EXTAB Excluding table
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZSTANDARD'. "copy it from SALV func group standard
ENDFORM. "SET_PF_STATUS
*& Form user_command
* Handling custom function codes
* -->R_UCOMM Function code value
* -->RS_SELFIELD Info. of cursor position in ALV
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
* Local data declaration
DATA: li_tab TYPE REF TO data,
l_line TYPE REF TO data.
* Local field-symbols
FIELD-SYMBOLS:<l_tab> TYPE table,
<l_wa> TYPE ANY.
* Create table
CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
ASSIGN li_tab->* TO <l_tab>.
* Create workarea
CREATE DATA l_line LIKE LINE OF <l_tab>.
ASSIGN l_line->* TO <l_wa>.
CASE r_ucomm.
* When a record is selected
WHEN '&IC1'.
* Read the selected record
READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX
rs_selfield-tabindex.
IF sy-subrc = 0.
* Store the record in an internal table
APPEND <dyn_wa> TO <l_tab>.
* Fetch the field catalog info
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_structure_name = p_table
CHANGING
ct_fieldcat = i_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc = 0.
* Make all the fields input enabled except key fields
w_field-input = 'X'.
MODIFY i_fieldcat FROM w_field TRANSPORTING input
WHERE key IS INITIAL.
ENDIF.
* Display the record for editing purpose
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = p_table
it_fieldcat = i_fieldcat
i_screen_start_column = 10
i_screen_start_line = 15
i_screen_end_column = 200
i_screen_end_line = 20
TABLES
t_outtab = <l_tab>
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc = 0.
* Read the modified data
READ TABLE <l_tab> INDEX 1 INTO <l_wa>.
* If the record is changed then track its index no.
* and populate it in an internal table for future
* action
IF sy-subrc = 0 AND <dyn_wa> <> <l_wa>.
<dyn_wa> = <l_wa>.
i_index = rs_selfield-tabindex.
APPEND i_index.
ENDIF.
ENDIF.
ENDIF.
* When save button is pressed
WHEN 'SAVE'.
* Sort the index table
SORT i_index.
* Delete all duplicate records
DELETE ADJACENT DUPLICATES FROM i_index.
LOOP AT i_index.
* Find out the changes in the internal table
* and populate these changes in another internal table
READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX i_index.
IF sy-subrc = 0.
APPEND <dyn_wa> TO <dyn_tab_temp>.
ENDIF.
ENDLOOP.
* Lock the table
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc = 0.
* Modify the database table with these changes
MODIFY (p_table) FROM TABLE <dyn_tab_temp>.
REFRESH <dyn_tab_temp>.
* Unlock the table
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table.
ENDIF.
ENDCASE.
rs_selfield-refresh = 'X'.
ENDFORM. "user_command -
Dear all,
Anybody having idea on.......Solution data base(Customer Service)
What do you mean ,,,Symptom/Solution...
I gone through Help.sap...apartfrom that is thr any doc or Just explain me In General terms ,,if possible with Example......
Thanks in Advance
Regards
Luckky.Hi,
The Solution Database is a repository of information which is stored as problems and solutions, and is indexed for immediate retrieval. For the applications that use the Solution Database as a knowledge base, see Integration below.
Knowledge administrators use the Solution Database to define problems and solutions using, for example, free-text descriptions in several languages and customized attributes. They can structure multiple relationships between problems and solutions, and navigate easily between them.
The Solution Database offers a basic interface for knowledge administrators (but also agents, field engineers, and other users) to search for problems and solutions.
[symtom-solution|http://help.sap.com/saphelp_sm32/helpdata/en/33/c7f5414e2fc517e10000000a155106/content.htm]
regards
sadhu kishore -
When to refresh Servlet data from Data Base
Hello all,
I have a servlet that retrive few hundreds thousands records from data base table.
The data in data base table being updated once or twice in every week.
Since same servlet instance serve all users, that access the servlet many times a day.
I would like to avoid retriving the data from data base on each servlet access.
and make the users use same data already retrieved and kept in servlet members.
First, what is the best way to avoid data retrive from data base on each servlet access?
and how could I have some kind of trigger that will refresh servlet data from data base every few days?
Thanks in advance for every idea.
AmiJava_A wrote:
Thanks Saish for your reply.
I'm not using DAO in my application but retrive the data from BI data base using a web service. response time querying the BI data base is not quick enuogh.
Since, I wouldn't want to query the BI server on each servlet access.
Because the data I retrived at the begining using the web service contains all required data for all servlet requests, I thought to store the data (~200K rows) once in the servlet which will be using for all requests.
Why not store the results locally in your own database after you fetch them?
This still leave me with the questions: in which event should I query the BI data, and also when or in which event should I update the data again from BI server?
Query at startup, an user demand, when data becomes stale. It depends on your requirements.
>
Thanks
Ami- Saish -
Hiding dynamic selections which is default if Logical Data Bases is used
Hi All,
Am making use of PNP logical data base in my report .On the selection screen there is a default icon with text dynamic selections is visible besides the execute icon.Can please anyone tell me how to hide this,i have gone through the DBPNPSEL include but was not able to find the solution for the same.
Pointers will be appriciated.
Regards,
Zareena.Create your own report catogory
Goto --> Attributes --> Report Catogory
with all the fields that you require
That will solve your problem -
Hello!
Since I can do so that from a client (host) single oracle is connected to the data base from my applications, and not can connect from another programs to the data base the PC clientYou can use 'proxy authentication' such that they must log in through the application, although if the app is on their machine they could get to that password.
You can create an after login trigger that will look at such things as their program name to prevent a user from logging in with SQLPlus / Excel and kick them out if they come in the wrong way.
You can prevent them from doing anything by having the application utilize a Secure Application Role, such that if they login outside of the application they cannot read/write the application tables.
If the application lives on a users host then they can (with effort) get around all of these. If the application lives on a host outside their control then you can completely stop them from accessing the database. -
How do we decide the number of data base servers and application servers ?
Dear Gurus,
How do we decide the number of data base servers and application servers in BW ?
How does this number help in data load balance and reporting needs ?
Any hard n fast rule in the number of servers ?
Regards
MohanHi Mohan,
Check the number of application server in the T-code SM66.... and also u can check the it in Sm50 on appplication server basiss./.
From Sm37 u can see the application server Push button.. if u click on that also.. u can see the number of application servers in the system..
Get into the individual application server and check how many Dialogue and background WP's are free,,
If u see that the considerable number of WP are free(Waiting for task).. then u can shedule the loads..
If most of the WP are busy then u need to wait to trigger ur loads to maintain the load balancing..
If one Application server is too busy then u can check the other Application Servers in the systems..
And u can shedule the loads on a specific application sever level as well using the PC..
Thanks
I hope this is clear to u..
Assign points if this helps -
Transfer of xml file elements to data base columns
hi all,
i have to store xml file's data(element values) into the data base(table columns).
i heard that we can acheive this by XSU.
IS it is mediator between xml and db? if yes how to install it.
i tried something as below
with t as (
select xmltype('<Message-Header>
<Message-Id>1234</Message-Id>
<Sender-Company-ID>4569</Sender-Company-ID>
<Sender-Company-Name>abc company</Sender-Company-Nam
<Sender-User-ID>AA</Sender-User-ID>
<Recv-Company-ID>050</Recv-Company-ID>
<Recv-Company-Name>XYZ pvt.ltd</Recv-Company-Name>
<Creation-Time>20101019 15:59:39</Creation-Time>
</Message-Header>') as xml from dual
)but i am getting following error. can anybody explain about this
SQL> ed
Wrote file afiedt.buf
1 with t as (
2 select xmltype('<Message-Header>
3 <Message-Id>1234</Message-Id>
4 <Sender-Company-ID>4569</Sender-Company-ID>
5 <Sender-Company-Name>abc company</Sender-Company-Name>
6 <Sender-User-ID>AA</Sender-User-ID>
7 <Recv-Company-ID>050</Recv-Company-ID>
8 <Recv-Company-Name>XYZ pvt.ltd</Recv-Company-Name>
9 <Creation-Time>20101019 15:59:39</Creation-Time>
10 </Message-Header>') as xml from dual
11* )
SQL> /
with t as (
ERROR at line 1:
ORA-01041: internal error. hostdef extension doesn't existPlease help me..
my db version is Oracle Database 10g Release 10.2.0.1.0 - ProductionHi,
What are you trying to achieve with a single WITH clause and no SELECT?
Please see this from the documentation if you want to use it properly :
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_10002.htm#i2077142
Apart from its true purpose of subquery factoring, the WITH clause is often use here and there to simulate a table content, but you'll always need a SELECT.
Maybe that's what you were trying to do?
As for your question, starting with release 10.2, Oracle provides XMLTable to shred XML documents into relational structures.
For example,
with t as (
select xmltype('<Message-Header>
<Message-Id>1234</Message-Id>
<Sender-Company-ID>4569</Sender-Company-ID>
<Sender-Company-Name>abc company</Sender-Company-Name>
<Sender-User-ID>AA</Sender-User-ID>
<Recv-Company-ID>050</Recv-Company-ID>
<Recv-Company-Name>XYZ pvt.ltd</Recv-Company-Name>
<Creation-Time>20101019 15:59:39</Creation-Time>
</Message-Header>') as xml from dual
select x.*
from t,
XMLTable(
'/Message-Header'
passing t.xml
columns
message_id number path 'Message-Id',
sender_company_id number path 'Sender-Company-ID',
sender_company_name varchar2(30) path 'Sender-Company-Name',
sender_user_id varchar2(30) path 'Sender-User-ID',
recv_company_id varchar2(30) path 'Recv-Company-ID',
recv_company_name varchar2(30) path 'Recv-Company-Name',
creation_time varchar2(30) path 'Creation-Time'
) x
;If you're working in PL/SQL, and the XML resides in a variable, you can directly do (with necessary datatype conversion in the SELECT) :
insert into your_table ( <your_columns_list> )
select <your_columns_list>
from XMLTable(
'/Message-Header'
passing your_xml_var
columns
message_id number path 'Message-Id',
sender_company_id number path 'Sender-Company-ID',
sender_company_name varchar2(30) path 'Sender-Company-Name',
sender_user_id varchar2(30) path 'Sender-User-ID',
recv_company_id varchar2(30) path 'Recv-Company-ID',
recv_company_name varchar2(30) path 'Recv-Company-Name',
creation_time varchar2(30) path 'Creation-Time'
) x
; -
How to export a data as an XML file from oracle data base?
could u pls tell me the step by step procedure for following questions...? how to export a data as an XML file from oracle data base? is it possible? plz tell me itz urgent requirement...
Thankz in advance
BalaSQL> SELECT * FROM v$version;
BANNER
Oracle DATABASE 11g Enterprise Edition Release 11.1.0.6.0 - Production
PL/SQL Release 11.1.0.6.0 - Production
CORE 11.1.0.6.0 Production
TNS FOR 32-bit Windows: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - Production
5 rows selected.
SQL> CREATE OR REPLACE directory utldata AS 'C:\temp';
Directory created.
SQL> declare
2 doc DBMS_XMLDOM.DOMDocument;
3 xdata XMLTYPE;
4
5 CURSOR xmlcur IS
6 SELECT xmlelement("Employee",XMLAttributes('http://www.w3.org/2001/XMLSchema' AS "xmlns:xsi",
7 'http://www.oracle.com/Employee.xsd' AS "xsi:nonamespaceSchemaLocation")
8 ,xmlelement("EmployeeNumber",e.empno)
9 ,xmlelement("EmployeeName",e.ename)
10 ,xmlelement("Department",xmlelement("DepartmentName",d.dname)
11 ,xmlelement("Location",d.loc)
12 )
13 )
14 FROM emp e
15 , dept d
16 WHERE e.DEPTNO=d.DEPTNO;
17
18 begin
19 OPEN xmlcur;
20 FETCH xmlcur INTO xdata;
21 CLOSE xmlcur;
22 doc := DBMS_XMLDOM.NewDOMDocument(xdata);
23 DBMS_XMLDOM.WRITETOFILE(doc, 'UTLDATA/marco.xml');
24 end;
25 /
PL/SQL procedure successfully completed.
. -
I backed up my ipod. I then updated it but all of my data is still gone. How do I get my data back??
Were the app in your iTunes library? If not the app data in the backup has no place to go. Redownload the apps in your iTunes libaray
Downloading past purchases from the App Store, iBookstore, and iTunes Store
and then restore from backup.
iOS: How to back up and restore your content
Otherwise, try restoring from backup again.
If still problem that means the backup does not include the data. -
Im trying to build user expiration into my registration form, but I cant get the form to send back the date registering.
in my data base i have tried every thing from timestamp to datetime. I can get a timestamp but it is not functioning with the expiration?just have a look at my tutorial Login tables: installation & configuration where the required column attributes are explained and where you can obtain a fully functional SQL dump for a typical ADDT "login" and (optionally) "login_stats" table.
BTW, "expiration" will have to be an "int" column.
Cheers,
Günter -
Quota Generation not happen's on Pro data basis .
Dear experts,
Time evalution status - 1.
1.Employee service 0 - 5 years - 24 Days entitlement
2.Employee service 5 - 10 years - 29 days entitlement.
when generating quota for employee less than five years its calculating correctly.when come's to employee more than 5 years its not calculating on pro-data basis of employee joining month. Instead of Month it's looking at the year and calculating it.
DOJ of employee
Mar-09
Year
TOTAL quota accrued
2009
20
2010
24
2011
24
2012
24
2013
24
Client requirement
System calculation as of now
2014
28
29
Calculation part.
below screen shot show how system calculating and how client needed.
how this scenario can be configured.
Regards
VinodhCheck the Deduction rule for that Quota
once check the Groupings for ESG and PSA
V_001P_ALL
V_503_ALL -
How to stored data after clicking checkbox in data base table
REPORT ZT .
TYPE-pools: slis.
tables:mkpf,mseg,mard,COWB_COMP,ZTABLE.
Types:BEGIN OF tp_data,
mblnr LIKE mseg-mblnr,
matnr LIKE mseg-matnr,
werks LIKE mard-werks,
lgort LIKE mard-lgort,
lgpbe LIKE mard-lgpbe,
charg LIKE mseg-charg,
bwart LIKE mseg-bwart,
budat LIKE mkpf-budat,
menge LIKE mseg-menge,
meins LIKE mseg-meins,
kostl LIKE mseg-kostl,
aufnr LIKE mseg-aufnr,
rsnum LIKE mseg-rsnum,
endkz like COWB_COMP-endkz,
END OF tp_data,
tp_tbl_data TYPE STANDARD TABLE OF tp_data.
MODIFIED*******************
DATA: WA TYPE TP_DATA.
MODIFIED*******************
*data: t_data like Y00_MM_ISSUE_DAT occurs 0 with header line.
Constants
Data objects (variable declarations and definitions)
Report data to be shown.
DATA: it_data TYPE STANDARD TABLE OF tp_data.
MODIFIED*******************
DATA : V_REPID LIKE SY-REPID.
MODIFIED*******************
Heading of the report.
DATA: t_heading TYPE slis_t_listheader.
*========================== Selection Screen
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:smblnr FOR mseg-mblnr MODIF ID m1,
smatnr FOR mseg-matnr MODIF ID m2,
swerks FOR mard-werks MODIF ID m3,
slgort FOR mard-lgort MODIF ID m4,
slgpbe FOR mard-lgpbe MODIF ID m5,
scharg FOR mseg-charg MODIF ID m6,
sbwart FOR mseg-bwart MODIF ID m7,
skostl FOR mseg-kostl MODIF ID m8,
saufnr FOR mseg-aufnr MODIF ID m9,
srsnum FOR mseg-rsnum MODIF ID m10.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS:pre RADIOBUTTON GROUP radi USER-COMMAND ucomm DEFAULT 'X',
pse RADIOBUTTON GROUP radi,
bps RADIOBUTTON GROUP radi.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
PARAMETER:layout TYPE i.
SELECTION-SCREEN END OF BLOCK b3.
MODIFIED*******************
INITIALIZATION.
V_REPID = sy-repid.
MODIFIED*******************
*=========================== Event Blocks
AT selection-SCREEN.
start-OF-selection.
PERFORM get_data USING it_data.
END-OF-selection.
PERFORM build_alv USING it_data t_heading.
*=========================== Subroutines
*& Form get_data
Gets the information to be shown in the report.
FORM get_data USING t_data TYPE tp_tbl_data.
SELECT msegmblnr msegmatnr mardwerks mardlgort mard~lgpbe
msegcharg msegbwart mkpf~budat
msegmenge msegmeins msegkostl msegaufnr mseg~rsnum
INTO CORRESPONDING FIELDS OF TABLE t_data
FROM mseg
JOIN mard ON mardmatnr EQ msegmatnr
JOIN mkpf ON msegmblnr EQ mkpfmblnr
WHERE mseg~matnr IN smatnr.
ENDFORM. " get_data
*& Form build_alv
Builds and display the ALV Grid.
FORM build_alv USING t_data TYPE tp_tbl_data
t_heading TYPE slis_t_listheader.
ALV required data objects.
DATA: w_title TYPE lvc_title,
w_comm TYPE slis_formname,
w_status TYPE slis_formname,
x_layout TYPE slis_layout_alv,
t_event TYPE slis_t_event,
t_fieldcat TYPE slis_t_fieldcat_alv,
t_sort TYPE slis_t_sortinfo_alv.
REFRESH t_fieldcat.
REFRESH t_event.
REFRESH t_sort.
CLEAR x_layout.
CLEAR w_title.
Field Catalog
PERFORM set_fieldcat2 USING:
1 'MBLNR' 'MBLNR' 'MSEG' space space space space space space
space space space space space space t_fieldcat ,
2 'MATNR' 'MATNR' 'MSEG' space space space space space space
space space space space space space t_fieldcat ,
3 'WERKS' 'WERKS' 'MARD' space space space space space space
space space space space space space t_fieldcat,
4 'LGORT' 'LGORT' 'MARD' space space space space space space
space space space space space space t_fieldcat ,
5 'LGPBE' 'LGPBE' 'MARD' space space space space space space
space space space space space space t_fieldcat ,
6 'CHARG' 'CHARG' 'MSEG' space space space space space space
space space space space space space t_fieldcat ,
7 'BWART' 'BWART' 'MSEG' space space space space space space
space space space space space space t_fieldcat,
8 'BUDAT' 'BUDAT' 'MKPF' space space space space space space
space space space space space space t_fieldcat,
9 'MENGE' 'MENGE' 'MSEG' space space space space space space
space space space space space space t_fieldcat,
10 'MEINS' 'MEINS' 'MSEG' space space space space space space
space space space space space space t_fieldcat,
11 'KOSTL' 'KOSTL' 'MSEG' space space space space space space
space space space space space space t_fieldcat,
12 'AUFNR' 'AUFNR' 'MSEG' space space space space space space
space space space space space space t_fieldcat,
13 'RSNUM' 'RSNUM' 'MSEG' space space space space space space
space space space space space space t_fieldcat,
14 'ENDKZ' 'ENDKZ' 'COWB_COMP' space space 'select' 'Select this row' 'Sel' 'Select this row' space space space 'X' 'X' space t_fieldcat.
Layout
x_layout-zebra = 'X'.
Top of page heading
PERFORM set_top_page_heading USING t_heading t_event.
Events
PERFORM set_events USING t_event.
GUI Status
w_status = ''.
User commands
w_comm = 'USER_COMMAND'.
Order
Example
PERFORM set_order USING '<field>' 'IT_DATA' 'X' space space t_sort.
PERFORM set_order USING 'MBLNR' 'IT_DATA' 'X' space 'X' t_sort.
PERFORM set_order USING 'EBELN' 'IT_DATA' 'X' space 'X' t_sort.
PERFORM set_order USING 'EBELP' 'IT_DATA' 'X' space space t_sort.
Displays the ALV grid
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = V_REPID
it_fieldcat = t_fieldcat
is_layout = x_layout
it_sort = t_sort
i_callback_pf_status_set = w_status
i_callback_user_command = w_comm
i_save = 'X'
it_events = t_event
i_grid_title = w_title
TABLES
t_outtab = t_data
EXCEPTIONS
program_error = 1
OTHERS = 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. " build_alv.
*& Form set_top_page_heading
Creates the report headings.
FORM set_top_page_heading USING t_heading TYPE slis_t_listheader
t_events TYPE slis_t_event.
DATA: x_heading TYPE slis_listheader,
x_event TYPE LINE OF slis_t_event.
Report title
CLEAR t_heading[].
CLEAR x_heading.
x_heading-typ = 'H'.
x_heading-info = 'Reporte Prueba'(001).
APPEND x_heading TO t_heading.
Program name
CLEAR x_heading.
x_heading-typ = 'S'.
x_heading-KEY = 'Program: '.
x_heading-info = sy-repid.
APPEND x_heading TO t_heading.
User who is running the report
CLEAR x_heading.
x_heading-typ = 'S'.
x_heading-KEY = 'User: '.
x_heading-info = sy-uname.
APPEND x_heading TO t_heading.
Date of execution
CLEAR x_heading.
x_heading-typ = 'S'.
x_heading-KEY = 'Date: '.
WRITE sy-datum TO x_heading-info.
APPEND x_heading TO t_heading.
Time of execution
CLEAR x_heading.
x_heading-typ = 'S'.
x_heading-KEY = 'Time: '.
WRITE sy-uzeit TO x_heading-info.
APPEND x_heading TO t_heading.
Top of page event
x_event-name = slis_ev_top_of_page.
x_event-FORM = 'TOP_OF_PAGE'.
APPEND x_event TO t_events.
ENDFORM.
*& Form set_events
Sets the events for ALV.
The TOP_OF_PAGE event is alredy being registered in
the set_top_page_heading subroutine.
FORM set_events USING t_events TYPE slis_t_event.
DATA: x_event TYPE LINE OF slis_t_event.
Example
clear x_event.
x_event-name = .
x_event-form = .
append x_event to t_event.
ENDFORM.
*& Form set_order
Adds an entry to the order table.
FORM set_order USING p_fieldname p_tabname p_up p_down p_subtot
t_sort TYPE slis_t_sortinfo_alv.
DATA: x_sort TYPE slis_sortinfo_alv.
CLEAR x_sort.
x_sort-fieldname = p_fieldname.
x_sort-tabname = p_tabname.
x_sort-UP = p_up.
x_sort-down = p_down.
x_sort-subtot = p_subtot.
APPEND x_sort TO t_sort.
ENDFORM. "set_order
*& Form set_fieldcat2
Adds an entry to the field catalog.
FORM set_fieldcat2 USING p_colpos p_fieldname p_ref_fieldname
p_ref_tabname
p_outputlen p_noout
p_seltext_m p_seltext_l p_seltext_s p_reptext_ddic p_ddictxt
p_hotspot p_showasicon p_checkbox p_edit
p_dosum
t_fieldcat TYPE slis_t_fieldcat_alv.
DATA: wa_fieldcat TYPE slis_fieldcat_alv.
CLEAR wa_fieldcat.
General settings
wa_fieldcat-fieldname = p_fieldname.
wa_fieldcat-col_pos = p_colpos.
wa_fieldcat-no_out = p_noout.
wa_fieldcat-HOTSPOT = p_hotspot.
wa_fieldcat-CHECKBOX = p_checkbox.
wa_fieldcat-ICON = p_showasicon.
wa_fieldcat-do_sum = p_dosum.
Set reference fieldname, tablenam and rollname.
If p_ref_tabname is not given, the ref_fieldname given is a data
*element.
If p_ref_tabname is given, the ref_fieldname given is a field of a
*table. In case ref_fieldname is not given, it is copied from the
*fieldname.
IF p_ref_tabname IS INITIAL.
wa_fieldcat-rollname = p_ref_fieldname.
ELSE.
wa_fieldcat-ref_tabname = p_ref_tabname.
IF p_ref_fieldname EQ space.
wa_fieldcat-ref_fieldname = wa_fieldcat-fieldname.
ELSE.
wa_fieldcat-ref_fieldname = p_ref_fieldname.
ENDIF.
ENDIF.
Set output length.
IF NOT p_outputlen IS INITIAL.
wa_fieldcat-outputlen = p_outputlen.
ENDIF.
Set text headers.
IF NOT p_seltext_m IS INITIAL.
wa_fieldcat-seltext_m = p_seltext_m.
ENDIF.
IF NOT p_seltext_l IS INITIAL.
wa_fieldcat-seltext_l = p_seltext_l.
ENDIF.
IF NOT p_seltext_s IS INITIAL.
wa_fieldcat-seltext_s = p_seltext_s.
ENDIF.
IF NOT p_reptext_ddic IS INITIAL.
wa_fieldcat-reptext_ddic = p_reptext_ddic.
ENDIF.
IF NOT p_ddictxt IS INITIAL.
wa_fieldcat-ddictxt = p_ddictxt.
ENDIF.
Set as editable or not.
IF NOT p_edit IS INITIAL.
wa_fieldcat-INPUT = 'X'.
wa_fieldcat-EDIT = 'X'.
ENDIF.
APPEND wa_fieldcat TO t_fieldcat.
ENDFORM. "set_fieldcat2
*& Form top_of_page
Called on top_of_page ALV event.
Prints the heading.
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = 'TRVPICTURE04'
it_list_commentary = t_heading.
ENDFORM. " alv_top_of_page
*& Form user_command
Called on user_command ALV event.
Executes custom commands.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
case sy-ucomm.
WHEN '&DATA_SAVE'.
LOOP AT IT_DATA INTO WA WHERE ENDKZ = 'X'.
IF WA-ENDKZ = 'X'.
*******MODIFIED*********************************
U DELETE THIS CODE N USER UR INSERT CODE TO CHECK
SY-MSGV1 = WA-MBLNR. " U CAN DELETE
SY-MSGV2 = WA-MATNR. " U CAN DELETE
MESSAGE ID 'BC_BOR' TYPE 'I' NUMBER '888' " U CAN DELETE
WITH SY-MSGV1 SY-MSGV2. " U CAN DELETE
*******MODIFIED*********************************
INSERT ZTABLE.
ENDIF.
endloop.
ENDCASE.
ENDFORM. "user_command
this is my code, database will stored in fields only.data is empty,
how to slove that one,send any sugestion.Hi Lakshmi,
Can u explain briefly what is ur requirement. U mean to say that after clicking the checkbox in data base table or Screen?
Regards,
Jayaram... -
Differnace b/w SID and Global data base name
please tell me what is differance b/w SID and global data base name.
Hi,
Oracle System Identifier (SID)
A name that identifies a specific instance of a running pre-release 8.1 Oracle database. For any database, there is at least one instance referencing the database.
For pre-release 8.1 databases, SID is used to identify the database. The SID is included in the connect descriptor of a tnsnames.ora file and in the definition of the listener in the listener.ora file.
http://download-uk.oracle.com/docs/cd/B19306_01/network.102/b14213/glossary.htm#i433004
Global database name
The full name of the database which uniquely identifies it from any other database. The global database name is of the form "database_name.database_domain," for example, sales.us.acme.com.
The database name portion, sales, is a simple name you wish to call your database. The database domain portion, us.acme.com, specifies the database domain in which the database is located, making the global database name unique. When possible, Oracle Corporation recommends that your database domain mirror the network domain.
The global database name is the default service name of the database, as specified by the SERVICE_NAMES parameter in the initialization parameter file.
http://download-uk.oracle.com/docs/cd/B19306_01/network.102/b14213/glossary.htm#i435858
Adith -
i have been using CView Manager 11 to do my reports and is relatively easy to setup reports to the data base, but not all of my reports work with this program plus there is no user manual available. So I am trying to switch over to Chrystal Reports 11 with little success. I can not figure out how to setup the data base server with this program. I am trying to access the McKesson IntelliShelf Supply (Supply Scan) data base server. Is there anyone that can help me with this?
McKesson is an OEM partner of ours. I suggest you ask them how to.
Maybe you are looking for
-
Enhance GRC issue status report columns
Hello GRC Gurus I am new to GRC application and I have a requirement to enhance u201CIssue Statusu201D report fields. Process: Goto -> Report Center - > "Issue status" Report -> run based on the condition. It will display ll the issue report in a AL
-
Forgotten username and password for G4 notebook help
Hi there i have forgotten my username and password for a G4, also I do not have a disk. Any ideas Steve
-
Max number of characteristics on query result
Hi Experts, I got an error: "maximum number of characteristics(50) reached (BRAIN 696)" on query result because my query has over than 50 characteristics on rows. How can i solve it? Best Regards, Pablo Edited by: Pablo Moraes on Aug 6, 2009 5:42 PM
-
Hello i hv installed 2 to 3 times Oracle 9i and each time during installation i hv to give new SID. I have Deinstalled it before Installation if installed. Some Services of Oracle are removed but not all. I hv restarted after deinstalled. My Question
-
I use Trial product and trial product does not work at all surely I will think adobe products don't work at all eh?? specifically Photoshop Elements 12 stopped working so I bought 'Photoshop Elements 13 that worked even more poorly and now I am on th