on 04-18-2012 2:53 PM
Hi All,
I am new to using nco and I must say, I am really impressed with what I have seen so far..
All I have so far achieved is designing a small windows form project that pulls out customer details (from accounts receivable) based on a customer number supplied by the end user.
Im pretty pleased to have got that working so quickly and with so few lines of code (c#).
My mind has now gone on to thinking that maybe I can improve this form by allowing users to update customer master data from this form. i.e. end user retrieves customer record and is able to make a change to that record and save it back to SAP..
Based on this, can anyone answer these questions:
1) Do i need to invoke a BAPI to first display the customer details and then invoke another (on a different button click) to actually update the record.
2) Would something like this work to update a field : bapivalue.customername.setvalue("BAPIFIELD", updatedvalue.tostring());
3) Does the gateway connection still perform the same role access checking that the GUI would. i.e. if the connected user doesnt have a roll that would allow updating, would the process fail?
4) Are there any examples of updating masterdata of employees/customers/vendors through nco3 out there?
Many thanks
Iain
Hi,
The short answer is this :
the long one bit longer ...
First,I should say that my approach to sap connector is as DAL ( Data Access Layer ).
In other words – I use sap connector as data source and update against sap application but not as my application object model.
So my application will contain view layer and model layer with application specific classes .
in this classes I utilize sap nco in all method which interact with sap ( GetData,UpdateRecord and etc. ).
This encapsulate complex call's, object structure and simplify program flow and view model.
After said all that let's get to business …
In SAP , Most BAPI's are designed to do one thing (update,create,get detail and etc.),that’s mean – you should use two BAPI's in order to update data ( at least) .
Reasonable flow for update will be in this sequence :
1. Get data from SAP ( BAPI XXX_get_detail) and fill object with relevant data.
2. Do something :
* Display view to user.
* Get input from files.
* Apply changes to object.
3. Write data back to sap - Map data from object to BAPI_XXX_UPDATE.
In order to update sap back you should flow this sequence data to function:
1. Create structure\table to hold data and set values to fields (like reading but with SetValue() ).
2. set table to function.
3. Invoke function.
Some BAPI's demand executing commit after "update" FM.
in this case we use the "context" concept which ensure FM invocation in one connection
For this example let's look at purchase requisition update call sequance :
RfcDestination destSys = RfcDestinationManager.GetDestination("some destination");
RfcRepository rep = destSys.Repository ;
IRfcFunction bapi_pr_change = rep.Createfunction("BAPI_PR_CHANGE");
IRfcFunction bapi_commit = rep.Createfunction("BAPI_TRANSACTION_COMMIT");
// set values to structrues,tables and return them to function.
//for example
bapi_pr_change["NUMBER"].SetValue("1234567890");
bapi_commit["WAIT"].SetValue("X");
//invoke update
RfcSessionManager.BeginContext(destSys);
bapi_pr_change.Invoke(destSys);
bapi_commit.Invoke(destSys);
RfcSessionManager.EndContext(destSys);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
like all software development it's all depend on customer use-case , requirements and constraint ( UI & technology ).
When desktop application is needed - I turn to WPF with MVVM pattern.
When web application is needed as standalone - I use MVC ( currently 3 , seen some cool stuff MVC 4 beta ).
the third deployment option is to use Microsoft Silverlight Islands Integration for ABAP WD ( Web Dynpro ) for better UI ( that's not SAP NCO but you should take a look... ).
Yarden
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.