goenning / SharpSapRfc

Making SAP RFC calls even easier with .NET
MIT License
84 stars 27 forks source link

Can not get purchase order list or sttus codes #28

Closed patagoniahiker closed 8 years ago

patagoniahiker commented 8 years ago

Hello, I am unable to do the following, can you please help

  1. get the purchase order list
  2. get the status of a PO

I even tried transaction code:MEMASSPO

Can you give me a sample please, I have the following functions but not the PO?

ME21N - Create purchase order MM - Purchasing ME22N - Change purchase order MM - Purchasing ME23N - Display purchase order MM - Purchasing ME21 - Create purchase order MM - Purchasing ME2N - purchase orders by PO Number MM - Purchasing ME9F - Message Output: purchase orders MM - Purchasing ME29N - Release purchase order MM - Purchasing ME2L - purchase orders by Vendor MM - Purchasing ME2M - purchase orders by Material MM - Purchasing SPRO - Customizing - Edit Project Basis - Customizing Project Management (IMG) MIGO - Goods Movement MM - Inventory Management MIRO - Enter Incoming Invoice MM - Invoice Verification MD04 - Display Stock/Requirements Situation PP - Master Data NACE - WFMC: Initial Customizing Screen SD - Output Determination ME51N - Create purchase Requisition MM - Purchasing ME52N - Change purchase Requisition MM - Purchasing ME53N - Display purchase Requisition MM - Purchasing VA01 - Create Sales order SD - Sales VA02 - Change Sales order SD - Sales MMBE - Stock Overview Logistics - Material Master VA03 - Display Sales order SD - Sales MD02 - MRP - Single-item, Multi-level - PP - Master Data VOV8 - Document Type Maintenance SD - Basic Functions CO02 - Change Production order PP - Production Orders KO88 - Actual Settlement: order CO - Overhead Cost Orders ME11 - Create Purchasing Info Record MM - Purchasing ME59N - Automatic generation of POs MM - Purchasing ME59 - Automatic Generation of POs MM - Purchasing ME54N - Release purchase Requisition MM - Purchasing ME5A - purchase Requisitions: List Display MM - Purchasing MN04 - Create Message: PO MM - Purchasing ME80FN - General Analyses (F) MM - Purchasing VL10B - purchase orders Due for Delivery Logistics Execution - Shipping ME28 - Release purchase order MM - Purchasing ME22 - Change purchase order MM - Purchasing ME23 - Display purchase order MM - Purchasing MEMASSPO - Mass Change of purchase orders MM - Purchasing BBP_POC - Process purchase order SRM - Enterprise Buyer ME1P - purchase order Price History MM - Purchasing ME2J - purchase orders for Project MM - Purchasing MEPO - purchase order MM - Purchasing ME91F - purchase orders: Urging/Reminders MM - Purchasing ME2W - purchase orders for Supplying Plant MM - Purchasing

thanks

goenning commented 8 years ago

With RFC (and SharpSapRfc) you don't use transactions, only Function Modules like BAPI or Z's. You can try using BAPI_PO_GETDETAIL1 to get details from a specific PO.

The code should be something like this.

using (SapRfcConnection conn = new PlainSapRfcConnection("SAP"))
{
    var result = conn.ExecuteFunction("BAPI_PO_GETDETAIL1", new
    {
        purchaseorder = "4500425010"
    });
    var header = result.GetOutput<POHeader>("POHEADER");
    var itens = result.GetTable<POItem>("POITEM");
    //...
}
patagoniahiker commented 8 years ago

Thanks for the response :+1: , but if I am outside the LAN/intranet, and accessing via internet,

  1. then should I use SOAP or webservices.
  2. besides putting the credentials, do I need to ask SAP to configure a channel or will this information be available from the object calls in the lib?
  3. how can I get a table of all PO's open and their details?
  4. In the build of the solution its looking for some dll's SAP middleware name spaces, is this dll from Nuget or somewhere here, I did not see an internal build dependency for this dll.

thanks

goenning commented 8 years ago

1) Yes, you should use SharpSapRfc.Soap when connection to SAP from outside your private network. 2) Your SAP need to be reachable from the internet, either directly or behind a Reverse Proxy (like SAP WebDispatcher). You can try it directly from the browser with the following URL:

http://<your-sap-address>:<your-port>/sap/bc/soap/rfc?sap-client=100

It if works from the browser, it will surely work with the library.

3) I'm not a MM specialist, so I don't know any existing BAPI for that. If there is none, you can always write your own Z function module.

4) The only project with SAP Middleware dependency is SharpSapRfc.Plain.x64 and x86, because it uses SAP NCo internally. But in your case you can go with Soap without any external dependency.

patagoniahiker commented 8 years ago

Hi, can you suggest, where would I find the PO tables list (I am not a partner) or is the table you gave me maybe/closeto the correct one Do I need to change the object SapRfcConnection to the SapSoapConnection?

goenning commented 8 years ago

It's easy to find it in Google. This is a good start: https://scn.sap.com/thread/777633

And yes, you need to chage the connection class, but it is SoapSapRfcConnection.

patagoniahiker commented 8 years ago

ok thanks, will try this for now :+1: on my own... and will get back