Friday, 27 February 2015

API to create or Update UDA attributes in supplier Hub

set serveroutput on
DECLARE
  ln_party_id              NUMBER    := 99999;
  ln_attr_num              NUMBER    := NULL;
  ln_msg_index_out         NUMBER    := NULL;
 
  lv_attr_char             VARCHAR2(50) := 'CR';
  lv_failed_row_id_list    VARCHAR2(100)  := NULL;
 
  ldt_attr_date            DATE      := NULL;
 
  lv_pk_column_values      ego_col_name_value_pair_array;
  lv_attributes_row_table  ego_user_attr_row_table;
  lv_attributes_data_table ego_user_attr_data_table;
  lv_class_code            ego_col_name_value_pair_array;
 
  lv_return_status         VARCHAR2(10)   := NULL;
  ln_msg_count             NUMBER         := 0;
  lv_msg_data              VARCHAR2(1000) := NULL;
  ln_errorcode             NUMBER         := 0;
BEGIN
  fnd_global.apps_initialize(1234, 68654, 177);
 
  lv_pk_column_values := ego_col_name_value_pair_array(ego_col_name_value_pair_obj
                                                      ('PARTY_ID',ln_party_id));
 
  lv_class_code := ego_col_name_value_pair_array(ego_col_name_value_pair_obj
                                              ('CLASSIFICATION_CODE','BS:BASE'));
  lv_attributes_data_table := ego_user_attr_data_table(
                                         ego_user_attr_data_obj
                                         (row_identifier       => 1,
                                          attr_name            => 'C_ATTR3',
                                          attr_value_str       => 'CR',
                                          attr_value_num       => NULL,
                                          attr_value_date      => NULL,
                                          attr_disp_value      => NULL,
                                          attr_unit_of_measure => NULL,
                                          user_row_identifier  => 1),
                                         ego_user_attr_data_obj
                                         (row_identifier       => 1,
                                          attr_name            => 'Attr1',--'A3',
                                          attr_value_str       => lv_attr_char,
                                          attr_value_num       => ln_attr_num,
                                          attr_value_date      => ldt_attr_date,
                                          attr_disp_value      => NULL,
                                          attr_unit_of_measure => NULL,
                                          user_row_identifier  => 1));
 
    lv_attributes_row_table := ego_user_attr_row_table(ego_user_attr_row_obj
                                        (row_identifier    => 1,
                                         attr_group_id     => NULL,
                                         attr_group_app_id => 177,
                                         attr_group_type   => 'POS_SUPP_PROFMGMT_GROUP',
                                         attr_group_name   => 'XX_CUST_ATTR_GRP_NAME',
                                         data_level        => 'SUPP_LEVEL', --for site level use SUPP_SITE_LEVEL
                                         data_level_1      => 'N',
                                         data_level_2      => NULL,
                                         data_level_3      => NULL,
                                         data_level_4      => NULL,
                                         data_level_5      => NULL,
                                         transaction_type  => ego_user_attrs_data_pvt.g_sync_mode)); --for update use g_update_mode
 
    --Supplier uda updation started
    pos_vendor_pub_pkg.process_user_attrs_data
                      (p_api_version                 => 1.0,
                       p_attributes_row_table        => lv_attributes_row_table,
                       p_attributes_data_table       => lv_attributes_data_table,
                       p_pk_column_name_value_pairs  => lv_pk_column_values,
                       p_class_code_name_value_pairs => lv_class_code,
                       x_failed_row_id_list          => lv_failed_row_id_list,
                       x_return_status               => lv_return_status,
                       x_errorcode                   => ln_errorcode,
                       x_msg_count                   => ln_msg_count,
                       x_msg_data                    => lv_msg_data);      
  IF lv_return_status = 'S' THEN
    dbms_output.put_line('return_status: ' || lv_return_status);
    dbms_output.put_line('msg_data: ' || lv_msg_data);
    commit;
  ELSE
    dbms_output.put_line ('Error Message Count : ' || ln_msg_count);
    dbms_output.put_line ('Error Message Data  : ' || lv_msg_data);
    dbms_output.put_line ('Error Code          : ' || ln_errorcode);
    dbms_output.put_line ('Entering Error Loop ');
    FOR i IN 1 .. ln_msg_count
    LOOP
      fnd_msg_pub.get(p_msg_index     => i,
                      p_data          => lv_msg_data,
                      p_encoded       => 'F',
                      p_msg_index_out => ln_msg_index_out);
      fnd_message.set_encoded(lv_msg_data);
      dbms_output.put_line ('Inside Error Loop : ' || i || ', ' || lv_msg_data);
    END LOOP;
    rollback;
  END IF;
EXCEPTION
  WHEN OTHERS THEN
    dbms_output.put_line ('Error : ' || SQLCODE);
    dbms_output.put_line ('Error : ' || SQLERRM);
    rollback;
END; 

No comments:

Post a Comment

AP Invoice Notes related Table details in Oracle Fusion

 What is the table that stores the AP Invoice notes? AP notes are stored in ZMM_NOTES table with SOURCE_OBJECT_CODE = 'AP_STANDARD_INVOI...