Hi Ari
In general with ME51N, you have to enter the first row separately, which you've done. You'll want to record a Qty and Percent scenario and use an IF statement for the different inputs. You can do a filter here after the first account assignment and then always input on the first row.
Then do the filter on line items.
Then inside the loop
add the next line item on row one - select it (don't hit enter) and click to see line item details
then repeat the logic for the first row to enter the first account assignment with the line item
then filter the account assignments so that you are always entering on an empty row - then add as many account assignments as needed.
end loop
save
Because ME51N has to have a row in order to filter, and since you state you cannot use a BAPI, can you use ME51 instead of ME51N? It's older and much, much simpler to automate. There's an insert row for the line items - no need to enter the first row separately.
then for account assignments click on change display on the pop-up
You'll get a screen like this to enter the account assignments
Include the first row, which is required, with the line item
then loop
click on the navigation buttons on the top right - page to bottom then page down
then enter the new account assignment near the bottom and hit enter
end loop
then save.
It's much simpler.
Hope that helps,
Sigrid
------------------------------
Sigrid Kok
Precisely Software Inc.
------------------------------
Original Message:
Sent: 11-17-2023 16:33
From: ARI arunachalam
Subject: Need Script for ME51N with multiple account assignments.
Dear Sigrid,
Thank you for providing sample BAPI PR create script. However, our current license only allows for Transactions Type.
I have attached the script for ME51N, incorporating a nested loop to facilitate multiple account assignments for multiple line items within a PR. The script performs well for the first line item but the second line item not working.
I tried debugging and noticed that the second loop is not pulled. Could you kindly review the script and help identify where I might need to correct the loop to make second line-item work.
Thank you in advance for your help.
Ari
------------------------------
ARI arunachalam
Graphic Packaging International, Inc.
West Monroe LA
Original Message:
Sent: 11-14-2023 19:05
From: Sigrid Kok
Subject: Need Script for ME51N with multiple account assignments.
Hi Ari
I can't do individual help sessions - but our services team can.
In general, you would record one of each type of account assignment and then use IF statements on when to use different cost objects and different distribution types - qty or %.
I'd rather use a BAPI for this, because it's simpler. I've attached an example. It uses cost centers or WBS elements, but you can change that up. It also has quantity and % distribution, supporting 1 account assignment or multiple. It should help you get started.
The key fields
column D for loop id, and this uses nested loops - H = header, D = PR line item, A = account assignment
column F for account assignment - aka cost object type
for the type of cost object
then
Column X if it's 1 it will use quantity, if 2, it will use % and if blank assumes all.
Column Y just needs a sequential #
Then Z or AA is filled in with cost center or wbs based on column F - account assignment type
Then AB is used if Quantity
and AC is used if %
Best Regards,
Sigrid
------------------------------
Sigrid Kok
Precisely Software Inc.
Original Message:
Sent: 11-14-2023 08:13
From: ARI arunachalam
Subject: Need Script for ME51N with multiple account assignments.
Hi Sigrid,
My requirements are multiple line items in Purchase Requisition creation ME51N with account assignment - Cost center (K) with multiple GL/Cost Center combinations with some line items single GL/cost center, some line items with multiple GL/Cost Center with distribution on quantity basis and some line items with distribution by percent etc.as shown below.
Please help me record the script using Transaction option.
Line item 1 with Distribution on quantity basis with multiple GL/cost center
Line item 2 with single GL/cost
Line item 3 with Distribution by percentage basis with multiple GL/cost center
------------------------------
ARI arunachalam
Graphic Packaging International, Inc.
West Monroe LA
Original Message:
Sent: 09-26-2023 12:40
From: Sigrid Kok
Subject: Need Script for ME51N with multiple account assignments.
Hi Ari
On the community, we typically try to help customers where they are stuck. Can you please provide more details?
In general:
- For the "Enjoy" tcodes for PR's and PO's, the ones the end in "N", we recommend BATCH mode.
- To get an empty row, since there isn't an insert, we set a filter that will never be true - so the first row will always be empty. That works for line items, and it looks like the account assignments also have a filter button.
- Since the tcode can be a bit tricky, can you consider a BAPI instead?
Please share specifics, any script attempts or screen shots of specifically where you are having problems and if you're open to a Direct option.
Best Regards,
Sigrid
------------------------------
Sigrid Kok
Precisely Software Inc.
Original Message:
Sent: 09-18-2023 15:02
From: ARI arunachalam
Subject: Need Script for ME51N with multiple account assignments.
Hi Experts,
I tried recording the script for ME51N with multiple account assignments for one or more line items but the multiple accounts assignment loop not working. if anyone has a recorded video, please share it.
------------------------------
ARI arunachalam
Graphic Packaging International, Inc.
West Monroe LA
------------------------------