/*@(#)cadrfc.h        20.5.2.1     SAP     96/07/10    */
/*--------------------------------------------------------------------*/
/*                                                                    */
/*  SAP AG Walldorf                                                   */
/*  SAP  Systeme, Anwendungen und Produkte in der Datenverarbeitung   */
/*                                                                    */
/*  (C) Copyright SAP AG 1995                                         */
/*                                                                    */
/*--------------------------------------------------------------------*/
/*  File: cadrfc.h                                                    */
/*--------------------------------------------------------------------*/
/*  global headerfile for CAD RFC interface                           */
/*--------------------------------------------------------------------*/
/*  3.0E                                                              */
/*  BINK090600 180696 Struktur CSRFCITEM erweitert                    */
/*                                                                    */
/*  3.0A                                                              */
/*  YENK00000  111194 Neu aufgenommen                                 */
/*--------------------------------------------------------------------*/

#include "saprfc.h"
#include "sapitab.h"

/******* field type definitions and structure type definitions *******/
#ifndef SAP_ST_SAP_FIELD_DATA
#define SAP_ST_SAP_FIELD_DATA
typedef struct
  {
  RFC_CHAR Fieldmulti[40];
  RFC_CHAR Fieldname[35];
  RFC_CHAR Fieldvalue[255];
  } SAP_FIELD_DATA;
#endif

#ifndef SAP_ST_CLASS_CHARACTERISTICS
#define SAP_ST_CLASS_CHARACTERISTICS
typedef struct
  {
  RFC_CHAR Atnam[30];
  RFC_CHAR Atbez[30];
  RFC_CHAR Atwrt[30];
  RFC_CHAR Dinkb[3];
  RFC_CHAR Unit[6];
  } CLASS_CHARACTERISTICS;
#endif

#ifndef SAP_ST_BICSK
#define SAP_ST_BICSK
typedef struct
  {
  RFC_CHAR Stype[1];
  RFC_CHAR Tcode[4];
  RFC_CHAR Aennr[12];
  RFC_CHAR Bmein[3];
  RFC_CHAR Bmeng[17];
  RFC_CHAR Cadkz[1];
  RFC_CHAR Datub[10];
  RFC_CHAR Datuv[10];
  RFC_CHAR Emeng[17];
  RFC_CHAR Equnr[18];
  RFC_CHAR Exstl[18];
  RFC_CHAR Labor[3];
  RFC_CHAR Loekz[1];
  RFC_CHAR Losbs[17];
  RFC_CHAR Losvn[17];
  RFC_CHAR Matnr[18];
  RFC_CHAR Selal[2];
  RFC_CHAR Serge[30];
  RFC_CHAR Stktx[40];
  RFC_CHAR Stlal[2];
  RFC_CHAR Stlan[1];
  RFC_CHAR Stlbe[4];
  RFC_CHAR Stlst[2];
  RFC_CHAR Vmtnr[18];
  RFC_CHAR Werks[4];
  RFC_CHAR Ztext[40];
  RFC_CHAR Revlv[2];
  RFC_CHAR Tplnr[30];
  RFC_CHAR Dokar[3];
  RFC_CHAR Doknr[25];
  RFC_CHAR Doktl[3];
  RFC_CHAR Dokvr[2];
  RFC_CHAR Vbeln[10];
  RFC_CHAR Vbpos[6];
  RFC_CHAR Stobj[18];
  } BICSK;
#endif

#ifndef SAP_ST_CSRFCITEM
#define SAP_ST_CSRFCITEM
typedef struct
  {
  RFC_CHAR Upskz[1];
  RFC_CHAR Auskz[1];
  RFC_CHAR Alpos[1];
  RFC_CHAR Ausch[6];
  RFC_CHAR Avoau[6];
  RFC_CHAR Beikz[1];
  RFC_CHAR Cadpo[1];
  RFC_CHAR Ekgrp[3];
  RFC_CHAR Erskz[1];
  RFC_CHAR Fmeng[1];
  RFC_CHAR Idnrk[18];
  RFC_CHAR Lifnr[10];
  RFC_CHAR Lifzt[3];
  RFC_CHAR Matkl[9];
  RFC_CHAR Meins[3];
  RFC_CHAR Menge[18];
  RFC_CHAR Netau[1];
  RFC_CHAR Nfmat[18];
  RFC_CHAR Nlfzt[3];
  RFC_CHAR Peinh[6];
  RFC_CHAR Posnr[4];
  RFC_CHAR Postp[1];
  RFC_CHAR Preis[14];
  RFC_CHAR Potx1[40];
  RFC_CHAR Potx2[40];
  RFC_CHAR Pswrk[4];
  RFC_CHAR Rekrs[1];
  RFC_CHAR Rform[2];
  RFC_CHAR Roanz[17];
  RFC_CHAR Roame[3];
  RFC_CHAR Rokme[3];
  RFC_CHAR Romei[3];
  RFC_CHAR Romen[17];
  RFC_CHAR Roms1[17];
  RFC_CHAR Roms2[17];
  RFC_CHAR Roms3[17];
  RFC_CHAR Rvrel[1];
  RFC_CHAR Sakto[10];
  RFC_CHAR Sanfe[1];
  RFC_CHAR Sanin[1];
  RFC_CHAR Sanka[1];
  RFC_CHAR Sanko[1];
  RFC_CHAR Sanvs[1];
  RFC_CHAR Schgt[1];
  RFC_CHAR Selal[2];
  RFC_CHAR Selid[18];
  RFC_CHAR Selpo[4];
  RFC_CHAR Selsb[10];
  RFC_CHAR Sortf[10];
  RFC_CHAR Stkkz[1];
  RFC_CHAR Stktx[40];
  RFC_CHAR Stlal[2];
  RFC_CHAR Stlkz[1];
  RFC_CHAR Verti[4];
  RFC_CHAR Webaz[3];
  RFC_CHAR Waers[5];
  RFC_CHAR Dokar[3];
  RFC_CHAR Doknr[25];
  RFC_CHAR Dokvr[2];
  RFC_CHAR Doktl[3];
  RFC_CHAR Ewahr[3];
  RFC_CHAR Ekorg[4];
  RFC_CHAR Lgort[4];
  RFC_CHAR Class[18];
  RFC_CHAR Klart[3];
  RFC_CHAR Potpr[1];
  RFC_CHAR Alpgr[2];
  RFC_CHAR Alpst[1];
  RFC_CHAR Alprf[2];
  RFC_CHAR Dspst[2];                      /* BINK090600 180696 */
  RFC_CHAR Prvbe[10];                     /* BINK090600 180696 */
  RFC_CHAR Nfeag[2];                      /* BINK090600 180696 */
  RFC_CHAR Nfgrp[2];                      /* BINK090600 180696 */
  RFC_CHAR Kzkup[1];                      /* BINK090600 180696 */
} CSRFCITEM;
#endif

#ifndef SAP_ST_DRAW_RFC
#define SAP_ST_DRAW_RFC
typedef struct {
  RFC_CHAR Dokar[3];
  RFC_CHAR Doknr[25];
  RFC_CHAR Dokvr[2];
  RFC_CHAR Doktl[3];
  RFC_CHAR Dwnam[12];
  RFC_CHAR Dokst[2];
  RFC_CHAR Protf[20];
  RFC_CHAR Labor[3];
  RFC_CHAR Aennr[12];
  RFC_CHAR Werka[4];
  RFC_CHAR Loedk[1];
  RFC_CHAR Cadkz[1];
  RFC_CHAR Prenr[25];
  RFC_CHAR Prevr[2];
  RFC_CHAR Pretl[3];
  RFC_CHAR Prear[3];
  RFC_CHAR Begru[4];
  RFC_CHAR Filep[70];
  RFC_CHAR Dttrg[10];
  RFC_CHAR Dappl[3];
  RFC_CHAR Filep1[70];
  RFC_CHAR Dttrg1[10];
  RFC_CHAR Dappl1[3];
  RFC_CHAR Vrldat[10];
  RFC_NUM  Vprior[1];
  RFC_CHAR Res1[14];
  RFC_CHAR Res2[14];
  RFC_CHAR Res3[14];
  RFC_CHAR Res4[14];
  RFC_CHAR Adatum[10];
  RFC_CHAR DoknrVl[25];
  RFC_CHAR DoktlVl[3];
  RFC_CHAR DokvrVl[2];
  RFC_CHAR Doktxt[40];
  RFC_CHAR Pathname[200];
  } DRAW_RFC;
#endif


typedef struct {
   char BomAction[1];
   char BomAlternative[2];
   char BomApplication[4];
   char BomType[1];
   char BusinessArea[4];
   char ChangeNumber[12];
   char ClassNo[18];
   char ClassType[3];
   char DocNumber[25];
   char DocOriginal[70];
   char Doktl[3];
   char DocPathname[70];
   char DocPathprefix[10];
   char Dokar[3];
   char Dokvr[2];
   char Dokst[2];
   char Dwnam[12];
   char Equipment[18];
   char EquipmentType[1];
   char FunctionalLocation[30];
   char FunctionalLocationType[1];
   char Labor[3];
   char MatApplication[1];
   char MatType[4];
   char Material[18];
   char Notification[12];
   char NotificationType[2];
   char Object[1];
   char ObjectId[1];
   char ObjectKey[50];
   char ObjectTable[10];
   char PmOrderNo[12];
   char PmOrderType[4];
   char Plant[4];
   char PrevDocNumber[25];
   char PrevDocType[3];
   char PrevDocPart[3];
   char PrevDocVers[2];
   char RevisionLevel[2];
   char RefEquipment[18];
   char RefFunctionalLocation[30];
   char RefReferenceLocation[30];
   char RefMaterial[18];
   char SkipFirstScreen[1];
   char StructureIndicator[5];
   char ValidFrom[10];
   char ValidTo[10];
   char WUDirect[1];
   char WUViaclass[1];
} CadRfcExportField;


typedef struct {
   char ChangeNumber[12];
   char ClassNo[18];
   char ClassType[3];
   char DateFormat[30];
   char DecimalSign[1];
   char DocNumber[25];
   char DocType[3];
   char DocPart[3];
   char DocVers[2];
   char DocPath[255];
   char Equipment[18];
   char FunctionalLocation[30];
   char FunctionCode[14];
   char Language[1];
   char Material[18];
   char Notification[12];
   char ObjectKey[50];
   char ObjectTable[10];
   char PmOrderNo[12];
   char SapSystemRelease[4];
   char UserName[12];
   char ValidFrom[10];
} CadRfcImportField;


typedef struct {
   char ApplicationType[11];
   char ApplicationMode;
   char ApplicationName[41];
   char ApplicationPath[71];
   char TempDir[141];
   char CallbackPara0[133];
   char CallbackPara1[40];
   char CallbackPara2[40];
   char CallbackPara3[40];
   char CallbackPara4[40];
} CadRfcInitData;

CadRfcInitData *pInitData;


/******************** Function prototypes ****************************/
int  CadRfcAllocMemory     (CadRfcExportField **, CadRfcImportField **,
                            BICSK **, DRAW_RFC **);

int  CadRfcBomChange       (BICSK *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);
int  CadRfcBomCreate       (BICSK *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);
int  CadRfcBomDisplay      (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);
int  CadRfcBomWhereUsed    (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);

int  CadRfcClassSelection  (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **, ITAB_H **);

int  CadRfcClose           ();

int  CadRfcChgChange       (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);
int  CadRfcChgCreate       (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);
int  CadRfcChgDisplay      (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);

int  CadRfcDistributeApplication(int, char**);


int  CadRfcDocChange       (DRAW_RFC *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);
int  CadRfcDocCreate       (DRAW_RFC *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);
int  CadRfcDocDisplay      (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);
int  CadRfcDocSelect       (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);
int  CadRfcDocInsert       (DRAW_RFC *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);
int  CadRfcGetDmsData      (CadRfcExportField *, DRAW_RFC *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);
int  CadRfcGetHandle       (RFC_HANDLE*);

int  CadRfcGetSystemParas  (CadRfcImportField *);

int  CadRfcSetHandle       (RFC_HANDLE*);

int  CadRfcEquChange       (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);
int  CadRfcEquCreate       (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);
int  CadRfcEquDisplay      (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);

int  CadRfcFloChange       (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);
int  CadRfcFloCreate       (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);
int  CadRfcFloDisplay      (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);

int  CadRfcPmOrderChange   (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);
int  CadRfcPmOrderCreate   (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);
int  CadRfcPmOrderDisplay  (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);

int  CadRfcPmrChange       (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);
int  CadRfcPmrCreate       (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);
int  CadRfcPmrDisplay      (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);

int  CadRfcMailInbox       (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);
int  CadRfcMailOutbox      (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);
int  CadRfcWorkflowInbox   (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);

int  CadRfcMatchcode       (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);

int  CadRfcMatChange       (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);
int  CadRfcMatCreate       (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);
int  CadRfcMatDisplay      (CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);

int  CadRfcProductStructure(CadRfcExportField *, CadRfcImportField *,
                            ITAB_H **, ITAB_H **);

int  CadRfcInit            (char *, char*, char*, char*, RFC_HANDLE*);

int  CadRfcOpen            (char *, char*, char*, char*, char*, char*,
                            char *, RFC_HANDLE*);

int  CadRfcWriteBomTabEntry(char*, char*, int);
