Using OKS_CASCADE_ATTRIBUTES_PUB.oks_cascade_attributes to cascade line dates to sub line of Service Contract

 

DECLARE 
        --Local variable
        l_contract_id                  NUMBER;
        lx_return_status               VARCHAR2(1);
        lx_msg_count                   NUMBER;
        lx_msg_data                    VARCHAR2(4000);
        l_msg_data                     VARCHAR2(4000);
        
        lp_header_lines_tbl            OKS_CASCADE_ATTRIBUTES_PUB.cas_header_lines_tbl_type;
        lp_lines_sublines_tbl          OKS_CASCADE_ATTRIBUTES_PUB.cas_lines_sublines_tbl_type;
        lx_msg_tbl                     OKS_ATTR_DEFAULTS_PVT.attr_msg_tbl_type;
        lx_line_msg_tbl                OKS_ATTR_DEFAULTS_PVT.attr_msg_tbl_type;
        

BEGIN
	
    fnd_global.apps_initialize(
        user_id => 263915 ,    --FND_USER.USER_ID
        resp_id => 56785,      --OM Service Contracts
        resp_appl_id => 515    --OKS
    );
        

    SELECT  okc.id
            INTO l_contract_id   --2698262
    FROM    okc_k_headers_all_b okc
    WHERE   1=1
    AND     okc.contract_number = '112348';
    
    --Set the org context for okc
    OKC_CONTEXT.set_okc_org_context(p_chr_id => l_contract_id);

    /*
    select * 
    from    okc_k_lines_b 
    where   dnz_chr_id = l_contract_id and chr_id=l_contract_id;
    */
    
    lp_lines_sublines_tbl(1).contract_line_id := '295520844472982192095195610780854432106';    
    /* Intentionally passing line_id as subline_id not working*/
    lp_lines_sublines_tbl(1).subline_id       := '295520844472982192095195610780854432106'; 
    lp_lines_sublines_tbl(1).dates_flag       := 'Y';
    
    
                        
	OKS_CASCADE_ATTRIBUTES_PUB.oks_cascade_attributes(
        p_contract_id           => l_contract_id,
        header_lines_tbl        => lp_header_lines_tbl,
        lines_sublines_tbl      => lp_lines_sublines_tbl,
        X_return_status         => lx_return_status,
        x_msg_tbl               => lx_msg_tbl,
        x_line_msg_tbl          => lx_line_msg_tbl 
    );

	
    DBMS_OUTPUT.put_line(' lx_return_status : '|| lx_return_status );
    DBMS_OUTPUT.put_line(' lx_msg_count: '|| lx_msg_count );
    DBMS_OUTPUT.put_line(' lx_msg_data: '|| replace(lx_msg_data,chr(0),' ' ));
    DBMS_OUTPUT.put_line(' fnd_msg_pub.count_msg: '|| fnd_msg_pub.count_msg );
        
        
    IF lx_return_status='S' THEN
        COMMIT;
    ELSE
        FOR i IN 1..fnd_msg_pub.count_msg
        LOOP
            l_msg_data := FND_MSG_PUB.Get(i, p_encoded => FND_API.G_FALSE);
            DBMS_OUTPUT.put_line(l_msg_data);
        END LOOP;
    END IF;
    
END;

Comments