# Manual Integration Test: Create Multiple Sales Orders

## DESCRIPTION

Test creation of multiple entities with the Sales Orders application.

## PREPARATION

To check console errors open the developer tools before starting the application and check with each step, that there are no errors and warnings.

### Testing with mock data

Start the Sales Orders application with following URL (adjust host and port if necessary):

- local: http://localhost:8080/test-resources/sap/ui/core/demokit/sample/common/index.html?component=odata.v4.SalesOrders

New sales orders can be created only, if the `Note` property has one of the following values: `"new 1"`, `"new 2"`, `"new 3"`, or `"new 4"` (without quotation marks).

### Testing with back end

Configure your IDE to be able to execute the Sales Orders application against an ABAP back-end system.
Start the Sales Orders application with the URL (adjust host and port if necessary):

- local: http://localhost:8080/test-resources/sap/ui/core/demokit/sample/common/index.html?component=odata.v4.SalesOrders&realOData=true

## REALIZE and CHECK

### Multiple create, delete and reset changes

1. Click on the `Create` button in the `Sales Orders` table.
2. Check: The table below the `Create New Sales Order` dialog gets a new first row with an empty `Sales Order ID` and the `Note` as displayed in the `Create New Sales Order` dialog.
3. Modify the content of the `Note` input field of the `Create New Sales Order` dialog for example to: "new 1".
4. Check: The `Note` of the first sales order (table below the dialog) is updated automatically after leaving the input field of the dialog.
5. Click on `OK` in the `Create New Sales Order` dialog.
6. Click on `Save` button in the `Sales Orders` table.
7. Check: You get a success message for creating the sales order.
8. Click on `OK` in the `Success` dialog.
9. Check: The content of the new sales order is updated (for example `Sales Order ID`).
10. Create a second sales order: Repeat steps 1 - 9 for example with the `Note`: "new 2".
11. Create a third sales order: Repeat steps 1 - 5 (do not save!) for example with the `Note`: "new 3".
12. Create a fourth sales order: Repeat steps 1 - 5 (do not save!) for example with the `Note`: "new 4".
13. Select the sales order created in step 11 (with `Note` "new 3").
14. Click on `Delete` button in the `Sales Orders` table.
15. Check: The selected sales order is removed from the `Sales Orders` table.
16. Click on `Cancel sales order list changes` button in the `Sales Orders` table.
17. Check: The not yet saved new sales order created in step 12 is gone.

### Multiple Create and Deferred Delete

18. Create and save a sales order by repeating Steps 1 - 9 with the `Note` "new 3".
19. Create and save a sales order by repeating Steps 1 - 9 with the `Note` "new 4".
20. Select the sales order in the first row (with `Note` "new 4").
21. Click on the `Delete` button in the `Sales Orders` table.
22. Check: The selected sales order is removed from the `Sales Orders` table and the count in the title is decreased by one.
23. Select the sales order in the first row (with `Note` "new 3").
24. Click on the `Delete` button in the `Sales Orders` table.
25. Check: The selected sales order is removed from the `Sales Orders` table and the count in the title is decreased by one.
26. Click on the `Cancel sales order list changes` button in the `Sales Orders` table.
27. Check: The two deleted rows reappear and the count in the title is increased by two.
28. Repeat Steps 20 - 25.
29. Click on the `Save` button in the `Sales Orders` table.

### Multiple create, POST with back-end error, restart after fix works fine

30. Create 2 new sales orders by repeating steps 11 and 12.
31. Change the `Note` of a not yet saved new sales order (for example with the `Note` "new 4") to "RAISE_ERROR" (without quotation marks).
32. Click on `Save` button in the `Sales Orders` table.
33. Check: The message pop-over opens and you got an error that the value "RAISE_ERROR" for the `Note` property is not allowed.
34. Close the message pop-over.
35. Check: Both sales orders created in step 21 don't have a sales order ID.
36. Change the invalid `Note` from "RAISE_ERROR" to for example "new 4" (without quotation marks).
37. Click on `Save` button in the `Sales Orders` table.
38. Check: You get a success message for creating both sales orders. Confirm each success dialog with `OK`.
39. Check: The content of the two new sales order is updated (for example `Sales Order ID`).

### Multiple create, relative

40. Create a new sales order: Repeat steps 1 - 9 for example with the `Note` : "new 3".
41. Click on the `Create` button in the `Sales Order Line Items` table.
42. Check: You can't select a different sales order in the `Sales Orders` table.
43. Update the `Note` of the newly created sales order line item to "new 10".
44. Create a second sales order line item by clicking on the `Create` button in the `Sales Order Line Items` table.
45. Check: The secondly created sales order line item is inserted after the formerly created one.
46. Update the `Note` of the last created sales order line item to "new 20".
47. Click on the `Save` button in the `Sales Order Details` section.
48. Click on `OK` in the `Success` dialog two times.
49. Check: The `Sales Order Line Items` table header shows 2 `Sales Order Line Items` in realOData mode and 0 in mock data mode.
    Remark: With mock data the table gets empty because of a restriction in the mock server implementation.
50. If `realOData=true`
    - Open the Sales Order Schedules dialog.
    - Check: The table contains two schedules.
    - Click on `Select all`.
    - Click on `Delete selected schedules`.
    - Check: The `Sales Order Schedules` table is empty.
    - Close the Sales Orders Schedules dialog.
    - Check: The `Sales Order Line Items` table is empty.
51. Check: You now can select a different sales order in the `Sales Orders` table.

### Deferred Deletion of a Line Item

If `realOData=false`:

52. Select the line item with `Item Position` "10".
53. Click on the `Delete sales order line item`.
54. Check: The line item is removed from the table and the count in the title is decreased by one.
55. Click on the `Cancel` button in the `Sales Order Details` section.
56. Check: The line item reappears and the count in the title is increased by one.
57. Repeat Steps 52 - 54
58. Click on the `Save` button in the `Sales Order Details` section.