on 04-09-2013 9:21 PM
Hello Guys,
I have an ASP.NET web page an this gets data from a structure from SAP.
If in my source I say:
string Rollo = TextBox1.Text;
IRfcFunction PesosRollos = _ecc.Repository.CreateFunction("ZFUNCIONES_ROLLOS");
PesosRollos.SetValue("ROLLO", Rollo);
PesosRollos.Invoke(_ecc);
string GetData = PesosRollos.GetStructure("WA_PAPEL").GetString("PESO_ROLLO");
Please see this part:
string GetData = PesosRollos.GetStructure("WA_PAPEL").GetString("PESO_ROLLO");
Here I gets the PESO_ROLLO value from my structure WA_PAPEL. Something like: WA_PAPEL-PESO_ROLLO
Here I get the value: 2.254 ( because Peso is weight in spanish and I from Mexico)
But I need all data from the structure for example: If I say:
string GetData = PesosRollos.GetStructure("WA_PAPEL").ToString();
The GetData Value it's:
STRUCTURE ZWA_REMPAPEL { FIELD NUM_ROLLO=DGO19E1920301 FIELD PAPEL=C-140K42 FIELD PESO_ROLLO=2.846 FIELD REM_PAPEL=5710 FIELD EBELN=P1388C }
How Can I get all my structure like an Array in C# I not want to use regular expressions...
Thanks And Regards,
Luis.
If you want a string array of values:
IRfcStructure sapStructure = PesosRollos.GetStructure("WA_PAPEL");
IEnumerator<IRfcField> list = sapStructure.GetEnumerator;
string[] strArray = null;
int i = 0;
while (list.MoveNext) {
strArray(i) = list.Current.GetValue;
}
Or if you want the values in a generic list:
List<string> valueList = new List<string>();
while (list.MoveNext) {
valueList.Add(list.Current.GetValue);
}
If you want the field names, too, use list.Current.Metadata.Name object.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
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.