If Excel Row matches append document number with comma

Hello Everyone,

I’m working on Excel, so when bot posted the value in SAP there were two document number generating for same ID. Image is below

My requirement is if ID,SAP Code ,Plant Code and Header Text is same document number should be append by comma … Below Image (Expected Image)

Can anyone help on this…

Thanks

@toru
welcome to the forum

it can be handled with grouping the data on SAP FP Code and processing the resulting group members.

Have a further look here:

refering to you screenshots also duplicated rows are to remove on advance

2 Likes

Try to read the Excel file to data table, and run for each loop,
put condition for example if datatable.rows.indexof(row)+1=datatable.rows.indexof(row)
add flag for your row so that u will not process duplicate entries

Hi @ppr,

sorry for late reply. I’m currently grouping the data on plant code and using below LINQ code. It’s not appending comma , can you help?

(From d In dt_ExtractLog.AsEnumerable
Group d By k=d(“Plant Code”).toString.Trim Into grp=Group
Let cn = String.Join(",", grp.Select(Function (rn) rn(“Doc Number”).toString).toArray)
Let ra = New Object(){k, cn}
Select dt_ExtractLog1.Rows.Add(ra)).CopyToDataTable

Hi @ppr,

I’m sending the xml file which i’ve tried…
Main.xaml (8.1 KB)