API-Oracle EBS INV 创建物料搬运单头

摘自:Oracle EBS INV 创建物料搬运单头 (bbsmax.com)

Oracle EBS INV 创建物料搬运单头

Jenrry 2018-11-26 原文

 
  1. CREATE OR REPLACE
  2. PROCEDURE XX_CreateMoveOrderHeader AS
  3. -- Common Declarations
  4. l_api_version NUMBER := 1.0;
  5. l_init_msg_list VARCHAR2(2) := FND_API.G_TRUE;
  6. l_return_values VARCHAR2(2) := FND_API.G_FALSE;
  7. l_commit VARCHAR2(2) := FND_API.G_FALSE;
  8. x_return_status VARCHAR2(2);
  9. x_msg_count NUMBER := 0;
  10. x_msg_data VARCHAR2(255);
  11. -- WHO columns
  12. l_user_id NUMBER := -1;
  13. l_resp_id NUMBER := -1;
  14. l_application_id NUMBER := -1;
  15. l_user_name VARCHAR2(30) := 'MFG';
  16. l_resp_name VARCHAR2(50) := 'Manufacturing and Distribution Manager';
  17. -- API specific declarations
  18. l_trohdr_rec INV_MOVE_ORDER_PUB.TROHDR_REC_TYPE;
  19. l_trohdr_val_rec INV_MOVE_ORDER_PUB.TROHDR_VAL_REC_TYPE;
  20. x_trohdr_rec INV_MOVE_ORDER_PUB.TROHDR_REC_TYPE;
  21. x_trohdr_val_rec INV_MOVE_ORDER_PUB.TROHDR_VAL_REC_TYPE;
  22. l_validation_flag VARCHAR2(2) := INV_MOVE_ORDER_PUB.G_VALIDATION_YES;
  23. BEGIN
  24. -- Get the user_id
  25. SELECT user_id
  26. INTO l_user_id
  27. FROM fnd_user
  28. WHERE user_name = l_user_name;
  29. -- Get the application_id and responsibility_id
  30. SELECT application_id, responsibility_id
  31. INTO l_application_id, l_resp_id
  32. FROM fnd_responsibility_vl
  33. WHERE responsibility_name = l_resp_name;
  34. FND_GLOBAL.APPS_INITIALIZE(l_user_id, l_resp_id, l_application_id);
  35. dbms_output.put_line('Initialized applications context: '|| l_user_id || ' '|| l_resp_id ||' '|| l_application_id );
  36. -- Initialize the variables
  37. l_trohdr_rec.date_required := sysdate+2;
  38. l_trohdr_rec.organization_id := 207;
  39. l_trohdr_rec.from_subinventory_code := 'Stores';
  40. l_trohdr_rec.to_subinventory_code := 'FGI';
  41. l_trohdr_rec.status_date := sysdate;
  42. l_trohdr_rec.request_number := 'TEST_TRO1';
  43. l_trohdr_rec.header_status := INV_Globals.G_TO_STATUS_PREAPPROVED; -- preApproved
  44. l_trohdr_rec.transaction_type_id := INV_GLOBALS.G_TYPE_TRANSFER_ORDER_SUBXFR; -- INV_GLOBALS.G_TYPE_TRANSFER_ORDER_STGXFR;
  45. l_trohdr_rec.move_order_type := INV_GLOBALS.G_MOVE_ORDER_REQUISITION; -- G_MOVE_ORDER_PICK_WAVE;
  46. l_trohdr_rec.db_flag := FND_API.G_TRUE;
  47. l_trohdr_rec.operation := INV_GLOBALS.G_OPR_CREATE;
  48. -- Who columns
  49. l_trohdr_rec.created_by := l_user_id;
  50. l_trohdr_rec.creation_date := sysdate;
  51. l_trohdr_rec.last_updated_by := l_user_id;
  52. l_trohdr_rec.last_update_date := sysdate;
  53. -- call API to create move order header
  54. DBMS_OUTPUT.PUT_LINE('=======================================================');
  55. DBMS_OUTPUT.PUT_LINE('Calling INV_MOVE_ORDER_PUB.Create_Move_Order_Header API');
  56. INV_MOVE_ORDER_PUB.Create_Move_Order_Header(
  57. P_API_VERSION_NUMBER => l_api_version
  58. , P_INIT_MSG_LIST => l_init_msg_list
  59. , P_RETURN_VALUES => l_return_values
  60. , P_COMMIT => l_commit
  61. , X_RETURN_STATUS => x_return_status
  62. , X_MSG_COUNT => x_msg_count
  63. , X_MSG_DATA => x_msg_data
  64. , P_TROHDR_REC => l_trohdr_rec
  65. , P_TROHDR_VAL_REC => l_trohdr_val_rec
  66. , X_TROHDR_REC => x_trohdr_rec
  67. , X_TROHDR_VAL_REC => x_trohdr_val_rec
  68. , P_VALIDATION_FLAG => l_validation_flag
  69. );
  70. DBMS_OUTPUT.PUT_LINE('=======================================================');
  71. DBMS_OUTPUT.PUT_LINE('Return Status: '||x_return_status);
  72. IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
  73. DBMS_OUTPUT.PUT_LINE('Error Message :'||x_msg_data);
  74. END IF;
  75. IF (x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
  76. DBMS_OUTPUT.PUT_LINE('Move Order Created Successfully');
  77. DBMS_OUTPUT.PUT_LINE('Move Order Header ID : '||x_trohdr_rec.header_id);
  78. END IF;
  79. DBMS_OUTPUT.PUT_LINE('=======================================================');
  80. EXCEPTION
  81. WHEN OTHERS THEN
  82. DBMS_OUTPUT.PUT_LINE('Exception Occured :');
  83. DBMS_OUTPUT.PUT_LINE(SQLCODE ||':'||SQLERRM);
  84. DBMS_OUTPUT.PUT_LINE('=======================================================');
  85. END XX_CreateMoveOrderHeader;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值