Thursday, December 30, 2021

QUERY

  SELECT *

    FROM (  SELECT DISTINCT

                   APS.VENDOR_NAME,

                   TO_CHAR (inv.invoice_date, 'rrrr/mm/dd')

                       inv_date,

                   --                   INV.INVOICE_ID ,

                   --                   TO_CHAR (SYSDATE, 'dd/mm/rrrr hh24:mi:ss'),

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

                   TO_CHAR (

                       TO_DATE ( :P_FROM_DATE, 'RRRR/MM/DD HH24:MI:SS'),

                       'rrrr/mm/dd')

                       FROM_DATEX,

                   TO_CHAR (TO_DATE ( :P_TO_DATE, 'RRRR/MM/DD HH24:MI:SS'),

                            'rrrr/mm/dd')

                       TO_DATEX,

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


                   inv.DESCRIPTION,

                   (  SELECT SUM (amount) * -1

                        FROM AP_INVOICE_lines_ALL LL

                       WHERE     1 > LL.amount

                             AND LL.amount <> 0

                             AND LL.INVOICE_ID = INV.INVOICE_ID

                    GROUP BY INV.INVOICE_ID)

                       ded,

                   --------- ______

                   --INVL.INVOICE_LINE_ID,



                   aps.SEGMENT1,

                   INV.PO_HEADER_ID,

                   POH.COMMENTS

                       PROJECT,

                   INV.DISPUTE_REASON

                       INV_NUMBER,

                   (SELECT SUM (AMOUNT)

                      FROM AP_INVOICE_LINES_aLL

                     WHERE INVOICE_ID = INV.INVOICE_ID AND AMOUNT > 0)

                       INVOICE_AMOUNT,

                   --         CK.CHECK_NUMBER,

                   INV.ORG_ID,

                   --         LISTAGG (CK.CHECK_NUMBER, ', ')

                   --            WITHIN GROUP (ORDER BY INV.DISPUTE_REASON)

                   --            CHECKS,

                   --         SUM (INV.AMOUNT_PAID) AMOUNT_PAID,

                   CASE

                       WHEN INVOICE_TYPE_LOOKUP_CODE <> 'MIXED'

                       THEN

                           LISTAGG (CK.CHECK_NUMBER, ', ')

                               WITHIN GROUP (ORDER BY INV.DISPUTE_REASON)

                       ELSE

                           apps.xx_fin_pkg.xx_get_check_num_prep_inv (

                               inv.invoice_id,

                               INV.ORG_ID)

                   END

                       CHECKS,

                   CASE

                       WHEN INVOICE_TYPE_LOOKUP_CODE <> 'MIXED'

                       THEN

                           (INV.AMOUNT_PAID)

                       ELSE

                           0

                   END

                       AMOUNT_PAID,

                   aps.vendor_id,

                   INV.INVOICE_ID

              FROM AP_INVOICES_ALL      INV,

                   --                   AP_INVOICE_LINES_ALL INVL,

                   AP_CHECKS_ALL        CK,

                   AP_INVOICE_PAYMENTS_ALL PAY,

                   AP_SUPPLIERS         APS,

                   PO_HEADERS_ALL       POH

             WHERE     1 = 1

                   AND INV.CANCELLED_DATE IS NULL

                   AND PAY.INVOICE_ID(+) = INV.INVOICE_ID

                   AND CK.CHECK_ID(+) = PAY.CHECK_ID

                   AND INV.VENDOR_ID = APS.VENDOR_ID

                   AND INV.PO_HEADER_ID = POH.PO_HEADER_ID(+)

                   AND CK.VOID_DATE IS NULL

                   AND (INV.ORG_ID = :P_ORG_ID OR :P_ORG_ID IS NULL)

                   &p_VENDOR_ID_XX

--                   AND (aps.SEGMENT1 = :P_VENDOR_ID OR :p_VENDOR_ID IS NULL)

                   AND TRUNC (TO_DATE (inv.invoice_Date)) BETWEEN TO_DATE (

                                                                      :P_FROM_DATE,

                                                                      'RRRR/MM/DD HH24:MI:SS')

                                                              AND TO_DATE (

                                                                      :P_TO_DATE,

                                                                      'RRRR/MM/DD HH24:MI:SS')

          GROUP BY INV.DISPUTE_REASON,

                   INV.INVOICE_ID,

                   APS.VENDOR_NAME,

                   INV.PO_HEADER_ID,

                   POH.COMMENTS,

                   aps.SEGMENT1,

                   INV.ORG_ID,

                   aps.vendor_id,

                   inv.invoice_date,

                   INVOICE_TYPE_LOOKUP_CODE,

                   INV.AMOUNT_PAID,

                   inv.DESCRIPTION)

   WHERE     1 = 1

         AND (   CASE WHEN CHECKS IS NULL THEN 'NO' ELSE 'YES' END =

                 :P_IS_INV_PAID

              OR :P_IS_INV_PAID IS NULL)

ORDER BY 1, 2

PKG ORACLE APPS R12 -report Parameters WITH MULTI SELECT VALUES IN Concurrent Program

CREATE OR REPLACE PACKAGE APPS.xxparam_pkg

AS

--    PROCEDURE create_platter (x_errbuf           OUT VARCHAR2,

--                              x_retcode          OUT VARCHAR2,

--                              p_dummy_val   IN     VARCHAR2,

--                              p_list_val    IN     VARCHAR2);


    FUNCTION get_selected_list (p_val VARCHAR2)

        RETURN VARCHAR2;

         FUNCTION xxget_no_duplicate (p_value VARCHAR2)

        RETURN VARCHAR2;

END xxparam_pkg;

/

 

CREATE OR REPLACE PACKAGE BODY APPS.xxparam_pkg

AS

    --Package level variable which holds the value

    v_selected_list   VARCHAR2 (1000) := NULL;


    --    PROCEDURE create_platter (x_errbuf         OUT VARCHAR2,

    --                              x_retcode        OUT VARCHAR2,

    --                              p_dummy_val   IN     VARCHAR2,

    --                              p_list_val    IN     VARCHAR2)

    --    IS

    --    BEGIN

    --        --This will have the last selected values. Just ignore it :)

    ----        fnd_file.put_line (fnd_file.LOG, 'p_dummy_list : ' || p_dummy_val);

    ----        fnd_file.put_line (fnd_file.LOG, 'p_list_Values  : ' || p_list_val);

    --  null;  END create_platter;


    FUNCTION get_selected_list (p_val VARCHAR2)

        RETURN VARCHAR2

    IS

    BEGIN

        IF p_val = '0'

        THEN

            v_selected_list := NULL;

        ELSE

            --Concatenate the selected value to the existing list

            SELECT DISTINCT

                      NVL2 (v_selected_list,

                            v_selected_list || ',',

                            v_selected_list)

                   || p_val

              INTO v_selected_list

              FROM DUAL;

        END IF;


        RETURN v_selected_list;

    END;


    FUNCTION xxget_no_duplicate (p_value VARCHAR2)

        RETURN VARCHAR2

    AS

        l_value   VARCHAR2 (2000);

    BEGIN

        SELECT REGEXP_REPLACE (p_value, '(^|,)([^,]*)(,\2)+', '\1\2')

          INTO l_value

          FROM DUAL;


        RETURN l_value;

    EXCEPTION

        WHEN OTHERS

        THEN

            RETURN p_value;

    END xxget_no_duplicate;

END;

/

ORACLE APPS R12 -report Parameters WITH MULTI SELECT VALUES IN Concurrent Program

 We had a requirement to select multiple values from a list when submitting the Concurrent Program.

Few of the options suggested were as below:

1. Create a custom Form and capture the values and then submit the Concurrent Program form a button click .  

  • This was ruled out as we didn't want to create a new Form

2. Let the users enter a comma separated values in the parameter field and split the values in the code.

  • This was ruled out as there is a probability that the user may enter wrong values
  • We found a blog where someone suggested some solution with some limitations. 

    The solution given below is without the limitation mentioned in the above link. The limitation we have is the length of the parameter field (240 characters). I have suggested a workaround for that also below.

Edited: This solution needs to be read along with the below post.

Oracle Apps: How to set Concurrent Program Parameter Disabled / Readonly

The Concurrent Program example given below has 2 Parameters. One is the original list and the second is the selected values from the list.

  1.  Create a Valueset with the needed values. Make sure that you have an extra value in the list, which will be user to clear the selected list. In my example I have created a valueset with the list of Vendors. Please note, there is a value in the list 'Clear'. Usage of the value '0' is explained below.


Case

So we use two input

1-     Select the Vendor

2-     Collect all the selected values

 

 

Solution

1-     Main point is Create DB Pkg as link 

2-     Create Parameters first for all Vendors as any Normal VS we use

Note:- TOKEN VALUE USE ANY CHAR IT JUST TO SHOW FOR THE USER NOT USE IN THE REPORT QUERY

v_selected_list. If the value 0  selected in the first parameter, the function will clear the package variable and then also remove the values from the second parameter. Package level variable is visible only on the session, so if multiple users try to submit the job at the same time, this will not cause any issues.




 

3-     Create the main Parameter of collect the selected vendors (also I used Dummy Parameter’x2’ not use on query or Report for the User and the user can see the selected values) note I faced Duplicated Value in the values so I created a function by regular Expression to Avoid Duplication


240 Characters

Default Type: 

SQL Statement

Default Value : 

Sql Statement = select xxparam_pkg.xxget_no_duplicate(  xxparam_pkg.get_selected_list(:$FLEX$.XXvendorList) ) from dual  



4-     Same previos Paramters only I added the Real Parameter value in Token with update on the

Sql Statmnet = select 'and  APS.segment1 IN  ('||xxparam_pkg.get_selected_list(:$FLEX$.XXvendorList)||')' from dual

And in report I add the Parameter using &P_vendor_id_xx this is the Only Update on The Report  



 

5-     Rdf report ONLY WE UPDATE THE PARAMETERS &P_NAME AS WE SAID

6- REPORT QUERY HERE

Thursday, September 3, 2020

IBM Watson New project or upload python script

IBM Watson new project 

open  https://cloud.ibm.com/

then from navigator select Watson 


then services 



open Watson Studio 



select your service plan and we will use free service for now


and create it as a first step and for your info service create for free once if u will create again needs upgrade your account


next page click on get started and the previous step u will create it Once

create New Project 

- by click on new Project or there is a recent projects you can find it in Overview 



create Empty Project and storgare selection is disable because we are already select in the beginning the free service  so its default selected 




then project name 



then select add to prject and the tab of asset will be for data files



asset tab


after add to project click select the note book




then create the note book 

add name testx2 then create


or you can select already created python note book file 




now write your python code ;) 




SQL Query to Convert number into Words for Money

SELECT INITCAP ( DECODE ( FLOOR (TO_NUMBER ( :amount)), 0, '', TO_CHAR (TO_DATE...