Professional Documents
Culture Documents
SAP System
For internal use only \INTFSD_E.DOC Version : 1.0 Date : 02/26/96
SAP AG
Neurottstr. 16
D-69190 Walldorf
SAP AG
Copyright
Copyright 1996 SAP AG. All rights reserved. No part of this description of functions may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. Microsoft, WINDOWS and EXCEL and SQL-Server are registered trademarks of Microsoft Corporation. IBM, OS/2, DB2/6000 and AIX are a registered trademark of IBM Corporation. OSF/Motif is a registered trademark of Open Software Foundation. ORACLE is a registered trademark of ORACLE Corporation, California, USA. INFORMIX-OnLine for SAP is a registered trademark of Informix Software Incorporated. UNIX is a registered trademark of SCO Santa Cruz Operation. ADABAS is a registered trademark of Software AG. SAP, R/2, R/3, RIVA, ABAP/4, SAPoffice, SAPmail, SAPaccess, SAPEDI, SAP ArchiveLink, InterSAP, SAP Business Workflow, are registered trademarks of SAP AG.
Order information
ii
February 1996
SAP AG
Contents
Chapter 1: Specification............................................................................................... 1 A.1 Administration....................................................................................................... 1 A.1.1 Author, Date, Status, Version .......................................................................... 1 A.1.2 Project Team................................................................................................... 1 A.1.3 Development requests / customer requirements .............................................. 1 A.1.4 Intended usage for this document / target group .............................................. 2 A.2 Development information /news .......................................................................... 2 A.2.1 Background ..................................................................................................... 2 A.2.2 Graphical Overview......................................................................................... 3 A.2.3 Negative list, possible enhancements ............................................................ 3 A.3 Requirements ........................................................................................................ 4 A.3.1 Functional requirements .................................................................................. 4 A.3.2 Technical requirements ................................................................................... 4 A.3.3 Customizing .................................................................................................... 4 Chapter 2: Design......................................................................................................... 1 B.1 Master Data Maintenance ..................................................................................... 1 B.2 Tax Calculation ..................................................................................................... 3 B.3 External Tax System Update ................................................................................ 4 B.4 Additional functions/Reports ............................................................................... 5 B.5 RFC function modules.......................................................................................... 6 B.5.1 Function module for tax jurisdiction code determination .................................. 6 B.5.2 Function module for tax calculation ................................................................. 6 B.6 Tables / Interfaces to External Systems .............................................................. 6 B.6.1 COM_ERR - SAP link area for the error message handling ............................. 7 B.6.2 COM_ERR - SAP link area for the tax jurisdiction code determination............. 8 B.6.3 COM_TAX - SAP link area for the tax calculation function............................... 9
iii
SAP AG
Chapter 1: Specification
A.1 Administration
A.1.1 Author, Date, Status, Version
Author: Date: Status: Version: Gert Bizer 02/26/96 draft 1.0
February 1996
SAP AG
to the SAP system in the event of tax changes so long as the tax software and rates are kept current. The best solution combining both rate and rule processing would be to link from SAP to the vendor package giving the tax software all required line item data. The package can then determine tax based upon its complete system of rates and processing logic and return the tax data to SAP. SAP can then move the tax amounts into the line item as manual condition records for inclusion into the appropriate document.
February 1996
SAP AG
- fill SAP link area - initiate RFC communication - receive SAP link area - Error handling
- accept SAP link area - map to Partner link area - call Partners programs - map to SAP link area - prepare error handling
February 1996
SAP AG
A.3 Requirements
A.3.1 Functional requirements
There are three critical points where an interface between SAP and a sales and use tax software package must occur: A) Master data maintenance: the interface is required here so that the proper keys to the tax software can be stored on the SAP customer, plant, asset, cost center, internal order, and vendor master file record(s) so that the two systems can successfully link. Note: For assets and internal orders there is no automatic jurisdiction code determination possible because these objects do not carry address information. B) Tax calculation: access the tax software to move the appropriate tax amounts to the SAP document. C) External tax system update: update the databases of the external tax system for later audit and/or tax return reporting.
February 1996
SAP AG
Chapter 2: Design
The design is based on the above mentioned requirements (A, B, C).
February 1996
SAP AG
The external determination of a tax jurisdiction code is also performed at change of the ship-to address during order entry.
February 1996
SAP AG
Note:
For other master data (project WBS element, Internal order, Fixed Asset), the external determination of the tax jurisdiction code is not possible, since these elements do not carry appropriate address data. In those elements, the tax jurisdiction code can either be entered manually or can be defaulted from the responsible cost center.
February 1996
SAP AG
SAP-Vertex Tax-API
February 1996
SAP AG
Step 1: at time of document creation, the tax calculation details are stored in the internal memory of the tax calculation modules. As soon as the document is posted into FI, the data is removed from the internal memory and stored into a table (TTXY). This table contains all COM_TAX data by document number and item number. This allows to have more detailed information available, especially for SD documents. Step 2: at time of FI document posting a special index (TTXI) is updated for all tax relevant documents. Step 3: SAP provides 2 programs (RFYTXD00 and RFYTXU00) which use the index (TTXI,TTXY), along with the document tax information (BSET), to update the external tax package. The index is then updated with status information (i.e. update successful or not successful).
February 1996
SAP AG
--> Input Structure COM_TAX --> Output Structure COM_TAX --> Structure COM_ERR
COM_TAX - defines the SAP link area for the tax calculation function
February 1996
SAP AG
B.6.1 COM_ERR - SAP link area for the error message handling
The structure COM_ERR defines the SAP link area for the error message handling. An explanation of the possible field types is given at the end of this section. SAP Field Name RETCODE Length char01 Field Type C Input Output X Comment Return code (note: '0' = determination successful, other values = determination not successful) Application specific error code (to be displayed in SAP online error message) Application specific error message (to be displayed in SAP online error message)
ERRCODE
char04
ERRMSG
char72
February 1996
SAP AG
B.6.2 COM_ERR - SAP link area for the tax jurisdiction code determination
The structure COM_JUR defines the SAP link area for the tax jurisdiction code determination. An explanation of the possible field types is given at the end of this section. SAP Field Name COUNTRY STATE COUNTY CITY ZIPCODE TXJCD_L1 Length char03 char03 char35 char35 char10 char02 Field Type C C C C C C Input X X X X X X X X X X Output Comment Country key (ISO code to be expected) State code County name City name Zipcode Length of first structure element of the Tax Jurisdiction Code (usually used for the state code) Length of second structure element ot the tax jurisdiction code (used for state or Zipcode) Length of third structure element of the tax jurisdiction code (used for Geocode or Citycode) Length of fourth structure element of the tax jurisdiction code (probably used for the city in/out indicator) X Tax jurisdiction code (note: SAP expects the full tax jurisdiction code, i.e. state/county/city/.. or state/zipcode/geocode in this field) Indicator: location is out of city
TXJCD_L2
char02
TXJCD_L3
char02
TXJCD_L4
char02
TXJCD
char15
OUTOF_CITY
char01
February 1996
SAP AG
B.6.3 COM_TAX - SAP link area for the tax calculation function
The structure COM_TAX defines the SAP link area for the tax calculation function. An explanation of the possible field types is given at the end of this section. SAP Field Name CLIENT Length char03 Field Type C Input X Output Comment SAP Client (note: this field might be used for sepparation of audit file records, if a company uses more than one SAP client with the external tax interface Company code (note: this field will be filled always by the SAP company code) Division Code (note: this field will be filled with the actual SAP business area when available) country key (ISO code to be expected) Document number of the financial or sales document (No. of financial doc document / No. of SD billing document), used for updating the audit file/sales tax register Item number of the financial or sales document (No. of financial doc document / No. of SD billing document), used for updating the audit file/sales tax register Customer (A/R) or vendor (A/P) account number Customer (A/R) or vendor (A/P) account class (note: this field is currently not supported by SAP, it can be filled in an SAP User-Exit by the customer)
COMP_CODE
char04
DIVISION
char04
COUNTRY DOC_NUMBER
char03 char10
C C
X X
POS_NO
char06
ACCNT_NO ACCNT_CLS
char16 char10
C C
X X
February 1996
SAP AG
Field Type D C C C
Input X X X X
Output
Comment Date for tax calculation Tax Jurisdiction Code of the shipto Tax Jurisdiction Code of the shipfrom "Tax Jurisdiction Code of the point of order acceptance (note: this field is currently not supported by SAP, it can be filled in an SAP User-Exit by the customer; if not specified by the customer, this field is defaulted from the shipfrom)" "Tax Jurisdiction Code of the point of order origin (note: this field is currently not supported by SAP, it can be filled in an SAP User-Exit by the customerr; if not specified by the customer, this field is defaulted from the shipto)"
TXJCD_POO
char15
TXJCD_IND
char01
"Indicates which tax jurisdiction code is used(note: values: '1' = ST, '2' = SF, '3' = POA, '4' = POO; this field is currently not supported by SAP, it can be filled in an SAP User-Exit by the customer)" "Indicates which Jurisdiction is the Point of Title Passage(note: values: '0' = ST, '1' = SF; this field is currently not supported by SAP, it can be filled in an User-Exit by the customer) " "Indicates, whether the actual transaction is an accounts payable or an accounts receivable transaction. The value is filled
PTP_IND
char01
APAR_IND
char01
10
February 1996
SAP AG
Length
Field Type
Input
Output
Comment from SAP T007A; values: 'A' = accounts receivable, 'V' = accounts payable)"
TXJCD_L1
char02
Length of first structure element of the Tax Jurisdiction Code (usually used for the state code) Length of second structure element ot the tax jurisdiction code (used for state or Zipcode) Length of third structure element of the tax jurisdiction code (used for Geocode or Citycode) Length of fourth structure element of the tax jurisdiction code (probably used for the city in/out indicator) X Type of tax -sales/use/service/ lease/... (note: values:' ' or '0' = Sales Tax, '1' = Consumer Use Tax, '2' = Service Tax, '3' = Rental/Lease Tax, other values could be later defined) Material number Product code (from SAP-table TTXP - user defined) Item quantity (note: this value is not available for all SAP transactions i.e. not for financial documents) Unit of item quantity (note: this value is not available for all SAP transactions i.e. not for financial documents) Gross Amount Document currency (note: ISO
TXJCD_L2
char02
TXJCD_L3
char02
TXJCD_L4
char02
TAX_TYPE
char01
C C Q
X X X
UNIT
char03
AMOUNT CURRENCY
char15 char05
A C
X X
February 1996
11
SAP AG
Length
Field Type C
Input X
Output
CURR_DEC
char03
Number of decimals used for the currency in the SAP-system (note: value comes out of TCURXCURRDEC) Freight Amount (note: this field is currently not used by SAP) Tax exempt amount (note: this field is currently not used by SAP) "Tax exempt indicator (note: values: ' ' or '0' = decision about taxability always external, '1' = transaction is taxable, '2' = transaction is non-taxable;this field is currently not used by SAP,SAP defaults '0')" "Indicates whether the transaction is doing a tax credit or tax debit (note: this is used for the update of the sales tax register/audit file; values: ' ' or '0' = debit, '1' = credit) " Update indicator (note: 'X' = update, ' ' = no update to sales tax register/audit file) "Overwrite indicator (note: 'X' = overwrite, ' ' = no overwrite; G78 this indicator tells the external tax systems not to recalculate the taxes but to use the given amounts and rates; this is used for the update of the sales tax register/audit file only) " X "Federal tax percentage (note: Within SAP only used for display purposes; currently not used by
A A C
X X X
CREDIT_IND
char01
UPDATE_IND
char01
OVRWRT_IND
char01
TAXPCT0
char15
12
February 1996
SAP AG
Length
Field Type P
Input X
Output X
Comment SAP)"
TAXPCT1
char15
State tax percentage (note: Within SAP only used for display purposes) County tax percentage (note: Within SAP only used for display purposes) City/local tax percentage (note: Within SAP only used for display purposes) District/secondary county tax percentage (note: Within SAP only used for display purposes) Secondary city tax percentage (note: Within SAP only used for display purposes) Other tax percentage (note: Within SAP only used for display purposes) "Other tax percentage (note: Within SAP only used for display purposes; currently not used by SAP)" "Other tax percentage (note: Within SAP only used for display purposes; currently not used by SAP)" "Other tax percentage (note: Within SAP only used for display purposes; currently not used by SAP)" Overall combined tax percentage (note: currently not used by SAP) Federal tax amount (note: currently not used by SAP)
TAXPCT2
char15
TAXPCT3
char15
TAXPCT4
char15
TAXPCT5
char15
TAXPCT6
char15
TAXPCT7
char15
TAXPCT8
char15
TAXPCT9
char15
TAXPCOV TAXAMT0
char15 char15
P A
X X
X X
February 1996
13
SAP AG
SAP Field Name TAXAMT1 TAXAMT2 TAXAMT3 TAXAMT4 TAXAMT5 TAXAMT6 TAXAMT7 TAXAMT8 TAXAMT9 TAXAMOV TAXBAS0
Length char15 char15 char15 char15 char15 char15 char15 char15 char15 char15 char15
Field Type A A A A A A A A A A A
Input X X X X X X X X X X X
Output X X X X X X X X X X X
Comment State tax amount County tax amount City/local tax amount District/secondary county tax amount Secondary city tax amount Other tax amount Other tax amount (note: currently not used by SAP) Other tax amount (note: currently not used by SAP) Other tax amount (note: currently not used by SAP) Overall tax amount (note: currently not used by SAP) "Federal tax base amount (note: Within SAP only used for display purposes; currently not used by SAP; only to be filled if different from AMOUNT field)" "State tax base amount (note: Within SAP only used for display purposes; only to be filled if different from AMOUNT field)" "County tax base amount (note: Within SAP only used for display purposes; only to be filled if different from AMOUNT field)" "City/local tax base amount (note: Within SAP only used for display purposes; only to be filled if different from AMOUNT field)" "District/secondary county base
TAXBAS1
char15
TAXBAS2
char15
TAXBAS3
char15
TAXBAS4
char15
14
February 1996
SAP AG
Length
Field Type
Input
Output
Comment amount (note: Within SAP only used for display purposes; only to be filled if different from AMOUNT field)"
TAXBAS5
char15
"Secondary city tax base amount (note: Within SAP only used for display ; only to be filled if different from AMOUNT field)" "Other tax base amount (note: Within SAP only used for display purposes; only to be filled if different from AMOUNT field)" "Other tax base amount (note: Within SAP only used for display purposes; currently not used by SAP; only to be filled if different from AMOUNT field)" "Other tax base amount (note: Within SAP only used for display purposes; currently not used by SAP; only to be filled if different from AMOUNT field)" "Other tax base amount (note: Within SAP only used for display purposes; currently not used by SAP; only to be filled if different from AMOUNT field)" Product exemption flag (note: only output parameter, indicates material exemption reason, currently not used by SAP) Customer exemption flag (note: only output parameter, indicates material exemption reason, currently not used by SAP) Federal exempt amount (note:
TAXBAS6
char15
TAXBAS7
char15
TAXBAS8
char15
TAXBAS9
char15
EXMATFLG
char02
EXCUSFLG
char02
EXAMT0
char15
February 1996
15
SAP AG
Length
Field Type A A A A
Input
Output X X X X
State exempt amount (note: currently not used by SAP) County exempt amount (note: currently not used by SAP) City/local exempt amount (note: currently not used by SAP) District/secondary county exempt amount (note: currently not used by SAP) Secondary city exempt amount (note: currently not used by SAP) Other exempt amount (note: currently not used by SAP) Other exempt amount (note: currently not used by SAP) Other exempt amount (note: currently not used by SAP) Other exempt amount (note: currently not used by SAP) Federal exempt code (note: currently not used by SAP) State exempt code (note: currently not used by SAP) County exempt code (note: currently not used by SAP) City/local exempt code (note: currently not used by SAP) District/secondary county exempt code (note: currently not used by SAP) Secondary city exempt code (note:
EXAMT5 EXAMT6 EXAMT7 EXAMT8 EXAMT9 EXCODE0 EXCODE1 EXCODE2 EXCODE3 EXCODE4
char15 char15 char15 char15 char15 char02 char02 char02 char02 char02
A A A A A C C C C C
X X X X X X X X X X
EXCODE5
char02
16
February 1996
SAP AG
Length
Field Type C C C C C
Input
Output X X X X
Other exempt code (note: currently not used by SAP) Other exempt code (note: currently not used by SAP) Other exempt code (note: currently not used by SAP) Other exempt code (note: currently not used by SAP) Number of tax exemption certificate (note: forseen for later use) Reason for tax exemption (note: forseen for later use) User defined field (for reporting purposes)
EXREASON USER_DATA
char02 char50
C C X
February 1996
17
SAP AG
Possible Field Types : Field Type A Field Description Amount fields Comment Amount fields are right justified, left filled with spaces. The number of digits after the decimal point is variable. The structure field CURR_DEC contans the number of decimal places after the decimal point. If the CURR_DEC field is empty, two (2) decimals have to be assumed. Example1: Currency = US$, decimals of US$ = 2, content of field CURR_DEC = 002 --> 100.00 US$ is passed over in the tax link area as _10000 Example2: Currency = LIT, decimals of LIT = 0, content of field CURR_DEC = 000 --> 100 Lit is passed over in the tax link area as ___100 Negative values have a minus sign (-) at the last digit of the field. Example: A negative amount of minus 100.00 US$ is passed over in the tax link area amount field as 10000-. C D P Character fields Date fields Percent fields Character fields are all left justified, right filled with spaces. Date fields are in the format character(8) completely filled. Structure: YYYYMMDD. Percent fields are right justified, left filled with spaces. They are assumed to have three (3) digits after the decimal point within SAP. In the communication structure, no decimal point is used. Example: If SAP displays a percentage as 10.000 the percentage field in the tax link area is filled as _10000. Negative values have a minus sign (-) at the last digit of the field. Example: If a percentage is negative 10.000-the percentage field in the tax link area is filled as 10000-. Q Quantity fields Quantity fiels are similar to percentage fields. Negative values are not allowed.
18
February 1996
SAP AG
Chapter 3: Implementation
C.1 RFC Server Example Program
C.1.1 Header File - saprfcsr.h
/* -----------------------------------------------------------------------------SAP AG - R/3 Remote Function Call Interface Generation RFC_ANSIC_SR_EXP E 30C 02-09-1996 12:44 Complete ANSI C server example saprfcsr.h -----------------------------------------------------------------------------*/ #include #include #include #include #include #include <memory.h> <stdio.h> <stdlib.h> <string.h> "saprfc.h" "sapitab.h"
/* -----------------------------------------------------------------------------Called function RFC_DETERMINE_JURISDICTION importing LOCATION_DATA structure COM_JUR length 110 number of fields 11 exporting LOCATION_ERR structure COM_ERR length 77 number of fields 3 tables LOCATION_RESULTS structure COM_JUR length 110 number of fields 11 exceptions -----------------------------------------------------------------------------*/ /* structure type definition */ #ifndef SAP_ST_COM_JUR #define SAP_ST_COM_JUR typedef struct { RFC_CHAR Country[3]; RFC_CHAR State[3]; RFC_CHAR County[35]; RFC_CHAR City[35]; RFC_CHAR Zipcode[10]; RFC_NUM TxjcdL1[2]; RFC_NUM TxjcdL2[2]; RFC_NUM TxjcdL3[2]; RFC_NUM TxjcdL4[2]; RFC_CHAR Txjcd[15]; RFC_CHAR OutofCity[1]; } COM_JUR; #endif #ifndef SAP_ST_COM_ERR #define SAP_ST_COM_ERR typedef struct { RFC_CHAR Retcode[1]; RFC_NUM Errcode[4]; RFC_CHAR Errmsg[72]; } COM_ERR; #endif /* ------------------------------------------------------------------------------
February 1996
SAP AG
Called function RFC_CALCULATE_TAXES importing TAX_DATA structure COM_TAX length 968 number of fields 91 exporting TAX_ERR structure COM_ERR length 77 number of fields 3 TAX_RESULT structure COM_TAX length 968 number of fields 91 tables exceptions -----------------------------------------------------------------------------*/ /* structure type definition */ #ifndef SAP_ST_COM_TAX #define SAP_ST_COM_TAX typedef struct { RFC_CHAR Client[3]; RFC_CHAR CompCode[4]; RFC_CHAR Division[4]; RFC_CHAR Country[3]; RFC_CHAR DocNumber[10]; RFC_NUM PosNo[6]; RFC_CHAR AccntNo[16]; RFC_CHAR AccntCls[10]; RFC_CHAR TaxDate[8]; RFC_CHAR TxjcdSt[15]; RFC_CHAR TxjcdSf[15]; RFC_CHAR TxjcdPoa[15]; RFC_CHAR TxjcdPoo[15]; RFC_CHAR TxjcdInd[1]; RFC_CHAR PtpInd[1]; RFC_CHAR AparInd[1]; RFC_NUM TxjcdL1[2]; RFC_NUM TxjcdL2[2]; RFC_NUM TxjcdL3[2]; RFC_NUM TxjcdL4[2]; RFC_CHAR TaxType[1]; RFC_CHAR Matnr[18]; RFC_CHAR ProdCode[10]; RFC_CHAR Quantity[13]; RFC_CHAR Unit[3]; RFC_CHAR Amount[15]; RFC_CHAR Currency[5]; RFC_CHAR CurrDec[3]; RFC_CHAR FreightAm[15]; RFC_CHAR ExemptAmt[15]; RFC_CHAR ExemptInd[1]; RFC_CHAR CreditInd[1]; RFC_CHAR UpdateInd[1]; RFC_CHAR OvwrtInd[1]; RFC_CHAR Taxpct0[15]; RFC_CHAR Taxpct1[15]; RFC_CHAR Taxpct2[15]; RFC_CHAR Taxpct3[15]; RFC_CHAR Taxpct4[15]; RFC_CHAR Taxpct5[15]; RFC_CHAR Taxpct6[15]; RFC_CHAR Taxpct7[15]; RFC_CHAR Taxpct8[15]; RFC_CHAR Taxpct9[15]; RFC_CHAR Taxpcov[15]; RFC_CHAR Taxamt0[15]; RFC_CHAR Taxamt1[15]; RFC_CHAR Taxamt2[15]; RFC_CHAR Taxamt3[15]; RFC_CHAR Taxamt4[15]; RFC_CHAR Taxamt5[15]; RFC_CHAR Taxamt6[15]; RFC_CHAR Taxamt7[15]; RFC_CHAR Taxamt8[15]; RFC_CHAR Taxamt9[15];
February 1996
SAP AG
RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR RFC_CHAR #endif
Taxamov[15]; Taxbas0[15]; Taxbas1[15]; Taxbas2[15]; Taxbas3[15]; Taxbas4[15]; Taxbas5[15]; Taxbas6[15]; Taxbas7[15]; Taxbas8[15]; Taxbas9[15]; Exmatflg[2]; Excusflg[2]; Examt0[15]; Examt1[15]; Examt2[15]; Examt3[15]; Examt4[15]; Examt5[15]; Examt6[15]; Examt7[15]; Examt8[15]; Examt9[15]; Excode0[2]; Excode1[2]; Excode2[2]; Excode3[2]; Excode4[2]; Excode5[2]; Excode6[2]; Excode7[2]; Excode8[2]; Excode9[2]; Excertif[25]; Exreason[2]; UserData[50]; } COM_TAX;
#ifndef SAP_ST_COM_ERR #define SAP_ST_COM_ERR typedef struct { RFC_CHAR Retcode[1]; RFC_NUM Errcode[4]; RFC_CHAR Errmsg[72]; } COM_ERR; #endif
February 1996
SAP AG
{ if (logfile!=NULL) { fprintf(logfile,"%d %s %s\n",hRfc,text,str); fflush(logfile); } } #define OUT(text,pos) printf("%*.0s",pos,text); printf("%s\n",text); if (outfile!=NULL) fprintf(outfile,"=%s\n",text) #define NL printf("\n") typedef void (* RFC_HELP)(const char *topic, const char *subtopic, const char *text); static RFC_HELP rfc_help; void WIN_DLL_EXPORT_FLAGS hlp_rfc_determine_jurisdiction(const char *topic, const char *subtopic, const char *text); void WIN_DLL_EXPORT_FLAGS hlp_rfc_calculate_taxes(const char *topic, const char *subtopic, const char *text); void help(const char *topic, const char *subtopic, const char *text) { /* general help */ if (strcmp(topic,"h")==0) { OUT("This is a server example programm for SAP Remote Function Call.",6); OUT("The program was generated by the R/3 RFC Interface Generator.",6); OUT("For further information about the example see saprfcsr.txt.",6); OUT("To get help using the example, answer '?' on any item.",6); OUT("The example has been generated for function module:",6); NL; OUT("- RFC_DETERMINE_JURISDICTION",8); OUT(" Ermittlung des Jurisdictioncodes durch ein externes System.",8); NL; } /* program arguments help */ if (strcmp(topic,"s")==0) { OUT("Starting the generated external server you can use the following",6); OUT("additional program arguments:",6); NL; OUT("-i <filename> input from file",8); OUT("-o <filename> output to file",8); OUT("-log <filename> log events file",8); OUT("-? this text",8); NL; } /* input help */ if (strcmp(topic,"i")==0) { OUT("To input function module parameters, answer 'y' and type in",6); OUT("parameter values and append table rows if necessary.",6); NL; } if ((strcmp(topic,"isi")==0)||(strcmp(topic,"esi")==0)) { OUT("To fill in the structure, answer 'y' and type in structure fields.",10); NL; } if ((strcmp(topic,"iso")==0)||(strcmp(topic,"eso")==0)) { OUT("To display the structure fields, answer 'y'.",10); NL; } if (strcmp(topic,"ti")==0) { OUT("To append a table row, answer 'y' and type in table row fields.",10); NL; } if (strcmp(topic,"to")==0) { OUT("To get the table row and display the row fields, answer 'y' or '*' for all rows.",10); NL; } if (strcmp(topic,"xi")==0) { OUT("Terminates the function. To raise the exception, answer 'y'.",10); NL; } if (strcmp(topic,"xo")==0) { OUT("Terminated the called function.",10); NL; } if (strcmp(topic,"c")==0) { OUT("To call the function module, answer 'y'.",6); NL; } if (strcmp(topic,"a")==0) { OUT("To call the function module again, answer 'y'.",6); NL; } /* end info */ if (strcmp(topic,"end")==0) { OUT("Thank you for using the SAP Business Application Programming Interface",2); OUT("and SAP Remote Function Call. For further information please call us at:",2); OUT("SAP America Inc. Western Regional Office 950 Towerlane Foster City",2); OUT("CA 94404-2127, Phone (+1) 415 637 1655 FAX (+1) 415 637 9592 or",2); OUT("SAP AG Basisvertrieb Postbox 1461 D-69185 Walldorf Germany,",2);
February 1996
SAP AG
OUT("Phone (+49) 6227 34 1763 FAX (+49) 6227 34 1880.",2); NL; } if (rfc_help!=NULL) rfc_help(topic, subtopic, text); } void INS(const char *topic,const char *subtopic,const char *text,const unsigned pos,const unsigned len,char *str) { int c=0; do { printf("%*.0s",pos,text); printf("%-*s : ",len,text); if (infile!=NULL) { /* read from input file comparing input event (text) */ do { c=getc(infile); if (c==EOF) { OUT("error reading input file",0); exit(1); } fgets(str,256,infile); *(str+strlen(str)-1) = '\0'; } while ((c!='=')||(strcmp(text,str)!=0)); c=getc(infile); if (c==EOF) { OUT("error reading input file",0); exit(1); } fgets(str,256,infile); *(str+strlen(str)-1) = '\0'; printf("%s\n",str); } /* cut CR/LF and stdout */ else gets(str); /* read from stdin */ if (outfile!=NULL) fprintf(outfile,"=%s\n<%s\n",text,str); /* write output file */ if (str[0]=='?') help(topic,subtopic,text); } while (str[0]=='?'); return; } void OUTS(const char *text,const unsigned pos,const unsigned len,char *str) { printf("%*.0s",pos,text); printf("%-*s : %s\n",len,text,str); if (outfile!=NULL) fprintf(outfile,"=%s\n>%s\n",text,str); return; } #define SETCHAR(var,str) memcpy(var,str,__min(strlen(str),sizeof(var))); \ if (sizeof(var)>strlen(str)) memset(var+strlen(str),' ',sizeof(var)-strlen(str)) #define GETCHAR(var,str) sprintf(str,"%.*s",sizeof(var),var) #define SETDATE(var,str) memcpy(var,str,__min(strlen(str),sizeof(var))); \ if (sizeof(var)>strlen(str)) memset(var+strlen(str),'0',sizeof(var)-strlen(str)) #define GETDATE(var,str) sprintf(str,"%.*s",sizeof(var),var) #define SETFLOAT(var,str) *var=atof(str); #define GETFLOAT(var,str) sprintf(str,"%f",var); #define SETINT(var,str) *var=atol(str); #define GETINT(var,str) sprintf(str,"%ld",var); #define SETNUM(var,str) memcpy(var+(sizeof(var)__min(strlen(str),sizeof(var))),str,__min(strlen(str),sizeof(var))); \ if (sizeof(var)>strlen(str)) memset(var,'0',sizeof(var)strlen(str)) #define GETNUM(var,str) sprintf(str,"%.*s",sizeof(var),var) #define SETTIME(var,str) memcpy(var,str,__min(strlen(str),sizeof(var))); \ if (sizeof(var)>strlen(str)) memset(var+strlen(str),'0',sizeof(var)-strlen(str)) #define GETTIME(var,str) sprintf(str,"%.*s",sizeof(var),var) #define SETINT1(var,str) *var=atoi(str); #define GETINT1(var,str) sprintf(str,"%hu",var); #define SETINT2(var,str) *var=atoi(str); #define GETINT2(var,str) sprintf(str,"%d",var); void WIN_DLL_EXPORT_FLAGS rfc_error(char *operation) { #ifdef SAPonNT char s[16]; #endif RFC_ERROR_INFO RfcErrorInfo;
February 1996
SAP AG
OUT("RFC error",0); OUTS("operation/code",0,15,operation); memset(&RfcErrorInfo,0,sizeof(RfcErrorInfo)); RfcLastError(&RfcErrorInfo); OUTS("key",0,15,RfcErrorInfo.key); OUTS("status",0,15,RfcErrorInfo.status); OUTS("message",0,15,RfcErrorInfo.message); OUTS("internal status",0,15,RfcErrorInfo.intstat); NL; RfcClose (RFC_HANDLE_NULL); #ifdef SAPonNT INS("","","Quit? [y]",4,24,s); #endif exit(1); } /* -----------------------------------------------------------------------------Called function RFC_DETERMINE_JURISDICTION importing LOCATION_DATA structure COM_JUR length 110 number of fields 11 exporting LOCATION_ERR structure COM_ERR length 77 number of fields 3 tables LOCATION_RESULTS structure COM_JUR length 110 number of fields 11 exceptions -----------------------------------------------------------------------------*/ RFC_RC WIN_DLL_EXPORT_FLAGS rfc_determine_jurisdiction(RFC_HANDLE hRfc ,COM_JUR *iLocationData ,COM_ERR *eLocationErr ,ITAB_H thLocationResults ,char *xException) { /* --------------------------------------------------begin of example code replace the example code with your code --------------------------------------------------*/ /* table row variables */ COM_JUR *tLocationResults; unsigned crow; char t; char s[256]; if (!gh) { gh=1; do { INS("h","","Help? ?/[n]",4,24,s); } while (s[0]=='?'); NL; } rfc_help = hlp_rfc_determine_jurisdiction; help("f","",""); /* display importing parameters */ OUT("importing",6); OUT("LOCATION_DATA",8); NL; INS("iso","LOCATION_DATA","Display structure? [y]/n",4,24,s); NL; if ((s[0] != 'n')&&(s[0] != 'N')) { GETCHAR(iLocationData->Country,s); OUTS("COUNTRY",10,30,s); GETCHAR(iLocationData->State,s); OUTS("STATE",10,30,s); GETCHAR(iLocationData->County,s); OUTS("COUNTY",10,30,s); GETCHAR(iLocationData->City,s); OUTS("CITY",10,30,s); GETCHAR(iLocationData->Zipcode,s); OUTS("ZIPCODE",10,30,s); GETNUM(iLocationData->TxjcdL1,s); OUTS("TXJCD_L1",10,30,s); GETNUM(iLocationData->TxjcdL2,s); OUTS("TXJCD_L2",10,30,s); GETNUM(iLocationData->TxjcdL3,s); OUTS("TXJCD_L3",10,30,s); GETNUM(iLocationData->TxjcdL4,s); OUTS("TXJCD_L4",10,30,s); GETCHAR(iLocationData->Txjcd,s); OUTS("TXJCD",10,30,s); GETCHAR(iLocationData->OutofCity,s); OUTS("OUTOF_CITY",10,30,s); OUT("LOCATION_DATA",8); NL; }
February 1996
SAP AG
/* display tables */ OUT("tables",6); sprintf(s,"%d lines",ItFill(thLocationResults)); OUTS("LOCATION_RESULTS",8,32,s); NL; t=0; for (crow = 1;crow <= ItFill(thLocationResults); crow++) { if (t!='*') { INS("to","LOCATION_RESULTS","Get table row? [y]/n",4,24,s); t=s[0]; NL; } if ((s[0] == 'n')||(s[0] == 'N')) break; tLocationResults = ItGetLine(thLocationResults,crow); if (tLocationResults == NULL) rfc_error("ItGetLine LOCATION_RESULTS"); GETCHAR(tLocationResults->Country,s); OUTS("COUNTRY",10,30,s); GETCHAR(tLocationResults->State,s); OUTS("STATE",10,30,s); GETCHAR(tLocationResults->County,s); OUTS("COUNTY",10,30,s); GETCHAR(tLocationResults->City,s); OUTS("CITY",10,30,s); GETCHAR(tLocationResults->Zipcode,s); OUTS("ZIPCODE",10,30,s); GETNUM(tLocationResults->TxjcdL1,s); OUTS("TXJCD_L1",10,30,s); GETNUM(tLocationResults->TxjcdL2,s); OUTS("TXJCD_L2",10,30,s); GETNUM(tLocationResults->TxjcdL3,s); OUTS("TXJCD_L3",10,30,s); GETNUM(tLocationResults->TxjcdL4,s); OUTS("TXJCD_L4",10,30,s); GETCHAR(tLocationResults->Txjcd,s); OUTS("TXJCD",10,30,s); GETCHAR(tLocationResults->OutofCity,s); OUTS("OUTOF_CITY",10,30,s); sprintf(s,"%d of %d lines",crow,ItFill(thLocationResults)); OUTS("LOCATION_RESULTS",8,32,s); NL; } INS("i","","Input? [y]/n",4,24,s); NL; if ((s[0]!='n') && (s[0]!='N')) { /* input export parameters */ OUT("exporting",6); OUT("LOCATION_ERR",8); NL; do { INS("esi","LOCATION_ERR","Fill structure? y/n",4,24,s); } while (s[0]==0); NL; if ((s[0]=='y')||(s[0]=='Y')) { INS("esfi","LOCATION_ERR","RETCODE",10,30,s); SETCHAR(eLocationErr>Retcode,s); INS("esfi","LOCATION_ERR","ERRCODE",10,30,s); SETNUM(eLocationErr>Errcode,s); INS("esfi","LOCATION_ERR","ERRMSG",10,30,s); SETCHAR(eLocationErr>Errmsg,s); OUT("LOCATION_ERR",8); NL; } /* input table rows */ OUT("tables",6); while ("you want") { sprintf(s,"%d lines",ItFill(thLocationResults)); OUTS("LOCATION_RESULTS",8,32,s); NL; do { INS("ti","LOCATION_RESULTS","Append table row? y/n",4,24,s); } while (s[0]==0); NL; if ((s[0] != 'y')&&(s[0] != 'Y')) break; tLocationResults = ItAppLine(thLocationResults); if (tLocationResults == NULL) rfc_error("ItAppLine LOCATION_RESULTS"); INS("tfi","LOCATION_RESULTS","COUNTRY",10,30,s); SETCHAR(tLocationResults>Country,s); INS("tfi","LOCATION_RESULTS","STATE",10,30,s); SETCHAR(tLocationResults>State,s); INS("tfi","LOCATION_RESULTS","COUNTY",10,30,s); SETCHAR(tLocationResults>County,s); INS("tfi","LOCATION_RESULTS","CITY",10,30,s); SETCHAR(tLocationResults>City,s); INS("tfi","LOCATION_RESULTS","ZIPCODE",10,30,s); SETCHAR(tLocationResults>Zipcode,s); INS("tfi","LOCATION_RESULTS","TXJCD_L1",10,30,s); SETNUM(tLocationResults>TxjcdL1,s); INS("tfi","LOCATION_RESULTS","TXJCD_L2",10,30,s); SETNUM(tLocationResults>TxjcdL2,s); INS("tfi","LOCATION_RESULTS","TXJCD_L3",10,30,s); SETNUM(tLocationResults>TxjcdL3,s); INS("tfi","LOCATION_RESULTS","TXJCD_L4",10,30,s); SETNUM(tLocationResults>TxjcdL4,s); INS("tfi","LOCATION_RESULTS","TXJCD",10,30,s); SETCHAR(tLocationResults>Txjcd,s);
February 1996
SAP AG
INS("tfi","LOCATION_RESULTS","OUTOF_CITY",10,30,s); SETCHAR(tLocationResults->OutofCity,s); } } OUT("Returning...",4); NL; /* --------------------------------------------------end of example code --------------------------------------------------*/ return RFC_OK; } RFC_RC WIN_DLL_EXPORT_FLAGS srv_rfc_determine_jurisdiction(RFC_HANDLE hRfc) { /* RFC variables */ RFC_PARAMETER Importing[2]; RFC_PARAMETER Exporting[2]; RFC_TABLE Tables[2]; RFC_RC RfcRc; /* param variables */ COM_JUR iLocationData; COM_ERR eLocationErr; ITAB_H thLocationResults = ITAB_NULL; char xException[256]; /* init export parameters */ SETCHAR(eLocationErr.Retcode,""); SETNUM(eLocationErr.Errcode,""); SETCHAR(eLocationErr.Errmsg,""); /* define import params */ Importing[0].name Importing[0].nlen Importing[0].type Importing[0].leng Importing[0].addr = = = = = "LOCATION_DATA"; 13; TYPC; sizeof(COM_JUR); &iLocationData;
Importing[1].name = NULL; /* define internal tables */ Tables[0].name Tables[0].nlen Tables[0].type Tables[0].leng Tables[0].itmode = = = = = "LOCATION_RESULTS"; 16; TYPC; sizeof(COM_JUR); RFC_ITMODE_BYREFERENCE;
Tables[1].name = NULL; if (RfcGetData(hRfc,Importing,Tables) != RFC_OK) return RfcRc; thLocationResults = Tables[0].ithandle; /* call RFC function */ RfcRc = rfc_determine_jurisdiction(hRfc ,&iLocationData ,&eLocationErr ,thLocationResults ,xException); if (RfcRc == RFC_EXCEPTION) { RfcRaise(hRfc,xException); RfcListen(hRfc); return RfcRc; } /* define export params */ Exporting[0].name = "LOCATION_ERR";
February 1996
SAP AG
= = = =
Exporting[1].name = NULL; if (RfcRc == RFC_OK) RfcRc = RfcSendData(hRfc, Exporting, Tables); return RfcRc; } void hlp_rfc_determine_jurisdiction(const char *topic, const char *subtopic, const char *text) { if (strcmp(topic,"f")==0) { OUT("Called function RFC_DETERMINE_JURISDICTION",2); OUT("importing",6); OUT("LOCATION_DATA",8); OUT("exporting",6); OUT("LOCATION_ERR",8); OUT("tables",6); OUT("LOCATION_RESULTS",8); NL; } /* import param help */ if (strcmp(topic,"eso")==0) { if (strcmp(subtopic,"LOCATION_ERR")==0) { OUT("structure COM_ERR",10); OUT("length 77 number of fields 3",10); NL; } } /* export param help */ if (strcmp(topic,"efi")==0) { } if (strcmp(topic,"esi")==0) { if (strcmp(subtopic,"LOCATION_ERR")==0) { OUT("structure COM_ERR",10); OUT("length 77 number of fields 3",10); NL; } } if (strcmp(topic,"esfi")==0) { if (strcmp(subtopic,"LOCATION_ERR")==0) { if (strcmp(text,"RETCODE")==0) { OUT("like COM_ERR-RETCODE",12); OUT("type RFC_CHAR length 1 init ' '",12); NL; } if (strcmp(text,"ERRCODE")==0) { OUT("like COM_ERR-ERRCODE",12); OUT("type RFC_NUM length 4 init '0'",12); NL; } if (strcmp(text,"ERRMSG")==0) { OUT("like COM_ERR-ERRMSG",12); OUT("type RFC_CHAR length 72 init ' '",12); NL; } } } /* table help */ if ((strcmp(topic,"to")==0)||(strcmp(topic,"ti")==0)) { if (strcmp(subtopic,"LOCATION_RESULTS")==0) { OUT("structure COM_JUR",10); OUT("length 110 number of fields 11",10); NL; } } if (strcmp(topic,"tfi")==0) { if (strcmp(subtopic,"LOCATION_RESULTS")==0) { if (strcmp(text,"COUNTRY")==0) { OUT("like COM_JUR-COUNTRY",12); OUT("type RFC_CHAR length 3 init ' '",12); NL; } if (strcmp(text,"STATE")==0) { OUT("like COM_JUR-STATE",12); OUT("type RFC_CHAR length 3 init ' '",12); NL; } if (strcmp(text,"COUNTY")==0) { OUT("like COM_JUR-COUNTY",12); OUT("type RFC_CHAR length 35 init ' '",12); NL; } if (strcmp(text,"CITY")==0) { OUT("like COM_JUR-CITY",12); OUT("type RFC_CHAR length 35 init ' '",12); NL; } if (strcmp(text,"ZIPCODE")==0) { OUT("like COM_JUR-ZIPCODE",12); OUT("type RFC_CHAR length 10 init ' '",12); NL; } if (strcmp(text,"TXJCD_L1")==0) {
February 1996
SAP AG
OUT("like COM_JUR-TXJCD_L1",12); OUT("type RFC_NUM length 2 init '0'",12); NL; } if (strcmp(text,"TXJCD_L2")==0) { OUT("like COM_JUR-TXJCD_L2",12); OUT("type RFC_NUM length 2 init '0'",12); NL; } if (strcmp(text,"TXJCD_L3")==0) { OUT("like COM_JUR-TXJCD_L3",12); OUT("type RFC_NUM length 2 init '0'",12); NL; } if (strcmp(text,"TXJCD_L4")==0) { OUT("like COM_JUR-TXJCD_L4",12); OUT("type RFC_NUM length 2 init '0'",12); NL; } if (strcmp(text,"TXJCD")==0) { OUT("like COM_JUR-TXJCD",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"OUTOF_CITY")==0) { OUT("like COM_JUR-OUTOF_CITY",12); OUT("type RFC_CHAR length 1 init ' '",12); NL; } } } return; } /* -----------------------------------------------------------------------------Called function RFC_CALCULATE_TAXES importing TAX_DATA structure COM_TAX length 968 number of fields 91 exporting TAX_ERR structure COM_ERR length 77 number of fields 3 TAX_RESULT structure COM_TAX length 968 number of fields 91 tables exceptions -----------------------------------------------------------------------------*/ RFC_RC WIN_DLL_EXPORT_FLAGS rfc_calculate_taxes(RFC_HANDLE hRfc ,COM_TAX *iTaxData ,COM_ERR *eTaxErr ,COM_TAX *eTaxResult ,char *xException) { /* --------------------------------------------------begin of example code replace the example code with your code --------------------------------------------------*/ char s[256]; if (!gh) { gh=1; do { INS("h","","Help? ?/[n]",4,24,s); } while (s[0]=='?'); NL; } rfc_help = hlp_rfc_calculate_taxes; help("f","",""); /* display importing parameters */ OUT("importing",6); OUT("TAX_DATA",8); NL; INS("iso","TAX_DATA","Display structure? [y]/n",4,24,s); NL; if ((s[0] != 'n')&&(s[0] != 'N')) { GETCHAR(iTaxData->Client,s); OUTS("CLIENT",10,30,s); GETCHAR(iTaxData->CompCode,s); OUTS("COMP_CODE",10,30,s); GETCHAR(iTaxData->Division,s); OUTS("DIVISION",10,30,s); GETCHAR(iTaxData->Country,s); OUTS("COUNTRY",10,30,s); GETCHAR(iTaxData->DocNumber,s); OUTS("DOC_NUMBER",10,30,s); GETNUM(iTaxData->PosNo,s); OUTS("POS_NO",10,30,s); GETCHAR(iTaxData->AccntNo,s); OUTS("ACCNT_NO",10,30,s); GETCHAR(iTaxData->AccntCls,s); OUTS("ACCNT_CLS",10,30,s); GETCHAR(iTaxData->TaxDate,s); OUTS("TAX_DATE",10,30,s); GETCHAR(iTaxData->TxjcdSt,s); OUTS("TXJCD_ST",10,30,s); GETCHAR(iTaxData->TxjcdSf,s); OUTS("TXJCD_SF",10,30,s);
10
February 1996
SAP AG
GETCHAR(iTaxData->TxjcdPoa,s); OUTS("TXJCD_POA",10,30,s); GETCHAR(iTaxData->TxjcdPoo,s); OUTS("TXJCD_POO",10,30,s); GETCHAR(iTaxData->TxjcdInd,s); OUTS("TXJCD_IND",10,30,s); GETCHAR(iTaxData->PtpInd,s); OUTS("PTP_IND",10,30,s); GETCHAR(iTaxData->AparInd,s); OUTS("APAR_IND",10,30,s); GETNUM(iTaxData->TxjcdL1,s); OUTS("TXJCD_L1",10,30,s); GETNUM(iTaxData->TxjcdL2,s); OUTS("TXJCD_L2",10,30,s); GETNUM(iTaxData->TxjcdL3,s); OUTS("TXJCD_L3",10,30,s); GETNUM(iTaxData->TxjcdL4,s); OUTS("TXJCD_L4",10,30,s); GETCHAR(iTaxData->TaxType,s); OUTS("TAX_TYPE",10,30,s); GETCHAR(iTaxData->Matnr,s); OUTS("MATNR",10,30,s); GETCHAR(iTaxData->ProdCode,s); OUTS("PROD_CODE",10,30,s); GETCHAR(iTaxData->Quantity,s); OUTS("QUANTITY",10,30,s); GETCHAR(iTaxData->Unit,s); OUTS("UNIT",10,30,s); GETCHAR(iTaxData->Amount,s); OUTS("AMOUNT",10,30,s); GETCHAR(iTaxData->Currency,s); OUTS("CURRENCY",10,30,s); GETCHAR(iTaxData->CurrDec,s); OUTS("CURR_DEC",10,30,s); GETCHAR(iTaxData->FreightAm,s); OUTS("FREIGHT_AM",10,30,s); GETCHAR(iTaxData->ExemptAmt,s); OUTS("EXEMPT_AMT",10,30,s); GETCHAR(iTaxData->ExemptInd,s); OUTS("EXEMPT_IND",10,30,s); GETCHAR(iTaxData->CreditInd,s); OUTS("CREDIT_IND",10,30,s); GETCHAR(iTaxData->UpdateInd,s); OUTS("UPDATE_IND",10,30,s); GETCHAR(iTaxData->OvwrtInd,s); OUTS("OVWRT_IND",10,30,s); GETCHAR(iTaxData->Taxpct0,s); OUTS("TAXPCT0",10,30,s); GETCHAR(iTaxData->Taxpct1,s); OUTS("TAXPCT1",10,30,s); GETCHAR(iTaxData->Taxpct2,s); OUTS("TAXPCT2",10,30,s); GETCHAR(iTaxData->Taxpct3,s); OUTS("TAXPCT3",10,30,s); GETCHAR(iTaxData->Taxpct4,s); OUTS("TAXPCT4",10,30,s); GETCHAR(iTaxData->Taxpct5,s); OUTS("TAXPCT5",10,30,s); GETCHAR(iTaxData->Taxpct6,s); OUTS("TAXPCT6",10,30,s); GETCHAR(iTaxData->Taxpct7,s); OUTS("TAXPCT7",10,30,s); GETCHAR(iTaxData->Taxpct8,s); OUTS("TAXPCT8",10,30,s); GETCHAR(iTaxData->Taxpct9,s); OUTS("TAXPCT9",10,30,s); GETCHAR(iTaxData->Taxpcov,s); OUTS("TAXPCOV",10,30,s); GETCHAR(iTaxData->Taxamt0,s); OUTS("TAXAMT0",10,30,s); GETCHAR(iTaxData->Taxamt1,s); OUTS("TAXAMT1",10,30,s); GETCHAR(iTaxData->Taxamt2,s); OUTS("TAXAMT2",10,30,s); GETCHAR(iTaxData->Taxamt3,s); OUTS("TAXAMT3",10,30,s); GETCHAR(iTaxData->Taxamt4,s); OUTS("TAXAMT4",10,30,s); GETCHAR(iTaxData->Taxamt5,s); OUTS("TAXAMT5",10,30,s); GETCHAR(iTaxData->Taxamt6,s); OUTS("TAXAMT6",10,30,s); GETCHAR(iTaxData->Taxamt7,s); OUTS("TAXAMT7",10,30,s); GETCHAR(iTaxData->Taxamt8,s); OUTS("TAXAMT8",10,30,s); GETCHAR(iTaxData->Taxamt9,s); OUTS("TAXAMT9",10,30,s); GETCHAR(iTaxData->Taxamov,s); OUTS("TAXAMOV",10,30,s); GETCHAR(iTaxData->Taxbas0,s); OUTS("TAXBAS0",10,30,s); GETCHAR(iTaxData->Taxbas1,s); OUTS("TAXBAS1",10,30,s); GETCHAR(iTaxData->Taxbas2,s); OUTS("TAXBAS2",10,30,s); GETCHAR(iTaxData->Taxbas3,s); OUTS("TAXBAS3",10,30,s); GETCHAR(iTaxData->Taxbas4,s); OUTS("TAXBAS4",10,30,s); GETCHAR(iTaxData->Taxbas5,s); OUTS("TAXBAS5",10,30,s); GETCHAR(iTaxData->Taxbas6,s); OUTS("TAXBAS6",10,30,s); GETCHAR(iTaxData->Taxbas7,s); OUTS("TAXBAS7",10,30,s); GETCHAR(iTaxData->Taxbas8,s); OUTS("TAXBAS8",10,30,s); GETCHAR(iTaxData->Taxbas9,s); OUTS("TAXBAS9",10,30,s); GETCHAR(iTaxData->Exmatflg,s); OUTS("EXMATFLG",10,30,s); GETCHAR(iTaxData->Excusflg,s); OUTS("EXCUSFLG",10,30,s); GETCHAR(iTaxData->Examt0,s); OUTS("EXAMT0",10,30,s); GETCHAR(iTaxData->Examt1,s); OUTS("EXAMT1",10,30,s); GETCHAR(iTaxData->Examt2,s); OUTS("EXAMT2",10,30,s); GETCHAR(iTaxData->Examt3,s); OUTS("EXAMT3",10,30,s); GETCHAR(iTaxData->Examt4,s); OUTS("EXAMT4",10,30,s); GETCHAR(iTaxData->Examt5,s); OUTS("EXAMT5",10,30,s); GETCHAR(iTaxData->Examt6,s); OUTS("EXAMT6",10,30,s); GETCHAR(iTaxData->Examt7,s); OUTS("EXAMT7",10,30,s); GETCHAR(iTaxData->Examt8,s); OUTS("EXAMT8",10,30,s); GETCHAR(iTaxData->Examt9,s); OUTS("EXAMT9",10,30,s); GETCHAR(iTaxData->Excode0,s); OUTS("EXCODE0",10,30,s); GETCHAR(iTaxData->Excode1,s); OUTS("EXCODE1",10,30,s); GETCHAR(iTaxData->Excode2,s); OUTS("EXCODE2",10,30,s); GETCHAR(iTaxData->Excode3,s); OUTS("EXCODE3",10,30,s); GETCHAR(iTaxData->Excode4,s); OUTS("EXCODE4",10,30,s);
February 1996
11
SAP AG
GETCHAR(iTaxData->Excode5,s); OUTS("EXCODE5",10,30,s); GETCHAR(iTaxData->Excode6,s); OUTS("EXCODE6",10,30,s); GETCHAR(iTaxData->Excode7,s); OUTS("EXCODE7",10,30,s); GETCHAR(iTaxData->Excode8,s); OUTS("EXCODE8",10,30,s); GETCHAR(iTaxData->Excode9,s); OUTS("EXCODE9",10,30,s); GETCHAR(iTaxData->Excertif,s); OUTS("EXCERTIF",10,30,s); GETCHAR(iTaxData->Exreason,s); OUTS("EXREASON",10,30,s); GETCHAR(iTaxData->UserData,s); OUTS("USER_DATA",10,30,s); OUT("TAX_DATA",8); NL; } INS("i","","Input? [y]/n",4,24,s); NL; if ((s[0]!='n') && (s[0]!='N')) { /* input export parameters */ OUT("exporting",6); OUT("TAX_ERR",8); NL; do { INS("esi","TAX_ERR","Fill structure? y/n",4,24,s); } while (s[0]==0); NL; if ((s[0]=='y')||(s[0]=='Y')) { INS("esfi","TAX_ERR","RETCODE",10,30,s); SETCHAR(eTaxErr->Retcode,s); INS("esfi","TAX_ERR","ERRCODE",10,30,s); SETNUM(eTaxErr->Errcode,s); INS("esfi","TAX_ERR","ERRMSG",10,30,s); SETCHAR(eTaxErr->Errmsg,s); OUT("TAX_ERR",8); NL; } OUT("TAX_RESULT",8); NL; do { INS("esi","TAX_RESULT","Fill structure? y/n",4,24,s); } while (s[0]==0); NL; if ((s[0]=='y')||(s[0]=='Y')) { INS("esfi","TAX_RESULT","CLIENT",10,30,s); SETCHAR(eTaxResult->Client,s); INS("esfi","TAX_RESULT","COMP_CODE",10,30,s); SETCHAR(eTaxResult>CompCode,s); INS("esfi","TAX_RESULT","DIVISION",10,30,s); SETCHAR(eTaxResult>Division,s); INS("esfi","TAX_RESULT","COUNTRY",10,30,s); SETCHAR(eTaxResult->Country,s); INS("esfi","TAX_RESULT","DOC_NUMBER",10,30,s); SETCHAR(eTaxResult>DocNumber,s); INS("esfi","TAX_RESULT","POS_NO",10,30,s); SETNUM(eTaxResult->PosNo,s); INS("esfi","TAX_RESULT","ACCNT_NO",10,30,s); SETCHAR(eTaxResult->AccntNo,s); INS("esfi","TAX_RESULT","ACCNT_CLS",10,30,s); SETCHAR(eTaxResult>AccntCls,s); INS("esfi","TAX_RESULT","TAX_DATE",10,30,s); SETCHAR(eTaxResult->TaxDate,s); INS("esfi","TAX_RESULT","TXJCD_ST",10,30,s); SETCHAR(eTaxResult->TxjcdSt,s); INS("esfi","TAX_RESULT","TXJCD_SF",10,30,s); SETCHAR(eTaxResult->TxjcdSf,s); INS("esfi","TAX_RESULT","TXJCD_POA",10,30,s); SETCHAR(eTaxResult>TxjcdPoa,s); INS("esfi","TAX_RESULT","TXJCD_POO",10,30,s); SETCHAR(eTaxResult>TxjcdPoo,s); INS("esfi","TAX_RESULT","TXJCD_IND",10,30,s); SETCHAR(eTaxResult>TxjcdInd,s); INS("esfi","TAX_RESULT","PTP_IND",10,30,s); SETCHAR(eTaxResult->PtpInd,s); INS("esfi","TAX_RESULT","APAR_IND",10,30,s); SETCHAR(eTaxResult->AparInd,s); INS("esfi","TAX_RESULT","TXJCD_L1",10,30,s); SETNUM(eTaxResult->TxjcdL1,s); INS("esfi","TAX_RESULT","TXJCD_L2",10,30,s); SETNUM(eTaxResult->TxjcdL2,s); INS("esfi","TAX_RESULT","TXJCD_L3",10,30,s); SETNUM(eTaxResult->TxjcdL3,s); INS("esfi","TAX_RESULT","TXJCD_L4",10,30,s); SETNUM(eTaxResult->TxjcdL4,s); INS("esfi","TAX_RESULT","TAX_TYPE",10,30,s); SETCHAR(eTaxResult->TaxType,s); INS("esfi","TAX_RESULT","MATNR",10,30,s); SETCHAR(eTaxResult->Matnr,s); INS("esfi","TAX_RESULT","PROD_CODE",10,30,s); SETCHAR(eTaxResult>ProdCode,s); INS("esfi","TAX_RESULT","QUANTITY",10,30,s); SETCHAR(eTaxResult>Quantity,s); INS("esfi","TAX_RESULT","UNIT",10,30,s); SETCHAR(eTaxResult->Unit,s); INS("esfi","TAX_RESULT","AMOUNT",10,30,s); SETCHAR(eTaxResult->Amount,s); INS("esfi","TAX_RESULT","CURRENCY",10,30,s); SETCHAR(eTaxResult>Currency,s); INS("esfi","TAX_RESULT","CURR_DEC",10,30,s); SETCHAR(eTaxResult->CurrDec,s); INS("esfi","TAX_RESULT","FREIGHT_AM",10,30,s); SETCHAR(eTaxResult>FreightAm,s); INS("esfi","TAX_RESULT","EXEMPT_AMT",10,30,s); SETCHAR(eTaxResult>ExemptAmt,s); INS("esfi","TAX_RESULT","EXEMPT_IND",10,30,s); SETCHAR(eTaxResult>ExemptInd,s); INS("esfi","TAX_RESULT","CREDIT_IND",10,30,s); SETCHAR(eTaxResult>CreditInd,s);
12
February 1996
SAP AG
INS("esfi","TAX_RESULT","UPDATE_IND",10,30,s); SETCHAR(eTaxResult>UpdateInd,s); INS("esfi","TAX_RESULT","OVWRT_IND",10,30,s); SETCHAR(eTaxResult>OvwrtInd,s); INS("esfi","TAX_RESULT","TAXPCT0",10,30,s); SETCHAR(eTaxResult->Taxpct0,s); INS("esfi","TAX_RESULT","TAXPCT1",10,30,s); SETCHAR(eTaxResult->Taxpct1,s); INS("esfi","TAX_RESULT","TAXPCT2",10,30,s); SETCHAR(eTaxResult->Taxpct2,s); INS("esfi","TAX_RESULT","TAXPCT3",10,30,s); SETCHAR(eTaxResult->Taxpct3,s); INS("esfi","TAX_RESULT","TAXPCT4",10,30,s); SETCHAR(eTaxResult->Taxpct4,s); INS("esfi","TAX_RESULT","TAXPCT5",10,30,s); SETCHAR(eTaxResult->Taxpct5,s); INS("esfi","TAX_RESULT","TAXPCT6",10,30,s); SETCHAR(eTaxResult->Taxpct6,s); INS("esfi","TAX_RESULT","TAXPCT7",10,30,s); SETCHAR(eTaxResult->Taxpct7,s); INS("esfi","TAX_RESULT","TAXPCT8",10,30,s); SETCHAR(eTaxResult->Taxpct8,s); INS("esfi","TAX_RESULT","TAXPCT9",10,30,s); SETCHAR(eTaxResult->Taxpct9,s); INS("esfi","TAX_RESULT","TAXPCOV",10,30,s); SETCHAR(eTaxResult->Taxpcov,s); INS("esfi","TAX_RESULT","TAXAMT0",10,30,s); SETCHAR(eTaxResult->Taxamt0,s); INS("esfi","TAX_RESULT","TAXAMT1",10,30,s); SETCHAR(eTaxResult->Taxamt1,s); INS("esfi","TAX_RESULT","TAXAMT2",10,30,s); SETCHAR(eTaxResult->Taxamt2,s); INS("esfi","TAX_RESULT","TAXAMT3",10,30,s); SETCHAR(eTaxResult->Taxamt3,s); INS("esfi","TAX_RESULT","TAXAMT4",10,30,s); SETCHAR(eTaxResult->Taxamt4,s); INS("esfi","TAX_RESULT","TAXAMT5",10,30,s); SETCHAR(eTaxResult->Taxamt5,s); INS("esfi","TAX_RESULT","TAXAMT6",10,30,s); SETCHAR(eTaxResult->Taxamt6,s); INS("esfi","TAX_RESULT","TAXAMT7",10,30,s); SETCHAR(eTaxResult->Taxamt7,s); INS("esfi","TAX_RESULT","TAXAMT8",10,30,s); SETCHAR(eTaxResult->Taxamt8,s); INS("esfi","TAX_RESULT","TAXAMT9",10,30,s); SETCHAR(eTaxResult->Taxamt9,s); INS("esfi","TAX_RESULT","TAXAMOV",10,30,s); SETCHAR(eTaxResult->Taxamov,s); INS("esfi","TAX_RESULT","TAXBAS0",10,30,s); SETCHAR(eTaxResult->Taxbas0,s); INS("esfi","TAX_RESULT","TAXBAS1",10,30,s); SETCHAR(eTaxResult->Taxbas1,s); INS("esfi","TAX_RESULT","TAXBAS2",10,30,s); SETCHAR(eTaxResult->Taxbas2,s); INS("esfi","TAX_RESULT","TAXBAS3",10,30,s); SETCHAR(eTaxResult->Taxbas3,s); INS("esfi","TAX_RESULT","TAXBAS4",10,30,s); SETCHAR(eTaxResult->Taxbas4,s); INS("esfi","TAX_RESULT","TAXBAS5",10,30,s); SETCHAR(eTaxResult->Taxbas5,s); INS("esfi","TAX_RESULT","TAXBAS6",10,30,s); SETCHAR(eTaxResult->Taxbas6,s); INS("esfi","TAX_RESULT","TAXBAS7",10,30,s); SETCHAR(eTaxResult->Taxbas7,s); INS("esfi","TAX_RESULT","TAXBAS8",10,30,s); SETCHAR(eTaxResult->Taxbas8,s); INS("esfi","TAX_RESULT","TAXBAS9",10,30,s); SETCHAR(eTaxResult->Taxbas9,s); INS("esfi","TAX_RESULT","EXMATFLG",10,30,s); SETCHAR(eTaxResult>Exmatflg,s); INS("esfi","TAX_RESULT","EXCUSFLG",10,30,s); SETCHAR(eTaxResult>Excusflg,s); INS("esfi","TAX_RESULT","EXAMT0",10,30,s); SETCHAR(eTaxResult->Examt0,s); INS("esfi","TAX_RESULT","EXAMT1",10,30,s); SETCHAR(eTaxResult->Examt1,s); INS("esfi","TAX_RESULT","EXAMT2",10,30,s); SETCHAR(eTaxResult->Examt2,s); INS("esfi","TAX_RESULT","EXAMT3",10,30,s); SETCHAR(eTaxResult->Examt3,s); INS("esfi","TAX_RESULT","EXAMT4",10,30,s); SETCHAR(eTaxResult->Examt4,s); INS("esfi","TAX_RESULT","EXAMT5",10,30,s); SETCHAR(eTaxResult->Examt5,s); INS("esfi","TAX_RESULT","EXAMT6",10,30,s); SETCHAR(eTaxResult->Examt6,s); INS("esfi","TAX_RESULT","EXAMT7",10,30,s); SETCHAR(eTaxResult->Examt7,s); INS("esfi","TAX_RESULT","EXAMT8",10,30,s); SETCHAR(eTaxResult->Examt8,s); INS("esfi","TAX_RESULT","EXAMT9",10,30,s); SETCHAR(eTaxResult->Examt9,s); INS("esfi","TAX_RESULT","EXCODE0",10,30,s); SETCHAR(eTaxResult->Excode0,s); INS("esfi","TAX_RESULT","EXCODE1",10,30,s); SETCHAR(eTaxResult->Excode1,s); INS("esfi","TAX_RESULT","EXCODE2",10,30,s); SETCHAR(eTaxResult->Excode2,s); INS("esfi","TAX_RESULT","EXCODE3",10,30,s); SETCHAR(eTaxResult->Excode3,s); INS("esfi","TAX_RESULT","EXCODE4",10,30,s); SETCHAR(eTaxResult->Excode4,s); INS("esfi","TAX_RESULT","EXCODE5",10,30,s); SETCHAR(eTaxResult->Excode5,s); INS("esfi","TAX_RESULT","EXCODE6",10,30,s); SETCHAR(eTaxResult->Excode6,s); INS("esfi","TAX_RESULT","EXCODE7",10,30,s); SETCHAR(eTaxResult->Excode7,s); INS("esfi","TAX_RESULT","EXCODE8",10,30,s); SETCHAR(eTaxResult->Excode8,s); INS("esfi","TAX_RESULT","EXCODE9",10,30,s); SETCHAR(eTaxResult->Excode9,s); INS("esfi","TAX_RESULT","EXCERTIF",10,30,s); SETCHAR(eTaxResult>Excertif,s); INS("esfi","TAX_RESULT","EXREASON",10,30,s); SETCHAR(eTaxResult>Exreason,s); INS("esfi","TAX_RESULT","USER_DATA",10,30,s); SETCHAR(eTaxResult>UserData,s); OUT("TAX_RESULT",8); NL; } } OUT("Returning...",4); NL;
February 1996
13
SAP AG
/* --------------------------------------------------end of example code --------------------------------------------------*/ return RFC_OK; } RFC_RC WIN_DLL_EXPORT_FLAGS srv_rfc_calculate_taxes(RFC_HANDLE hRfc) { /* RFC variables */ RFC_PARAMETER Importing[2]; RFC_PARAMETER Exporting[3]; RFC_TABLE Tables[1]; RFC_RC RfcRc; /* param variables */ COM_TAX iTaxData; COM_ERR eTaxErr; COM_TAX eTaxResult; char xException[256]; /* init export parameters */ SETCHAR(eTaxErr.Retcode,""); SETNUM(eTaxErr.Errcode,""); SETCHAR(eTaxErr.Errmsg,""); SETCHAR(eTaxResult.Client,""); SETCHAR(eTaxResult.CompCode,""); SETCHAR(eTaxResult.Division,""); SETCHAR(eTaxResult.Country,""); SETCHAR(eTaxResult.DocNumber,""); SETNUM(eTaxResult.PosNo,""); SETCHAR(eTaxResult.AccntNo,""); SETCHAR(eTaxResult.AccntCls,""); SETCHAR(eTaxResult.TaxDate,""); SETCHAR(eTaxResult.TxjcdSt,""); SETCHAR(eTaxResult.TxjcdSf,""); SETCHAR(eTaxResult.TxjcdPoa,""); SETCHAR(eTaxResult.TxjcdPoo,""); SETCHAR(eTaxResult.TxjcdInd,""); SETCHAR(eTaxResult.PtpInd,""); SETCHAR(eTaxResult.AparInd,""); SETNUM(eTaxResult.TxjcdL1,""); SETNUM(eTaxResult.TxjcdL2,""); SETNUM(eTaxResult.TxjcdL3,""); SETNUM(eTaxResult.TxjcdL4,""); SETCHAR(eTaxResult.TaxType,""); SETCHAR(eTaxResult.Matnr,""); SETCHAR(eTaxResult.ProdCode,""); SETCHAR(eTaxResult.Quantity,""); SETCHAR(eTaxResult.Unit,""); SETCHAR(eTaxResult.Amount,""); SETCHAR(eTaxResult.Currency,""); SETCHAR(eTaxResult.CurrDec,""); SETCHAR(eTaxResult.FreightAm,""); SETCHAR(eTaxResult.ExemptAmt,""); SETCHAR(eTaxResult.ExemptInd,""); SETCHAR(eTaxResult.CreditInd,""); SETCHAR(eTaxResult.UpdateInd,""); SETCHAR(eTaxResult.OvwrtInd,""); SETCHAR(eTaxResult.Taxpct0,""); SETCHAR(eTaxResult.Taxpct1,""); SETCHAR(eTaxResult.Taxpct2,""); SETCHAR(eTaxResult.Taxpct3,""); SETCHAR(eTaxResult.Taxpct4,""); SETCHAR(eTaxResult.Taxpct5,""); SETCHAR(eTaxResult.Taxpct6,""); SETCHAR(eTaxResult.Taxpct7,""); SETCHAR(eTaxResult.Taxpct8,""); SETCHAR(eTaxResult.Taxpct9,"");
14
February 1996
SAP AG
SETCHAR(eTaxResult.Taxpcov,""); SETCHAR(eTaxResult.Taxamt0,""); SETCHAR(eTaxResult.Taxamt1,""); SETCHAR(eTaxResult.Taxamt2,""); SETCHAR(eTaxResult.Taxamt3,""); SETCHAR(eTaxResult.Taxamt4,""); SETCHAR(eTaxResult.Taxamt5,""); SETCHAR(eTaxResult.Taxamt6,""); SETCHAR(eTaxResult.Taxamt7,""); SETCHAR(eTaxResult.Taxamt8,""); SETCHAR(eTaxResult.Taxamt9,""); SETCHAR(eTaxResult.Taxamov,""); SETCHAR(eTaxResult.Taxbas0,""); SETCHAR(eTaxResult.Taxbas1,""); SETCHAR(eTaxResult.Taxbas2,""); SETCHAR(eTaxResult.Taxbas3,""); SETCHAR(eTaxResult.Taxbas4,""); SETCHAR(eTaxResult.Taxbas5,""); SETCHAR(eTaxResult.Taxbas6,""); SETCHAR(eTaxResult.Taxbas7,""); SETCHAR(eTaxResult.Taxbas8,""); SETCHAR(eTaxResult.Taxbas9,""); SETCHAR(eTaxResult.Exmatflg,""); SETCHAR(eTaxResult.Excusflg,""); SETCHAR(eTaxResult.Examt0,""); SETCHAR(eTaxResult.Examt1,""); SETCHAR(eTaxResult.Examt2,""); SETCHAR(eTaxResult.Examt3,""); SETCHAR(eTaxResult.Examt4,""); SETCHAR(eTaxResult.Examt5,""); SETCHAR(eTaxResult.Examt6,""); SETCHAR(eTaxResult.Examt7,""); SETCHAR(eTaxResult.Examt8,""); SETCHAR(eTaxResult.Examt9,""); SETCHAR(eTaxResult.Excode0,""); SETCHAR(eTaxResult.Excode1,""); SETCHAR(eTaxResult.Excode2,""); SETCHAR(eTaxResult.Excode3,""); SETCHAR(eTaxResult.Excode4,""); SETCHAR(eTaxResult.Excode5,""); SETCHAR(eTaxResult.Excode6,""); SETCHAR(eTaxResult.Excode7,""); SETCHAR(eTaxResult.Excode8,""); SETCHAR(eTaxResult.Excode9,""); SETCHAR(eTaxResult.Excertif,""); SETCHAR(eTaxResult.Exreason,""); SETCHAR(eTaxResult.UserData,""); /* define import params */ Importing[0].name Importing[0].nlen Importing[0].type Importing[0].leng Importing[0].addr = = = = = "TAX_DATA"; 8; TYPC; sizeof(COM_TAX); &iTaxData;
Importing[1].name = NULL; Tables[0].name = NULL; if (RfcGetData(hRfc,Importing,Tables) != RFC_OK) return RfcRc; /* call RFC function */ RfcRc = rfc_calculate_taxes(hRfc ,&iTaxData ,&eTaxErr ,&eTaxResult ,xException); if (RfcRc == RFC_EXCEPTION) { RfcRaise(hRfc,xException); RfcListen(hRfc); return RfcRc; }
February 1996
15
SAP AG
/* define export params */ Exporting[0].name Exporting[0].nlen Exporting[0].type Exporting[0].leng Exporting[0].addr Exporting[1].name Exporting[1].nlen Exporting[1].type Exporting[1].leng Exporting[1].addr = = = = = = = = = = "TAX_ERR"; 7; TYPC; sizeof(COM_ERR); &eTaxErr; "TAX_RESULT"; 10; TYPC; sizeof(COM_TAX); &eTaxResult;
Exporting[2].name = NULL; if (RfcRc == RFC_OK) RfcRc = RfcSendData(hRfc, Exporting, Tables); return RfcRc; } void hlp_rfc_calculate_taxes(const char *topic, const char *subtopic, const char *text) { if (strcmp(topic,"f")==0) { OUT("Called function RFC_CALCULATE_TAXES",2); OUT("importing",6); OUT("TAX_DATA",8); OUT("exporting",6); OUT("TAX_ERR",8); OUT("TAX_RESULT",8); NL; } /* import param help */ if (strcmp(topic,"eso")==0) { if (strcmp(subtopic,"TAX_ERR")==0) { OUT("structure COM_ERR",10); OUT("length 77 number of fields 3",10); NL; } if (strcmp(subtopic,"TAX_RESULT")==0) { OUT("structure COM_TAX",10); OUT("length 968 number of fields 91",10); NL; } } /* export param help */ if (strcmp(topic,"efi")==0) { } if (strcmp(topic,"esi")==0) { if (strcmp(subtopic,"TAX_ERR")==0) { OUT("structure COM_ERR",10); OUT("length 77 number of fields 3",10); NL; } if (strcmp(subtopic,"TAX_RESULT")==0) { OUT("structure COM_TAX",10); OUT("length 968 number of fields 91",10); NL; } } if (strcmp(topic,"esfi")==0) { if (strcmp(subtopic,"TAX_ERR")==0) { if (strcmp(text,"RETCODE")==0) { OUT("like COM_ERR-RETCODE",12); OUT("type RFC_CHAR length 1 init ' '",12); NL; } if (strcmp(text,"ERRCODE")==0) { OUT("like COM_ERR-ERRCODE",12); OUT("type RFC_NUM length 4 init '0'",12); NL; } if (strcmp(text,"ERRMSG")==0) { OUT("like COM_ERR-ERRMSG",12); OUT("type RFC_CHAR length 72 init ' '",12); NL; } } if (strcmp(subtopic,"TAX_RESULT")==0) { if (strcmp(text,"CLIENT")==0) { OUT("like COM_TAX-CLIENT",12); OUT("type RFC_CHAR length 3 init ' '",12); NL; } if (strcmp(text,"COMP_CODE")==0) { OUT("like COM_TAX-COMP_CODE",12); OUT("type RFC_CHAR length 4 init ' '",12); NL; } if (strcmp(text,"DIVISION")==0) { OUT("like COM_TAX-DIVISION",12); OUT("type RFC_CHAR length 4 init ' '",12); NL; }
16
February 1996
SAP AG
if (strcmp(text,"COUNTRY")==0) { OUT("like COM_TAX-COUNTRY",12); OUT("type RFC_CHAR length 3 init ' '",12); NL; } if (strcmp(text,"DOC_NUMBER")==0) { OUT("like COM_TAX-DOC_NUMBER",12); OUT("type RFC_CHAR length 10 init ' '",12); NL; } if (strcmp(text,"POS_NO")==0) { OUT("like COM_TAX-POS_NO",12); OUT("type RFC_NUM length 6 init '0'",12); NL; } if (strcmp(text,"ACCNT_NO")==0) { OUT("like COM_TAX-ACCNT_NO",12); OUT("type RFC_CHAR length 16 init ' '",12); NL; } if (strcmp(text,"ACCNT_CLS")==0) { OUT("like COM_TAX-ACCNT_CLS",12); OUT("type RFC_CHAR length 10 init ' '",12); NL; } if (strcmp(text,"TAX_DATE")==0) { OUT("like COM_TAX-TAX_DATE",12); OUT("type RFC_CHAR length 8 init ' '",12); NL; } if (strcmp(text,"TXJCD_ST")==0) { OUT("like COM_TAX-TXJCD_ST",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TXJCD_SF")==0) { OUT("like COM_TAX-TXJCD_SF",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TXJCD_POA")==0) { OUT("like COM_TAX-TXJCD_POA",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TXJCD_POO")==0) { OUT("like COM_TAX-TXJCD_POO",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TXJCD_IND")==0) { OUT("like COM_TAX-TXJCD_IND",12); OUT("type RFC_CHAR length 1 init ' '",12); NL; } if (strcmp(text,"PTP_IND")==0) { OUT("like COM_TAX-PTP_IND",12); OUT("type RFC_CHAR length 1 init ' '",12); NL; } if (strcmp(text,"APAR_IND")==0) { OUT("like COM_TAX-APAR_IND",12); OUT("type RFC_CHAR length 1 init ' '",12); NL; } if (strcmp(text,"TXJCD_L1")==0) { OUT("like COM_TAX-TXJCD_L1",12); OUT("type RFC_NUM length 2 init '0'",12); NL; } if (strcmp(text,"TXJCD_L2")==0) { OUT("like COM_TAX-TXJCD_L2",12); OUT("type RFC_NUM length 2 init '0'",12); NL; } if (strcmp(text,"TXJCD_L3")==0) { OUT("like COM_TAX-TXJCD_L3",12); OUT("type RFC_NUM length 2 init '0'",12); NL; } if (strcmp(text,"TXJCD_L4")==0) { OUT("like COM_TAX-TXJCD_L4",12); OUT("type RFC_NUM length 2 init '0'",12); NL; } if (strcmp(text,"TAX_TYPE")==0) { OUT("like COM_TAX-TAX_TYPE",12); OUT("type RFC_CHAR length 1 init ' '",12); NL; } if (strcmp(text,"MATNR")==0) { OUT("like COM_TAX-MATNR",12); OUT("type RFC_CHAR length 18 init ' '",12); NL; } if (strcmp(text,"PROD_CODE")==0) { OUT("like COM_TAX-PROD_CODE",12); OUT("type RFC_CHAR length 10 init ' '",12); NL; } if (strcmp(text,"QUANTITY")==0) { OUT("like COM_TAX-QUANTITY",12); OUT("type RFC_CHAR length 13 init ' '",12); NL; } if (strcmp(text,"UNIT")==0) { OUT("like COM_TAX-UNIT",12); OUT("type RFC_CHAR length 3 init ' '",12); NL; } if (strcmp(text,"AMOUNT")==0) { OUT("like COM_TAX-AMOUNT",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"CURRENCY")==0) { OUT("like COM_TAX-CURRENCY",12); OUT("type RFC_CHAR length 5 init ' '",12); NL; }
February 1996
17
SAP AG
if (strcmp(text,"CURR_DEC")==0) { OUT("like COM_TAX-CURR_DEC",12); OUT("type RFC_CHAR length 3 init ' '",12); NL; } if (strcmp(text,"FREIGHT_AM")==0) { OUT("like COM_TAX-FREIGHT_AM",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"EXEMPT_AMT")==0) { OUT("like COM_TAX-EXEMPT_AMT",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"EXEMPT_IND")==0) { OUT("like COM_TAX-EXEMPT_IND",12); OUT("type RFC_CHAR length 1 init ' '",12); NL; } if (strcmp(text,"CREDIT_IND")==0) { OUT("like COM_TAX-CREDIT_IND",12); OUT("type RFC_CHAR length 1 init ' '",12); NL; } if (strcmp(text,"UPDATE_IND")==0) { OUT("like COM_TAX-UPDATE_IND",12); OUT("type RFC_CHAR length 1 init ' '",12); NL; } if (strcmp(text,"OVWRT_IND")==0) { OUT("like COM_TAX-OVWRT_IND",12); OUT("type RFC_CHAR length 1 init ' '",12); NL; } if (strcmp(text,"TAXPCT0")==0) { OUT("like COM_TAX-TAXPCT0",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXPCT1")==0) { OUT("like COM_TAX-TAXPCT1",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXPCT2")==0) { OUT("like COM_TAX-TAXPCT2",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXPCT3")==0) { OUT("like COM_TAX-TAXPCT3",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXPCT4")==0) { OUT("like COM_TAX-TAXPCT4",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXPCT5")==0) { OUT("like COM_TAX-TAXPCT5",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXPCT6")==0) { OUT("like COM_TAX-TAXPCT6",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXPCT7")==0) { OUT("like COM_TAX-TAXPCT7",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXPCT8")==0) { OUT("like COM_TAX-TAXPCT8",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXPCT9")==0) { OUT("like COM_TAX-TAXPCT9",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXPCOV")==0) { OUT("like COM_TAX-TAXPCOV",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXAMT0")==0) { OUT("like COM_TAX-TAXAMT0",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXAMT1")==0) { OUT("like COM_TAX-TAXAMT1",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXAMT2")==0) { OUT("like COM_TAX-TAXAMT2",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXAMT3")==0) { OUT("like COM_TAX-TAXAMT3",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXAMT4")==0) { OUT("like COM_TAX-TAXAMT4",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXAMT5")==0) { OUT("like COM_TAX-TAXAMT5",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; }
18
February 1996
SAP AG
if (strcmp(text,"TAXAMT6")==0) { OUT("like COM_TAX-TAXAMT6",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXAMT7")==0) { OUT("like COM_TAX-TAXAMT7",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXAMT8")==0) { OUT("like COM_TAX-TAXAMT8",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXAMT9")==0) { OUT("like COM_TAX-TAXAMT9",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXAMOV")==0) { OUT("like COM_TAX-TAXAMOV",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXBAS0")==0) { OUT("like COM_TAX-TAXBAS0",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXBAS1")==0) { OUT("like COM_TAX-TAXBAS1",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXBAS2")==0) { OUT("like COM_TAX-TAXBAS2",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXBAS3")==0) { OUT("like COM_TAX-TAXBAS3",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXBAS4")==0) { OUT("like COM_TAX-TAXBAS4",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXBAS5")==0) { OUT("like COM_TAX-TAXBAS5",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXBAS6")==0) { OUT("like COM_TAX-TAXBAS6",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXBAS7")==0) { OUT("like COM_TAX-TAXBAS7",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXBAS8")==0) { OUT("like COM_TAX-TAXBAS8",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"TAXBAS9")==0) { OUT("like COM_TAX-TAXBAS9",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"EXMATFLG")==0) { OUT("like COM_TAX-EXMATFLG",12); OUT("type RFC_CHAR length 2 init ' '",12); NL; } if (strcmp(text,"EXCUSFLG")==0) { OUT("like COM_TAX-EXCUSFLG",12); OUT("type RFC_CHAR length 2 init ' '",12); NL; } if (strcmp(text,"EXAMT0")==0) { OUT("like COM_TAX-EXAMT0",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"EXAMT1")==0) { OUT("like COM_TAX-EXAMT1",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"EXAMT2")==0) { OUT("like COM_TAX-EXAMT2",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"EXAMT3")==0) { OUT("like COM_TAX-EXAMT3",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"EXAMT4")==0) { OUT("like COM_TAX-EXAMT4",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"EXAMT5")==0) { OUT("like COM_TAX-EXAMT5",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"EXAMT6")==0) { OUT("like COM_TAX-EXAMT6",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; }
February 1996
19
SAP AG
if (strcmp(text,"EXAMT7")==0) { OUT("like COM_TAX-EXAMT7",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"EXAMT8")==0) { OUT("like COM_TAX-EXAMT8",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"EXAMT9")==0) { OUT("like COM_TAX-EXAMT9",12); OUT("type RFC_CHAR length 15 init ' '",12); NL; } if (strcmp(text,"EXCODE0")==0) { OUT("like COM_TAX-EXCODE0",12); OUT("type RFC_CHAR length 2 init ' '",12); NL; } if (strcmp(text,"EXCODE1")==0) { OUT("like COM_TAX-EXCODE1",12); OUT("type RFC_CHAR length 2 init ' '",12); NL; } if (strcmp(text,"EXCODE2")==0) { OUT("like COM_TAX-EXCODE2",12); OUT("type RFC_CHAR length 2 init ' '",12); NL; } if (strcmp(text,"EXCODE3")==0) { OUT("like COM_TAX-EXCODE3",12); OUT("type RFC_CHAR length 2 init ' '",12); NL; } if (strcmp(text,"EXCODE4")==0) { OUT("like COM_TAX-EXCODE4",12); OUT("type RFC_CHAR length 2 init ' '",12); NL; } if (strcmp(text,"EXCODE5")==0) { OUT("like COM_TAX-EXCODE5",12); OUT("type RFC_CHAR length 2 init ' '",12); NL; } if (strcmp(text,"EXCODE6")==0) { OUT("like COM_TAX-EXCODE6",12); OUT("type RFC_CHAR length 2 init ' '",12); NL; } if (strcmp(text,"EXCODE7")==0) { OUT("like COM_TAX-EXCODE7",12); OUT("type RFC_CHAR length 2 init ' '",12); NL; } if (strcmp(text,"EXCODE8")==0) { OUT("like COM_TAX-EXCODE8",12); OUT("type RFC_CHAR length 2 init ' '",12); NL; } if (strcmp(text,"EXCODE9")==0) { OUT("like COM_TAX-EXCODE9",12); OUT("type RFC_CHAR length 2 init ' '",12); NL; } if (strcmp(text,"EXCERTIF")==0) { OUT("like COM_TAX-EXCERTIF",12); OUT("type RFC_CHAR length 25 init ' '",12); NL; } if (strcmp(text,"EXREASON")==0) { OUT("like COM_TAX-EXREASON",12); OUT("type RFC_CHAR length 2 init ' '",12); NL; } if (strcmp(text,"USER_DATA")==0) { OUT("like COM_TAX-USER_DATA",12); OUT("type RFC_CHAR length 50 init ' '",12); NL; } } } return; } /* -----------------------------------------------------------------------------main program -----------------------------------------------------------------------------*/ main(int argc,char **argv) { /* RFC variables */ static RFC_HANDLE hRfc; static RFC_ENV RfcEnv; static RFC_RC RfcRc; static RFC_FUNCTIONNAME RfcFuncName; char s[16]; int count; /* program arguments */
20
February 1996
SAP AG
outfile = NULL; infile = NULL; logfile = NULL; for (count=0;count<argc;count++) { if (argv[count][0]=='-') { if (argv[count][1]=='?') { help("h","",""); help("l","",""); help("end","",""); exit(0); } if (argv[count][1]=='i') { if ((infile=fopen(argv[count+1],"r"))==NULL) { OUT("error opening input file",0); exit(1); } } if ((argv[count][1]=='l')&&(argv[count][2]=='o')&&(argv[count][3]=='g')) { if ((logfile=fopen(argv[count+1],"w"))==NULL) { OUT("error opening log file",0); exit(1); } } if (argv[count][1]=='o') { if ((outfile=fopen(argv[count+1],"w"))==NULL) { OUT("error opening output file",0); exit(1); } } } } LOG(hRfc,"program started",*argv); #ifdef SAPonWINDOWS _wsetexit(_WINEXITNOPERSIST); /* close window when program finished */ #endif /* accept connection */ hRfc = RfcAccept(argv); LOG(hRfc,"RfcAccept called",""); if (hRfc == 0) rfc_error("RfcAccept"); RfcEnv.errorhandler = rfc_error; RfcEnvironment(&RfcEnv); /* install function */ RfcRc = RfcInstallFunction("RFC_DETERMINE_JURISDICTION",srv_rfc_determine_jurisdiction , "Ermittlung des Jurisdictioncodes durch ein externes System"); LOG(hRfc,"RfcInstallFunction called","rfc_determine_jurisdiction"); if (RfcRc != RFC_OK) {RfcAbort(hRfc,"RfcInstallFunction"); rfc_error("RfcInstallFunction"); } /* install function */ RfcRc = RfcInstallFunction("RFC_CALCULATE_TAXES",srv_rfc_calculate_taxes, "Berechnung der Steuern durch ein externes System"); LOG(hRfc,"RfcInstallFunction called","rfc_calculate_taxes"); if (RfcRc != RFC_OK) {RfcAbort(hRfc,"RfcInstallFunction"); rfc_error("RfcInstallFunction"); } /* --------------------------------------------------do your initilisation work here --------------------------------------------------*/ OUT("SAP AG, Walldorf - Business Application Programming Interface",0); NL; OUT("External RFC server example program",2); NL; OUT("1 rfc_determine_jurisdiction",6); OUT("2 rfc_calculate_taxes",6); NL; /* wait for calls */ while ((RfcRc == RFC_OK) || (RfcRc == RFC_EXCEPTION)) RfcRc = RfcDispatch(hRfc); /* wait for calls using RfcGetName instead of RfcDispatch. RFC_PING not supported! */ /* while ((RfcRc == RFC_OK) || (RfcRc == RFC_EXCEPTION)) { RfcRc = RfcGetName(hRfc, RfcFuncName); if (RfcRc != RFC_OK) break; if (strcmp(RfcFuncName,"RFC_DETERMINE_JURISDICTION")==0) RfcRc = srv_rfc_determine_jurisdiction(hRfc); } if (strcmp(RfcFuncName,"RFC_CALCULATE_TAXES")==0) RfcRc = srv_rfc_calculate_taxes(hRfc); } */ /* connection close */ if (hRfc!=0) { RfcClose(hRfc); LOG(hRfc,"RfcClose called",""); }
February 1996
21
SAP AG
/* --------------------------------------------------do your exiting work here --------------------------------------------------*/ help("end","",""); #ifdef SAPonNT INS("","","Quit? [y]",4,24,s); #endif if (outfile!=NULL) fclose(outfile); if (infile!=NULL) fclose(infile); if (logfile!=NULL) fclose(logfile); return RfcRc; }
22
February 1996