Forum Stats

  • 3,853,650 Users
  • 2,264,249 Discussions
  • 7,905,426 Comments

Discussions

inv_move_order_pub.create_move_order_lines return Error for 2nd Line

User_NHSBO
User_NHSBO Member Posts: 2 Red Ribbon

Hi,

I create the below procedure to create Move order Lines, the 1st line created with Status 'S' but the 2nd line also created but Status return 'E'.

This issue will confuse us and user...

Looking for your advice.

DECLARE

    gn_conc_request_id Number :=19614240;

    user_id Number :=11830;

    x_return_status         VARCHAR2 (1);

    x_msg_count             NUMBER;

    x_msg_data              VARCHAR2 (4000);

    l_hdr_rec               inv_move_order_pub.trohdr_rec_type := inv_move_order_pub.g_miss_trohdr_rec;

    l_line_tbl              inv_move_order_pub.trolin_tbl_type := inv_move_order_pub.g_miss_trolin_tbl;

    x_hdr_rec               inv_move_order_pub.trohdr_rec_type := inv_move_order_pub.g_miss_trohdr_rec;

    x_hdr_val_rec           inv_move_order_pub.trohdr_val_rec_type;

    x_line_tbl              inv_move_order_pub.trolin_tbl_type;

    l_line_val_tbl          inv_move_order_pub.trolin_val_tbl_type;

    x_line_val_tbl          inv_move_order_pub.trolin_val_tbl_type;

    l_from_sub_err          VARCHAR2 (1);

    l_to_sub_err            VARCHAR2 (1); 

    K                       NUMBER:=0;

    p_validation_flag       VARCHAR2 (1);

    ln_process_status   NUMBER;

    l_process_flag      VARCHAR2(1);

    lc_process_message  VARCHAR2(4000);

    v_process_message  VARCHAR2(4000);

    v_line_id number;

    v_process_status      VARCHAR2(1);

BEGIN

    l_line_tbl.DELETE;

    x_line_tbl.DELETE;

    --

    --

    K := K + 1;

    l_line_tbl(K).header_id              := 4883266;

    l_line_tbl(K).date_required          := SYSDATE;

    l_line_tbl(K).inventory_item_id      := 6322;

    l_line_tbl(K).line_id                := fnd_api.g_miss_num;

    l_line_tbl(K).line_number            := K;

    l_line_tbl(K).line_status            := inv_globals.G_TO_STATUS_INCOMPLETE;--g_to_status_preapproved;

    l_line_tbl(K).REFERENCE              := TO_CHAR (TRIM (SYSDATE));

    l_line_tbl(K).transaction_type_id    := 64;

    l_line_tbl(K).organization_id        := 102;

    l_line_tbl(K).quantity               := 48;

    l_line_tbl(K).status_date            := TRUNC (SYSDATE);

    l_line_tbl(K).uom_code               := 'PEC';

    l_line_tbl(K).db_flag                := fnd_api.g_true;

    l_line_tbl(K).operation              := inv_globals.g_opr_create;

    l_line_tbl(K).from_subinventory_code := NULL;;

    l_line_tbl(K).to_subinventory_code   := 'SELLABLE';

    --

    inv_move_order_pub.create_move_order_lines (

    p_api_version_number   => 1.0,

    p_init_msg_list        => fnd_api.g_false,

    p_return_values        => fnd_api.g_false,

    p_commit               => fnd_api.g_true,

    x_return_status        => x_return_status,

    x_msg_count            => x_msg_count,

    x_msg_data             => x_msg_data,

    p_trolin_tbl           => l_line_tbl,

    p_trolin_val_tbl       => l_line_val_tbl,

    x_trolin_tbl           => x_line_tbl,

    x_trolin_val_tbl       => x_line_val_tbl,

    p_validation_flag      => p_validation_flag);

    --

    DBMS_OUTPUT.put_line ('Lines Created x_return_status:' || x_return_status);

    DBMS_OUTPUT.put_line ('Number of Lines Created are :' || x_line_tbl.COUNT);

    DBMS_OUTPUT.put_line ('Line ID Created is :' || x_line_tbl(K).line_id);

    DBMS_OUTPUT.put_line ('K: ' || K ||' - x_msg_data :' || x_msg_data);

    --

    K := K + 1;             

    DBMS_OUTPUT.put_line ('Loop Begin' || K);

    l_line_tbl(K).header_id              := 4883266;--x_hdr_rec.header_id;

    l_line_tbl(K).date_required          := SYSDATE;

    l_line_tbl(K).inventory_item_id      := 6320;--ats_mv_ords_ln_rec.inventory_item_id;

    l_line_tbl(K).line_id                := fnd_api.g_miss_num;

    l_line_tbl(K).line_number            := K;

    l_line_tbl(K).line_status            := inv_globals.G_TO_STATUS_INCOMPLETE;--g_to_status_preapproved;

    l_line_tbl(K).REFERENCE              := TO_CHAR (TRIM (SYSDATE));

    l_line_tbl(K).transaction_type_id    := 64;--ats_mv_ords_ln_rec.TRANSACTION_TYPE_ID; --Move Orer Transfer

    l_line_tbl(K).organization_id        := 102;--ats_mv_ords_ln_rec.organization_id;

    l_line_tbl(K).quantity               := 48;--ats_mv_ords_ln_rec.quantity;

    l_line_tbl(K).status_date            := TRUNC (SYSDATE);

    l_line_tbl(K).uom_code               := 'PEC';--ats_mv_ords_ln_rec.UOM_CODE;

    l_line_tbl(K).db_flag                := fnd_api.g_true;

    l_line_tbl(K).operation              := inv_globals.g_opr_create;

    l_line_tbl(K).from_subinventory_code := NULL;--ats_mv_ords_ln_rec.FROM_SUBINVENTORY_CODE;

    l_line_tbl(K).to_subinventory_code   := 'SELLABLE';--ats_mv_ords_ln_rec.TO_SUBINVENTORY_CODE;

    l_line_tbl(K).lot_number             := NULL;--ats_mv_ords_ln_rec.lot_number;

    l_line_tbl(K).to_account_id          := NULL;--ats_mv_ords_ln_rec.CODE_COMBINATION_ID;

    l_line_tbl(K).from_locator_id        := NULL;--ats_mv_ords_ln_rec.INVENTORY_LOCATION_ID;

    --

    inv_move_order_pub.create_move_order_lines (

    p_api_version_number   => 1.0,

    p_init_msg_list        => fnd_api.g_false,

    p_return_values        => fnd_api.g_false,

    p_commit               => fnd_api.g_true,

    x_return_status        => x_return_status,

    x_msg_count            => x_msg_count,

    x_msg_data             => x_msg_data,

    p_trolin_tbl           => l_line_tbl,

    p_trolin_val_tbl       => l_line_val_tbl,

    x_trolin_tbl           => x_line_tbl,

    x_trolin_val_tbl       => x_line_val_tbl,

    p_validation_flag      => p_validation_flag);

    --

    DBMS_OUTPUT.put_line ('Lines Created x_return_status:' || x_return_status);

    DBMS_OUTPUT.put_line ('Number of Lines Created are :' || x_line_tbl.COUNT);

    DBMS_OUTPUT.put_line ('Line ID Created is :' || x_line_tbl(K).line_id);

    DBMS_OUTPUT.put_line ('K: ' || K ||' - x_msg_data :' || x_msg_data);

    ---

END;

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

DBMS Output:

Lines Created x_return_status:S

Number of Lines Created are :1

Line ID Created is :14801407

K: 1 - x_msg_data :

Lines Created x_return_status:E

Number of Lines Created are :2

Line ID Created is :14801409

K: 2 - x_msg_data :

Tagged: