Create and Close Exceptions on deliveries and trips

This post I will show how to apply and close exceptions a one delivery.

Sem título

DECLARE

    p_exception_rec             WSH_EXCEPTIONS_PUB.xc_action_rec_type;
    lx_msg_count                NUMBER;
    lx_msg_data                 VARCHAR2 (2000);
    lx_return_status            VARCHAR2 (200);
    l_message                   VARCHAR2 (2000);
    l_msg_index_out             NUMBER;
    
    BEGIN
        
        fnd_global.apps_initialize(26801,21623,665);
            
        p_exception_rec.exception_name               := 'ATRASO NA ENTREGA';
        p_exception_rec.logged_at_location_code      := 'DFB-ZONA DE RECEPÇÃO';
        p_exception_rec.exception_location_code      := 'DFB-ZONA DE RECEPÇÃO';
        p_exception_rec.message                      := 'Esse produto está vencido a mais de 15 dias, entre em contato com o comercial para revisar a data de entrega';
        p_exception_rec.trip_name                    := 7218743;
        p_exception_rec.delivery_detail_id           := 9629195;
        p_exception_rec.logging_entity               := 'Shipper';
        p_exception_rec.manually_logged              := 'T';
        p_exception_rec.logging_entity_id            := 26801;
        p_exception_rec.severity                     := 'ERROR';
                                    
                                   
        WSH_EXCEPTIONS_PUB.Exception_Action (p_api_version      => 1.0, 
                                             p_init_msg_list    => NULL, 
                                             p_validation_level => NULL, 
                                             p_commit           => FND_API.g_false, 
                                             x_msg_count        => lx_msg_count, 
                                             x_msg_data         => lx_msg_data, 
                                             x_return_status    => lx_return_status, 
                                             p_exception_rec    => p_exception_rec,
                                             p_action           => 'LOG');
                                                                         
        DBMS_OUTPUT.PUT_LINE ('count : ' || lx_msg_count);
        DBMS_OUTPUT.PUT_LINE ('data : ' || lx_msg_data);
        DBMS_OUTPUT.PUT_LINE ('return_satus : ' || lx_return_status);
                                    
        IF lx_return_status <> 'S' THEN
        FOR I IN 1 .. fnd_msg_pub.count_msg   
        LOOP
            DBMS_OUTPUT.PUT_LINE ('retorno API: ' || fnd_msg_pub.get (p_encoded => fnd_api.g_false));
        END LOOP;
        ELSE
            DBMS_OUTPUT.PUT_LINE ('Deu certo');
            COMMIT;
        END IF;
END;

Exception applied with success.

Sem título

And after close this exception….

DECLARE

p_exception_rec WSH_EXCEPTIONS_PUB.xc_action_rec_type;
lx_msg_count NUMBER;
lx_msg_data VARCHAR2(2000);
lx_return_status VARCHAR2(200);
l_message VARCHAR2(2000);
l_msg_index_out NUMBER;

BEGIN

FOR C IN (SELECT logging_entity_id, 
exception_id,
logging_entity
FROM wsh_exceptions
WHERE status <> 'CLOSED'
AND exception_name = 'ATRASO NA ENTREGA'
AND delivery_detail_id = 9629195 )

LOOP

p_exception_rec.new_status := 'CLOSED';
p_exception_rec.delivery_detail_id := 9629195;
p_exception_rec.logging_entity_id := c.logging_entity_id;
p_exception_rec.logging_entity := c.logging_entity;
p_exception_rec.exception_id := c.exception_id;

WSH_EXCEPTIONS_PUB.Exception_Action (p_api_version => 1.0,
p_init_msg_list => NULL,
p_validation_level => NULL,
p_commit => FND_API.g_false,
x_msg_count => lx_msg_count,
x_msg_data => lx_msg_data,
x_return_status => lx_return_status,
p_exception_rec => p_exception_rec,
p_action => 'CHANGE_STATUS'); 
END LOOP;

COMMIT;

END;

END;

Sem título

Deixe uma resposta

Powered by WordPress.com. Tema: Baskerville 2 por Anders Noren

Acima ↑

%d blogueiros gostam disto: