Sunday 28 August 2016

Query to check Business Event and its Subscription details from Backend

Kindly enter Business event name in below query to get details for business event and its subscriptions.

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

select we.name
  ,we.status event_status
  ,wes.status subscription_status
  ,nvl(wes.phase,0) subscription_phase
  ,wes.licensed_flag subscription_licensed_flag
  ,we.licensed_flag event_licensed_flag
  ,wes.rule_function
from wf_events we
  ,wf_event_subscriptions wes
where
  we.name like 'xxcust.oracle.apps.cust.testBusinessEvent'
  and wes.event_filter_guid = we.guid;

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




Wednesday 17 August 2016

API to insert notes in AR transactions

To insert notes into AR transaction kindly used ARP_NOTES_PKG.insert_p API.
This API will take record variable as input parameter. we need to assigned value to it as shown in below given script.

================================================
DECLARE
  l_notes_rec ar_notes%rowtype;
begin

  --apps initialize
  mo_global.init('AR');
  mo_global.set_policy_context('S', '204');
  --
   l_notes_rec.customer_trx_id        := 1545557; -- Customer_trx_id
  l_notes_rec.note_type              := 'MAINTAIN';
  l_notes_rec.text                   := 'Test for AR note';
  l_notes_rec.customer_call_topic_id := NULL;
  l_notes_rec.call_action_id         := NULL;
  l_notes_rec.customer_call_id       := NULL;
 -- call API to insert note
  ARP_NOTES_PKG.insert_p(l_notes_rec);
--
  commit;
  dbms_output.put_line('Note inserted reference note id : ' || l_notes_rec.note_id);
END;
==================================================

screenshot for AR invoice workbench transaction notes.



===================================================
One can query this record from backend by using below given query.

select * from ar_notes_v 
where customer_trx_id=1545557;
===================================================

Tuesday 16 August 2016

How to insert/update short text attachment for AR transaction using API

Below given script you can use to insert / update short text attachment for AR invoice.
Kindly pass parameter TRX_Number value for which you want to add short text.


====================================================
DECLARE
  l_rowid                ROWID;
  l_attached_document_id NUMBER;
  l_document_id          NUMBER;
  l_media_id             NUMBER;
  l_user_id              NUMBER;
  l_category_id          NUMBER;
  l_pk1_value            fnd_attached_documents.pk1_value%TYPE;
  l_description          fnd_documents_tl.description%TYPE;
  l_seq_num           NUMBER;
  lv_short_text       VARCHAR2(1000);
  lv_bill_address1    VARCHAR2(1000);
  lv_bill_address2    VARCHAR2(1000);
  lv_bill_city        VARCHAR2(1000);
  lv_bill_state       VARCHAR2(1000);
  lv_bill_countryid   VARCHAR2(1000);
  lv_bill_postalcode  VARCHAR2(1000);
  l_title             VARCHAR2(1000);
  l_security_id       NUMBER;
  l_storage_type      VARCHAR2(1000);
  l_image_type        VARCHAR2(1000);
  l_start_date_active DATE;
  l_end_date_active   DATE;
  l_usage_type        VARCHAR2(1000);
  lv_notes_cnt        NUMBER;
  lv_bill_company     VARCHAR2(1000);
BEGIN
  SELECT customer_trx_id into l_pk1_value
  from ra_customer_trx_all
  where trx_number=&TRX_NUMBER; --AR TRANSACTION NUMBER

  SELECT user_id into l_user_id
  from fnd_user
  where user_name ='XXUSER';

  BEGIN
    SELECT COUNT(1)
      INTO lv_notes_cnt
      FROM fnd_attached_documents
     WHERE entity_name = 'RA_CUSTOMER_TRX'
       AND pk1_value = l_pk1_value;
  EXCEPTION
    WHEN OTHERS THEN
      lv_notes_cnt := NULL;
  END;

  IF lv_notes_cnt = 0 THEN
    l_description := 'Line level Notes';

    BEGIN
      SELECT fnd_documents_s.NEXTVAL INTO l_document_id FROM DUAL;
    EXCEPTION
      WHEN OTHERS THEN
        l_document_id := 1;
    END;

    BEGIN
      SELECT fnd_attached_documents_s.NEXTVAL
        INTO l_attached_document_id
        FROM DUAL;
    EXCEPTION
      WHEN OTHERS THEN
        l_attached_document_id := 1;
    END;

    BEGIN
      SELECT NVL(MAX(seq_num), 0) + 10
        INTO l_seq_num
        FROM fnd_attached_documents
       WHERE pk1_value = l_pk1_value
         AND entity_name = 'RA_CUSTOMER_TRX';
    EXCEPTION
      WHEN OTHERS THEN
        l_seq_num := 1;
    END;

    BEGIN
      SELECT category_id
        INTO l_category_id
        FROM fnd_document_categories_vl
       WHERE name = 'MISC';
    EXCEPTION
      WHEN OTHERS THEN
        l_category_id := NULL;
    END;

    fnd_documents_pkg.insert_row(x_rowid             => l_rowid,
                                 x_document_id       => l_document_id,
                                 x_creation_date     => SYSDATE,
                                 x_created_by        => l_user_id,
                                 x_last_update_date  => SYSDATE,
                                 x_last_updated_by   => l_user_id,
                                 x_last_update_login => l_user_id,
                                 x_datatype_id       => 1,
                                 x_category_id   => l_category_id,
                                 x_security_type => 2,
                                 x_publish_flag  => 'Y',
                                 x_usage_type    => 'O',
                                 x_language      => 'US',
                                 x_description   => l_description,
                                 x_file_name     => NULL,
                                 x_title         => 'Line level Notes',
                                 x_media_id      => l_media_id);
    fnd_documents_pkg.insert_tl_row(x_document_id       => l_document_id,
                                    x_creation_date     => SYSDATE,
                                    x_created_by        => l_user_id,
                                    x_last_update_date  => SYSDATE,
                                    x_last_updated_by   => l_user_id,
                                    x_last_update_login => l_user_id,
                                    x_language          => 'US',
                                    x_description       => l_description                                
                                    );
    fnd_attached_documents_pkg.insert_row(x_rowid                    => l_rowid,
                                          x_attached_document_id     => l_attached_document_id,
                                          x_document_id              => l_document_id,
                                          x_creation_date            => SYSDATE,
                                          x_created_by               => l_user_id,
                                          x_last_update_date         => SYSDATE,
                                          x_last_updated_by          => l_user_id,
                                          x_last_update_login        => l_user_id,
                                          x_seq_num                  => l_seq_num,
                                          x_entity_name              => 'RA_CUSTOMER_TRX',
                                          x_column1                  => NULL,
                                          x_pk1_value                => l_pk1_value,
                                          x_pk2_value                => NULL,
                                          x_pk3_value                => NULL,
                                          x_pk4_value                => NULL,
                                          x_pk5_value                => NULL,
                                          x_automatically_added_flag => 'N',
                                          x_datatype_id              => 1,
                                          x_category_id              => l_category_id,
                                          x_security_type            => 2,
                                          x_publish_flag             => 'Y',
                                          x_language                 => 'US',
                                          x_description              => l_description,
                                          x_media_id                 => l_media_id);
                                       
                                          DBMS_OUTPUT.PUT_LINE ('Media id '||l_media_id);
                                       
                                          lv_short_text := 'Test for short text attachment INSERT';

    INSERT INTO fnd_documents_short_text
    VALUES
      (l_media_id, lv_short_text, NULL);

    COMMIT;
  ELSIF lv_notes_cnt > 0 THEN
    SELECT MAX(document_id),
           category_id,
           seq_num,
           ROWID,
           attached_document_id
      INTO l_document_id,
           l_category_id,
           l_seq_num,
           l_rowid,
           l_attached_document_id
      FROM fnd_attached_documents
     WHERE entity_name = 'RA_CUSTOMER_TRX'
       AND pk1_value = l_pk1_value
     GROUP BY category_id, seq_num, ROWID, attached_document_id;

    SELECT description,
           title,
           fd.media_id,
           fd.security_id,
           fd.storage_type,
           fd.image_type,
           fd.start_date_active,
           fd.end_date_active,
           fd.usage_type
      INTO l_description,
           l_title,
           l_media_id,
           l_security_id,
           l_storage_type,
           l_image_type,
           l_start_date_active,
           l_end_date_active,
           l_usage_type
      FROM fnd_documents_tl fdt, fnd_documents fd
     WHERE fdt.document_id = fd.document_id
       AND fdt.document_id = l_document_id;

    ---------------------
    BEGIN
      fnd_documents_pkg.update_row(x_document_id       => l_document_id,
                                   x_last_update_date  => SYSDATE,
                                   x_last_updated_by   => l_user_id,
                                   x_last_update_login => l_user_id,
                                   x_datatype_id       => 1,
                                   x_category_id       => l_category_id,
                                   x_security_type     => 2,
                                   x_security_id       => l_security_id,
                                   x_publish_flag      => 'Y',
                                   x_image_type        => l_image_type,
                                   x_storage_type      => l_storage_type,
                                   x_usage_type        => 'O',
                                   x_start_date_active => l_start_date_active,
                                   x_end_date_active   => l_end_date_active,
                                   x_language          => 'US',
                                   x_description       => l_description,
                                   x_file_name         => NULL,
                                   x_media_id          => l_media_id,
                                   x_title             => l_title);
    EXCEPTION
      WHEN OTHERS THEN
        NULL;
    END;

    BEGIN
      fnd_documents_pkg.update_tl_row(x_document_id       => l_document_id,
                                      x_last_update_date  => SYSDATE,
                                      x_last_updated_by   => l_user_id,
                                      x_last_update_login => l_user_id,
                                      x_language          => 'US',
                                      x_description       => l_description,
                                      x_title             => l_title);
    EXCEPTION
      WHEN OTHERS THEN
        NULL;
    END;

    BEGIN
      fnd_attached_documents_pkg.update_row(x_rowid                    => l_rowid,
                                            x_attached_document_id     => l_attached_document_id,
                                            x_document_id              => l_document_id,
                                            x_last_update_date         => SYSDATE,
                                            x_last_updated_by          => l_user_id,
                                            x_last_update_login        => l_user_id,
                                            x_seq_num                  => l_seq_num,
                                            x_entity_name              => 'RA_CUSTOMER_TRX',
                                            x_column1                  => NULL,
                                            x_pk1_value                => l_pk1_value,
                                            x_pk2_value                => NULL,
                                            x_pk3_value                => NULL,
                                            x_pk4_value                => NULL,
                                            x_pk5_value                => NULL,
                                            x_automatically_added_flag => 'N',
                                            x_datatype_id              => 1,
                                            x_category_id              => l_category_id,
                                            x_security_type            => 2,
                                            x_publish_flag             => 'Y',
                                            x_usage_type               => l_usage_type,
                                            x_start_date_active        => l_start_date_active,
                                            x_end_date_active          => l_end_date_active,
                                            x_language                 => 'US',
                                            x_description              => l_description,
                                            x_media_id                 => l_media_id,
                                            x_title                    => l_title);
                                            DBMS_OUTPUT.PUT_LINE ('Media id '||l_media_id);
    EXCEPTION
      WHEN OTHERS THEN
        NULL;
    END;

    lv_short_text := 'Test for short text attachment UPDATE';
 
     UPDATE fnd_documents_short_text SET short_text = lv_short_text WHERE media_id = l_media_id;

    COMMIT;
  END IF;
EXCEPTION
  WHEN OTHERS THEN
    NULL;
END;
====================================================================

CHECK FOR AR TRANSACTION ATTACHMENT POST SCRIPT RUN



Wednesday 10 August 2016

Solution for error "fdlget failed due to ORA-24345 : A Truncation or Null fetch error occurs" for Table Type value set.

Solution for error "fdlget failed due to ORA-24345 : A Truncation or Null fetch error occurs" for Table Type value set.



Suppose you define one concurrent program say "Custom Trial Balance Report".
For this program you have three parameter as below given.
a) Ledger Name
b) Period Name
c) Cost Center

While defining value set for Ledger name suppose you set its Maximum size as 20.



And same value set you attached to you concurrent program. While running concurrent program when you try to get value for Ledger Name parameter it may be give you above screenshot error. if it exist ledger name with size greater than 20.

Solution:

Kindly change your value set Maximum size to exact size for table column width.
in this case GL_LEDGERS.NAME column size is 30 char.



Once you made changes to value set. Kindly save the changes and try to run concurrent program.
Now you can see error for value set is resolved.


Friday 5 August 2016

How to create soft link for host program

Kindly create shell script xxcust_test_shell_script and save it as .prog. Then transfer it to XXCUST_TOP/bin folder by using putty/winscp.

How to find XXCUST_TOP folder path?

a)By using Putty : 
simply write below command you will get path.
> echo $xxcust_top
app01(erpdev) /product/appl/apps/apps_st/appl/xxcust

b)By using SQL query:

select variable_name, value
from fnd_env_context 
where variable_name like 'XXCUST%';

Step to create soft link for host program:

Step 1:Go to the custom top as below:
>cd $XXCUST_TOP/bin
app01(erpdev)/product/appl/apps/apps_st/appl/xxcust/12.0.0/bin

Step 2: Use 'fndcpesr' command to create soft link

$pwd
app01(erpdev) /product/appl/apps/apps_st/appl/xxcust/12.0.0/bin

$ln -s $FND_TOP/bin/fndcpesr xxcust_test_shell_script

Note: Kindly mentioned only file name without extension (.prog) while creating soft link.

Once this command executed you can see new xxcust_test_shell_script link file got created. kindly refresh winscp XXCUST_TOP/bin folder to view new file.

How to resolve issue for BIP RTF template XML tags showing value as <?ref: 0000xx?>

 How to resolve issue for BIP RTF template XML tags showing value as <?ref: 0000xx?>  Sometime these xml data tags automatically chang...