IMPORT
Description
This action is called for each record for each table declared in the first tab of the template. This action intervenes when the [M] class has been changed. The [F] class contains the record to be imported. This action intervenes before the simulation of the entry.
Action called from the process generated by the import WWIxxxxxxx.
OBJect import
Simple, Grid, Combined
This action is not called on an import without OBJect.
Use
Even though possible in the action AP_IMPORT, it is also possible to complete the [F] class of the record to be imported.
It is possible to load in advance the information [M] class because there is no automatic mechanism in the supervisor for this information ( e.g. : additional window for the OBJect, hidden or displayed field, variable at the bottom of the grid).
Importing the texts leads to the creation of a clob in a dedicated table.
On a Header-detail OBJect, to identify for each detail, if in creation, modification, deletion or insertion into the grid.
Avoid the import of a record at level 1, as well as all the records at the lower level, the variable OK = 0.
Several variables that are useful in this action :
[L]TRTMSK : process generated in the screen
[L]IMPFIC : abbreviation of the current table
[S]nolign : it will be set to zero for the creation of a detail line otherwise it is loaded with the detail line number to be modified.
[L]status : the deletion of the line detail is identified by the status=65, the insertion of a line in the middle of the grid the status=72
Example
# as a function of GMANCOU, it is necessary or not to reactivate SOHNUM
If GREP="C"
Setmode INBAFF,IAFFCOD,IAFFMASK,IAFFCHP,IAFFIND,IAFFTXT,IAFFRANG,IAFFOPT1,IAFFOPT2
If GMANCOU=1
Diszo [M:SOH0]SOHNUM
Elsif GMANCOU=2
Actzo [M:SOH0]SOHNUM
Endif
Setmode
Endif
In the sales order object, the order number is activated or de-activated as a function of the order type. As the entry simulation processes the fields sequentially in the order in which they are defined on the screen. In this IMPORT action the user is obliged to activate or de-activate the order number.
Case IMPFIC
When "SOQ", "SOP" :
Gosub IMP_DECLARE From TRTX3IMP
# --> It is necessary to determine if it is a new line or not
If GREP = "M"
ICLEPRIM (0) = "SOPLIN"
ICLEPRIM (1) = "IMPNUMLIG" : ICLEBRK(1)=1
ICLEPRIM (2) = "ITMREF" : ICLESEC(2)="SHIDAT" : TSEC(2)="DSHIDAT"
ICLEPRIM (3) = "ITMREF"
NBASTAB = "NBLIG"
Gosub RECHERCHE_LIGNE From TRTX3IMP
If nolign=0 : G_NLDET=1 : Endif
# --> Deletion process for a line
Call TST_CHAMP(IMPFIC,"QTY",OKCHAMP) From SUBIMPOBJ
If OKCHAMP & [F:SOQ]QTY = 0 & nolign <> 0
status=65
# --> Deletion control for the lines
Call C_NBLIG From W1SOH4
If mkstat OK=0 : Return : Endif
Call AVANT_NBLIG From W1SOH4
Call APRES_NBLIG From W1SOH4
Endif
Return
Endif
Endcase
In the sales order import based on a header-detail OBJect, when in order modification, the possible operations for the lines in this order can be creation, modification or deletion. In this case, the quantity set to zero on a detail line indicates that it is necessary to delete the line. The status will then be set to 65 and the required actions should be executed in this IMPORT action.
If GREP="C" Raz [M:ADB1], [M:ADB2], [M:ADB3] Endif
If G_BPCNAM
[M:ADB1]ADBBPR = [F:SOH]BPCORD
[M:ADB1]BPRNAM(0) = [F:SOH]BPCNAM(0)
[M:ADB1]BPRNAM(1) = [F:SOH]BPCNAM(1)
[M:ADB1]BPAADDLIG(0) = [F:SOH]BPCADDLIG(0)
[M:ADB1]BPAADDLIG(1) = [F:SOH]BPCADDLIG(1)
[M:ADB1]BPAADDLIG(2) = [F:SOH]BPCADDLIG(2)
[M:ADB1]POSCOD = [F:SOH]BPCPOSCOD
[M:ADB1]CTY = [F:SOH]BPCCTY
[M:ADB1]SAT = [F:SOH]BPCSAT
[M:ADB1]CRY = [F:SOH]BPCCRY
[M:ADB1]CRYNAM = [F:SOH]BPCCRYNAM
Endif
In the sales order import, there is the possibility to import the ordering customer address in the order table, if the company name is parameterized in the import template. This information cannot be entered in one of the in the OBJects for the orders, but in a different screen called from the menu bar. There is not automatic mechanism for the loading of the [M] class in the supervisor. Therefore, in the action LIENS, load the [M] class with the [F] class for the record to be modified, then in the IMPORT action, load the [M] class with the [F] class for the record to be imported.
Case IMPFIC
When "SOH" :
If G_ENT : # --- Header text ---
Raz [M:ITC]T_CLE_CLOB(1)
Gosub IMP_T1 From TRTX3IMP : Gosub ECR_TEXTE From TRTX3IMP
[M:ITC]T_CLE_CLOB(1)=G_CLE_CLOB
Endif
If G_PIE : # --- Footer text ---
Raz [M:ITC]T_CLE_CLOB(2)
Gosub IMP_T2 From TRTX3IMP : Gosub ECR_TEXTE From TRTX3IMP
[M:ITC]T_CLE_CLOB(2)=G_CLE_CLOB
EndifWhen "SOQ"
If G_DET : # --- Detail text ---
Raz [M:ITC]T_CLE_CLOB(3)
Gosub IMP_T3 From TRTX3IMP : Gosub ECR_TEXTE From TRTX3IMP
[M:ITC]T_CLE_CLOB(3)=G_CLE_CLOB
Endif
Endcase
In the sales order import, there is the possibility to import 8 lines of 250 characters for the final, create a clob text associated with the header, with the footer or with each detail line of the order. In this action, the texts are loaded in 8 fields in the IMPTXTCLOB screen (screen reserved for the import/export of texts), all of these fields serve to make up the clob field in the same screen. In the last step, a record is created in the TEXTCLOB table. The assignment of the text number in the order table will be made in the IMP_ZONE action. The write to the action IMPORT is as follows :
$IMPORT
Case IMPFIC
When "SOH"
If G_GIMP6
I1=instr(1,GIMP(6),"~")
If I1 [F:SOH]BPCORD=left$(GIMP(6),I1-1) Else [F:SOH]BPCORD=GIMP(6) Endif
Endif
When Default
Endcase
Return
In the sales order import, it is possible to import a field containing the customer number followed by the "~" character followed by other data. To load the customer number in the [F] class, the IMPORT action is used as follows :