on 12-10-2008 8:02 AM
i am using SAP.net connect 2.0 and c#
i want to know that if, i call the RFC function and there are a lot of parameter we have to pass, how can i pass value to the sap structure and put it to the RFC function.
any examples and reference for me to work on it.....
thx you help Alex. i understand the syntax.
but how can i know that the structure with its parameters pass belongs to its SAPTable.
we use a RFC for example:Bapi_Ptmgrattabs_Mngcreation(XXXXX)
after generate the code, it just has one SAPTable (BAPIRET2Table), and few SAPStructures (BAPIHRABSATT_IN)
the code is:
BAPIRET2Table table = new BAPIRET2Table();
BAPIHRABSATT_IN row = table.CreateNewRow();
row.From_Date="11122008";
table.Add(Row);
after call the function Bapi_Ptmgrattabs_Mngcreation(...,ref table,........ ) or Bapi_Ptmgrattabs_Mngcreation(...,ref row,........ )
is that correct?? sorry i am not advance in program
Edited by: jacob tang on Dec 11, 2008 3:10 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey,
The Sap .net connectore uses a naming convention when creating the parameter types. If it ends with "Table" is is a table. If not it is a structure. The table and it's table will use the same root name. so can find the type for the row of a table. You can also go to the object explorer of visual studio "View>Object explorer" and there you should find all the types generated and their information (base types...)
You should not have to fill the BAPIRET2 table. You have to instanciate it but leave it empty.
BAPIRET2Table returntable = new BAPIRET2Table();
XXX.Bapimethod(x,x,x,out returntable);
again pseudo code...
Hope this help.
Regards,
Alex
but i still confuse on it.
i still do not know how to handle on:
1. there are only sap structure and no belongs table
2. there are sap structure and i can set pass parameter into structure but there are no table belongs it
3.what is the meaning of them is C# "ref structure", "out string" "ref string"
there are 2 examples:
XXX.Bapi_Catimesheetmgr_Insert(structure1 Agent, string Profile, string Release_Data,string Testrun, string Text_Format_Imp, ref XXX.table1 Catsrecords_In, ref XXX.table2 Catsrecords_Out,ref XXX.table3 Extensionin, ref XXX.Table4 Extensionout, ref XXX.table5 Longtext, ref XXX.table6 Return0,ref XXX.table7 Workflow_Text)
Bapi_Ptmgrattabs_Mngcreation(string abs_Att_Type, string Employeenumber, structure1 Hrabsatt_In, structure2 Hractivityalloc, structure3 Hraltpayment, structure4 Hrcostassign, string Simulate, out string Absence_Flag, out structure5 Hrabsatt_Out, out string Hrabsattext, out structure6 Hrtimeskeyout, ref string Lockindicator, ref Table1 Return0, ref string Worktaxarea)
thx you help in convenience.
can you help me in favour. for sample of code and step?
that means i just have to assign the data to all parameters, then i just call the RFC function and ref that table
like:
TableName.FirstName = "XXX";
TableName.LastName = "XXX";
RFC_test(string XXX, string XXX, ref TableName) ;
does it has any sample code for my reference
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
i beleive we are confusing structure and tables.
You can see it like that. when you generate your class in VS2003 using .NET connector you get Structure (inherit from SapStructure) and Tables (inherit from SapTable). Depending on the kind of parameter you have on your RFC/BAPI, you will get a structure and the table if it is a table, you will get only a structure if is a structure.
To instanciate a structure you do it like:
BAPIP0001 row = new BAPIP0001();
row.Attribute1 = "Hello world";
And you pass it to your method.
To instanciate a table you do it like:
BAPIP0001Table table = new BAPIP0001Table();
BAPIP0001 row = table.CreateNewRow();
row.Attribute1 = "Hello world";
table.Add(row);
And you pass it to your method.
PS: This is bit code. Please double check as I have not compile it
Hope this help
Alex.
Hi,
When you will use the SAP .NET connector, it will generate c# class for handling your structure.
You just need to instanciate those structure, to fill in the properties and to pass it as a regular parameter to the proxy method. As Simple as that. Pay attention that I'm not sure if you will be hable to generate structure which contains dynamic types (variable length like STRINGs... Those are more tricky to handle...
Hope this hep,
Alexandre
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.