1 // Written in the D programming language.
2 
3 module sapnwrfc.binding;
4 
5 import etc.c.sapnwrfc;
6 
7 import std.meta;
8 import std.traits;
9 import std.conv : to;
10 import std.algorithm : endsWith, startsWith;
11 static import std.utf;
12 
13 class SAPException : Exception
14 {
15     private immutable RFC_ERROR_INFO errorInfo;
16 
17     @safe pure nothrow this(in RFC_ERROR_INFO errorInfo,
18                             string file = __FILE__,
19                             size_t line = __LINE__)
20     {
21         super(null, file, line);
22         this.errorInfo = errorInfo;
23     }
24 
25     @property RFC_RC code()
26     {
27         return errorInfo.code;
28     }
29 
30     @property wstring codeAsString()
31     {
32         auto rcmsg = RfcGetRcAsString(errorInfo.code);
33         return cast(wstring)rcmsg[0 .. strlenU16(rcmsg)];
34     }
35 
36     @property RFC_ERROR_GROUP group()
37     {
38         return errorInfo.group;
39     }
40 
41     @property wstring key()
42     {
43         return errorInfo.key[0 .. strlenU16(errorInfo.key.ptr)];
44     }
45 
46     @property wstring message()
47     {
48         return cast(wstring)errorInfo.message[0 .. strlenU16(errorInfo.message.ptr)];
49     }
50 
51     @property wstring abapMsgClass()
52     {
53         return cast(wstring)errorInfo.abapMsgClass[0 .. strlenU16(errorInfo.abapMsgClass.ptr)];
54     }
55 
56     @property wstring abapMsgType()
57     {
58         return cast(wstring)errorInfo.abapMsgType[0 .. strlenU16(errorInfo.abapMsgType.ptr)];
59     }
60 
61     // abapMsgNumber ?
62 
63     @property wstring abapMsgV1()
64     {
65         return cast(wstring)errorInfo.abapMsgV1[0 .. strlenU16(errorInfo.abapMsgV1.ptr)];
66     }
67 
68     @property wstring abapMsgV2()
69     {
70         return cast(wstring)errorInfo.abapMsgV2[0 .. strlenU16(errorInfo.abapMsgV2.ptr)];
71     }
72 
73     @property wstring abapMsgV3()
74     {
75         return cast(wstring)errorInfo.abapMsgV3[0 .. strlenU16(errorInfo.abapMsgV3.ptr)];
76     }
77 
78     @property wstring abapMsgV4()
79     {
80         return cast(wstring)errorInfo.abapMsgV4[0 .. strlenU16(errorInfo.abapMsgV4.ptr)];
81     }
82 }
83 
84 private void enforce(in RFC_ERROR_INFO errorInfo,
85                      string file = __FILE__, size_t line = __LINE__)
86 {
87     if (errorInfo.code != RFC_RC.RFC_OK)
88     {
89         throw new SAPException(errorInfo, file, line);
90     }
91 }
92 
93 alias helper(alias T) = T;
94 private string generate()
95 {
96     alias mod = helper!(mixin(moduleName!RFC_RC));
97 
98     alias STC = ParameterStorageClass;
99 
100     string code = "";
101     foreach (memberName; __traits(allMembers, mod))
102     {
103     /*
104         static if (memberName == "RFC_ON_PASSWORD_CHANGE")
105         {
106             pragma(msg, __traits(getMember, mod, memberName));
107             pragma(msg, is(typeof(__traits(getMember, mod, memberName)) == function));
108             pragma(msg, isFunctionPointer!(__traits(getMember, mod, memberName)));
109         }
110      */
111         static if (is(typeof(__traits(getMember, mod, memberName)) == function))
112         {
113             alias member = helper!(__traits(getMember, mod, memberName));
114 
115             bool errorInfoSeen = false;
116             foreach(idx, argName; ParameterIdentifierTuple!member)
117                 static if (is(ParameterTypeTuple!member[idx] == RFC_ERROR_INFO))
118                     errorInfoSeen = true;
119 
120             if (errorInfoSeen)
121             {
122                 bool hasReturn = !is(ReturnType!member == void) && !is(ReturnType!member == RFC_RC);
123                 string head = (hasReturn ? ReturnType!member.stringof : "void") ~ " " ~ memberName ~ "(";
124                 string src = "string file = __FILE__, size_t line = __LINE__) {\n" ~
125                               "    RFC_ERROR_INFO errorInfo;\n" ~
126                               "    " ~ (hasReturn ? "auto ret = " : "") ~ "etc.c.sapnwrfc." ~ memberName ~ "(";
127                 string tail = ");\n    enforce(errorInfo, file, line);\n" ~ (hasReturn ? "    return ret;\n" : "") ~ "}\n";
128 
129                 immutable len = ParameterTypeTuple!member.length;
130                 foreach(idx, argName; ParameterIdentifierTuple!member)
131                 {
132                     static if (is(ParameterTypeTuple!member[idx] == RFC_ERROR_INFO))
133                     {
134                         src ~= "errorInfo";
135                     }
136                     else
137                     {
138                         static if (ParameterStorageClassTuple!member[idx] == STC.ref_)
139                             head ~= "ref ";
140                         else static if (ParameterStorageClassTuple!member[idx] == STC.out_)
141                             head ~= "out ";
142                         version(sapnwrfc_sdk_750)
143                         {
144                         alias Types = AliasSeq!(RFC_SERVER_ERROR_LISTENER, RFC_SERVER_STATE_CHANGE_LISTENER,
145                                                 RFC_SERVER_FUNCTION, RFC_ON_CHECK_TRANSACTION, RFC_ON_COMMIT_TRANSACTION, RFC_ON_ROLLBACK_TRANSACTION,
146                                                 RFC_ON_CONFIRM_TRANSACTION, RFC_FUNC_DESC_CALLBACK, RFC_PM_CALLBACK, RFC_ON_CHECK_UNIT, RFC_ON_COMMIT_UNIT,
147                                                 RFC_ON_ROLLBACK_UNIT, RFC_ON_CONFIRM_UNIT, RFC_ON_GET_UNIT_STATE, RFC_ON_PASSWORD_CHANGE, RFC_ON_AUTHORIZATION_CHECK);
148                         alias Names = AliasSeq!("RFC_SERVER_ERROR_LISTENER", "RFC_SERVER_STATE_CHANGE_LISTENER",
149                                                 "RFC_SERVER_FUNCTION", "RFC_ON_CHECK_TRANSACTION", "RFC_ON_COMMIT_TRANSACTION", "RFC_ON_ROLLBACK_TRANSACTION",
150                                                 "RFC_ON_CONFIRM_TRANSACTION", "RFC_FUNC_DESC_CALLBACK", "RFC_PM_CALLBACK", "RFC_ON_CHECK_UNIT", "RFC_ON_COMMIT_UNIT",
151                                                 "RFC_ON_ROLLBACK_UNIT", "RFC_ON_CONFIRM_UNIT", "RFC_ON_GET_UNIT_STATE", "RFC_ON_PASSWORD_CHANGE", "RFC_ON_AUTHORIZATION_CHECK");
152                         }
153                         else
154                         {
155                         alias Types = AliasSeq!(RFC_SERVER_FUNCTION, RFC_ON_CHECK_TRANSACTION, RFC_ON_COMMIT_TRANSACTION, RFC_ON_ROLLBACK_TRANSACTION,
156                                                 RFC_ON_CONFIRM_TRANSACTION, RFC_FUNC_DESC_CALLBACK, RFC_PM_CALLBACK, RFC_ON_CHECK_UNIT, RFC_ON_COMMIT_UNIT,
157                                                 RFC_ON_ROLLBACK_UNIT, RFC_ON_CONFIRM_UNIT, RFC_ON_GET_UNIT_STATE, RFC_ON_PASSWORD_CHANGE, RFC_ON_AUTHORIZATION_CHECK);
158                         alias Names = AliasSeq!("RFC_SERVER_FUNCTION", "RFC_ON_CHECK_TRANSACTION", "RFC_ON_COMMIT_TRANSACTION", "RFC_ON_ROLLBACK_TRANSACTION",
159                                                 "RFC_ON_CONFIRM_TRANSACTION", "RFC_FUNC_DESC_CALLBACK", "RFC_PM_CALLBACK", "RFC_ON_CHECK_UNIT", "RFC_ON_COMMIT_UNIT",
160                                                 "RFC_ON_ROLLBACK_UNIT", "RFC_ON_CONFIRM_UNIT", "RFC_ON_GET_UNIT_STATE", "RFC_ON_PASSWORD_CHANGE", "RFC_ON_AUTHORIZATION_CHECK");
161                         }
162                         static if (staticIndexOf!(ParameterTypeTuple!member[idx], Types) >= 0)
163                             head ~= Names[staticIndexOf!(ParameterTypeTuple!member[idx], Types)];
164                         else
165                             head ~= ParameterTypeTuple!member[idx].stringof;
166                         head ~= " p" ~ to!string(idx) ~ ", ";
167                         src ~= "p" ~ to!string(idx);
168                     }
169                     if (idx+1 < len) src ~= ", ";
170                 }
171 
172                 if (errorInfoSeen) code ~= head ~ src ~ tail;
173             }
174 
175             // Special bindings for RfcGet*Count functions
176             static if (is(ReturnType!member == RFC_RC) && ParameterTypeTuple!member.length == 3
177                 && memberName.startsWith("RfcGet") && memberName.endsWith("Count")
178                 && is(ParameterTypeTuple!member[1] == uint) && ParameterStorageClassTuple!member[1] == STC.out_
179                 && is(ParameterTypeTuple!member[2] == RFC_ERROR_INFO)
180                 )
181             {
182                 string src = "size_t " ~ memberName ~ "(";
183                 src ~= ParameterTypeTuple!member[0].stringof;
184                 src ~= " handle)\n";
185                 src ~= "{ uint count; " ~ memberName ~ "(handle, count); return count; }\n";
186                 code ~= src;
187             }
188 
189 
190             // Special bindings for RfcGet*ByIndex functions
191             static if (is(ReturnType!member == RFC_RC) && ParameterTypeTuple!member.length == 4
192                 && memberName.startsWith("RfcGet") && memberName.endsWith("ByIndex")
193                 && is(ParameterTypeTuple!member[1] == uint) && ParameterStorageClassTuple!member[2] == STC.out_
194                 && is(ParameterTypeTuple!member[3] == RFC_ERROR_INFO)
195                 )
196             {
197                 string src = "void " ~ memberName ~ "(";
198                 src ~= ParameterTypeTuple!member[0].stringof;
199                 src ~= " handle, size_t idx, out ";
200                 src ~= ParameterTypeTuple!member[2].stringof;
201                 src ~= " value)\n";
202                 src ~= "{ " ~ memberName ~ "(handle, cast(uint) idx, value); }\n";
203                 code ~= src;
204             }
205         }
206     }
207 
208     return code;
209 }
210 
211 mixin(generate());
212 
213 // Some manual bindings.
214 // FIXME: Create via reflection.
215 
216 RFC_CONNECTION_HANDLE RfcOpenConnection(in RFC_CONNECTION_PARAMETER[] connectionParams)
217 {
218     return RfcOpenConnection(connectionParams.ptr, cast(uint)connectionParams.length);
219 }
220 
221 RFC_CONNECTION_HANDLE RfcRegisterServer(in RFC_CONNECTION_PARAMETER[] connectionParams)
222 {
223     return RfcRegisterServer(connectionParams.ptr, cast(uint)connectionParams.length);
224 }
225 
226 RFC_CONNECTION_HANDLE RfcStartServer(int argc, SAP_UC** argv, in RFC_CONNECTION_PARAMETER[] connectionParams)
227 {
228     return RfcStartServer(argc, argv, connectionParams.ptr, cast(uint)connectionParams.length);
229 }
230 
231 RFC_FUNCTION_DESC_HANDLE RfcGetFunctionDesc(RFC_CONNECTION_HANDLE rfcHandle, in wstring name)
232 {
233     return RfcGetFunctionDesc(rfcHandle, std.utf.toUTF16z(name));
234 }
235 
236 RFC_TYPE_DESC_HANDLE RfcGetTypeDesc(RFC_CONNECTION_HANDLE rfcHandle, in wstring name)
237 {
238     return RfcGetTypeDesc(rfcHandle, std.utf.toUTF16z(name));
239 }
240 
241 RFC_EXCEPTION_DESC RfcGetExceptionDescByIndex(RFC_FUNCTION_DESC_HANDLE rfcHandle, size_t idx)
242 {
243     RFC_EXCEPTION_DESC desc;
244     RfcGetExceptionDescByIndex(rfcHandle, cast(uint)idx, desc);
245     return desc;
246 }
247 
248 RFC_EXCEPTION_DESC RfcGetExceptionDescByName(RFC_FUNCTION_DESC_HANDLE rfcHandle, in wstring name)
249 {
250     RFC_EXCEPTION_DESC desc;
251     RfcGetExceptionDescByName(rfcHandle, std.utf.toUTF16z(name), desc);
252     return desc;
253 }
254 
255 RFC_FIELD_DESC RfcGetFieldDescByIndex(RFC_TYPE_DESC_HANDLE rfcHandle, size_t idx)
256 {
257     RFC_FIELD_DESC desc;
258     RfcGetFieldDescByIndex(rfcHandle, cast(uint)idx, desc);
259     return desc;
260 }
261 
262 RFC_FIELD_DESC RfcGetFieldDescByName(RFC_TYPE_DESC_HANDLE rfcHandle, in wstring name)
263 {
264     RFC_FIELD_DESC desc;
265     RfcGetFieldDescByName(rfcHandle, std.utf.toUTF16z(name), desc);
266     return desc;
267 }
268 
269 RFC_PARAMETER_DESC RfcGetParameterDescByIndex(RFC_FUNCTION_DESC_HANDLE rfcHandle, size_t idx)
270 {
271     RFC_PARAMETER_DESC desc;
272     RfcGetParameterDescByIndex(rfcHandle, cast(uint)idx, desc);
273     return desc;
274 }
275 
276 RFC_PARAMETER_DESC RfcGetParameterDescByName(RFC_FUNCTION_DESC_HANDLE rfcHandle, in wstring name)
277 {
278     RFC_PARAMETER_DESC desc;
279     RfcGetParameterDescByName(rfcHandle, std.utf.toUTF16z(name), desc);
280     return desc;
281 }
282 
283 void RfcMoveTo(RFC_TABLE_HANDLE handle, size_t index)
284 {
285 	RfcMoveTo(handle, cast(uint)index);
286 }
287 
288 wstring RfcGetFunctionName(RFC_FUNCTION_DESC_HANDLE handle)
289 {
290     RFC_ABAP_NAME name;
291     RfcGetFunctionName(handle, name);
292     return name[0..strlenU16(name.ptr)].idup;
293 }
294 
295 wstring RfcGetTypeName(RFC_TYPE_DESC_HANDLE handle)
296 {
297     RFC_ABAP_NAME name;
298     RfcGetTypeName(handle, name);
299     return name[0..strlenU16(name.ptr)].idup;
300 }
301 
302 // Data container getter
303 
304 void RfcGetChars(DATA_CONTAINER_HANDLE dataHandle, in wstring name, wchar[] buffer)
305 {
306     RfcGetChars(dataHandle, std.utf.toUTF16z(name), buffer.ptr, cast(uint)buffer.length);
307 }
308 
309 void RfcGetCharsByIndex(DATA_CONTAINER_HANDLE dataHandle, in size_t idx, wchar[] buffer)
310 {
311     RfcGetCharsByIndex(dataHandle, cast(uint)idx, buffer.ptr, cast(uint)buffer.length);
312 }
313 
314 void RfcGetNum(DATA_CONTAINER_HANDLE dataHandle, in wstring name, wchar[] buffer)
315 {
316     RfcGetNum(dataHandle, std.utf.toUTF16z(name), buffer.ptr, cast(uint)buffer.length);
317 }
318 
319 void RfcGetNumByIndex(DATA_CONTAINER_HANDLE dataHandle, in size_t idx, wchar[] buffer)
320 {
321     RfcGetNumByIndex(dataHandle, cast(uint)idx, buffer.ptr, cast(uint)buffer.length);
322 }
323 
324 void RfcGetBytes(DATA_CONTAINER_HANDLE dataHandle, in wstring name, ubyte[] buffer)
325 {
326     RfcGetBytes(dataHandle, std.utf.toUTF16z(name), buffer.ptr, cast(uint)buffer.length);
327 }
328 
329 void RfcGetBytesByIndex(DATA_CONTAINER_HANDLE dataHandle, in size_t idx, ubyte[] buffer)
330 {
331     RfcGetBytesByIndex(dataHandle, cast(uint)idx, buffer.ptr, cast(uint)buffer.length);
332 }
333 
334 void RfcGetString(DATA_CONTAINER_HANDLE dataHandle, in wstring name, wchar[] buffer, out size_t length)
335 {
336     uint len;
337     RfcGetString(dataHandle, std.utf.toUTF16z(name), buffer.ptr, cast(uint)buffer.length, len);
338     length = len;
339 }
340 
341 void RfcGetStringByIndex(DATA_CONTAINER_HANDLE dataHandle, in size_t idx, wchar[] buffer, out size_t length)
342 {
343     uint len;
344     RfcGetStringByIndex(dataHandle, cast(uint) idx, buffer.ptr, cast(uint)buffer.length, len);
345     length = len;
346 }
347 
348 size_t RfcGetStringLength(DATA_CONTAINER_HANDLE dataHandle, in wstring name)
349 {
350     uint len;
351     RfcGetStringLength(dataHandle, std.utf.toUTF16z(name), len);
352     return len;
353 }
354 
355 size_t RfcGetStringLengthByIndex(DATA_CONTAINER_HANDLE dataHandle, size_t index)
356 {
357     uint len;
358     RfcGetStringLengthByIndex(dataHandle, cast(uint)index, len);
359     return len;
360 }
361 
362 int RfcGetInt(DATA_CONTAINER_HANDLE dataHandle, in wstring name)
363 {
364 	int value;
365     RfcGetInt(dataHandle, std.utf.toUTF16z(name), value);
366     return value;
367 }
368 
369 ubyte RfcGetInt1(DATA_CONTAINER_HANDLE dataHandle, in wstring name)
370 {
371     ubyte value;
372     RfcGetInt1(dataHandle, std.utf.toUTF16z(name), value);
373     return value;
374 }
375 
376 short RfcGetInt2(DATA_CONTAINER_HANDLE dataHandle, in wstring name)
377 {
378     short value;
379     RfcGetInt2(dataHandle, std.utf.toUTF16z(name), value);
380     return value;
381 }
382 
383 double RfcGetFloat(DATA_CONTAINER_HANDLE dataHandle, in wstring name)
384 {
385     double value;
386     RfcGetFloat(dataHandle, std.utf.toUTF16z(name), value);
387     return value;
388 }
389 
390 RFC_STRUCTURE_HANDLE RfcGetStructure(DATA_CONTAINER_HANDLE dataHandle, in const(wchar)* name)
391 {
392     RFC_STRUCTURE_HANDLE value;
393     RfcGetStructure(dataHandle, name, value);
394     return value;
395 }
396 
397 RFC_STRUCTURE_HANDLE RfcGetStructure(DATA_CONTAINER_HANDLE dataHandle, in wstring name)
398 {
399     return RfcGetStructure(dataHandle, std.utf.toUTF16z(name));
400 }
401 
402 RFC_TABLE_HANDLE RfcGetTable(DATA_CONTAINER_HANDLE dataHandle, in const(wchar)* name)
403 {
404     RFC_TABLE_HANDLE value;
405     RfcGetTable(dataHandle, name, value);
406     return value;
407 }
408 
409 RFC_TABLE_HANDLE RfcGetTable(DATA_CONTAINER_HANDLE dataHandle, in wstring name)
410 {
411     return RfcGetTable(dataHandle, std.utf.toUTF16z(name));
412 }
413 
414 RFC_ABAP_OBJECT_HANDLE RfcGetAbapObject(DATA_CONTAINER_HANDLE dataHandle, in const(wchar)* name)
415 {
416     RFC_ABAP_OBJECT_HANDLE value;
417     RfcGetAbapObject(dataHandle, name, value);
418     return value;
419 }
420 
421 RFC_ABAP_OBJECT_HANDLE RfcGetAbapObject(DATA_CONTAINER_HANDLE dataHandle, in wstring name)
422 {
423     return RfcGetAbapObject(dataHandle, std.utf.toUTF16z(name));
424 }
425 
426 // Data container setter
427 
428 void RfcSetChars(DATA_CONTAINER_HANDLE dataHandle, in wstring name, in wstring value)
429 {
430     RfcSetChars(dataHandle, std.utf.toUTF16z(name), value.ptr, cast(uint)value.length);
431 }
432 
433 void RfcSetCharsByIndex(DATA_CONTAINER_HANDLE dataHandle, size_t index, in wstring value)
434 {
435     RfcSetCharsByIndex(dataHandle, cast(uint)index, value.ptr, cast(uint)value.length);
436 }
437 
438 void RfcSetNum(DATA_CONTAINER_HANDLE dataHandle, in wstring name, in wstring value)
439 {
440     RfcSetNum(dataHandle, std.utf.toUTF16z(name), value.ptr, cast(uint)value.length);
441 }
442 
443 void RfcSetNumByIndex(DATA_CONTAINER_HANDLE dataHandle, size_t index, in wstring value)
444 {
445     RfcSetNumByIndex(dataHandle, cast(uint)index, value.ptr, cast(uint)value.length);
446 }
447 
448 void RfcSetBytes(DATA_CONTAINER_HANDLE dataHandle, in wstring name, in ubyte[] value)
449 {
450     RfcSetBytes(dataHandle, std.utf.toUTF16z(name), value.ptr, cast(uint)value.length);
451 }
452 
453 void RfcSetBytesByIndex(DATA_CONTAINER_HANDLE dataHandle, size_t index, in ubyte[] value)
454 {
455     RfcSetBytesByIndex(dataHandle, cast(uint)index, value.ptr, cast(uint)value.length);
456 }
457 
458 void RfcSetString(DATA_CONTAINER_HANDLE dataHandle, const(SAP_UC)* name, const(SAP_UC)* value, size_t length)
459 {
460 	RfcSetString(dataHandle, name, value, cast(uint) length);
461 }
462 
463 void RfcSetString(DATA_CONTAINER_HANDLE dataHandle, in wstring name, in wstring value)
464 {
465     RfcSetString(dataHandle, std.utf.toUTF16z(name), value.ptr, cast(uint)value.length);
466 }
467 
468 void RfcSetStringByIndex(DATA_CONTAINER_HANDLE dataHandle, size_t index, const(SAP_UC)* value, size_t length)
469 {
470 	RfcSetStringByIndex(dataHandle, cast(uint)index, value, cast(uint) length);
471 }
472 
473 void RfcSetStringByIndex(DATA_CONTAINER_HANDLE dataHandle, size_t index, in wstring value)
474 {
475     RfcSetStringByIndex(dataHandle, cast(uint)index, value.ptr, cast(uint)value.length);
476 }
477 
478 void RfcSetInt(DATA_CONTAINER_HANDLE dataHandle, in wstring name, in int value)
479 {
480     RfcSetInt(dataHandle, std.utf.toUTF16z(name), value);
481 }
482 
483 void RfcSetIntByIndex(DATA_CONTAINER_HANDLE dataHandle, size_t index, in int value)
484 {
485     RfcSetIntByIndex(dataHandle, cast(uint)index, value);
486 }
487 
488 void RfcSetInt1(DATA_CONTAINER_HANDLE dataHandle, in wstring name, in ubyte value)
489 {
490     RfcSetInt1(dataHandle, std.utf.toUTF16z(name), value);
491 }
492 
493 void RfcSetInt1ByIndex(DATA_CONTAINER_HANDLE dataHandle, size_t index, in ubyte value)
494 {
495     RfcSetInt1ByIndex(dataHandle, cast(uint)index, value);
496 }
497 
498 void RfcSetInt2(DATA_CONTAINER_HANDLE dataHandle, in wstring name, in short value)
499 {
500     RfcSetInt2(dataHandle, std.utf.toUTF16z(name), value);
501 }
502 
503 void RfcSetInt2ByIndex(DATA_CONTAINER_HANDLE dataHandle, size_t index, in short value)
504 {
505     RfcSetInt2ByIndex(dataHandle, cast(uint)index, value);
506 }
507 
508 void RfcSetFloat(DATA_CONTAINER_HANDLE dataHandle, in wstring name, in double value)
509 {
510     RfcSetFloat(dataHandle, std.utf.toUTF16z(name), value);
511 }
512 
513 void RfcSetFloatByIndex(DATA_CONTAINER_HANDLE dataHandle, size_t index, in double value)
514 {
515     RfcSetFloatByIndex(dataHandle, cast(uint)index, value);
516 }
517 
518 void RfcSetStructure(DATA_CONTAINER_HANDLE dataHandle, in wstring name, in RFC_STRUCTURE_HANDLE value)
519 {
520     RfcSetStructure(dataHandle, std.utf.toUTF16z(name), value);
521 }
522 
523 void RfcSetStructureByIndex(DATA_CONTAINER_HANDLE dataHandle, size_t index, in RFC_STRUCTURE_HANDLE value)
524 {
525     RfcSetStructureByIndex(dataHandle, cast(uint)index, value);
526 }
527 
528 void RfcSetTable(DATA_CONTAINER_HANDLE dataHandle, in wstring name, in RFC_TABLE_HANDLE value)
529 {
530     RfcSetTable(dataHandle, std.utf.toUTF16z(name), value);
531 }
532 
533 void RfcSetTableByIndex(DATA_CONTAINER_HANDLE dataHandle, size_t index, in RFC_TABLE_HANDLE value)
534 {
535     RfcSetTableByIndex(dataHandle, cast(uint)index, value);
536 }
537 
538 void RfcSetAbapObject(DATA_CONTAINER_HANDLE dataHandle, in wstring name, in RFC_ABAP_OBJECT_HANDLE value)
539 {
540     RfcSetAbapObject(dataHandle, std.utf.toUTF16z(name), value);
541 }
542 
543 void RfcSetAbapObjectByIndex(DATA_CONTAINER_HANDLE dataHandle, size_t index, in RFC_ABAP_OBJECT_HANDLE value)
544 {
545     RfcSetAbapObjectByIndex(dataHandle, cast(uint)index, value);
546 }