Tuesday 24 May 2011

Project template creation in PA using standard API.

Here is a sample script which uses standard Oracle API pa_proj_template_setup_pub.create_project_template to create Project template in Project Accounts


DECLARE
    l_template_id  number;
    l_return_status varchar2(2);
    l_msg_count number;
    l_msg_data varchar2(250);
    l_msg_index_out NUMBER := 0;
    l_msg_data1 VARCHAR2 (2000);
BEGIN
      mo_global.init('PA');
       pa_proj_template_setup_pub.create_project_template
                                 (p_api_version              => 1,
                                  p_init_msg_list            => 'T',
                                  p_commit                      => 'F',
                                  p_validate_only          => 'T',
                                  p_validation_level      => 1,
                                  p_calling_module       => 'SELF_SERVICE',
                                  p_debug_mode           => 'N',
                                  p_max_msg_count     => 1,
                                  p_project_number      => 'Cost',
                                  p_project_name          => 'Cost',
                                  p_project_type            => 'Construction',
                                  p_organization_id       => 246,
                                  p_organization_name => 'VisionCorporation',
                                  p_effective_from_date => '23-may-2011',
                                  p_effective_to_date     => '24-may-2011',
                                  p_description                => 'JUNK_CHARS',
                                  p_security_level           => 0,
                                  p_long_name                => NULL,
                                  p_operating_unit_id   => 202,
                                  x_template_id              => l_template_id,
                                  x_return_status           => l_return_status,
                                  x_msg_count               => l_msg_count,
                                  x_msg_data                 => l_msg_data
                                 );
    dbms_output.put_line('l_return_statusd: '||l_return_status);
    dbms_output.put_line('l_msg_data: '||l_msg_data);
    dbms_output.put_line ('l_msg_count :'||l_msg_count);
    dbms_output.put_line('Template_id: '||l_template_id);
IF (l_return_status = 'E' AND l_msg_count > 0)
THEN
FOR i IN 1 .. fnd_msg_pub.count_msg
LOOP

      fnd_msg_pub.get (p_msg_index => i,
                                       p_data => l_msg_data,
                                       p_encoded => 'F',
                                       p_msg_index_out => l_msg_index_out
                                    );

       l_msg_data1 := l_msg_data1 || ' ' || l_msg_data;

      DBMS_OUTPUT.put_line ('Value is' || l_msg_data1);

END LOOP;   
END IF;                               
END;
/


No comments:

Post a Comment