-
Notifications
You must be signed in to change notification settings - Fork 9
/
saprfc.html
1305 lines (1215 loc) · 48.7 KB
/
saprfc.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<TITLE>SAPRFC functions</TITLE>
</HEAD>
<BODY CLASS="reference" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" >
<H1> SAPRFC functions</H1>
<P>
SAPRFC use RFC (remote call function) API to make call a function module in SAP R/3.
You can also write RFC server program in PHP and call PHP functions from SAP R/3.
Function modules are defined in transaction SE37 (Function Builder). Each function
module has interface defined. The interface definition consist from import
parameters (input), export parameters (output), internal tables (input/output)
and exceptions. The function module have to set RFC support enable to be able called by RFC
from a remote system. More information about function modules and programming concepts
in SAP R/3 you can find on <a href="help.sap.com">http://help.sap.com</a> under the BC
manuals.
<P>
You need to compile PHP with the --with-saprfc parameter to enable this extension. You also
need SAP RFCSDK (if you are SAP customer, you can find it on the "Presentation CD").
<DL>
<DT>
<B>Table of Contents</B><br><br>
</DT
<DT>
<A HREF="#function.saprfc-attributes.html">saprfc_attributes</A>
— Gets some information about RFC connection
</DT>
<DT>
<A HREF="#function.saprfc-call-and-receive.html">saprfc_call_and_receive</A>
— Does a remote call of an function module
</DT>
<DT><A HREF="#function.saprfc-close.html" >saprfc_close</A>
— Closes a RFC connection
</DT>
<DT><A HREF="#function.saprfc-error.html">saprfc_error</A>
— Gets the last RFC error message
</DT>
<DT><A HREF="#function.saprfc-exception.html">saprfc_exception</A>
— Gets a exception string for last call of an function module
</DT>
<DT><A HREF="#function.saprfc-export.html">saprfc_export</A>
— Gets a value of a export parameter
</DT>
<DT><A HREF="#function.saprfc-function-debug-info.html">saprfc_function_debug info</A>
— Prinst an interface definition of a function module and content of internal buffers
</DT>
<DT><A HREF="#function.saprfc-function-define.html">saprfc_function_define</A>
— Defines an interface of a function module
</DT>
<DT><A HREF="#function.saprfc-function-discover.html">saprfc_function_discover</A>
— Discovers an interface of a function module
</DT>
<DT><A HREF="#function.saprfc-function-free.html">saprfc_function_free</A>
— Frees a function module resources
</DT>
<DT><A HREF="#function.saprfc-function-interface.html">saprfc_function_interface</A>
— Gets an interface definition of a function module
</DT>
<DT><A HREF="#function.saprfc-function-name.html">saprfc_function_name</A>
— Gets the name of function module
</DT>
<DT><A HREF="#function.saprfc-import.html" >saprfc_import</A>
— Sets a value of a import parameter
</DT>
<DT><A HREF="#function.saprfc-server-accept.html">saprfc_server_accept</A>
— Accepts an incoming RFC connection
</DT>
<DT><A HREF="#function.saprfc-server-export.html">saprfc_server_export</A>
— Sets a value of a export parameter
</DT>
<DT><A HREF="#function.saprfc-server-import.html" >saprfc_server_import</A>
— Gets a value of a import parameter
</DT>
<DT><A HREF="#function.saprfc-server-dispatch.html" >saprfc_server_dispatch</A>
— Receives a single RFC request and call a corresponding PHP function
</DT>
<DT><A HREF="#function.saprfc-server-register-check.html" >saprfc_server_register_check</A>
— Check for registered RFC server at a SAP gateway
</DT>
<DT><A HREF="#function.saprfc-server-register-cancel.html" >saprfc_server_register_cancel</A>
— Cancel all registered RFC servers at a SAP gateway
</DT>
<DT><A HREF="#function.saprfc-set-trace.html" >saprfc_set_trace</A>
— Activate/Deactivate the RFC trace
</DT>
<DT><A HREF="#function.saprfc-table-append.html">saprfc_table_append</A>
— Appends a line at end of internal table
</DT>
<DT><A HREF="#function.saprfc-table-init.html">saprfc_table_init</A>
— Init a internal table
</DT>
<DT><A HREF="#function.saprfc-table-insert.html">saprfc_table_insert</A>
— Inserts a line into an internal table
</DT>
<DT><A HREF="#function.saprfc-table-modify.html">saprfc_table_modify</A>
— Modify a line of an internal table
</DT>
<DT><A HREF="#function.saprfc-table-read.html">saprfc_table_read</A>
— Reads a line from an internal table
</DT>
<DT><A HREF="#function.saprfc-table-remove.html">saprfc_table_remove</A>
— Removes a line of an internal table
</DT>
<DT><A HREF="#function.saprfc-table-rows.html">saprfc_table_rows</A>
— Gets a number of lines an internal table
</DT>
<DT><A HREF="#function.saprfc-trfc-call.html">saprfc_trfc_call</A>
— Calls a function module in R/3 indirectly (tRFC)
</DT>
<DT><A HREF="#function.saprfc-trfc-dispatch.html">saprfc_trfc_dispatch</A>
— Receives a single RFC request and call a corresponding PHP function (tRFC)
</DT>
<DT><A HREF="#function.saprfc-trfc-install.html">saprfc_trfc_install</A>
— Installs functions to control transactional behaviour (tRFC)
</DT>
<DT><A HREF="#function.saprfc-trfc-tid.html">saprfc_trfc_tid</A>
— Gets a transaction-ID for a following call of a function module using tRFC
</DT>
<DT><A HREF="#function.saprfc-open.html">saprfc_open</A>
— Open a RFC connection to SAP R/3
</DT>
<DT><A HREF="#function.saprfc-optional.html">saprfc_optional</A>
— Set a import parameter as optional
</DT>
<DT><A HREF="#function.saprfc-set-code-page.html">saprfc_set_code_page</A>
— Set SAP codepage for a RFC connection
</DT>
<DT><A HREF="#function.saprfc-allow-start-program.html">saprfc_allow_start_program</A>
— Explicitly allows the RFC library to start the programs
</DT>
<DT><A HREF="#function.saprfc-get-ticket.html">saprfc_get_ticket</A>
— Retrieve backend generated cookie version 2 after calling saprfc_open with flag GETSSO2
</DT>
</DL>
<H1><A NAME="#function.saprfc-attributes.html">saprfc_attributes</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_attributes --
Get some information about RFC connection
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> array <B> saprfc_attributes</B> (int rfc)</CODE>
<P>
</DIV>
<P>
Return <i>array</i> with some information about an RFC connection,
such as host name, service of the connected application server and
SAP gateway, the R/3 system number, client, user and language.
<p>
It should be called after saprfc_call_and_receive() or
saprfc_server_dispatch().
<p>
<table>
<tr><td>$attr[dest]</td><td>field RFC destination</td></tr>
<tr><td>$attr[own_host]</td><td>Own host name</td></tr>
<tr><td>$attr[partner_host]</td><td>Partner host name</td></tr>
<tr><td>$attr[systnr]</td><td>R/3 system number</td></tr>
<tr><td>$attr[sysid]</td><td>R/3 system name</td></tr>
<tr><td>$attr[client]</td><td>Client</td></tr>
<tr><td>$attr[user]</td><td>User</td></tr>
<tr><td>$attr[language]</td><td>Language</td></tr>
<tr><td>$attr[trace]</td><td>ON/OFF: 'X'/' '</td></tr>
<tr><td>$attr[ISO_language]</td><td>2-byte ISO-Language</td></tr>
<tr><td>$attr[own_codepage]</td><td>Own code page</td></tr>
<tr><td>$attr[partner_codepage]</td><td>Partner code page</td></tr>
<tr><td>$attr[rfc_role]</td><td>C/S: RFC Client / RFC Server</td></tr>
<tr><td>$attr[own_type]</td><td>2/3/E/R: R/2,R/3,Ext,Reg.Ext</td></tr>
<tr><td>$attr[own_rel]</td><td>My system release</td></tr>
<tr><td>$attr[partner_type]</td><td>2/3/E/R: R/2,R/3,Ext,Reg.Ext</td></tr>
<tr><td>$attr[partner_rel]</td><td>Partner system release</td></tr>
<tr><td>$attr[kernel_rel]</td><td>Partner kernel release</td></tr>
<tr><td>$attr[CPIC_convid]</td><td> CPI-C Conversation ID</td></tr>
</table>
</DIV>
<H1><A NAME="#function.saprfc-call-and-receive.html">saprfc_call_and_receive</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_call_and_receive --
Do a remote call of an function module
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> int <B> saprfc_call_and_receive</B> (int fce)</CODE>
<P>
</DIV>
<P>
Call a function module defined by function handle <i>fce</i>.
Return SAPRFC_OK if the call was successfully completed.
<p>
<b>List of SAP RFC return codes:</b>
<p>
<table>
<tr><td>SAPRFC_OK</td><td>O.K.</td></tr>
<tr><td>SAPRFC_FAILURE</td><td>Error occurred</td></tr>
<tr><td>SAPRFC_EXCEPTION</td><td>Exception raised</td></tr>
<tr><td>SAPRFC_SYS_EXCEPTION</td><td>System exception raised, connection closed</td></tr>
<tr><td>SAPRFC_CALL</td><td>Call received</td></tr>
<tr><td>SAPRFC_INTERNAL_COM</td><td>Internal communication, repeat (internal use only)</td></tr>
<tr><td>SAPRFC_CLOSED</td><td>Connection closed by the other side</td></tr>
<tr><td>SAPRFC_RETRY</td><td>No data yet</td></tr>
<tr><td>SAPRFC_NO_TID</td><td>No Transaction ID available</td></tr>
<tr><td>SAPRFC_EXECUTED</td><td>Function already executed</td></tr>
<tr><td>SAPRFC_SYNCHRONIZE</td><td>Synchronous Call in Progress</td></tr>
<tr><td>SAPRFC_MEMORY_INSUFFICIENT</td><td>Memory insufficient</td></tr>
<tr><td>SAPRFC_VERSION_MISMATCH</td><td>Version mismatch</td></tr>
<tr><td>SAPRFC_NOT_FOUND</td><td>Function not found (internal use only)</td></tr>
<tr><td>SAPRFC_CALL_NOT_SUPPORTED</td><td>This call is not supported</td></tr>
<tr><td>SAPRFC_NOT_OWNER</td><td>Caller does not own the specified handle</td></tr>
<tr><td>SAPRFC_NOT_INITIALIZED</td><td>RFC not yet initialized.</td></tr>
<tr><td>SAPRFC_SYSTEM_CALLED</td><td>A system call such as RFC_PING for connectiontest is executed</td></tr>
<tr><td>SAPRFC_INVALID_HANDLE</td><td>An invalid handle was passed to an API call.</td></tr>
<tr><td>SAPRFC_INVALID_PARAMETER</td><td>An invalid parameter was passed to an API call.</td></tr>
<tr><td>SAPRFC_CANCELED</td><td>Internal use only</td></tr>
</table>
<P>
<TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR><TD><DIV><P><p>
<B>Example 1. Call ABAP function module</B><p>
<TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%">
<TR><TD>
<PRE>
<?php
$rfc_rc = saprfc_call_and_receive ($fce);
switch ($rfc_rc) {
case SAPRFC_OK : break;
case SAPRFC_EXCEPTION : echo ("Exception raised:".saprfc_exception($fce));
// handle exception
default: : echo ("RFC error ".saprfc_error());
exit;
}
?>
</PRE>
</TD></TR>
</TABLE>
</TD></TR>
</TABLE>
<P>
See also: <A HREF="#function.saprfc-exception.html"><B>saprfc_exception()</B></A>,
<A HREF="#function.saprfc-error.html"><B>saprfc_error()</B></A>
</DIV>
<H1><A NAME="function.saprfc-close.html">saprfc_close</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_close --
Close a RFC connection
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> bool <B> saprfc_close</B> (int rfc)</CODE>
<P>
</DIV>
<P>
Close a RFC connection.
<P>
See also: <A HREF="#function.saprfc-open.html"><B>saprfc_open()</B></A>,
<A HREF="#function.saprfc-server_accept.html"><B>saprfc_server_accept()</B></A>
</DIV>
<H1><A NAME="function.saprfc-error.html">saprfc_error</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_error --
Get a last RFC error message
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> string <B> saprfc_error</B> ()</CODE>
<P>
</DIV>
<P>
Get string with more information on RFC errors that have occurred.
</DIV>
<H1><A NAME="function.saprfc-exception.html">saprfc_exception</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_exception --
Get a exception string for last call of an function module
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> string <B> saprfc_exception</B> (int fce)</CODE>
<P>
</DIV>
<P>
Get a exception string for last call of an function module.
<P>
See also: <A HREF="#function.saprfc-call-and-receive.html"><B>saprfc_call_and_receive()</B></A>
</DIV>
<H1><A NAME="function.saprfc-export.html">saprfc_export</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_export --
Get a value of a export parameter
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> mixed <B> saprfc_export</B> (int fce, string name)</CODE>
<P>
</DIV>
<P>
Return value of a export parameter <i>name</i> for function handle <i>fce</i>.
<P>
<TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR><TD><DIV><P><p>
<B>Example 1. Set of the import parameter</B><p>
<TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%">
<TR><TD>
<PRE>
<?php
$NAME = saprfc_export ($fce,"NAME");
echo ($NAME);
$FULLNAME = saprfc_export ($fce,"FULLNAME");
echo ($FULLNAME[FIRST]." ".$FULLNAME[LAST]);
?>
</PRE>
</TD></TR>
</TABLE>
</TD></TR>
</TABLE>
<P>
See also: <A HREF="#function.saprfc-import.html"><B>saprfc_import()</B></A>,
<A HREF="#function.saprfc-server-import.html"><B>saprfc_server_import()</B></A>,
<A HREF="#function.saprfc-server-export.html"><B>saprfc_server_export()</B></A>
</DIV>
<H1><A NAME="function.saprfc-function-debug-info.html">saprfc_function_debug info</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_function_debug info --
Print an interface definition of a function module and content of internal buffers
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> void <B> saprfc_function_debug_info</B> (int fce, [bool only_values])</CODE>
<P>
</DIV>
<P>
Show debug information for the function handle <i>fce</i>. If <i>only_values</i> is true
don't show interface definition, show values of parameters and values of internal tables only.
</DIV>
<H1><A NAME="function.saprfc-function-define.html">saprfc_function_define</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_function_define --
Define an interface of a function module
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> int <B> saprfc_function_define</B> (int rfc, string function_module, array def, [bool not_trim = false])</CODE>
<P>
</DIV>
<P>
Define interface of the <i>function_module</i>. The definition is in array <i>def</i>.
Return function handle on success or false on failure. You can use
<i>saprfc_test.php</i> script to get definition array for selected function module.
<P>
For definition of PHP server function can be <i>rfc</i> parameter set to 0.
<P>
<TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR><TD><DIV><P><p>
<B>Example 1: Interface definition for function module RFC_READ_REPORT</B><p>
<TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%">
<TR><TD>
<PRE>
<?php
$def = array (
array (
"name"=>"SYSTEM",
"type"=>"EXPORT",
"optional"=>"0",
"def"=> array (
array ("name"=>"","abap"=>"C","len"=>8,"dec"=>0,"offset"=>0)
)
),
array (
"name"=>"TRDIR",
"type"=>"EXPORT",
"optional"=>"0",
"def"=> array (
array ("name"=>"NAME","abap"=>"C","len"=>40,"dec"=>0,"offset"=>0),
array ("name"=>"SQLX","abap"=>"C","len"=>1,"dec"=>0,"offset"=>40),
array ("name"=>"EDTX","abap"=>"C","len"=>1,"dec"=>0,"offset"=>41),
array ("name"=>"VARCL","abap"=>"C","len"=>1,"dec"=>0,"offset"=>42),
array ("name"=>"DBAPL","abap"=>"C","len"=>1,"dec"=>0,"offset"=>43),
array ("name"=>"DBNA","abap"=>"C","len"=>2,"dec"=>0,"offset"=>44),
array ("name"=>"CLAS","abap"=>"C","len"=>4,"dec"=>0,"offset"=>46),
array ("name"=>"TYPE","abap"=>"C","len"=>3,"dec"=>0,"offset"=>50),
array ("name"=>"OCCURS","abap"=>"C","len"=>1,"dec"=>0,"offset"=>53),
array ("name"=>"SUBC","abap"=>"C","len"=>1,"dec"=>0,"offset"=>54),
array ("name"=>"APPL","abap"=>"C","len"=>1,"dec"=>0,"offset"=>55),
array ("name"=>"SECU","abap"=>"C","len"=>8,"dec"=>0,"offset"=>56),
array ("name"=>"CNAM","abap"=>"C","len"=>12,"dec"=>0,"offset"=>64),
array ("name"=>"CDAT","abap"=>"D","len"=>8,"dec"=>0,"offset"=>76),
array ("name"=>"UNAM","abap"=>"C","len"=>12,"dec"=>0,"offset"=>84),
array ("name"=>"UDAT","abap"=>"D","len"=>8,"dec"=>0,"offset"=>96),
array ("name"=>"VERN","abap"=>"C","len"=>6,"dec"=>0,"offset"=>104),
array ("name"=>"LEVL","abap"=>"C","len"=>4,"dec"=>0,"offset"=>110),
array ("name"=>"RSTAT","abap"=>"C","len"=>1,"dec"=>0,"offset"=>114),
array ("name"=>"RMAND","abap"=>"C","len"=>3,"dec"=>0,"offset"=>115),
array ("name"=>"RLOAD","abap"=>"C","len"=>1,"dec"=>0,"offset"=>118),
array ("name"=>"FIXPT","abap"=>"C","len"=>1,"dec"=>0,"offset"=>119),
array ("name"=>"SSET","abap"=>"C","len"=>1,"dec"=>0,"offset"=>120),
array ("name"=>"SDATE","abap"=>"D","len"=>8,"dec"=>0,"offset"=>121),
array ("name"=>"STIME","abap"=>"C","len"=>6,"dec"=>0,"offset"=>129),
array ("name"=>"IDATE","abap"=>"D","len"=>8,"dec"=>0,"offset"=>135),
array ("name"=>"ITIME","abap"=>"C","len"=>6,"dec"=>0,"offset"=>143),
array ("name"=>"LDBNAME","abap"=>"C","len"=>20,"dec"=>0,"offset"=>149),
array ("name"=>"UCCHECK","abap"=>"C","len"=>1,"dec"=>0,"offset"=>169)
)
),
array (
"name"=>"PROGRAM",
"type"=>"IMPORT",
"optional"=>"0",
"def"=> array (
array ("name"=>"","abap"=>"C","len"=>40,"dec"=>0,"offset"=>0)
)
),
array (
"name"=>"QTAB",
"type"=>"TABLE",
"optional"=>"0",
"def"=> array (
array ("name"=>"LINE","abap"=>"C","len"=>72,"dec"=>0,"offset"=>0)
)
)
);
$fce = saprfc_function_define($rfc,"RFC_READ_REPORT",$def);
?>
</PRE>
</TD></TR>
</TABLE>
</TD></TR>
</TABLE>
<P>
See also: <A HREF="#saprfc-function-discover.html"><B>saprfc_function_discover()</B></A>,
<A HREF="#saprfc-function-interface.html"><B>saprfc_function_interface()</B></A>,
<A HREF="#saprfc-function-debug-info.html"><B>saprfc_function_debug_info()</B></A>,
<A HREF="#saprfc-function-free.html"><B>saprfc_function_free()</B></A>
</DIV>
<H1><A NAME="function.saprfc-function-discover.html">saprfc_function_discover</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_function_discover --
Discover an interface of a function module
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> int <B> saprfc_function_discover</B> (int rfc, string function_module, [bool not_trim = false])</CODE>
<P>
</DIV>
<P>
Discover an interface of the <i> function_module</i>. Return function handle on
success or false on failure. Use function modules RFC_GET_FUNCTION_INTERFACE_P
and RFC_GET_STRUCTURE_DEFINITION_P in connected SAP R/3 to get information
about the interface.
<P>
See also: <A HREF="#saprfc-function-define.html"><B>saprfc_function_define()</B></A>,
<A HREF="#saprfc-function-interface.html"><B>saprfc_function_interface()</B></A>,
<A HREF="#saprfc-function-debug-info.html"><B>saprfc_function_debug_info()</B></A>,
<A HREF="#saprfc-function-free.html"><B>saprfc_function_free()</B></A>
</DIV>
<H1><A NAME="function.saprfc-function-free.html">saprfc_function_free</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_function_free --
Free a function module resources
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> bool <B>saprfc_function_free</B> (int fce)</CODE>
<P>
</DIV>
<P>
Free allocated resources for given function handle <i>fce</i>.
</DIV>
<H1><A NAME="function.saprfc-function-interface.html">saprfc_function_interface</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_function_interface --
Get an interface definition of a function module
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> array <B> saprfc_function_interface</B> (int fce)</CODE>
<P>
</DIV>
<P>
Return interface definition for the function handle <i>fce</i> on success or false on
failure. The definition has same format as in the <i>saprfc_function_define()</i>.
<P>
See also: <A HREF="#saprfc-function-define.html"><B>saprfc_function_define()</B></A>,
<A HREF="#saprfc-function-discover.html"><B>saprfc_function_discover()</B></A>
</DIV>
<H1><A NAME="function.saprfc-function-name.html">saprfc_function_name</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_function_name --
Gets the name of function module
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> string <B> saprfc_function_name</B> (int fce)</CODE>
<P>
</DIV>
<P>
Return name of the function module for function handle <i>fce</i> on success or false on
failure.
</DIV>
<H1><A NAME="function.saprfc-import.html">saprfc_import</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_import --
Set a value of a import parameter
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> bool <B> saprfc_import</B> (int fce, string name, mixed value)</CODE>
<P>
</DIV>
<P>
Set a value of the import parameter <i>name</i>. Return true on success or false on failure.
The <i>value</i> can be single (string, number....) or structure (hash array - key=name of
structure item).
<P>
<TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR><TD><DIV><P><p>
<B>Example 1. Set of the import parameter </B><p>
<TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%">
<TR><TD>
<PRE>
<?php
saprfc_import ($fce,"NAME","Smith");
saprfc_import ($fce,"FULLNAME", array ("FIRST"=>"John","LAST"=>"Smith"));
?>
</PRE>
</TD></TR>
</TABLE>
</TD></TR>
</TABLE>
<P>
See also: <A HREF="#function.saprfc-export.html"><B>saprfc_export()</B></A>,
<A HREF="#function.saprfc-server-import.html"><B>saprfc_server_import()</B></A>,
<A HREF="#function.saprfc-server-export.html"><B>saprfc_server_export()</B></A>
</DIV>
<H1><A NAME="function.saprfc-server-accept.html">saprfc_server_accept</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_server_accept --
Accept an incoming RFC connection
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> int <B> saprfc_server_accept</B> (mixed args)</CODE>
<P>
</DIV>
<P>
Accept an incoming RFC connection from SAP gateway and return RFC handle on success
or false on failure.
<p>
<i>Args</i> parameter is used for registration on SAP Gateway (transaction SM59).
The value of parameter can be <i>$argv</i> array or a command line string:
<p>
<table>
<tr><td>– a</td><td><i>program ID</i> e.g. own_host_name.program_name</td></tr>
<tr><td>– g</td><td><i>host name of the SAP gateway</i></td></tr>
<tr><td>– x</td><td><i><i>service of the SAP gateway</i> e.g. sapgw00</td></tr>
<tr><td>– t</td><td><i>Use RFC-trace</i></td></tr>
</table>
<p>
Note: The function has different behaviour under Windows and Unix. While under Windows
return to caller immediately, under Unix after receive first RFC call. This is behaviour
of function RfcAccept() (SAP RFCSDK).
<P>
<TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR><TD><DIV><P><p>
<B>Example 1. Checking Constants</B><p>
<TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%">
<TR><TD>
<PRE>
<?php
$rfc = saprfc_server_accept ("-a phpgw -g server -x sapgw30");
// or
// $rfc = saprfc_server_accept ($argv);
?>
</PRE>
</TD></TR>
</TABLE>
</TD></TR>
</TABLE>
<P>
See also: <A HREF="#function.saprfc_server_dispatch.html"><B>saprfc_server_dispatch()</B></A>
</DIV>
<H1><A NAME="function.saprfc-server-export.html">saprfc_server_export</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_server_export --
Set a value of a export parameter
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> bool <B> saprfc_server_export</B> (int fce, string name, mixed value)</CODE>
<P>
</DIV>
<P>
Set a value of the export parameter <i>name</i>. Return true on success or false on failure.
<P>
See also: <A HREF="#function.saprfc-export.html"><B>saprfc_export()</B></A>,
<A HREF="#function.saprfc-import.html"><B>saprfc_import()</B></A>,
<A HREF="#function.saprfc-server-export.html"><B>saprfc_server_export()</B></A>
</DIV>
<H1><A NAME="function.saprfc-server-import.html">saprfc_server_import</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_server_import --
Get a value of a import parameter
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> mixed <B> saprfc_server_import</B> (int fce, string name)</CODE>
<P>
</DIV>
<P>
Return value of a import parameter <i>name</i> for function handle <i>fce</i>.
See also: <A HREF="#function.saprfc-import.html"><B>saprfc_import()</B></A>,
<A HREF="#function.saprfc-server-import.html"><B>saprfc_export()</B></A>,
<A HREF="#function.saprfc-server-export.html"><B>saprfc_server_export()</B></A>
</DIV>
<H1><A NAME="function.saprfc-server-dispatch.html">saprfc_server_dispatch</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_server_dispatch --
Receive a single RFC request and call a corresponding PHP function
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> int <B> saprfc_server_dispatch</B> (int rfc, array list [, int timeout])</CODE>
<P>
</DIV>
<P>
Function waits for incoming a rfc request (forever or period defined by <i>timeout</i>
parameter in seconds), than calls a corresponding PHP function.
PHP server functions are defined in array <i>list</i>, key is function name (upper case)
and value is function handle.
Return SAPRFC_OK on success, SAPRFC_RETRY on timeout expire, -1 if call PHP server function
failed or other error code (see<i> saprfc_call_and_reveive()</i> ).
<P>
<TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR><TD><DIV><P><p>
<B>Example 1. Implementation of server PHP function RFC_READ_REPORT()</B><p>
<TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%">
<TR><TD>
<PRE>
<?php
function RFC_READ_REPORT ($fce)
{
$PROGRAM = saprfc_server_import ($fce,"PROGRAM");
if ($PROGRAM =="") return ("EMPTY"); // raise exception EMPTY
$list = file ($PROGRAM);
saprfc_table_init ($fce,"QTAB");
for ($i=0; $i<count ($list); $i++)
saprfc_table_append ($fce,"QTAB",array ("LINE"=>$list[$i]));
saprfc_server_export ($fce,"SYSTEM","PHP");
return;
}
$DEF_RFC_READ_REPORT = array (....) // see to saprfc_function_define() example
$GLOBAL_FCE_LIST[RFC_READ_REPORT] = saprfc_function_define (0,"RFC_READ_REPORT",$DEF_RFC_READ_REPORT);
$rfc = saprfc_server_accept ($argv);
$rfc_rc = saprfc_server_dispatch ($rfc,$GLOBAL_FCE_LIST);
?>
</PRE>
</TD></TR>
</TABLE>
</TD></TR>
</TABLE>
<P>
See also: <A HREF="#function.saprfce-function-define.html"><B>saprfc_function_define()</B></A>,
<A HREF="#function.saprfce-server-accept.html"><B>saprfc_server_accept()</B></A>,
</DIV>
<H1><A NAME="function.saprfc-server-register-check.html">saprfc_server_register_check</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_server_register_check --
Check for registered RFC server at a SAP gateway
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> array <B>saprfc_server_register_check</B> (string tpid, string gwhost, string gwservice)</CODE>
<P>
An RFC program can use this call to check whether and how
many RFC server programs are registered at a SAP gateway with a defined
program ID (<i>tpid</i>). Values are returned in the <i>array ("ntotal"=>?,
"ninit"=>?,"nready"=>?,"nbusy"=>? )</i> <br>
An RFC server program which registers at a SAP gateway and then waits for
RFC requests from any R/2 or R/3 or another external program can have
one of the following 3 states:<br>
<b>INIT:</b> RFC server is only registered at the SAP gateway, it doesn't wait
at this moment for RFC request. An RFC server enters in this state
after <i> saprfc_server_accept() </i> .<br>
<b>READY:</b> RFC server enters in this state after <i> saprfc_server_dispatch(),
saprfc_trfc_dispatch() </i>;
It is now ready to process incoming RFC requests.<br>
<b>BUSY: </b> RFC server is processing an RFC request and is not available
for other ones.
</DIV>
<P>
See also: <A HREF="#function.saprfc-server-register-cancel.html"><B>saprfc_server_register_cancel()</B></A>
</DIV>
<H1><A NAME="function.saprfc-server-register-cancel.html">saprfc_server_register_cancel</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_server_register_cancel --
Cancel all registered RFC servers at a SAP gateway
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> array <B>saprfc_server_register_cancel</B> (string tpid, string gwhost, string gwservice)</CODE>
<P>
</DIV>
<P>
An RFC program can use this call to cancel all registered RFC servers
at a SAP gateway with a defined program ID (<i>tpid</i>). <br>
Pay attention that RFC servers in BUSY state cannot be canceled.
In this case you will have a difference between the output parameters
<i>$array[ntotal]</i> and <i>$array[ncancel]</i> returned by this call.
</DIV>
<P>
See also: <A HREF="#function.saprfc-server-register-check.html"><B>saprfc_server_register_check()</B></A>
</DIV>
<H1><A NAME="function.saprfc-set-trace.html">saprfc_set_trace</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_set_trace --
Activate/Deactivate the RFC trace
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> void <B>saprfc_set_trace</B> (int rfc, bool level)</CODE>
<P>
Activates the RFC trace (<i>level</i> = true) for a specified connection (valid
<i>rfc</i> handle) or for all RFC connections (<i>rfc</i> = 0).
</DIV>
<P>
</DIV>
<H1><A NAME="function.saprfc-table-append.html">saprfc_table_append</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_table_append --
Append a line at end of internal table
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> bool <B> saprfc_table_append</B> (int fce, string name, array value)</CODE>
<P>
</DIV>
<P>
Append a <i>value</i> at the end of an internal table<i>name</i>.
</DIV>
<H1><A NAME="function.saprfc-table-init.html">saprfc_table_init</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_table_init --
Init a internal table
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> bool <B> saprfc_table_init</B> (int fce, string name)</CODE>
<P>
</DIV>
<P>
Deletes all rows from a table <i>name</i>. </DIV>
<H1><A NAME="function.saprfc-table-insert.html">saprfc_table_insert</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_table_insert --
Insert a line to an internal table
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> bool <B> saprfc_table_insert</B> (int fce, string name, array value, int index)</CODE>
<P>
</DIV>
<P>
Insert a <i>value</i> before line <i>index</i> in a table <i>name</i>.
</DIV>
<H1><A NAME="function.saprfc-table-modify.html">saprfc_table_modify</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_table_modify --
Modify a line of an internal table
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> bool <B> saprfc_table_modify</B> (int fce, string name, array value, int index)</CODE>
<P>
</DIV>
<P>
Modify a line <i>index</i> of an internal table <i>name</i> with a <i>value</i>.
</DIV>
<H1><A NAME="function.saprfc-table-read.html">saprfc_table_read</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_table_read --
Read a line from an internal table
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> array <B> saprfc_table_read</B> (int fce, string name, int index)</CODE>
<P>
</DIV>
<P>
Read a value from an internal table <i>name</i> from line <i>index</i> (indexed from 1,2,...)
</DIV>
<H1><A NAME="function.saprfc-table-remove.html">saprfc_table_remove</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_table_remove --
Remove a line of an internal table
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> bool <B> saprfc_table_remove</B>(int fce, string name, int index) </CODE>
<P>
</DIV>
<P>
Remove line <i>index</i> from a table <i>name</i>.
</DIV>
<H1><A NAME="function.saprfc-table-rows.html">saprfc_table_rows</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_table_rows --
Get a number of lines an internal table
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> int <B> saprfc_table_rows</B> (int fce, string name)</CODE>
<P>
</DIV>
<P>
Get a number of lines an internal table <i>name</i>.
</DIV>
<H1><A NAME="#function.saprfc-trfc-call.html">saprfc_trfc_call</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_trfc_call --
Calls a function module in R/3 indirectly (tRFC)
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> int <B> saprfc_trfc_call</B> (int fce, string tid)</CODE>
<P>
</DIV>
<P>
Calls a function module in R/3 indirectly. <br>
With this function, the call of a function module in R/3
will use the transactional RFC interface in R/3.<br>
Export parameters are not supported. <br>
If an error occurs (almost only communication errors), the RFC client program
has to reconnect to R/3 later and repeat this RFC call with the specific TransID.
It must not create a new TransID via <i>saprfc_trfc_tid()</i>
</DIV>
<P>
See also: <A HREF="#function.saprfc-call-and-receive.html"><B>saprfc_call_and_receive()</B></A>,
<A HREF="#function.saprfc-trfc-tid.html"><B>saprfc_trfc_tid()</B></A>
</DIV>
<H1><A NAME="function.saprfc-trfc-dispatch.html">saprfc_trfc_dispatch</A></H1>
<DIV>
<P> (PHP 4, PHP 5) <P>
saprfc_trfc_dispatch --
Receives a single RFC request and call a corresponding PHP function (tRFC)
</DIV>
<DIV>
<H2 >Description</H2>
<DIV>
<P>
<P><CODE> int <B> saprfc_trfc_dispatch</B> (int rfc, array list [, int timeout])</CODE>
<P>
Alias to <i>saprfc_server_dispatch()</i>.