3 weeks ago
I have SellingPrice and BuyingPrice in both Header level and Item level. And has a "Copy" button in Header level.
What I want to do is when user click the Copy button, the value of SellingPrice and BuyingPrice in header level will be assigned to item level and one record is created.
Everytime user click the Copy button, item level should be created with the value of Header level data.
Below is the logic I have written in Copy action. But it gets error of "Last runtime error at: 04/28/2025, 04:51:37, error text: The key of business object YY1_PRICINGINFORMATION is wrongly specified."
Although the YY1_PRICINGINFORMATION is correct, it gives the same error. The key has value "0000000001"
* Step 1: Get Root Entity Key
*DATA(lv_key_cleaned) = PRICINGINFORMATION-PriceID.
DATA(lv_key) = |{ PRICINGINFORMATION-PriceID }|.
* Step 2: Get the root node object
DATA(lo_root) = write->get_root(
business_object_id = 'YY1_PRICINGINFORMATION'
key = 'lv_key'
).
* Step 3: Prepare data for child node (ITEM)
DATA(ls_item) = VALUE YY1_HISTORY_PRICINGINFORMATION(
BuyingPrice = PRICINGINFORMATION-Price
SellingPrice = PRICINGINFORMATION-SellingPrice
).
* Step 4: Create child under root
lo_root->create_child(
EXPORTING
node_id = 'History'
data = ls_item
).
* Step 5: Return success message
message = VALUE #( severity = 'S' text = 'Item created from Action.' ).
Could you pls guide us how to change my logic to fulfil requirement? If that way is not okay, could you pls guide me the possible way?
Thanks in advance.
Best Regards,
Pyae
Request clarification before answering.
User | Count |
---|---|
69 | |
21 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.