Showing results for 
Search instead for 
Did you mean: 

ABAP Function Module alternative to MELB transaction

0 Kudos


I figuring out how to get Purchase orders for a specific Tracking number with ABAP function module with SapNCo (.Net Connector).

I currently do that with FM BAPI_PO_GETITEMS. I fill in TRACKINGNO, DOC_DATE and invoke my destination. But because it takes unreasonable amount of time to execute, I think there should be another way.

If I try to do the same with transaction MELB or ME2B via SAP GUI, the results appear very fast.

Do anyone know if there is any better BAPI "on the market" to do my job?

Thank you

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

I solved this by myself.

When I ran the BAPI_PO_GETITEMS with just TRACKING_NO parameter on PO's from year 2014, the SAP needed about 3 minutes to return the result.

Now I managed to accelerate this functionality with combining invoking two separate readings direct from SAP tables.

Firstly I employed BBP_RFC_READ_TABLE to read EBELN and BEDNR from EKPO table. I had some problems with building SQL query, because I tried to insert too long string. Then I broke it to two parts:

// if query lenght is very long, the whole SQL ROW exceeds its limits, which is 72 char! You need to break it to more smaller parts
// pointer to EKPO -> OPTIONS table                           
var optionsEKPO = readTableEKPO.GetTable("OPTIONS");

// build SQL query each in new row (TEXT field is limited to 72 char)
string query = "";

query = "(BEDNR LIKE '" + TRACKINGNO + "')"; // filter by TRACKINGNO
optionsEKPO.SetValue("TEXT", query);

query = " AND (AEDAT >= '" + dateStart.ToString("yyyyMMdd") + "')"; // filter by DATE
optionsEKPO.SetValue("TEXT", query);

Secondly I invoked the same BAPI function to read from EKKO table.

Then I combined returned EBELN (Purchasing Document Number) numbers.

I shortened query from 3 minutes with integrated API to around 300 ms with my own code.

Answers (0)