Converting PNP related statement to simple ABAP
Hello,
i had a report which uses PNP logical database of HR module.
the code contains two specific lines to be used with it.
Get PERNR.
and
rp_provide_from_last p0000 space pn-begda pn-endda.
Now i want to do the same functionality using simple ABAP statements.
Could you please guide me. My requirement is that i had to fill a table, lets take Pa0000 internal table, so for that i could use a select statemnt instead of GET PERNR statement.
but didnt getting the conversion for the macro being used above. Also the PERNR field is not a mandatory one on the selection screen
hi check this program,
*& Report ZBEN
REPORT ZBEN.
tables:t591a,pa0021,pa0002.
DATA:BEGIN OF IT_PA0002 OCCURS 0,
PERNR LIKE PA0002-PERNR,
BEGDA LIKE PA0002-BEGDA,
ENDDA LIKE PA0002-ENDDA,
END OF IT_PA0002.
DATA:BEGIN OF IT_PA0021 OCCURS 0,
PERNR LIKE PA0021-PERNR,
subty like pa0021-subty,
BEGDA LIKE PA0021-BEGDA,
ENDDA LIKE PA0021-ENDDA,
FAMSA LIKE PA0021-FAMSA,
OBJPS LIKE PA0021-OBJPS,
FAVOR LIKE PA0021-FAVOR,
FANAM LIKE PA0021-FANAM,
KDSVH LIKE PA0021-KDSVH,
KDART LIKE PA0021-KDART,
END OF IT_PA0021.
data:it_t591a type t591a occurs 0 with header line.
data:it_t591s type t591s occurs 0 with header line.
PARAMETERS:P_PERNR LIKE PA0021-PERNR.
START-OF-SELECTION.
SELECT PERNR
BEGDA
ENDDA
FROM PA0021
INTO TABLE IT_PA0002
WHERE PERNR = P_PERNR.
IF SY-SUBRC = 0.
SELECT PERNR
subty
BEGDA
ENDDA
FAMSA
FAVOR
OBJPS
FANAM
KDSVH
KDART
FROM PA0021
INTO CORRESPONDING FIELDS OF TABLE IT_PA0021
FOR ALL ENTRIES IN IT_PA0002
WHERE PERNR = IT_PA0002-PERNR.
if sy-subrc = 0.
SELECT * FROM T591A
INTO table it_t591a
for all entries in it_pa0021
where infty = '0021'
and subty = it_pa0021-subty.
if sy-subrc = 0.
select * from t591s into table it_t591s where sprsl = 'EN'
and infty = '0021'
and subty = it_t591a-subty.
IF SY-SUBRC = 0.
LOOP AT IT_PA0021.
WRITE:/ IT_PA0021-PERNR, IT_PA0021-BEGDA, IT_PA0021-ENDDA, IT_PA0021-FAMSA, IT_PA0021-OBJPS,it_t591s-stext,IT_PA0021-FAVOR, IT_PA0021-FANAM, IT_PA0021-KDSVH, IT_PA0021-KDART.
ENDLOOP.
ENDIF.
endif.
ENDIF.
endif.
reward points if useful,
venkat.
Edited by: venkat appikonda on Mar 5, 2008 12:11 PM
Similar Messages
-
Convert sql select statement to oracle
Hi All,
Can anyone help me converting this Sql select statement to oracle ....
-----------------------------------------Query--------------------------------------------------------------
select emp_master.emp_code ,
emp_master.dept_cd ,
attendance_master.daily_attn_code ,
attendance_master.linked_column ,
case when location.payroll_status <> 'N' and eDocsNetEmployeesLeave.StartDate < dateadd(mm, 1 , convert(smalldatetime, datename(yy ,location.next_pay_date) + '/'+ datename(mm ,location.next_pay_date)+ '/01'))
then
dateadd(mm, 1 , convert(smalldatetime, datename(yy ,location.next_pay_date) + '/'+ datename(mm ,location.next_pay_date)+ '/01'))
when eDocsNetEmployeesLeave.StartDate < convert(smalldatetime, datename(yy ,location.next_pay_date) + '/'+ datename(mm ,location.next_pay_date)+ '/01')
then convert(smalldatetime, datename(yy ,location.next_pay_date) + '/'+ datename(mm ,location.next_pay_date)+ '/01') else eDocsNetEmployeesLeaveDetails.StartDate
end ,
eDocsNetEmployeesLeaveDetails.NoOfDays,
case when eDocsNetEmployeesLeave.StartDate > location.next_pay_date
then convert(datetime , convert(varchar, dateadd(ss,-1, dateadd(mm, 1, convert(datetime , datename(yy,eDocsNetEmployeesLeave.StartDate)+ '/' + datename(mm,eDocsNetEmployeesLeave.StartDate)+ '/01') )),106) )
else
case when location.payroll_status <> 'N'
then dateadd(mm,1,location.next_pay_date)
else location.next_pay_date
end
end as PaymentDate ,
isnull(grade_master.leave_type,'C') ,
eDocsNetEmployeesLeave.StartDate ,
eDocsNetEmployeesLeaveDetails.LeaveType
from eDocsNetEmployeesLeave ,
eDocsNetEmployeesLeaveDetails ,
eDocsNetLeaveTypes ,
emp_master ,
grade_master ,
attendance_master ,
location
where eDocsNetEmployeesLeaveDetails.RequestID = eDocsNetEmployeesLeave.RequestID and
eDocsNetEmployeesLeave.EmployeeID = emp_master.emp_code and
eDocsNetEmployeesLeaveDetails.LeaveType = eDocsNetLeaveTypes.LeaveTypeID and
eDocsNetLeaveTypes.loc_cd = emp_master.loc_cd and
location.loc_cd = emp_master.loc_cd and
attendance_master.loc_cd = emp_master.loc_cd and
attendance_master.linked_column = eDocsNetLeaveTypes.LinkedAttendance and
grade_master.loc_cd = emp_master.loc_cd and
grade_master.grade_cd = emp_master.grade_cd and
eDocsNetEmployeesLeaveDetails.RequestID = @RequestID
order by eDocsNetEmployeesLeaveDetails.StartDate
Thanks in Advance
SmileySeems like you want to convert a SQL statement from the ??? dialect to the Oracle dialect. *(It would be useful to indicate the non-ANSI standard SQL you are starting with.)
Part of the problem is that you use several date related functions. Some are unnecessary in Oracle and some need to translated into Oracle functions as found in the Functions section (chapter 5) of the SQL Reference manual at http://www.oracle.com/pls/db102/homepage
Note that columns and expressions of type 'date' in ORacle always contain all of "yyyy mm dd hh mi ss" and you need to format and trauncate as necessary.
Also note that '09-JAN-31' is NOT an Oracle date, but rather a character representation of a date which must be converted to/from a date expression. You will often need to use the to_date() and to_char() functions with a format mask as the second parameter. This is also descreibed in the first 2 chapters of the SQL Reference manual. -
Barcode printing in simple abap report
Hai,
I want to print Barcode for 'RESERVATION' in my simple abap report.Can you please give step by step procedure to achieve this?
Thank you.
Note :I saw many threads in sdn,it is NOT clear for me.
With Regards,
Jaheer.Hi Hussain ,
Go through the program RSPO0031
This will help you out.
Regards,
Yogendra Bhaskar -
Throw statement equivalent in ABAP Objects
Hi All,
I am trying to raise an exception and use a throw statement after catch inside try endtry in ABAP objects. Later i understood that there is no throw statement defined in ABAP objects. Could anyone help me out to understand the equivalent throw statement in ABAP and how to use in raise exception. I am pasting my code below for reference.
try.
CATCH Zxx_EXCEPTION into err.
write:/ err->local_text.
message err->LOCAL_TEXT type 'I'.
if err->local_text = ZIF_XXXX~BUSOBJLOCKED.
throw CX_AI_APPLICATION_FAULT.
endtry.
Thanks
DenoHello Deno
The TRY/CATCH logic of ABAP-OO is pretty much the same like in Java. Instead of throwing exception we have to raise them.
Method execute somewhere raise an exception of class zcx_myexception.
method execute.
if ( condition = abap_true ).
else.
RAISE EXCEPTION TYPE zcx_myexception
EXPORTING
textid = ...
<parameter> = ...
endif.
endmethod.
TRY.
call method go->execute( ).
CATCH zcx_myexception INTO lo_error.
* Do error handling
ENDTRY.
If the method that calls go->execute does not surround the method call by TRY/CATCH then it must define the exception class in its interface and, thereby, propagate the exception to the next higher level calling method.
Regards
Uwe -
Printing a simple abap-list in panel-format (DIN A4)
Hallo Ladies and Gentlemen,
i have a simple abap-list. when i print it, the list will be printed in landscape-format. how can i change it? i have to print it in panel-format.
Thanks a lot,
MarcelHi Marcel,
I think you have to click on the "Full Administration" button t see the option for "Page Formats"...
Also go to transaction SPAD,
in Devices / Servers tab press Output devices button
Double click on the device type of your printer
Press button Formats
and here you get a list of all formats for your printer
Regards,
Abhy -
Converting a delete statement using VPD policies and context
Hello,
I'm trying to convert a delete statement in a update statement using VPD policies and context.
+/* Supose the user 'user1' already exists. This is an application user */+
conn user1/pwd
create table user1.test_a (
id number(4),
description varchar2(100),
deleted number(1)
+);+
alter table user1.test_a add constraint test_a_pk primary key (id);
insert into user1.test_a (1, 'abc', 0);
insert into user1.test_a (2, 'def', 0);
commit;
I'd like to convert each physical deletion into a logical deletion: statements like "delete from user1.test_a where id = 1" must be converted into "update user1.test_a set deleted = 1 where id = 1".
I've found the following way: I will create a policy to avoid physical deletion. Additionally, the policy function should update the deletion flag too.
conn user1/pwd
+/* Create context package */+
create or replace package user1.pkg_security_context is
procedure p_set_ctx(
i_test_a_id in user1.test_a.id %type
+);+
end;
+/+
create or replace package body user1.pkg_security_context is
procedure p_set_ctx (
i_test_a_id in user1.test_a.id %type
+) is+
begin
dbms_session.set_context( 'user1_ctx', 'test_a_id', i_test_a_id );
end;
end;
+/+
show errors
+/* Create trigger to set the context before deletion */+
create or replace trigger user1.test_a_bef_trg
before delete on user1.test_a
for each row
declare
pragma autonomous_transaction;
begin
-- only commits the preceding update, not the delete that fired the trigger.
commit;
user1.pkg_security_context.p_set_ctx( :old.id );
end;
+/+
show errors
create context user1_ctx using user1.pkg_security_context;
+/* Policy function */+
create or replace function user1.f_policy_chk_dels (
object_schema in varchar2,
object_name in varchar2
+) return varchar2+
is
out_string varchar2(400) default '1=2 ';
+/*+
* out_string is the return value.
* - 'WHERE 1=2' means 'nothing to access'
begin
if ( loc_logged_usr_authorized > 0 ) then
+/*+
* Set the flag deleted to 1
update user1.test_a set deleted = 1 where id = sys_context( 'user1_ctx', 'test_a_id' );
out_string := out_string || 'or 1=1 ';
end if;
return out_string;
end;
+/+
show errors
+/*+
* Create policy
begin
dbms_rls.add_policy(
object_schema => 'user1' ,
object_name => 'test_a' ,
policy_name => 'policy_chk_dels' ,
function_schema => 'user1' , -- function schema
policy_function => 'f_policy_chk_dels' , -- policy function
statement_types => 'DELETE'
+);+
end;
+/+
When I try to delete a record of the table test_a:
conn user1/pwd
SQL> delete from ilogdia.oplsimulaciones sim where sim.id = 9999;
+0 rows deleted+
No rows has been deleted, but the update stmt does not work. That means, the "deleted" flag has not been updated.
Any ideas?
Thank you in advance.
Marco A. Serrano
Edited by: albrotar on Oct 15, 2012 8:42 AM
Edited by: albrotar on Oct 15, 2012 8:42 AM
Edited by: albrotar on Oct 15, 2012 8:43 AMThe policy function is applied once per statement execution. The policy function executes first and the UPDATE statement, presumably, updates no rows because the context is not yet populated. The row-level populates the context (I'm assuming that your session can even see context values populated by an autonomous transaction-- I would guess it could but I'd have to test that) after the UPDATE statement is already complete. The COMMIT in the row-level trigger is also pointless-- it only applies to changes made by the current autonomous transaction, of which there are none-- it cannot apply to changes made in other autonomous transactions. Declaring the row-level trigger to use autonomous transactions doesn't seem to accomplish anything other than to open the question of whether the values set in the context by the autonomous transaction are visible in the caller's transaction.
Even if this, somehow, did work, using autonomous transactions would be a very bad idea since Oracle is free to roll-back a partially executed statement (and the work done by its triggers) and re-execute it. Oracle does that with some regularity to maintain write consistency.
Justin -
Converting an update statement to modify statement in BADI
Hai I want to convert an update statement to nodify statement . Can we define the internal table in BADI. Give me the code
Hi,
We can define internal tables in BADI.
Example:
Implement BADI ME_PROCESS_PO_CUST and in the method PROCESS_ITEM
DATA: ls_mepoitem TYPE mepoitem.
*get item data
ls_mepoitem = im_item->get_data( ).
IF ls_mepoitem-adrn2 EQ space AND
ls_mepoitem-adrnr EQ space.
Retrieve the adddres or hardcode as per ur reqmt.
*transfer the address to ls_mepoitem-adrn2.
MOVE v_adrn2 TO ls_mepoitem-adrn2.
CALL METHOD im_item->set_data
EXPORTING
im_data = ls_mepoitem.
ENDIF.
Asha -
Convert the insert statement of an MS SQL server into an oracle statement
Hi ,
The insert statement in the ms sql server is
INSERT INTO #temp EXEC Procedurename @Id OUTPUT
where table temp
CREATE TABLE #temp(
Id varchar(10),
FNa varchar(40),
LNa varchar(40),
SId varchar(20),
Aid varchar(20),
Did varchar(20),
CCNa varchar(255),
CCId int,
ISu char(1),
IA char(1),
Dir char(1),
Ema varchar(60),
St char(2),
DId char(3)
I converted the insert statement like this
Procedurename(Id);
LOOP
FETCH cv_1 INTO v_temp;
EXIT WHEN cv_1%NOTFOUND;
INSERT INTO TEMP VALUES v_temp;
END LOOP;
CLOSE cv_1;
But i am receiving PL/SQL: ORA-00947: not enough values
Can anyone help on this?
Thanks1) Are you sure that you even need a temp table? Fetching all the rows from a cursor 1-by-1 and then inserting them into a temp table (I'm assuming the Oracle table TEMP is declared as a global temporary table) would seem rather unusual and most likely pointless. In Oracle, readers don't block writers, so there is generally no need to use temp tables to hold intermediate results.
2) If you do need to store a set of results into a table, it's going to be more efficient to do this in a single SQL statement rather than using a cursor. Something like
INSERT INTO my_table ( <<list of columns>> )
SELECT <<list of columns>>
FROM <<other tables>>
WHERE <<some conditions>>The SELECT part of the statement here is likely whatever SQL you use in declaring the cursor.
Justin -
How to convert update,delete statement into select stmt
Hi all,
I have a field called dml_stmt, i am getting the dml statement has input from the user.
My requirement is, if user is giving "update set col_name = 'xyz' from table_name where codition = 'aa'", before updating the table, i need to get old values from the table and put it in the audit table
For that,i need to convert those update statement into select stmt and need to execute the query to get the data and then i will put it in the audit table..
can anyone guide how to convert the update or delete stmt into select(need to write in pl/sql)
Please do needfull things ......
Regards,
JameMaybe I'm missing something, but why would auditing help here? It sounds like the user wants to know the prior values of the data, not the SQL UPDATE statement that was issued. Auditing would tell you that a table was updated, fine-grained auditing would tell you what the UPDATE statement was, but you'd need something else to capture the state of the data prior to the update.
Depending on why putting triggers on every table was discounted, you may also want to take a look at using Workspace Manager or Total Recall (in 11g) to track a history of data changes. But triggers would be the common solution to this sort of problem.
Justin -
Convert manual bank statement to EBS
Hi,
one of our customer Indonesia is currently doing outflow bank statement processing manually, and going forward wants to user electronic bank statement processing.
Now, i have to check what are the config setting done for Manual bank statement and get data and use them for EBS.
i can see the first 4 config steps, create account symbols, assign accounts to symbols, create keys for posting rules and define posting rules are same in both manual banking and EBS. so i dont need to do these 4 config steps in EBS.
how to i get the transacton types?
please share what are the config steps / work i have to carry out in sequence to convert manual bank statement to EBS?
and test the EBS?
Thanks,
ShwethaHi,
http://srilogix.com/casesWhitepapers/Electronic%20Bank%20Statement.pdf
To set up Electronic Bank Statements (EBS)
Processing in SAP for most customers in North America.
1. Create House Bank and Account ID (FI12)
2. Setup EDI Partner Profile for FINSTA Message Type (WE20)
3. Configure Global Settings for EBS (IMG)
- Create Account Symbols
- Assign Accounts to Account Symbols
- Create Keys for Posting Rules
- Define Posting Rules
- Create Transaction Types
- Assign External Transaction Types to Posting Rules
- Assign Bank Accounts to Transaction Types
4. Define Search String for EBS(Optional)
- Search String Definition
- Search String Use
5. Define Program and Variant Selection
Additional information is also available in the SAP Library under:
Financial Accounting > Bank Accounting (FI-BL) > Electronic Bank Statement >
Electronic Account Statement Customizing.
regadrs,
Santosh kumar -
Is it possible to convert Pages to States?
I'm using another designer's FW files and she uses Pages, which I dislike. I'd prefer to use States. Can I convert Pages to States?
I've created Preflight > Fixup's for this scenerio a couple times.
I found that if the document space (or type?) was rgb, than as shown will not work. I have a version for rgb, but just converted the document to cmyk when I last ran it.
Fixups seem to apply to the whole document. (@Adobe - why??? Let me define a page range in that page range box)
Swapping pages from one to the other after use would be necessary, but cheaper than Pitstop for occasional use.
I would expect that the copier, driven by a RIP, will allow page ranges to be defined as cmyk or gray.
With our Fiery I use mixed media to define grayscale within a mixed job. (Mixed media is not available if imposing within the RIP however) -
System accounting sa command error converting user accounting stats
after enabling system accounting (underlying BSD os features) with "sudo accton /var/account/acct", daily attempts to summarize and rotate data into /var/account/savacct and ...usracct fails. these files were created by /usr/sbin/sa, and later runs of /usr/sbin/sa -s -q fail with an error
"sa: converting user accounting stats: Inappropriate file type or format"
"sa: user accounting initialization failed"
is there some bug being tracked with /usr/sbin/sa or do I need to file one?Above indeed works; file /var/account/acct begins accumulating stats and running 'sa' command shows them.
The problem is when running 'sa -s -q' daily to roll the individual records into summary count files /var/account/{sav,usr}acct; the first time creates those files and empties the .../acct file but the second and following times fail with the error lines:
sa: converting user accounting stats: Inappropriate file type or format
sa: user accounting initialization failed
After above setup steps you sent, try this:
sudo -s
/usr/sbin/sa -s -q
# observe that the files /var/account/{sav,usr}acct are newly created; now wait a bit and:
/usr/sbin/sa -s -q
# observe failure (at least, that's what I get)
(by the way Linc, thanks for all the digging you've done) -
IC won't update with simple ABAP statements
Hi,
I am trying to analyze an update rule. The standard rule has all the IF and ELSE statements, so I took them out. I then put only theses statement
RESULT = COMM_STRUCTURE-DLV_QTY.
RETURNCODE = 0.
ABORT = 0.
For some reason the IC will not update. I check the PSA and RSA3, and there are values for this field DLV_QTY.
What else should I do to check why the IC wouldn't update?
ThanksHi,
in the request monitor, select a datapackage, right click on it and select simulate update. In the following popup you can select what to debug, UR or TR as well as the no. of records to be used for debugging.
Just Try by Hard Coding in your Update Routine with BREAK-POINT.
1. Find the Activated Program which you can in the Update rules -> Extras -> Activated Program will give you the activated program. Go to SE38 and display the program and place a soft break-point in the program from where you want to Debug.
2. Go to the monitor, load the data using the psa. Once Loaded go into the details tab of the monitor (Right Hand Side) and right click on the Datapackage and click on Simulate update.
3. In the new screen, click on the update rules and activate debugging in update rules and click on simulation which ill take u into the program press F8 until u get the Break-point which you would have placed.
There are two methods of debugging update routines.
1. Debugging with Soft break point
2. Debugging with Hard break points
1. If you are in production envirnoment and client is not modifiable, it is not possible to hard code 'Break-Point' statement in the update routine. So you need to load data in PSA and from monitor need to go to processing of data package and then you can select routine which is to be debugged from the debuge window 'overview' tab.
2. Debugging with Hard break points is insertion of break-point statement in the code prior to the statement where debugging is to be started. Rest procedure remains same as explain above.
It is important to remove break point statement once debugging is over . Else it will give short dumps while loading data in foreground.
Regards,
Hareesh -
ASO-related statements fail in JAPI MaxL
Hi there,
I am trying to run an ASO database aggregation from a java program using Essbase JAPI. I am running Essbase 7.1.6. Since there seems not to be any ASO related call in the library, my approach is to open a MaxL session (IEssMaxlSession) and to execute a simple MaxL command (execute aggregate process on database appname.dbname). But surprisingly this fails. After some investigation, I realized that all ASO-related MaxL statements also fail to run in Essbase API while BSO ones function well. It always complain about some incorrect syntax, which I am 100% is valid since I was able to run it successfully from the MaxL prompt.
Any idea how to solve this?
Thanks a bunch in advance,
RegisMaxL was supported in the JAPI from version 7x, however, it goes away in System 9. Here is a portion of the javadoc of IEssMaxlSession in System 9.3.1:
boolean execute(java.lang.String maxlStatement)
Deprecated. - Deprecated for lack of JAPI support
Based on the fact that the JAPI never fully supported MaxL in the first place and the fact that MaxL/JAPI calls were deprecated in System 9, I would guess the ASO functionality wasn't available via the JAPI in the first place (although I have tested that scenario in any version of the JAPI)..
Any idea how to solve this?Perhaps you could install the Essbase client which, I believe, contains the full MaxL functionality, and write/execute your MaxL scripts from Java..
I looked in the 9.3.1. javadocs and didn't see anything new in regards to materinalizing aggregations; I will, however, see if any of my friends in the JAPI group have any further insights and, if I find anything out, I will followup here.
Sorry there isn't a cleaner solution.
Tim Tow
Oracle ACE
Applied OLAP, Inc -
Convert oracle cursor statements along with validations to XML
Hi Gurus/Odie,
I've one current in pl/sql report which is generating output as text format, but users are expecting to see the same output in excel format. In oracle apps we can generate XML tags and those tags can be produced to template so as to generate them in excel file.
My current procedure as shown below.Currently it is displaying output in one line concatenating all the data. But i want keep the same logic like that and change into xml tags. How can we do that. Please provide me your valueable inputs in this regard.
CREATE OR REPLACE PROCEDURE APPS.ACCTALS (
errbuf OUT VARCHAR2,
retcode OUT NUMBER,
p_st_date IN VARCHAR2,
p_end_date IN VARCHAR2,
p_set_of_book IN NUMBER,
p_chart_of_acnt IN NUMBER,
p_min_flex IN VARCHAR2,
p_max_flex IN VARCHAR2,
p_transaction_type IN VARCHAR2
IS
TYPE flex_tbl_type IS TABLE OF VARCHAR2 (10)
INDEX BY BINARY_INTEGER;
CURSOR c_acct (
p_period_num_low NUMBER,
p_period_num_high NUMBER,
p_min_flex_tbl flex_tbl_type,
p_max_flex_tbl flex_tbl_type
IS
SELECT gjh.period_name period_name,
sat.user_je_source_name SOURCE,
cat.user_je_category_name CATEGORY,gjb.NAME batch_name,
gjh.NAME journal_name, gcc.segment1, gcc.segment2, gcc.segment3,
gcc.segment4, gcc.segment5, gcc.segment6, gcc.segment7,
gcc.segment8, gjl.je_line_num,
gjl.description je_line_description, gjl.reference_1 party_name,
(SELECT pv.segment1
FROM ap_invoices_all aia, po_vendors pv
WHERE aia.invoice_id =TO_NUMBER(DECODE(NVL(LENGTH(LTRIM (TRANSLATE (gjl.reference_2,'1234567890','3'),'3')),0),0, TO_NUMBER (gjl.reference_2),-999))
AND pv.vendor_id = aia.vendor_id) party_number,
NULL trx_number, -- invoice_num,
NULL trx_line_number, -- invoice_line_num,
CASE
WHEN gjh.je_category = 'Purchase Invoices'
THEN (SELECT pha.segment1
FROM apps.ap_invoice_distributions_all aid,
apps.po_headers_all pha,
apps.po_lines_all pla,
apps.po_distributions_all pda
WHERE aid.po_distribution_id =
pda.po_distribution_id
AND pda.po_line_id = pla.po_line_id
AND pla.po_header_id = pha.po_header_id
AND aid.invoice_id = TO_NUMBER (gjl.reference_2)
AND aid.distribution_line_number =
TO_NUMBER (gjl.reference_3))
ELSE ''
END po_number,
CASE
WHEN gjh.je_category = 'Purchase Invoices'
AND gjl.reference_3 IS NOT NULL
THEN (SELECT pla.line_num
FROM apps.ap_invoice_distributions_all aid,
apps.po_headers_all pha,
apps.po_lines_all pla,
apps.po_distributions_all pda
WHERE aid.po_distribution_id =
pda.po_distribution_id
AND pda.po_line_id = pla.po_line_id
AND pla.po_header_id = pha.po_header_id
AND aid.invoice_id = TO_NUMBER (gjl.reference_2)
AND aid.distribution_line_number =
TO_NUMBER (gjl.reference_3))
ELSE TO_NUMBER ('')
END po_line,
CASE
WHEN gjh.je_category = 'Purchase Invoices'
AND gjl.reference_3 IS NOT NULL
THEN (SELECT mc.segment1
FROM apps.ap_invoice_distributions_all aid,
apps.po_headers_all pha,
apps.po_lines_all pla,
apps.po_distributions_all pda,
apps.mtl_categories mc
WHERE aid.po_distribution_id =
pda.po_distribution_id
AND pda.po_line_id = pla.po_line_id
AND mc.category_id = pla.category_id
AND pla.po_header_id = pha.po_header_id
AND aid.invoice_id = TO_NUMBER (gjl.reference_2)
AND aid.distribution_line_number =
TO_NUMBER (gjl.reference_3))
ELSE ''
END po_category,
gjl.accounted_dr debit, gjl.accounted_cr credit,
NVL (gjl.accounted_dr, 0) - NVL (gjl.accounted_cr, 0)
net_amount,
-- Added by Murali for bug 10405
gjh.currency_code entered_currency,
gjl.entered_dr entered_debit, gjl.entered_cr entered_credit,
NVL (gjl.entered_dr, 0)
- NVL (gjl.entered_cr, 0) net_entered_amount,
gjl.attribute1 bank_account_number,
gjl.attribute2 bank_account_name,
gjl.attribute3 it2_nl_posting_ref,
gjl.attribute4 bank_transaction_date,
gjl.attribute5 it2_transaction_number,
gjl.attribute6 funds_subtype_name,
CASE
WHEN gjh.je_category = 'Purchase Invoices'
THEN
CASE
WHEN (SELECT NVL (aid.po_distribution_id,-999)
FROM ap_invoice_distributions_all aid
WHERE aid.invoice_id =TO_NUMBER (gjl.reference_2)
AND aid.distribution_line_number =
TO_NUMBER (gjl.reference_3)) =
-999
THEN
(SELECT aia.attribute5
FROM apps.ap_invoices_all aia
WHERE aia.invoice_id =
TO_NUMBER(DECODE(NVL(LENGTH(LTRIM(TRANSLATE(gjl.reference_2,'1234567890','3'),'3')),0),0, TO_NUMBER(gjl.reference_2),-999))
AND ROWNUM = 1)
ELSE
--For PO Matched Invoice ,Pickup Proj code from PO header project DFF
(SELECT pha.attribute1
FROM apps.ap_invoice_distributions_all aid,
apps.po_headers_all pha,
apps.po_lines_all pla,
apps.po_distributions_all pda
WHERE aid.po_distribution_id = pda.po_distribution_id
AND pda.po_line_id = pla.po_line_id
AND pla.po_header_id = pha.po_header_id
AND aid.invoice_id = TO_NUMBER (gjl.reference_2)
AND aid.distribution_line_number =
TO_NUMBER (gjl.reference_3)
AND ROWNUM = 1)
END
ELSE
-- Invoice (Header) is not PO-Matched, so pickup Proj Code from invoice DFF --CHG0030444
(SELECT aia.attribute5
FROM apps.ap_invoices_all aia
WHERE aia.invoice_id =TO_NUMBER(DECODE(NVL(LENGTH(LTRIM (TRANSLATE (gjl.reference_2,'1234567890','3'),'3')),0),0, TO_NUMBER (gjl.reference_2),-999))
AND ROWNUM = 1)
END proj_code,
gjh.posted_date post_date, gjl.effective_date gl_date,
DECODE (gjh.je_category,
'Purchase Invoices', 'AP Invoice',
'Payments', 'AP Payment'
) transaction_class,
gjl.reference_3, gjl.reference_4, gjl.reference_5,
gjl.reference_1, gjl.reference_7,
gjl.attribute7, gjl.attribute8,
gjl.attribute9
FROM apps.gl_code_combinations gcc,
apps.gl_je_lines gjl,
apps.gl_je_headers gjh,
apps.gl_je_batches gjb,
apps.gl_period_statuses per,
apps.gl_je_categories_tl cat, -- Added by Murali for Bug 10405
apps.gl_je_sources_tl sat -- Added by Murali for Bug 10405
WHERE gcc.segment1 >= p_min_flex_tbl (1)
AND gcc.segment1 <= p_max_flex_tbl (1)
AND gcc.segment2 >= p_min_flex_tbl (2)
AND gcc.segment2 <= p_max_flex_tbl (2)
AND gcc.segment3 >= p_min_flex_tbl (3)
AND gcc.segment3 <= p_max_flex_tbl (3)
AND gcc.segment4 >= p_min_flex_tbl (4)
AND gcc.segment4 <= p_max_flex_tbl (4)
AND gcc.segment5 >= p_min_flex_tbl (5)
AND gcc.segment5 <= p_max_flex_tbl (5)
AND gcc.segment6 >= p_min_flex_tbl (6)
AND gcc.segment6 <= p_max_flex_tbl (6)
AND gjl.set_of_books_id = NVL (p_set_of_book, 1001)
AND per.effective_period_num BETWEEN p_period_num_low
AND p_period_num_high
AND gjl.code_combination_id = gcc.code_combination_id
AND gjl.status || '' = 'P'
AND gjb.average_journal_flag = 'N'
AND gjh.actual_flag =
DECODE (p_transaction_type,
'Actual', 'A',
'Budget', 'B',
gjh.actual_flag
AND gjh.je_header_id = gjl.je_header_id
AND gjb.je_batch_id = gjh.je_batch_id
AND per.application_id = 101
AND per.set_of_books_id = gjl.set_of_books_id
AND per.period_name = gjl.period_name
AND gjh.period_name = gjl.period_name
AND per.period_name = gjb.default_period_name
AND gjb.set_of_books_id = per.set_of_books_id
AND gjh.je_source = 'Payables'
AND cat.je_category_name = gjh.je_category
AND cat.LANGUAGE = 'US'
AND sat.je_source_name = gjh.je_source
AND sat.LANGUAGE = 'US'
main_rec c_acct%ROWTYPE;
l_min_flex_tbl flex_tbl_type;
l_max_flex_tbl flex_tbl_type;
l_min_flex VARCHAR2 (100);
l_max_flex VARCHAR2 (100);
min_flex_count NUMBER;
max_flex_count NUMBER;
i NUMBER;
v_display_str VARCHAR2 (1000);
v_header_str VARCHAR2 (1000);
l_proj_code VARCHAR2 (240);
rf_period_cur sys_refcursor;
l_period_num_low NUMBER := '';
l_period_num_high NUMBER := '';
-- l_vendor_name varchar2(1000);
l_party_name VARCHAR2 (1000);
l_party_number VARCHAR2 (1000);
l_trx_number VARCHAR2 (1000);
l_trx_line_number VARCHAR2 (50);
--Added by Bharat.K for CHG0035496
l_contract_number VARCHAR2 (30);
l_contract_modified VARCHAR2 (30);
l_order_number VARCHAR2 (30);
l_statement_date VARCHAR2 (30);
l_billed_from VARCHAR2 (30);
l_billed_to VARCHAR2 (30);
l_start_date VARCHAR2 (30);
l_reference_number VARCHAR2 (30);
BEGIN
fnd_file.put_line (fnd_file.LOG, 'set of book id: ' || p_set_of_book);
l_min_flex := p_min_flex;
i := 1;
LOOP
IF INSTR (l_min_flex, '-') = 0
THEN
EXIT;
END IF;
l_min_flex_tbl (i) := SUBSTR (l_min_flex, 1, INSTR (l_min_flex, '-') - 1);
l_min_flex :=SUBSTR (l_min_flex,INSTR (l_min_flex, '-') + 1,LENGTH (l_min_flex) - INSTR (l_min_flex, '-'));
i := i + 1;
END LOOP;
l_min_flex_tbl (i) := l_min_flex;
min_flex_count := i;
l_max_flex := p_max_flex;
i := 1;
LOOP
IF INSTR (l_max_flex, '-') = 0
THEN
EXIT;
END IF;
l_max_flex_tbl (i) := SUBSTR (l_max_flex, 1, INSTR (l_max_flex, '-') - 1);
l_max_flex :=SUBSTR (l_max_flex,INSTR (l_max_flex, '-') + 1,LENGTH (l_max_flex) - INSTR (l_max_flex, '-'));
i := i + 1;
END LOOP;
l_max_flex_tbl (i) := l_max_flex;
max_flex_count := i;
v_header_str := '';
v_header_str :=
'Period'|| '^'|| 'Source'|| '^'|| 'Category'|| '^'|| 'Batch Name'|| '^'|| 'Journal Name'|| '^'|| 'Company'|| '^'|| 'IBX'|| '^'|| 'Dept'|| '^'|| 'Account'
|| '^'|| 'Intercompany'|| '^'|| 'Product'|| '^'|| 'Future2'|| '^'|| 'Future3'|| '^'|| 'JE Line Num'|| '^'|| 'Description'|| '^'|| 'GL Date'|| '^'|| 'GL Post Date'
|| '^'|| 'Party Name'|| '^'|| 'Party Number'|| '^'|| 'Transaction Class'|| '^'|| 'Transaction Number'|| '^'|| 'Transaction Line Number' --bug#9819
|| '^'|| 'PO Number'|| '^'|| 'PO Line Num'|| '^'|| 'PO Category'|| '^'|| 'Project Code'|| '^'|| 'Converted Debit'|| '^'|| 'Converted Credit'
|| '^'|| 'Converted Net Amount (Dr - Cr)'|| '^'|| 'Entered Currency'|| '^'|| 'Entered Debit'|| '^'|| 'Entered Credit'|| '^'
|| 'Entered Net Amount (Dr - Cr)'|| '^'|| 'BANK ACCOUNT NUMBER'|| '^'|| 'BANK ACCOUNT NAME'|| '^'
|| 'IT2 NL POSTING REF'|| '^'|| 'BANK TRANSACTION DATE'|| '^'|| 'IT2 TRANSACTION NUMBER'|| '^'|| 'FUNDS SUBTYPE NAME'|| '^'
|| 'PCard Merchant Name'|| '^'|| 'PCard Posting Date'|| '^'|| 'PCard Transaction Date'|| '^'|| 'Contract Number'
|| '^'|| 'Contract Modified Number'|| '^'|| 'Order Number'|| '^'|| 'Statement Date'|| '^'|| 'Billed From'
|| '^'|| 'Billed To'|| '^'|| 'Start Date'|| '^'|| 'Reference Number';
fnd_file.put_line (fnd_file.output, v_header_str);
fnd_file.put_line (fnd_file.LOG, 'get effective period number');
OPEN rf_period_cur FOR
SELECT MIN (effective_period_num), MAX (effective_period_num)
FROM gl_period_statuses
WHERE start_date >= fnd_date.canonical_to_date (p_st_date)
AND end_date <= fnd_date.canonical_to_date (p_end_date)
AND set_of_books_id = p_set_of_book
AND application_id = 101;
FETCH rf_period_cur
INTO l_period_num_low, l_period_num_high;
CLOSE rf_period_cur;
IF l_period_num_low IS NOT NULL AND l_period_num_high IS NOT NULL
THEN
fnd_file.put_line (fnd_file.LOG,'effective period number low: '|| l_period_num_low|| ' period number high: '|| l_period_num_high);
i := 0;
OPEN c_acct (l_period_num_low,l_period_num_high,l_min_flex_tbl,l_max_flex_tbl);
LOOP
FETCH c_acct
INTO main_rec;
EXIT WHEN c_acct%NOTFOUND;
l_contract_number := NULL;
l_contract_modified := NULL;
l_order_number := NULL;
l_statement_date := NULL;
l_billed_from := NULL;
l_billed_to := NULL;
l_start_date := NULL;
l_reference_number := NULL;
--Do All the Processing for customer number and customer name--bug#9819
IF main_rec.CATEGORY = 'Adjustment'
THEN
BEGIN
SELECT hp.party_name, rc.account_number
INTO l_party_name, l_party_number
FROM ar_adjustments_all adj,
ra_customer_trx_all trx,
-- ra_customers rc
hz_cust_accounts rc,
hz_parties hp
WHERE adj.customer_trx_id = trx.customer_trx_id
AND trx.bill_to_customer_id = rc.cust_account_id
AND rc.party_id = hp.party_id
AND trx.set_of_books_id = NVL (p_set_of_book, 1001)
AND adj.adjustment_number = main_rec.reference_5;
EXCEPTION
WHEN OTHERS
THEN
l_party_name := NULL;
l_party_number := NULL;
END;
ELSIF main_rec.SOURCE = 'Payables'
THEN
l_party_name := main_rec.reference_1;
BEGIN
SELECT segment1
INTO l_party_number
FROM po_vendors
WHERE UPPER (vendor_name) = UPPER (l_party_name);
EXCEPTION
WHEN OTHERS
THEN
l_party_number := NULL;
END;
ELSIF main_rec.CATEGORY = 'Payments'
THEN
BEGIN
SELECT pv.vendor_name, pv.segment1
INTO l_party_name, l_party_number
FROM ap_checks_all ac, po_vendors pv
WHERE pv.vendor_id = ac.vendor_id
AND ac.check_id = main_rec.reference_3;
EXCEPTION
WHEN OTHERS
THEN
l_party_name := NULL;
l_party_number := NULL;
END;
-- Commented End for Bug 10405
ELSIF ( main_rec.CATEGORY = 'Debit Memos'
OR main_rec.CATEGORY = 'Credit Memos'
OR main_rec.CATEGORY = 'Sales Invoices'
THEN
BEGIN
SELECT hp.party_name, rc.account_number
INTO l_party_name, l_party_number
FROM apps.ra_cust_trx_line_gl_dist_all dist,
-- apps.ra_customer_trx_lines_all line,
apps.ra_customer_trx_all trx,
-- apps.ra_customers rc
apps.hz_cust_accounts rc,
hz_parties hp -- /*bug#7534 */
WHERE cust_trx_line_gl_dist_id = main_rec.reference_3
--and dist.CUSTOMER_TRX_LINE_ID=line.CUSTOMER_TRX_LINE_ID
AND trx.customer_trx_id = dist.customer_trx_id
AND trx.bill_to_customer_id = rc.cust_account_id
AND rc.party_id = hp.party_id
AND trx.set_of_books_id = NVL (p_set_of_book, 1001);
EXCEPTION
WHEN OTHERS
THEN
l_party_name := NULL;
l_party_number := NULL;
l_reference_number := NULL;
END;
ELSIF ( main_rec.CATEGORY = 'Misc Receipts'
OR main_rec.CATEGORY = 'Trade Receipts'
THEN
BEGIN
SELECT hp.party_name, hca.account_number
INTO l_party_name, l_party_number
FROM hz_parties hp, hz_cust_accounts hca
WHERE hp.party_id = hca.party_id
AND hca.cust_account_id = main_rec.reference_7;
EXCEPTION
WHEN OTHERS
THEN
l_party_name := NULL;
l_party_number := NULL;
END;
ELSE
l_party_name := main_rec.party_name;
l_party_number := main_rec.party_number;
l_reference_number := NULL;
END IF;
IF main_rec.SOURCE = 'Receivables' THEN
IF ( main_rec.CATEGORY = 'Debit Memos'
OR main_rec.CATEGORY = 'Credit Memos'
OR main_rec.CATEGORY = 'Sales Invoices'
THEN
BEGIN
SELECT DECODE (line.interface_line_context,
'OKS CONTRACTS', line.interface_line_attribute1, 'EQIX METERED POWER',line.interface_line_attribute3,
NULL
) contract_number,
DECODE (line.interface_line_context,
'OKS CONTRACTS', line.interface_line_attribute2,
NULL
) contract_modified,
DECODE (line.interface_line_context,
'ORDER ENTRY', line.interface_line_attribute1,
NULL
) order#,
(SELECT aci.cut_off_date
FROM apps.ar_cons_inv_all aci,
(SELECT DISTINCT customer_trx_id, cons_inv_id
FROM apps.ar_cons_inv_trx_lines_all) acit
WHERE aci.cons_inv_id = acit.cons_inv_id
AND dist.customer_trx_id = acit.customer_trx_id)
statement_date,
CASE line.interface_line_context
when 'OKS CONTRACTS' then
TO_CHAR
(TO_DATE (line.interface_line_attribute4,'YYYY/MM/DD' ),
'DD-MON-YYYY')
when 'EQIX METERED POWER' then line.interface_line_attribute4
else null
end as billed_from,
CASE line.interface_line_context
when 'OKS CONTRACTS' then
TO_CHAR
(TO_DATE (line.interface_line_attribute5,'YYYY/MM/DD' ),
'DD-MON-YYYY')
when 'EQIX METERED POWER' then line.interface_line_attribute5
else null
end as billed_to,
TO_CHAR(TO_DATE (DECODE (line.interface_line_context, 'OKS CONTRACTS', line.interface_line_attribute8, NULL ),'YYYY/MM/DD'),'DD-MON-YYYY') start_date
INTO l_contract_number,
l_contract_modified,
l_order_number,
l_statement_date,
l_billed_from,
l_billed_to,
l_start_date
FROM
apps.ra_customer_trx_all trx,
ra_customer_trx_lines_all line,
apps.ra_cust_trx_line_gl_dist_all dist,
apps.hz_cust_accounts rc,
hz_parties hp
WHERE cust_trx_line_gl_dist_id = main_rec.reference_3
AND trx.customer_trx_id = line.customer_trx_id
AND dist.customer_trx_line_id=line.customer_trx_line_id
AND trx.bill_to_customer_id = rc.cust_account_id
AND rc.party_id = hp.party_id
AND trx.set_of_books_id = NVL (p_set_of_book, 1001)
AND line.line_type = 'LINE';
EXCEPTION
WHEN OTHERS
THEN
l_contract_number := NULL;
l_contract_modified := NULL;
l_order_number := NULL;
l_statement_date := NULL;
l_billed_from := NULL;
l_billed_to := NULL;
l_start_date := NULL;
END;
END IF;
END IF;
--do processing to get line number , trx_number
IF ( main_rec.CATEGORY = 'Debit Memos'
OR main_rec.CATEGORY = 'Credit Memos'
OR main_rec.CATEGORY = 'Sales Invoices'
THEN
BEGIN
SELECT TO_CHAR (line_number), line.interface_line_attribute1
INTO l_trx_line_number, l_reference_number
FROM ra_cust_trx_line_gl_dist_all dist,
ra_customer_trx_lines_all line,
ra_customer_trx_all trx
WHERE cust_trx_line_gl_dist_id = main_rec.reference_3
AND dist.customer_trx_line_id = line.customer_trx_line_id
AND trx.customer_trx_id = line.customer_trx_id;
EXCEPTION
WHEN OTHERS
THEN
l_trx_line_number := NULL;
END;
l_trx_number := main_rec.reference_4;
ELSIF ( main_rec.CATEGORY = 'Misc Receipts'
OR main_rec.CATEGORY = 'Trade Receipts'
THEN
l_trx_number := main_rec.reference_4;
l_trx_line_number := NULL;
ELSIF main_rec.CATEGORY = 'Adjustment'
THEN
l_trx_number := main_rec.reference_5;
l_trx_line_number := NULL;
ELSIF main_rec.CATEGORY = 'Purchase Invoices'
THEN
l_trx_number := main_rec.reference_5;
l_trx_line_number := main_rec.reference_3;
ELSIF main_rec.CATEGORY = 'Payments'
THEN
--l_trx_number:=main_rec.reference_3;
l_trx_number := main_rec.reference_4;
-- change by dody CHG0030444
l_trx_line_number := NULL;
ELSE
l_trx_number := main_rec.trx_number;
l_trx_line_number := main_rec.trx_line_number;
END IF;
v_display_str :=
main_rec.period_name| '^'|| main_rec.SOURCE|| '^'|| main_rec.CATEGORY|| '^'|| main_rec.batch_name|| '^'|| main_rec.journal_name
|| '^'|| main_rec.segment1|| '^'|| main_rec.segment2|| '^'|| main_rec.segment3|| '^'|| main_rec.segment4|| '^'|| main_rec.segment5
|| '^'|| main_rec.segment6|| '^'|| main_rec.segment7|| '^'|| main_rec.segment8|| '^'| main_rec.je_line_num|| '^'|| main_rec.je_line_description
|| '^'|| main_rec.gl_date|| '^'|| main_rec.post_date|| '^'|| l_party_name|| '^'|| l_party_number|| '^'|| main_rec.transaction_class
|| '^'|| l_trx_number|| '^'|| l_trx_line_number|| '^'|| main_rec.po_number|| '^'|| main_rec.po_line|| '^'|| main_rec.po_category --Added for Bug # 11741
|| '^'|| main_rec.proj_code|| '^'|| main_rec.debit|| '^'|| main_rec.credit|| '^'|| main_rec.net_amount|| '^'|| main_rec.entered_currency
|| '^'|| main_rec.entered_debit|| '^'|| main_rec.entered_credit|| '^'|| main_rec.net_entered_amount|| '^'|| main_rec.bank_account_number
|| '^'|| main_rec.bank_account_name|| '^'|| main_rec.it2_nl_posting_ref|| '^'|| main_rec.bank_transaction_date|| '^'|| main_rec.it2_transaction_number
|| '^'|| main_rec.funds_subtype_name| '^'|| main_rec.attribute7|| '^'|| main_rec.attribute8|| '^'|| main_rec.attribute9|| '^'
|| l_contract_number|| '^'|| l_contract_modified|| '^'|| l_order_number|| '^'|| l_statement_date
|| '^'|| l_billed_from|| '^'|| l_billed_to|| '^'|| l_start_date|| '^'|| l_reference_number;
i := i + 1;
fnd_file.put_line (fnd_file.output, v_display_str);
END LOOP;
CLOSE c_acct;
ELSE
END IF;
EXCEPTION
WHEN OTHERS THEN
fnd_file.put_line (fnd_file.LOG, 'account analysis process error out - ' || SQLERRM );
retcode := 2;
errbuf := SUBSTR (SQLERRM, 1, 120);
RAISE;
END ACCTALS;
/Thanks in advance,
Nag
Edited by: 838961 on Apr 12, 2013 1:29 AM
Edited by: 838961 on Apr 12, 2013 2:02 AMYou are probably looking for the SQL/XML functions that have been in Oracle for several major releases now. Here is the latest Oracle documentation on them
[url http://docs.oracle.com/cd/E11882_01/appdev.112/e23094/xdb13gen.htm]Generating XML Data from the Database
You can also find some examples at [url http://www.oracle-base.com/articles/misc/sqlxml-sqlx-generating-xml-content-using-sql.php]SQL/XML (SQLX) : Generating XML using SQL in Oracle. There are plenty of examples on the forums and web in general.
Note: It is a lower case "code" in your formatting tags, not "CODE"
Maybe you are looking for
-
Creating a new option in MIRO credit memo
Hi All, I am working on MIRO transaction - Credit memo. In PO reference tab there is a drop down list where i could select the type of entry and create a credit memo accordingly Now in this list i was asked to add another option material document, wh
-
Missing Producer Portal info in the Enterprise Portal
Whenever we make any change to our Producer Portal, BI in this case, the Consumer Portal, EP stops displaying the Fedeated pages or iviews. Anyone trying to access the EP with BI roles either then gets a blank page or it times out. The EP continues t
-
Easiest way to transfer contacts from iphone 4 to ...
which the easy way to transfer contacts from iphone4 to 520. i have backup of iphone4 in windows outlook express.from here anyway to nokia 520? or any other easiest way?
-
Showing af:popup from bean - the new way?
I've been using this approach in my bean, to show a popup: My bean: +try {+ FacesContext context = FacesContext.getCurrentInstance(); +if (popupId != null) {+ StringBuilder script = new StringBuilder(); script.append("var popup = AdfPage.PAGE.findCom
-
Dear Experts , Can you please inform me the user exit name associated with Contract and Scheduling Agreement? Regards, Santosh