cancel
Showing results for 
Search instead for 
Did you mean: 

How to create batch PO by BO interface after excel upload immediately?

Neil_Lee_057
Explorer
0 Kudos

Dear Experts,

My business scenario:

Step 1. Upload batch data with Excel upload function

Step 2. EML create Purchase Orders by BO Interface: i_purchaseordertp_2

Step 3. There are batch PO created after I click "Upload" button

Example: I upload 5 row data, and expected to create 2 Purchase Orders,

maybe 2 Items in PO_1 and 3 Items in PO_2

The screenshot will like below

The issue I have is only 4500000186 been created, but there are no Error in Failed/Reported data.

I also check that the below EML create code executed 2 times.

I suppose the reason of this issue is "commit work" statement only execute 1 times.

Because it get work if I use Method if_oo_adt_classrun~main by run as console

there are 2 PO be created success.

Is it possible to create batch PO after I upload Excel data immediately ?

The command "COMMIT-ENTITIES" is not allowed in a BEHAVIOR class.

=> or can I redefine the commit statement logic ?

What options do we have here?

Kindly help.

Regards,

ABAPer.

OwenLiu
Product and Topic Expert
Product and Topic Expert
0 Kudos

Changed tag to Procurement.

Marian_Zeis
Active Contributor
0 Kudos

Hi Neil,

Thanks for using my component.

I can't really help you on the backend, but I updated my component to show better if a backend error happened. Current version is 0.21.

Just be careful because the package name changed.

Otherwise have a look in the browser console if there are some errors visible.

Cheers Marian

inesmartins
Participant
0 Kudos

Hello,

How did you solve that?

Thanks,
Ines Martins

Accepted Solutions (1)

Accepted Solutions (1)

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos

You have to use the convert key statement in the save_modified() method as described in this hands-on script where we use it to retrieve the purchase requistion iD from the PID that is sent back by the called RAP BO from SAP.

abap-platform-rap-workshops/rap6xx/rap610/exercises/ex4/README.md at main · SAP-samples/abap-platfor...

LOOP AT zbp_r_onlineshop_###=>mapped_purchase_requisition-purchaserequisition ASSIGNING FIELD-SYMBOL(<fs_pr_mapped>).
      CONVERT KEY OF i_purchaserequisitiontp FROM <fs_pr_mapped>-%pid TO DATA(ls_pr_key).
      <fs_pr_mapped>-purchaserequisition = ls_pr_key-purchaserequisition.
ENDLOOP.
Neil_Lee_057
Explorer
0 Kudos

Dear Andre,

Really appreciate for reply first.

I have referenced the URL exercise 4.4 to retrieve the PO id from PID success.

But my issue is can't create multi-PO after I select batch entity and use BO interface.

(example: 3 entity been selected and supposed to create to 1 PO with 3 item, but 3 PO as result(each have 1 item)

I'm study below blog that the result is what I want, but it seems doesn't explain how to create 2 PO in 1 action.

https://blogs.sap.com/2023/06/19/sap-s-4hana-cloud-public-edition-abap-environment-case-5-purchase-r...

Answers (1)

Answers (1)

alikhach
Explorer
0 Kudos

Hello, sorry, have no answer your question, but want to ask how upload excel has been implemented? Is this freestyle UI development or it is possible to add this functionality with annotations? And if it is freestyle do you receive raw data from UI and then save it to buffer table and display it or UI manage it and only calls actions from backend?

Thanks

Neil_Lee_057
Explorer
0 Kudos

I reference this great blog: Simplifying Excel Upload in Fiori Elements: The Open Source and Easy-to-Use UI5 Custom Control

https://blogs.sap.com/2023/02/17/simplifying-excel-upload-in-fiori-elements-the-open-source-and-easy...