Total Pageviews

Wednesday, 20 September 2023

EBS : How to execute Dynamic SQL in PLSQL

 Dynamic SQL in PLSQL


In PL/SQL the SQL statement is created as a string, which is then executed using the EXECUTE IMMEDIATE clause

declare
v_techhards varchar2(2000);
begin

for r_techhards in (select * from user_tables) loop

v_techhards:= 'delete '||r_techhards.table_name;

dbms_output.put_line(v_techhards);

execute immediate v_techhards;

end loop;
end;

=========================================================================
#Oracle SQL#Oracle PLSQL#Oracle Apps#Oracle Database#SQL #Query #Dynamic SQL #execute immediate #Oracle dynamic DDL

EBS : Important Oracle Database related SQL Query

  Important Oracle Database related SQL Query

  • Query to get the name of the instance

select INSTANCE_NAME from v$instance;

  • Query to get the User name of theDatabase

select USER_ID from ALL_USERS Order by 1





=========================================================================
#Oracle SQL#Oracle Apps#Oracle Database#SQL #Query #v$instance #ALL_USERS

Sunday, 10 September 2023

EBS : OPM (Process Manufacturing) Important Query in r12


Query to get Formula wise All Resource in OPM

SELECT   gor.resources, crm.resource_desc, crd.nominal_cost,
                  NVL (gor.resource_usage, 1) resource_usage,
                  NVL (gor.process_qty, 1) process_qty
             FROM fm_rout_dtl frd,gmd_operation_activities goa,
                  gmd_operation_resources gor,
                  cr_rsrc_mst crm,
                  cm_rsrc_dtl crd
            WHERE frd.oprn_id = goa.oprn_id
              AND routing_id IN (
                     SELECT gr.routing_id
                       FROM mtl_system_items_kfv ic,
                            fm_matl_dtl dtl,
                            gmd_recipes gr
                      WHERE dtl.formula_id = x_formula_id
                        AND line_no = 1
                        AND line_type = 1
                        AND ic.organization_id = p_inv_org_id
                        AND ic.inventory_item_id = dtl.inventory_item_id
                        AND gr.formula_id = dtl.formula_id
                        AND ic.item_type not like '%TEA%' --added 28nov14 TEA Routing Resource will not appeared
                        )
              AND gor.oprn_line_id = goa.oprn_line_id
              AND crm.resources = gor.resources
              AND crm.resources = crd.resources
              AND crd.cost_type_id = p_cost_type_id
              AND period_id = p_period_id
         ORDER BY 1;


=========================================================================
#Oracle Apps#EBS #OPM #Process manufacturing #Formula #Resources 

EBS : How to identify the SQL_ID of a statement in Oracle Apps R12


How to identify the SQL_ID of a statement in Oracle Apps R12

1) Run the below SQL Query.

SELECT /* ORACLE SQL */ * FROM dual;

2) Run below query to get above ran SQL ID.

SELECT sql_id, plan_hash_value, substr(sql_text,1,40) sql_text
FROM v$sql
WHERE sql_text like 'SELECT /* ORACLE SQL */%'


------Here is the Output---------------


SQL_ID SQL_TEXT
------------- ----------------------------------------
0xzpkrs5gktjs SELECT /* ORACLE SQL */ * FROM dual


Sunday, 30 July 2023

EBS : Add Attachment in Supplier Master OAF Page in Oracle Apps (r12)


How to add Attachments at Supplier and Supplier Site Level


Navigation:-

1) Adding attachment at supplier

  •      Go to Payables Manager Responsibility (Any super User Responsibility)
  •      Search for a particular Supplier
  •      Go to Supplier Company Profile > Organization >Attachments > Add Attachment
2)  Adding attachment at supplier site level

  •     Go to Payables Manager Responsibility  (Any super User Responsibility.
  •     Search for a particular Supplier
  •     Go to Supplier Address Book > Click on Manage Sites >Click on Identification Tab > Click on   Attachments  > Click on Add button '+' is Enable

***********************************************************************************
#Oracle Apps #EBS #OAF #Supplier Master Page 


Saturday, 29 July 2023

Oracle : Useful SQL Query

 

SQL Query

1) generate Serial number in SQL Query

select row_number() over(partition by part_no order by part_no,decode(ORDER_TYPE_TEXT,'On Hand','01','02') from dual;




*************************************************************************************

#SQL Query #Oracle #Oracle Apps #Oracle #

EBS : Oracle Forms Compilation Scripts in Oracle Apps (r12)

How to compile forms in Oracle Apps

Forms Compilation scripts

frmcmp_batch module=/oraTECHHARDS/oracle/PERSONAL/fs1/EBSapps/appl/au/12.0.0/forms/US/XX_AR_INV_FORM.fmb module_type=form output_file=/oraTECHHARDS/oracle/PERSONAL/fs1/EBSapps/appl/ap/12.0.0/forms/US/XX_AR_INV_FORM.fmx userid=apps/apps batch=no compile_all=special 



Steps:-

1) Deploy the .fmb in AU_TOP 

2) Compile the forms using above scripts to generate .fmx in the Custom_TOP (like XX, AP, AR).



=========================================================================
#Oracle Forms #Oracle Apps #EBS #Forms Compilation

EBS : Useful AOL Query in Oracle Apps (r12)

Query to find Concurrent Request Details against input Concurrent Program

SELECT concurrent_program_name, fcr.*
  FROM fnd_concurrent_programs fcp, fnd_concurrent_requests fcr
 WHERE fcp.concurrent_program_id = fcr.concurrent_program_id
   AND fcp.concurrent_program_name = 'XX_TECHHARDS';











***********************************************************************************
#Oracle Apps #EBS #Concurrent Request #Concurrent Programs

#How to get concurrent Request Details



Tuesday, 18 July 2023

EBS : WHEN-TAB-PAGE-CHANGED change code in oracle forms in Oracle Apps (r12)

Oracle Forms Code for TAB WHEN-TAB-PAGE-CHANGED


DECLARE
   v_tp_nm   VARCHAR2 (30);
   v_tp_id   tab_page;
   v_tp_lb   VARCHAR2 (30);
BEGIN
   v_tp_nm := GET_CANVAS_PROPERTY ('TECHHARDS_TABS', topmost_tab_page);---TECHHARDS_TABS is your tab canvas
   v_tp_id := FIND_TAB_PAGE (v_tp_nm);   --this is tab page which you just had clicked to activate
   v_tp_lb := GET_TAB_PAGE_PROPERTY (v_tp_id, label);
                        --you get the lable for that particular tab page here

--here is to check the page name and associate your auto-query options--
   IF v_tp_lb LIKE 'TechHards WB%'
   THEN
      GO_BLOCK ('XX_TECHHARDS_KAB');
      EXECUTE_QUERY (no_validate);
   ELSIF v_tp_lb LIKE 'TechHards WB Pro%'
   THEN
      GO_BLOCK ('XX_TECHHARDS_PAB');
      EXECUTE_QUERY (no_validate);
   ELSIF v_tp_lb LIKE 'TechHards WB Free%'
   THEN
      GO_BLOCK ('XX_TECHHARDS_DAB');
      EXECUTE_QUERY (no_validate);
   ELSE
      NULL;
   END IF;
END;
=========================================================================
#Oracle Forms #Oracle Apps #EBS #Forms Trigger #WHEN-TAB-PAGE-CHANGED

Sunday, 16 July 2023

EBS : Step to change supplier name prompt in AP Invoice Workflow in Oracle Apps (r12)

 Step to change supplier name prompt in AP Invoice Workflow

Go to below table and update the display name

before change


After Change







***********************************************************************************
#Oracle Workflow #Oracle Apps # EBS #WF Notifications 

Important WF Tables:-
WF_Notifications 
WF_Notification_attributes





Oracle : How to convert Column to Row in SQL in Oracle Apps (r12)

Convert Text (column) to Row in Oracle Apps


SELECT REGEXP_SUBSTR(p_inv_org_id,'[^,]+', 1, LEVEL) COL1 FROM DUAL

                               CONNECT BY LEVEL <= REGEXP_COUNT(p_inv_org_id, ',') + 1


===========================================================================

#SQL QUERY #Oracle Apps #EBS #Column to Row conversion #PLSQL #r12 #REGEXP

EBS : API to Add / Remove Concurrent Program from Request Group in Oracle Apps (r12)

How to ADD / Remove concurrent 

Program using API in Request Group

 

Remove Concurrent Request from request Group

BEGIN

begin

    apps.fnd_program.remove_from_group

           (PROGRAM_SHORT_NAME  => 'XXTECHARDS_PROG',

            PROGRAM_APPLICATION => 'SQLAP',

            REQUEST_GROUP       => 'All_Payables',

            GROUP_APPLICATION   => 'SQLAP'

          );

    commit;

exception

    when no_data_found then

    dbms_output.put_line('Unable to remove from Request group');

end;

ADD Concurrent Request from request Group

begin

apps.fnd_program.add_to_group(

            PROGRAM_SHORT_NAME  => 'XXTECHARDS_TRANS',

            PROGRAM_APPLICATION => 'SQLAP',

            REQUEST_GROUP       => 'All_Payables',

            GROUP_APPLICATION   => 'SQLAP'

      );

=========================================================================

#Oracle Apps #EBS #Concurrent Request #Remove Concurrent Program from Request Group #Add Concurrent Program from Request Group #Request Group

#Add Concurrent Program to Request group without front end.

Tuesday, 11 July 2023

EBS : API To Delete Concurrent Program and Executable in Oracle Apps (R12)

API To Delete Concurrent Program and Executable from Backend in Oracle Apps


---API : How to Delete Concurrent Program Executable From Backend 
DECLARE
   v_executable_short_name   VARCHAR2 (200);
   v_application             VARCHAR2 (200);
BEGIN
   v_executable_short_name := 'XX_SHORTNAME'; ---Short name 
   v_application           := 'Payables';
   apps.fnd_program.delete_executable (executable_short_name      => v_executable_short_name,
                                       application                => v_application
                                      );
   COMMIT;
END;
--API : How to Delete Concurrent Program AND Executable From Backend ---
begin
fnd_program.delete_program('TECHHARDS_SHORTNAME','APPLICATION');
fnd_program.delete_executable('TECHHARDS_EXE_NAME','APPLICATION');
COMMIT;
end; 

***********************************************************************************
#Oracle Apps #EBS #Concurrent Program #Executable 

#How to Delete Concurrent Program through API
#How to Delete Concurrent Program Executable through API
# Fnd_Concurrent_Requests

EBS : Trigger in Sales Order Line Interface in Oracle Apps

 How to write Trigger in Sales Order Line Interface


/* Formatted on 2023/07/11 10:22 (Formatter Plus v4.8.8) */
CREATE OR REPLACE TRIGGER apps.xxfah_iriso_default_lin_trig
   BEFORE INSERT
   ON "ONT"."OE_LINES_IFACE_ALL"
   FOR EACH ROW
DECLARE
   l_seg1          NUMBER;
   l_seg2          VARCHAR2 (50);
   l_seg3          VARCHAR2 (50);
   l_city          VARCHAR2 (50);
   l_hdr_context   VARCHAR2 (50);
   l_item_id       NUMBER;
   l_orgn_id       NUMBER;
   l_lin_context   VARCHAR2 (50);
   l_segment1      VARCHAR2 (50);
BEGIN
   IF :NEW.order_source_id = 10
   THEN
      IF INSERTING
      THEN
--BEGIN
         :NEW.calculate_price_flag := 'Y';
         :NEW.CONTEXT := 'XXTECHHARDS Domestic';

--:NEW.ship_from_org_id :=l_seg1;
         BEGIN
            UPDATE ont.oe_headers_iface_all a1
               SET a1.ship_from_org_id = :NEW.ship_from_org_id
             WHERE a1.orig_sys_document_ref = :NEW.orig_sys_document_ref
               AND order_source_id = 10;
         EXCEPTION
            WHEN OTHERS
            THEN
               fnd_file.put_line
                  (fnd_file.LOG,
                      'Error in XXTECHHARDS_IRISO_DEFAULT_LIN_TRIG trigger..wXXTECHHARDSe updating ont.Oe_headers_iface_all: a1.ship_from_org_id  '
                   || SQLERRM
                  );
         END;

--commit;
         BEGIN
            SELECT attribute11
              INTO l_seg2
              FROM po.po_requisition_headers_all
             WHERE TO_CHAR (requisition_header_id) =
                                                    :NEW.orig_sys_document_ref;
         EXCEPTION
            WHEN OTHERS
            THEN
               fnd_file.put_line (fnd_file.LOG,
                                  'Error in fetching l_seg2' || SQLERRM
                                 );
         END;

         BEGIN
            SELECT attribute10
              INTO l_seg3
              FROM po.po_requisition_headers_all
             WHERE TO_CHAR (requisition_header_id) =
                                                    :NEW.orig_sys_document_ref;
         EXCEPTION
            WHEN OTHERS
            THEN
               fnd_file.put_line (fnd_file.LOG,
                                  'Error in fetching l_seg3' || SQLERRM
                                 );
         END;

         BEGIN
            SELECT item_id
              INTO l_item_id
              FROM po.po_requisition_lines_all a1
             WHERE requisition_header_id = :NEW.orig_sys_document_ref
               AND ROWNUM = 1;
         EXCEPTION
            WHEN OTHERS
            THEN
               fnd_file.put_line (fnd_file.LOG,
                                  'Error in fetching l_item_id' || SQLERRM
                                 );
         END;

         :NEW.attribute18 := :NEW.ship_to_city;
      END IF;
   END IF;
EXCEPTION
   WHEN OTHERS
   THEN
      fnd_file.put_line (fnd_file.LOG, 'Error in trigger ' || SQLERRM);
END;
/
EXIT

**********************************************************************************
#Oracle Apps #EBS #Trigger #PLSQL

#How to write trigger in Standard Interface Table

EBS : AR Interface Scripts in Oracle Apps (R12)

 AR Interface Scripts  in Oracle Apps (R12)



Some Important AR Interface Tables are :-

  • ra_interface_lines_all
  • ra_interface_distributions_all
  • ra_interface_errors_all

Standard Import Program Name :- Autoinvoice Import Program

Saturday, 1 July 2023

Java : Send Email from Java

Java Code to send email

package com;


import java.io.File;

import java.util.Date;

import java.util.Properties;

import javax.activation.DataHandler;

import javax.activation.DataSource;

import javax.activation.FileDataSource;

import javax.mail.Authenticator;

import javax.mail.Message;

import javax.mail.MessagingException;

import javax.mail.Multipart;

import javax.mail.PasswordAuthentication;

import javax.mail.Session;

import javax.mail.Transport;

import javax.mail.internet.AddressException;

import javax.mail.internet.InternetAddress;

import javax.mail.internet.MimeBodyPart;

import javax.mail.internet.MimeMessage;

import javax.mail.internet.MimeMultipart;


/********

* This class is used to utility that sends e-mail messages.

* @author TechHards

*******/

public class EmailSender {


    /*********

     * Sends an e-mail with attachments.

     * @param host address of the server

     * @param port port number of the server

     * @param userName email address used to send mails

     * @param password password of the email account

     * @param toAddress email address to send

     * @param subject title of the email

     * @param message content of the email

     * @param attachFiles an array of file paths

     * @throws AddressException

     * @throws MessagingException

     ********/

    public void sendEmail(String host, String port, String userName, String password,

            String toAddress, String subject, String message, String[] attachFiles)

                throws AddressException, MessagingException {

        // sets SMTP properties----

        Properties properties = new Properties();

        properties.put("mail.smtp.host", host);

        properties.put("mail.smtp.port", port);

        properties.put("mail.smtp.auth", "true");

        properties.put("mail.smtp.starttls.enable", "false");

        properties.put("mail.user", userName);

        properties.put("mail.password", password);


        // creates a new session with an authenticator

        Authenticator auth = new SMTPAuthenticator(userName, password);

        //Authenticator auth = new SMTPAuthenticator("finance", password);

        System.out.println("Authenticator reached"+password);

        

        Session session = Session.getInstance(properties, auth);


        // creates a new e-mail message

        MimeMessage msg = new MimeMessage(session);


        msg.setFrom(new InternetAddress(userName));

        InternetAddress[] toAddresses = {new InternetAddress(toAddress)};

        msg.setRecipients(Message.RecipientType.TO, toAddresses);

        msg.setSubject(subject);

        msg.setSentDate(new Date());


        // creates message part

        MimeBodyPart messageBodyPart = new MimeBodyPart();

        messageBodyPart.setContent(message, "text/html");


        // creates multi-part

        Multipart multipart = new MimeMultipart();

        multipart.addBodyPart(messageBodyPart);


        // adds attachments

        if (attachFiles != null && attachFiles.length > 0) {

            for (String filePath : attachFiles) {

                addAttachment_fnc(multipart, filePath);

            }

        }


        // sets the multi-part as e-mail's content

        msg.setContent(multipart);


        // sends the e-mail

        Transport.send(msg);


    }


    /******

     * You can add a file as an attachment to the email's content

     * @param p_multipart

     * @param p_filePath

     * @throws MessagingException

     *****/


    private void addAttachment_fnc(Multipart p_multipart, String p_filePath) throws MessagingException {

        MimeBodyPart l_attachPart = new MimeBodyPart();

        DataSource source = new FileDataSource(p_filePath);

        attachPart.setDataHandler(new DataHandler(source));

        attachPart.setFileName(new File(p_filePath).getName());


        p_multipart.addBodyPart(l_attachPart);

    }


    /**

     * This class is used to provides authentication information.

     * @author TechHards

     *

     */

    private class SMTPAuthenticator extends javax.mail.Authenticator {

        private String userName;

        private String password;


        public SMTPAuthenticator(String p_userName, String p_password) {

            this.userName = p_userName;

            this.password = p_password;

            System.out.println("#SMTPAuthenticator reached.User:"+p_userName);

            System.out.println("SMTPAuthenticator reached.pwd:"+p_password);

        }


        public PasswordAuthentication getPasswordAuthentication() {

        

        System.out.println("# PassAuthentication reached point");

            return new PasswordAuthentication(userName, password);

        }

    }

}

-----------------------------------------------------------------------------------------------------------------------------Call Java Program to send email

-----------------------------------------------------------------------------------------------------------------------------

package com;


import javax.mail.MessagingException;

import javax.mail.internet.AddressException;

import com.EmailSender.*;

import com.EmailSender;

 

public class TechHardsEmailSender {

    public static void main(String[] args) throws AddressException, MessagingException {

        String host = "mailgate";

        String port = "25";

        String mailFrom = "techhards.admin@outlook.com";

        String mailTo = "ebs@dilmahtea.com";

        //#String mailTo = "techhards.admin@gmail.com";

        String password = "Engineer";

        String userName = "Engineer.admin";

        String subject = "News email";

        String bodyMessage = "<html><b>Hello</b><br/><i>This is an HTML email with an attachment</i></html>";

        

        EmailSender sender = new EmailSender();

        String[] fileAttachment = null ;//{"/tmp/a.pdf"};

        sender.sendEmail(host, port, mailFrom, password, mailTo, subject, bodyMessage, fileAttachment);       

    }

}




--###############################################################################---

#Java #Email Send 
#FNDLOAD #Oracle Apps #Migration Utility #.lct #.ldt #EBS
#How to send Email from java
#Use Java Code to Send Email
#Send email add attachment

Saturday, 24 June 2023

EBS : Submit XML Publisher report from backend : Oracle Apps : RTF Layout

How to submit RTF Layout from Backend


DECLARE

   l_bool         BOOLEAN;

   l_request_id   NUMBER;

BEGIN

   fnd_global.apps_initialize (user_id           => 9999,--fnd_global.user_id,

                               resp_id           => 20560,--fnd_global.resp_id,

                               resp_appl_id      => 706--fnd_global.resp_appl_id

                              );

   l_bool :=

      fnd_request.add_layout (template_appl_name      => '''TECHHARDS''',

                              template_code           => '''TECHHARDS_OSP_COMP_SHRTG''',

                              template_language       => '''EN''',

                              template_territory      => '''IN''',

                              output_format           => '''PDF'''

                             );

   l_request_id :=

      fnd_request.submit_request (application      => '''TECHHARDS''',

                                  program          => '''TECHHARDS_OSP_COMP_SHRTG''',

                                  description      => '',

                                  start_time       => SYSDATE,

                                  sub_request      => NULL

                                 -- argument1        => fnd_global.org_id,

                                 -- argument2        => p_inv_id

                                 );


   IF l_request_id = 0

   THEN

   DBMS_OUTPUT.put_line (l_request_id);

     -- raise_application_error (-20001, '''Dear Unable to Submit Report''');

     

   END IF;


   DBMS_OUTPUT.put_line (l_request_id);

   COMMIT;

END;

=========================================================================
#Oracle #Oracle Apps#Oracle Database#Oracle Reports #Oracle PLSQL report #fnd_global.apps_initialize #fnd_request.submit_request #fnd_request.add_layout #Bi Publisher

Oracle APEX : Interview Question

 Oracle APEX : Interview Question


1.Session state in APEX?
Ans: A Session state enables programmer to store and retrieve values for a user as the user navigates between different application pages.


2.Session state protection used for in APEX?
Ans:This is a built-in functionality that prevents hackers from tampering with the URLs within your application.

3.What is Session ID?
Ans:A session ID is a unique number assigned a specific user for the duration of that user's visit.

4.Session?
Ans: A session is a logical construct that establishes persistence (or stateful behavior) across page views. Each session is assigned a unique identifier. The Application Express engine uses this identifier (or session ID) to store and retrieve an application's working set of data (or session state) before and after each page view.

5.What is Authorization Scheme and its types?

6. Difference between Page Items,Application Items and Global Page Items

Page Items: This item create in the Page Level. 
Application Items: This Items that are created at Application Level.
Global Page Items: This Global page of your application functions as a master page. You can add a separate Global page for each user interface. The Application Express engine renders all components you add to a Global page on every page within your application. 


***********************************************************************************
#Oracle apex #Apex #Interview Question

Thursday, 22 June 2023

EBS : API to Register Table in Oracle APPS

 EBS : API to Register Table in Oracle APPS

This section will guide you how to register tables to be used in Oracle Alerts and Flexfields with Oracle Applications. We will be learning about Procedures of AD_DD Package like procedure REGISTER_TABLE, REGISTER_COLUMN, DELETE_COLUMN, DELETE_TABLE,

Introduction

EBS comes with lots of seeded database tables, there can be multiple applications in which one might be required to create a custom table to be used. Flexfields (like KFF, DFF etc ) and Oracle Alert are the only features or products that require the custom tables to be registered in Oracle Apps

We can register custom application tables using a PL/SQL procedure in the AD_DD package.

We only need to register those tables (and all of their columns) that will be used. Application Object Library tables should you later modify your tables. If you alter the table later, then you may need to include revised or new calls to the table registration routines.

Alter registration steps:-

  • a)      a) delete the registration
  • b)     b) Re-register the table or column. Delete the column registration first, then the table registration.
  • c)      c) Commit your changes.


Example of calling AD_DD Package

1) Register Table

BEGIN

AD_DD.REGISTER_TABLE (&#39;FND&#39;,&#39;HARDTECH&#39;,&#39;T&#39;);

END;

2) Register Column

BEGIN

AD_DD.REGISTER_COLUMN (&#39;FND&#39;,&#39;TEST_DESC&#39;,&#39;RESOURCE_NAME&#39;, 1,&#39;VARCHAR2&#39;, 150, &#39;Y&#39;, &#39;N&#39;);

End;







Procedures in the AD_DD Package

1. Procedure REGISTER_TABLE

procedure register_table ( p_appl_short_name in varchar2,

p_tab_name in varchar2,

p_tab_type in varchar2,

p_next_extent in number default 512,

p_pct_free in number default 10,

p_pct_used in number default 70);

 

2. Procedure REGISTER_COLUMN

procedure register_column (p_appl_short_name in varchar2,

p_tab_name in varchar2,

p_col_name in varchar2,

p_col_seq in number,

p_col_type in varchar2,

p_col_width in number,

p_nullable in varchar2,

p_translate in varchar2,

p_precision in number default null,

p_scale in number default null);

3. Procedure DELETE_TABLE

procedure delete_table (p_appl_short_name in varchar2,

p_tab_name in varchar2);

4. Procedure DELETE_COLUMN

procedure delete_column (p_appl_short_name in varchar2,

p_tab_name in varchar2,

p_col_name in varchar2);

VARIABLE

NAMES

 

DESCRIPTION

 

p_appl_short_name The application short name of the application that owns the table

 

(usually your custom application).

 

p_tab_name The name of the table (in uppercase letters).

 

p_tab_type Use ’T’ if it is a transaction table (almost all application tables), or

’S’ for a ”seed data” table (used only by Oracle Applications

products).

 

p_pct_free The percentage of space in each of the table’s blocks reserved

for future updates to the table (1–99). The sum of p_pct_free and

p_pct_used must be less than 100.

 

p_pct_used Minimum percentage of used space in each data block of the

table (1–99). The sum of p_pct_free and p_pct_used must be

less than 100.

 

p_col_name The name of the column (in uppercase letters).

 

p_col_seq The sequence number of the column in the table (the order in

 

which the column appears in the table definition).

 

p_col_type The column type (’NUMBER’, ’VARCHAR2’, ’DATE’, etc.).

 

p_col_width The column size (a number). Use 9 for DATE columns, 38 for

 

NUMBER columns (unless it has a specific width).

 

p_nullable Use ’N’ if the column is mandatory or ’Y’ if the column allows null

 

values.

 

p_translate Use ’Y’ if the column values will be translated for an Oracle

Applications product release (used only by Oracle Applications

products) or ’N’ if the

values are not translated (most application columns).

 

p_next_extent The next extent size, in kilobytes. Do not include the ’K’.

 

p_precision The total number of digits in a number.

 

p_scale The number of digits to the right of the decimal point in a

 

number.

 

Example of Using the AD_DD Package

Here is an example of using the AD_DD package to register a flexfield table and its columns:

Though the use of AD_DD package does not require that the table should exist first, it is always

better to create one and proceed further. Use the below mentioned script to create the dummy

table. Use the APPS User ID to run the below mentioned queries from TOAD or SQL*PLUS.

CREATE TABLE TEST_DESC ( RESOURCE_NAME VARCHAR2 (150),

RESOURCE_TYPE VARCHAR2 (100),

ATTRIBUTE_CATEGORY VARCHAR2 (40),

ATTRIBUTE1 VARCHAR2 (150),

ATTRIBUTE2 VARCHAR2 (150),

ATTRIBUTE3 VARCHAR2 (150),

ATTRIBUTE4 VARCHAR2 (150),

ATTRIBUTE5 VARCHAR2 (150),

 

ATTRIBUTE6 VARCHAR2 (150)

);

Thursday, 8 June 2023

EBS : Password change from backend in Oracle APPS

 How to changes Password from Backend in Oracle Apps

DECLARE
           V_pwdchanged BOOLEAN;

      BEGIN
         v_pwdchanged := fnd_user_pkg.changepassword('TCHHARDS','12345');
         IF v_pwdchanged THEN
         DBMS_OUTPUT.put_line('password changed Sucessfully');
         ELSE
         DBMS_OUTPUT.put_line('Failed to change the Password');
        END IF;
      END;
      

*********************************************************************************
#Oracle Apps #EBS #fnd_user_pkg #Password 

EBS : PLSQL : How to generate ID based on input date : Oracle Apps

How to generate ID based on input date in PLSQL  

CREATE OR REPLACE FUNCTION generate_estqs_id (p_quote_date IN DATE)

   RETURN NUMBER

IS

   lv_month            NUMBER;

   lv_year             NUMBER;

   lv_year_next        NUMBER;

   lv_max_no           NUMBER;

   lv_from_date        DATE;

   lv_to_date          DATE;

   lv_quote_date       DATE;

   lv_estimtation_id   NUMBER;

BEGIN

   lv_quote_date := p_quote_date;


   SELECT TO_CHAR (lv_quote_date, 'MM')

     INTO lv_month

     FROM DUAL;


   DBMS_OUTPUT.put_line ('lv_month' || '-' || lv_month);


   IF lv_month IN ('01', '02', '03')

   THEN

      SELECT TO_CHAR (lv_quote_date, 'YY') - 1

        INTO lv_year

        FROM DUAL;

   ELSE

      SELECT TO_CHAR (lv_quote_date, 'YY')

        INTO lv_year

        FROM DUAL;

   END IF;


   lv_year_next := lv_year + 1;

   DBMS_OUTPUT.put_line (lv_year || '-' || lv_year_next);


   SELECT TO_CHAR ('01-Apr-' || lv_year), TO_CHAR ('31-Mar-' || lv_year_next)

     INTO lv_from_date, lv_to_date

     FROM DUAL;


   DBMS_OUTPUT.put_line (lv_from_date || '-' || lv_to_date);


   SELECT   NVL (SUBSTR (NVL (MAX (estimation_id), 0),

                         5,

                         LENGTH (MAX (estimation_id))

                        ),

                 0

                )

          + 1

     INTO lv_max_no

     FROM xx_estqs_hdr

    WHERE TRUNC (creation_date) BETWEEN lv_from_date AND lv_to_date;


   DBMS_OUTPUT.put_line ('lv_max_no' || '-' || lv_max_no);

   --lv_ESTIMTATION_id := lv_year || lv_year_next || '0000000' || lv_max_no;

   lv_estimtation_id := lv_year || lv_year_next || LPAD (lv_max_no, 8, 0);

   RETURN lv_estimtation_id;

EXCEPTION

   WHEN OTHERS

   THEN

      RETURN 'Unable to Generate ESTIMTATION Id';

END;

EBS : AP : Query to Get List Of Approver for IExpense Transaction using API : Oracle Apps

 Query to Get List Of Approver for IExpense Transaction using API  

Dynamic Approver List for AME



DECLARE
   p_application_id        NUMBER;
   p_transaction_type      VARCHAR2 (200);
   p_transaction_id        VARCHAR2 (200);
   p_apprs_view_type       VARCHAR2 (200);
   p_coa_insertions_flag   VARCHAR2 (200);
   p_ame_approvers_list    ame_approver_record2_table_ss ;---apps.ame_dynamic_approval_pkg.ame_approver_record2_table_ss;
   p_ame_order_type_list  ame_insertion_record2_table_ss:= ame_insertion_record2_table_ss(); --apps.ame_dynamic_approval_pkg.ame_insertion_record2_table_ss;
   p_all_approvers_count   VARCHAR2 (200);
   p_warning_msg_name      VARCHAR2 (200);
   p_error_msg_text        VARCHAR2 (200);
BEGIN
   p_application_id := 200;
   p_transaction_type := 'APEXP';
   p_transaction_id := 99878;
   p_apprs_view_type := 'Active';
   p_coa_insertions_flag := NULL;
   -- P_AME_APPROVERS_LIST := NULL;  Modify the code to initialize this parameter
   -- P_AME_ORDER_TYPE_LIST := NULL;  Modify the code to initialize this parameter
   p_all_approvers_count := NULL;
   p_warning_msg_name := NULL;
   p_error_msg_text := NULL;
   p_ame_approvers_list := ame_approver_record2_table_ss();
  apps.ame_dynamic_approval_pkg.get_ame_apprs_and_ins_list
                                                      (p_application_id,
                                                       p_transaction_type,
                                                       p_transaction_id,
                                                       p_apprs_view_type,
                                                       p_coa_insertions_flag,
                                                       p_ame_approvers_list,
                                                       p_ame_order_type_list,
                                                       p_all_approvers_count,
                                                       p_warning_msg_name,
                                                       p_error_msg_text
                                                      );
   DBMS_OUTPUT.put_line (   'Alam:-'
                         || p_all_approvers_count
                         || ','
                         || p_warning_msg_name
                         || ','
                         || p_error_msg_text
                        );
                        
                        
 IF(p_ame_approvers_list.count() ) > 0 THEN

FOR i IN 1..p_ame_approvers_list.count() LOOP

dbms_output.put_line(' approver_order_number =>'|| p_ame_approvers_list(i).approver_order_number
||' **** display_name =>'||p_ame_approvers_list(i).display_name
--' **** Approver Category =>'||p_ame_approvers_list(i).approver_category
--' **** approval_status =>' ||p_ame_approvers_list(i).approval_status
--' **** source =>'||p_ame_approvers_list(i).source 
);

END LOOP;

ELSE

dbms_output.put_line(' No Approver Found');

END IF;

END;                        
  -- COMMIT;
   
   
END;

MACROS : How to Remove tabs and carriage returns from worksheet cells in Excel

Remove tabs and carriage returns from worksheet cells

Sub CleanUp()

Dim TheCell As Range

 On Error Resume Next


 For Each TheCell In ActiveSheet.UsedRange

   With TheCell

     If .HasFormula = False Then

       .Value = Application.WorksheetFunction.Clean(.Value)

     End If

   End With

 Next TheCell

End Sub

 

Wednesday, 7 June 2023

EBS : PA Costing : Steps of Project Costing Expenditure Booking

 

Steps of Project Costing of Expenditure Booking

  1. Expenditure Entered      

 

select * from pa_expenditures_all where EXPENDITURE_GROUP ='Test' order by creation_date desc;

select * from pa_expenditure_items_all where EXPENDITURE_ID=878744;

 

  1. PRC: Distribute Labor Costs -> program ran to generate cost.

 

select acct_event_id,pcd.* from pa_cost_distribution_lines_all pcd where EXPENDITURE_item_ID in (1840951,1840952,1840953);

 

  1. PRC: Generate Cost Accounting Events -> Program ran to generate costing events and data will be generated in XLA

 

a.       Update eventid in pa_cost_distribution_lines_all

b.      Populate data in -> select * from xla_events where event_id in (36442497,36442498,36442499);

 

  1. PRC: Create Accounting -> populate data in subledger

 

select * from xla_ae_headers where event_id in (36442497,36442498,36442499)

order by creation_date desc;

select * from xla_ae_lines where  AE_HEADER_ID in (35023524,35023525,35023526);

order by creation_date desc;

 

  1. Journal Import -> create journal in GL and post it.

 

select * from gl_je_lines where reference_6 in ('36442497','36442498','36442499') --event_id

and reference_7 in ('35023524','35023525','35023526')    --ae_header_id

and je_header_id in (1685653,1685655,1685654)

 

select * from gl_je_headers  where je_category='Labor Cost' and je_source ='Project Accounting'

and je_header_id in (1685653,1685655,1685654) order by creation_date desc;

FUSION: Purchasing Query

  1) ---------CPA to PO Amount---------- select poh.segment1, (select sum(nvl(cpol.quantity,1)* cpol.unit_price) from po_headers_all cpoh,po...