# Manual Integration Test: Create Sales Order Line Items (create on relative binding)

## DESCRIPTION

Test entity creation on relative bindings 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):

- as sample preview in the SDK: http://<host>:<port>/sapui5-sdk-dist/#/sample/sap.ui.core.sample.odata.v4.SalesOrders/preview
- local: http://<host>:<port>/test-resources/sap/ui/core/demokit/sample/common/index.html?component=odata.v4.SalesOrders

### 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://<host>:<port>/test-resources/sap/ui/core/demokit/sample/common/index.html?component=odata.v4.SalesOrders&realOData=true

## REALIZE and CHECK

### Preparation: create a new sales order

1. After the application is started, click on `Create` in the `Sales Orders` table.
2. Modify the content of the `Note` input field of the `Create New Sales Order` dialog.
3. Click on `OK` in the `Create New Sales Order` dialog.
4. Click on `Save` in the `New Sales Orders` table.
5. Click on `OK` in the `Success` dialog.
6. Check: That `Company Name` in the `Sales Order` table is updated with "SAP".
7. Select the newly created sales order.
8. Check: The `Sales Order Line Items` table does not have any data.

### Create a new sales order item; no refresh allowed; cancel created item

1. Click on `Create` in the `Sales Order Line Items` table.
2. Check: The `Sales Order Line Items` table contains 1 entry.
3. Check: The `Sales Order Line Items` table header shows `1 Sales Order Line Items`.
4. Click on `Refresh` in the `New Sales Orders` table.
5. Check: You get a warning about pending changes.
6. Click on `Cancel`.
7. Click on `Cancel sales order list changes` in the `New Sales Orders` table.
8. Check: The `Sales Order Line Items` table contains still 1 entry, because the cancellation has been done for another group ID.
9. Click on `Cancel sales order changes` in the `Sales Order Details` section.
10. Check: The `Sales Order Line Items` table contains 0 entries.
11. Check: The `Sales Order Line Items` table header shows `0 Sales Order Line Items`.

### Delete transient sales order item

1. Click on `Create` in the `Sales Order Line Items` table.
2. Select the newly created sales order line item.
3. Click on `Delete` in the `Sales Order Line Items` table.
4. Check: The `Sales Order Line Items` table contains 0 entries.
5. Click on the `Save` button in the `Sales Orders` table.

### Create a sales order line item; save, update and delete it

1. Click on `Create` in the `Sales Order Line Items` table.
2. Select the newly created sales order line item.
3. Click on `Save` in the `Sales Order Details` section.
4. Click on `OK` in the `Success` dialog.
5. Check: The `Sales Order Line Items` table header shows 1 `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.
6. Within realOData Mode:
   1. Update the `Note` of the newly created sales order line item.
   2. Click on `Save` in the `Sales Order Details` section.
   3. Update the `Note` of the just saved sales order line item.
   4. Update the `Quantity` to an invalid value of "0.0" (invalid on server side).
   5. Click on `Save` in the `Sales Order Details` section.
   6. Check: You got a error message about the invalid `Quantity` "0.0".
   7. Correct the `Quantity` to something greater than "0.0".
   8. Click on `Save` in the `Sales Order Details` section.
   9. Check: The `Sales Order Line Items` regarding `Note` and `Quantity` is as expected.
   10. Change the `Note` for the parent sales order in the `New Sales Orders` table.
   11. Click on `Save` in the `New Sales Orders` table.
   12. Now change the context by selecting a different sales order in the `New Sales Orders` table.
   13. Check: That the dependent bindings for the current sales order looks as expected.
   14. Select again the sales order selected before.
   15. Check: That the dependent bindings for the current sales order looks as expected.
   16. Change the `Note` in the `Sales Order Details` object page and click on `Save` for the `Sales Order Details` .
   17. Now change the `Note` in the `New Sales Orders` table and click on `Save` for the `New Sales Orders` table.
   18. Now change again the `Note` in the `Sales Order Details` object page and click on `Save` for the `Sales Order Details`.
   19. Check: That you got an error popup regarding outdated Etag.
   20. Confirm the error popup.
   21. Reset changes for the `Sales Order Details`.
   22. Click on `Refresh selected sales order` in the `New Sales Orders` table.
   23. Now change again the `Note` in the `Sales Order Details` object page and click on `Save` for the `Sales Order Details`.
   24. Check: That the `Note` in the `New Sales Orders` table is updated as expected.
   25. Delete the created line item in the `Sales Order Line Item` table and check that the table is updated as expected.

   26. ### Confirmation of new created sales order

   27. Again create a new sales order line item for the new sales order.
   28. Select HT-1000 as Product ID and enter a space in the `Note` field.
   29. Click on `Save` in the `Sales Order Details` section.
   30. Click on `Confirm selected sales order` in the `New Sales Orders` table.
   31. Check: That you got a dialog telling that one warning exists and asking if you want to continue.
   32. Click on `No`/li>
   33. Check: The dialog was closed and the Sales Order is not yet confirmed.
   34. Click again on `Confirm selected sales order` in the `New Sales Orders` table.
   35. Check: That you got a dialog telling that one warning exists and asking if you want to continue.
   36. Click on `Yes`
   37. Check: The sales order is confirmed and is filtered out from the `New Sales Orders` table.

   38. ### Test refresh single row

   39. Refresh the `Sales Order` table.
   40. Click on `Create` in the `New Sales Orders` table.
   41. Click on `OK` in the `Create New Sales Order` dialog.
   42. Click on `Save` in the `New Sales Orders` table.
   43. Click on `OK` in the `Success` dialog.
   44. Select the newly created sales order.
   45. Click on `Refresh selected sales order`.
   46. Click on `Create` in the `Sales Order Line Items` table.
   47. Click on `Save` in the `Sales Order Details` section.
   48. Click on `OK` in the `Success` dialog.
   49. Check: That the `Sales Order Line Items` table contains 1 entry.
   50. Click on `Refresh selected sales order`.
   51. Check: That the `Sales Order Line Items` table contains 1 entry.

   52. ### Test changing the Product ID manually and via value help.

   53. Click on `Create` in the `Sales Order Line Items` table.
   54. Select the newly created sales order line item.
   55. Change the `Product ID` of the newly created sales order line item by entering a different `Product ID`.
   56. Click on `Save` in the `Sales Order Details` section.
   57. Click on `OK` in the `Success` dialog.
   58. Check: That `Product, Category and Type Code` is updated correctly.
   59. Now change the `Product ID` again using the value help.
   60. Click on `Save` in the `Sales Order Details` section.
   61. Check: That `Product, Category and Type Code` are updated correctly.
7. Select another sales order in the `New Sales Orders` table.
8. Check: The `Sales Order Line Items` are related to the current sales order.
9. Select again the sales order where the new sales order line items was created within the `New Sales Orders` table.
10. Select again the before created sales order line item in the `Sales Order Line Item` table.
11. Click `Delete` in the `Sales Order Line Items` table.
12. Check: The `Sales Order Line Items` table contains 0 entries.
13. Click on the `Save` button in the `Sales Order Details` section.