· 9 years ago · Nov 22, 2016, 10:36 AM
1// Modification History
2// Date Who SDR What
3// 25oct16 nb Initial Version
4
5
6//TODO
7//Are all incoming records INSERT functions in Pronto?
8
9//DONE
10//have a copy of exports in processed
11//Go through all files that are *.csv and NOT ack*.csv
12//GUID for the first line and true to send something back
13//1 record is exported, not 3
14//If new record from biztalk creates an insert, DO NOT EXPORT
15//Change to export and import
16
17
18//Setup
19//1. Create dictionary triggers that track the deb-master, name-and-address-master, and system-table tables. They should call the salesforce-change procedure below
20//2. Setup module function codes for exporting the data
21//3. Setup the SF_EXPORTDIR environment variable
22//4. Create the template account. Dont forget to set deb-status = "N" and accountcode to be "Z_SF_TEMP"
23//5. Create the z-salesforce-change-log table in the dictionary according to commented out schema code below
24//6. Create the ZSF system table entry in the YY table for a counter for the export files
25//7. Create the salesforce-data table in the dictionary according to the commented out schema code below
26
27//object z-salesforce-change-log
28// type is memory
29// record is
30// scl-type pic X //'D'eb-master, 'N'ame-and-address-master, 'S'ystem-table
31// scl-date type date
32// scl-time type time
33// scl-processed type boolean
34// scl-key-1 like accountcode
35// scl-key-2 like sys-tbl-code
36// scl-change-type pic X //'I'nsert, 'U'pdate, 'D'elete
37// endrecord
38// key is scl-type scl-date scl-time unique
39
40// object z-salesforce-data
41// type is memory
42// record is
43// sd-accountcode pic X(10)
44// sd-salesforce-account-id pic X(20)
45// sd-salesforce-user-id pic X(20)
46// endrecord
47// key is sd-accountcode unique
48
49link 'clib/clibtax'
50
51#include "../include/bmsdef.spl"
52#include "../include/i8trigtags.spl"
53
54object tmp-customer-object
55 type is external //NOT csv. csv needs quotes around fields. biztalk is not giving us quotes around test so external is needed
56 separator is "|"
57 record is
58 sd-salesforce-account-id //AccountID
59 shortname //AccountName
60 accountcode //ProntoID
61 sd-salesforce-user-id //AccountOwner
62 tco-account-source pic X //Not stored in Pronto
63 na-street //BillingStreet
64 na-country //BillingCity
65 na-address-6 //BillingState
66 postcode //BillingPostalCode
67 na-address-7 //BillingCountry
68 na-fax-no //Fax
69 dr-marketing-flag //Parent
70 na-phone //Phone
71 tco-cust-type like sys-description //dr-cust-type //CustomerType
72 tco-terms-disc like sys-description //terms-disc //PaymentType
73 tco-first-name pic X //Not stored in Pronto
74 tco-last-name pic X //Not stored in Pronto
75 territory //TerritoryCode
76 tco-territory-description like sys-description //TerritoryDescription
77 tco-region-code like sys-tbl-code //RegionCode
78 tco-region-description like sys-description //RegionDescription
79 endrecord
80
81object tmp-acknowledge
82 type is external
83 record is
84 ta-data pic X(256)
85 endrecord
86
87
88field
89 ws-template-deb-status like deb-status
90 ws-template-dr-clearflag like dr-clearflag
91 ws-template-price-code like price-code
92 ws-template-warehouse like warehouse
93 ws-template-rep-code like rep-code
94 ws-template-territory like territory
95 ws-template-na-tax-group like na-tax-group
96 ws-template-dr-industry-code like dr-industry-code
97 ws-template-dr-cust-type like dr-cust-type
98 ws-template-dr-part-shipment-allowed like dr-part-shipment-allowed
99 ws-template-dr-order-priority like dr-order-priority
100 ws-template-dr-price-disc-by-bill-to like dr-price-disc-by-bill-to
101 ws-template-dr-ageing-code like dr-ageing-code
102 ws-report-started type boolean
103 ws-error-message pic X(256)
104
105procedure library-init
106 get system-control
107 first
108endprocedure
109
110
111procedure main export
112
113 get system-control
114 first
115
116 get deb-master
117 on index accountcode
118 key is "S_SF_TEMP"
119 on error
120 message "The S_SF_TEMP customer template account does not exist. Please create it."
121 else
122 set ws-template-deb-status = deb-status
123 set ws-template-dr-clearflag = dr-clearflag
124 set ws-template-price-code = price-code
125 set ws-template-warehouse = warehouse
126 set ws-template-rep-code = rep-code
127 set ws-template-territory = territory
128 get name-and-address-master
129 on index accountcode na-type
130 key is "S_SF_TEMP" "C"
131 on error
132 set ws-template-na-tax-group = spaces
133 else
134 set ws-template-na-tax-group = na-tax-group
135 endon
136 set ws-template-dr-industry-code = dr-industry-code
137 set ws-template-dr-cust-type = dr-cust-type
138 set ws-template-dr-part-shipment-allowed = dr-part-shipment-allowed
139 set ws-template-dr-order-priority = dr-order-priority
140 set ws-template-dr-price-disc-by-bill-to = dr-price-disc-by-bill-to
141 set ws-template-dr-ageing-code = dr-ageing-code
142 endon
143
144 command 'sh'
145 parameter "-c" concat("mkdir $SF_EXPORTDIR > /dev/null 2>&1")
146 command 'sh'
147 parameter "-c" concat("mkdir $SF_EXPORTDIR/export > /dev/null 2>&1")
148 command 'sh'
149 parameter "-c" concat("mkdir $SF_EXPORTDIR/export/out > /dev/null 2>&1")
150 command 'sh'
151 parameter "-c" concat("mkdir $SF_EXPORTDIR/export/out/processed > /dev/null 2>&1")
152 command 'sh'
153 parameter "-c" concat("mkdir $SF_EXPORTDIR/import > /dev/null 2>&1")
154 command 'sh'
155 parameter "-c" concat("mkdir $SF_EXPORTDIR/import/in > /dev/null 2>&1")
156 command 'sh'
157 parameter "-c" concat("mkdir $SF_EXPORTDIR/import/out > /dev/null 2>&1")
158 command 'sh'
159 parameter "-c" concat("mkdir $SF_EXPORTDIR/import/in/processed > /dev/null 2>&1")
160
161
162 if get-param(1) = 'export' //Export Customer
163 do export-customer
164 elseif get-param(1) = "import" //Import Customer
165 do import-customer
166 endif
167
168endprocedure
169
170
171procedure get-counter
172 returning lr-counter like sys-money-value
173
174 get system-table
175 on index sys-tbl-type sys-tbl-code
176 key is "YY" "ZSF"
177 on error
178 message "Please initialize the YY/ZSF system table entry with 0"
179 set lr-counter = 0
180 else
181 serial system-table sys-money-value
182 on index sys-tbl-type sys-tbl-code
183 key is "YY" "ZSF"
184 set lr-counter = sys-money-value
185 endon
186
187endprocedure
188
189procedure import-customer export
190 local field
191 lf-ic-filename pic X(256)
192 lf-ack-filename like lf-ic-filename
193 lf-ok type boolean
194 lf-first-record type boolean
195 lf-session-id pic X(256)
196 lf-counter like sys-money-value
197 lf-dir pic X(300)
198 lf-search-pattern pic X(5)
199 lf-file-name pic X(300)
200 lf-dir-ok type boolean
201
202 set lf-dir = concat(get-env("SF_EXPORTDIR"),"/import/in/")
203 set lf-search-pattern = 'csv' // Find Report files whose names contain
204
205 if start-dir-search(lf-dir, lf-search-pattern)
206 set lf-dir-ok = TRUE
207 else
208 set lf-dir-ok = FALSE
209 endif
210 while lf-dir-ok
211 set lf-file-name = next-dir-entry()
212 if lf-file-name = SPACES // Search exhausted - No more files
213 set lf-dir-ok = false
214 elseif pattern(lf-file-name,"ack") = 1 //Dont pick up "ack"nowledge files
215 else
216 set lf-ic-filename = concat(get-env("SF_EXPORTDIR"),"/import/in/",lf-file-name)
217
218 open tmp-customer-object
219 file is lf-ic-filename
220
221 set lf-first-record = true
222
223 extract tmp-customer-object all
224 detail
225 //The first record contains only the session id, which is in the first column
226 if lf-first-record = true
227 set lf-session-id = sd-salesforce-account-id
228 set lf-first-record = false
229 continue
230 endif
231 do validate-lines
232 returning lf-ok
233 if lf-ok
234 open deb-master no-triggers
235 //The tables we are using already have the correct fields defined
236 set terms-disc = tco-terms-disc
237 set dr-cust-type = tco-cust-type
238 insert deb-master
239 on error
240 endon
241
242 open z-salesforce-data no-triggers
243 set sd-accountcode = accountcode
244 insert z-salesforce-data
245 on error
246 endon
247
248 open name-and-address-master no-triggers
249 insert name-and-address-master
250 on error
251 endon
252 endif
253 endextract
254
255 close tmp-customer-object
256
257 command 'sh'
258 parameter "-c" concat("cd $SF_EXPORTDIR/import/in; mv ",lf-file-name," processed/",lf-file-name)
259
260 do get-counter
261 returning lf-counter
262 set lf-ack-filename = concat(get-env("SF_EXPORTDIR"),"/import/out/ack-",str(lf-counter),".csv.wip")
263
264 open tmp-acknowledge create permanent
265 file is lf-ack-filename
266
267 set ta-data = lf-session-id
268 insert tmp-acknowledge
269 on error
270 endon
271 set ta-data = "true"
272 insert tmp-acknowledge
273 on error
274 endon
275 close tmp-acknowledge
276
277 command 'sh'
278 parameter "-c" concat("cd ",get-env("SF_EXPORTDIR"),"/import/out; cp ack-",str(lf-counter),".csv.wip ack-",str(lf-counter),".csv")
279
280 endif
281 end-while
282
283 if ws-report-started = true
284 report finished
285 endif
286endprocedure
287
288procedure salesforce-change-dm export
289 parameters are
290 lp-old.* like deb-master.*
291 lp-new.* like deb-master.*
292 lp-trigger-type pic 9(4)
293 local field
294 lf-change-type pic X
295
296 if pattern(lp-new.accountcode,"SF_") = 1
297 if lp-trigger-type = TRIGGER_AFTER_INSERT
298 set lf-change-type = "I"
299 elseif lp-trigger-type = TRIGGER_AFTER_UPDATE
300 set lf-change-type = "U"
301 elseif lp-trigger-type = TRIGGER_AFTER_DELETE
302 set lf-change-type = "D"
303 endif
304 do salesforce-change
305 parameters are "D" //deb-master
306 lp-new.accountcode
307 spaces
308 lf-change-type
309 endif
310endprocedure
311
312procedure salesforce-change-naam export
313 parameters are
314 lp-old.* like name-and-address-master.*
315 lp-new.* like name-and-address-master.*
316 lp-trigger-type pic 9(4)
317 local field
318 lf-change-type pic X
319
320 if lp-new.na-type != "C"
321 exit
322 endif
323
324 //if pattern(lp-new.accountcode,"SF_") = 1 or
325 //pattern(lp-old.accountcode,"SF_") = 1
326 if lp-trigger-type = TRIGGER_AFTER_INSERT
327 set lf-change-type = "I"
328 elseif lp-trigger-type = TRIGGER_AFTER_UPDATE
329 set lf-change-type = "U"
330 elseif lp-trigger-type = TRIGGER_AFTER_DELETE
331 set lf-change-type = "D"
332 endif
333 do salesforce-change
334 parameters are "N" //name-and-address-master
335 lp-new.accountcode
336 lp-new.na-type
337 lf-change-type
338 //endif
339
340endprocedure
341
342procedure salesforce-change-st export
343 parameters are
344 lp-old.* like system-table.*
345 lp-new.* like system-table.*
346 lp-trigger-type pic 9(4)
347 local field
348 lf-change-type pic X
349
350 exit
351
352 if lp-new.sys-tbl-type in { 'TC' 'CT' 'DD' }
353 else
354 exit
355 endif
356
357 if lp-trigger-type = TRIGGER_AFTER_INSERT
358 set lf-change-type = "I"
359 elseif lp-trigger-type = TRIGGER_AFTER_UPDATE
360 set lf-change-type = "U"
361 elseif lp-trigger-type = TRIGGER_AFTER_DELETE
362 set lf-change-type = "D"
363 endif
364 do salesforce-change
365 parameters are "S" //system-table
366 lp-new.sys-tbl-type
367 lp-new.sys-tbl-code
368 lf-change-type
369
370endprocedure
371
372procedure salesforce-change export
373 parameters are lp-type like scl-type
374 lp-key-1 like scl-key-1
375 lp-key-2 like scl-key-2
376 lp-change-type like scl-change-type
377
378 set scl-type = lp-type
379 set scl-date = today()
380 set scl-time = tod()
381 set scl-processed = false
382 set scl-key-1 = lp-key-1
383 set scl-key-2 = lp-key-2
384 set scl-change-type = lp-change-type
385 insert z-salesforce-change-log
386 on error
387 endon
388
389endprocedure
390
391
392procedure export-customer
393 local field
394 lf-filename pic X(256)
395 lf-counter like sys-money-value
396
397 do get-counter
398 returning lf-counter
399 set lf-filename = concat(get-env("SF_EXPORTDIR"),"/export/out/pronto-sf-export-",str(lf-counter),".csv.wip")
400
401 open tmp-customer-object create permanent
402 file is lf-filename
403
404 extract z-salesforce-change-log all
405 on index scl-type scl-date scl-time
406 where scl-processed = false
407 detail
408 if scl-type in { "D" "N" }
409 get deb-master
410 on index accountcode
411 key is scl-key-1
412 on error
413 else
414 endon
415 get name-and-address-master
416 on index accountcode na-type
417 key is accountcode "C"
418 on error
419 else
420 endon
421 get z-salesforce-data
422 on index sd-accountcode
423 key is accountcode
424 on error
425 else
426 endon
427 elseif scl-type = "S"
428 endif
429 //We also need to find the territory description
430 get system-table
431 on index sys-tbl-type sys-tbl-code
432 key is "TC" territory
433 on error
434 else
435 set tco-territory-description = sys-description
436 endon
437 get system-table
438 on index sys-tbl-type sys-tbl-code
439 key is "CT" tco-cust-type
440 on error
441 else
442 set tco-cust-type = sys-description
443 endon
444 get system-table
445 on index sys-tbl-type sys-tbl-code
446 key is "DD" tco-terms-disc
447 on error
448 else
449 set tco-terms-disc = sys-description
450 endon
451 insert tmp-customer-object
452 on error
453 else
454 set scl-processed = true
455 update z-salesforce-change-log
456 on error
457 endon
458 endon
459 endextract
460
461 command 'sh'
462 parameter "-c" concat("cd $SF_EXPORTDIR/export/out; cp pronto-sf-export-",str(lf-counter),".csv.wip processed/pronto-sf-export-",str(lf-counter),".csv")
463
464 command 'sh'
465 parameter "-c" concat("cd $SF_EXPORTDIR/export/out; mv pronto-sf-export-",str(lf-counter),".csv.wip pronto-sf-export-",str(lf-counter),".csv")
466
467endprocedure
468
469procedure validate-lines
470 returning lr-ok type boolean
471
472 do validate-record
473 returning lr-ok
474
475 if lr-ok = false
476 //ws-error-message has the current error
477 if ws-report-started = false
478 set ws-report-started = true
479 report "Salesforce - Customer Import"
480 width is 200
481 endif
482 print ws-error-message col 1
483 endif
484
485endprocedure
486
487procedure validate-record
488 returning lr-ok type boolean
489 local field
490 lf-tax-group-ok type boolean
491 lf-tax-group-error-message pic X(256)
492 lf-tax-group-error-title pic X(256)
493
494 set lr-ok = true
495 get deb-master
496 on index accountcode
497 key is accountcode
498 on error
499 //Good. We want a unique new accountcode
500 else //Account exists
501 set ws-error-message = "Account code already exists"
502 set lr-ok = false
503 exit
504 endon
505
506// if deb-status = 'I' and credit-limit between '0' and '9'
507 if deb-status != spaces
508// set ws-error-message = 'WARNING - Can only use limits "A" - "Z" with "Insured Debt" '
509 set deb-status = ws-template-deb-status
510 set ws-error-message = 'deb-status should be blank. Copied from template account.'
511 //set lr-ok = false
512 //exit
513 endif
514 if dr-clearflag != 'O'
515 set dr-clearflag = ws-template-dr-clearflag
516 set ws-error-message = "Clear flag should be O. Copied from template account."
517 //set lr-ok = false
518 //exit
519 endif
520 if warehouse = spaces
521 set warehouse = ws-template-warehouse
522 set ws-error-message = "Warehouse can not be spaces. Copied from template account."
523 //set lr-ok = false
524 //exit
525 endif
526 if warehouse != spaces
527 get system-table
528 on index sys-tbl-type sys-tbl-code
529 key is 'WH' warehouse
530 on error
531 set ws-error-message = "Warehouse not found"
532 set lr-ok = false
533 exit
534 endon
535 endif
536 if rep-code = spaces
537 set rep-code = ws-template-rep-code
538 set ws-error-message = "Rep code can not be spaces. Copied from template account."
539 //set lr-ok = false
540 //exit
541 endif
542 if rep-code != spaces
543 get rep-master
544 key is rep-code
545 on error
546 set ws-error-message = 'Rep code not valid'
547 set lr-ok = false
548 exit
549 endon
550 endif
551 if territory = spaces
552 set territory = ws-template-territory
553 set ws-error-message = "Territory can not be spaces. Copied from template account."
554 //set lr-ok = false
555 //exit
556 endif
557 if territory != spaces
558 get system-table
559 on index sys-tbl-type sys-tbl-code
560 key is 'TC' territory
561 on error
562 set ws-error-message = "Territory not valid"
563 set lr-ok = false
564 exit
565 endon
566 endif
567 if na-tax-group = SPACES
568 set na-tax-group = ws-template-na-tax-group
569 set ws-error-message = "Tax group can not be spaces. Copied from template account."
570 //set lr-ok = false
571 //exit
572 endif
573 if na-tax-group != SPACES
574 do clibtax-validate-tax-group
575 parameters
576 na-tax-group
577 returning
578 lf-tax-group-ok
579 lf-tax-group-error-message
580 lf-tax-group-error-title
581 if not lf-tax-group-ok
582 set ws-error-message = lf-tax-group-error-message
583 set lr-ok = false
584 exit
585 endif
586 endif
587 if dr-industry-code = spaces
588 set dr-industry-code = ws-template-dr-industry-code
589 set ws-error-message = "Industry Code can not be spaces. Copied from template account."
590 //set lr-ok = false
591 //exit
592 endif
593 if dr-industry-code != spaces
594 get system-table
595 on index sys-tbl-type sys-tbl-code
596 key is 'CI' dr-industry-code
597 on error
598 set ws-error-message = "Industry code not valid"
599 set lr-ok = false
600 exit
601 endon
602 endif
603 if dr-cust-type = spaces
604 set dr-cust-type = ws-template-dr-cust-type
605 set ws-error-message = "Cust type can not be spaces. Copied from template account."
606 //set lr-ok = false
607 //exit
608 endif
609 if dr-cust-type != spaces
610 get system-table
611 on index sys-tbl-type sys-tbl-code
612 key is 'CT' dr-cust-type
613 on error
614 set ws-error-message = "Cust type not valid"
615 set lr-ok = false
616 exit
617 endon
618 endif
619 if dr-part-shipment-allowed not in {'Y' 'N'}
620 set dr-part-shipment-allowed = ws-template-dr-part-shipment-allowed
621 set ws-error-message = "Part shipment allowed should be 'Y' or 'N'. Copied from template account."
622 //set lr-ok = false
623 //exit
624 endif
625 if dr-order-priority > 9
626 set dr-order-priority = ws-template-dr-order-priority
627 set ws-error-message = "Order Priority should be between 0-9. Copied from template account."
628 //set lr-ok = false
629 //exit
630 endif
631 if dr-price-disc-by-bill-to not in {'Y' 'N' ' '}
632 set dr-price-disc-by-bill-to = ws-template-dr-price-disc-by-bill-to
633 set ws-error-message = "Price disc by bill-to should be 'Y' , 'N' or blank. Copied from template account."
634 //set lr-ok = false
635 //exit
636 endif
637 if dr-ageing-code = spaces
638 set dr-ageing-code = ws-template-dr-ageing-code
639 set ws-error-message = "Ageing code can not be spaces. Copied from template account."
640 //set lr-ok = false
641 //exit
642 endif
643 if dr-ageing-code != spaces
644 get system-table
645 on index sys-tbl-type sys-tbl-code
646 key is 'DK' dr-ageing-code
647 on error
648 set ws-error-message = "Ageing code not valid"
649 set lr-ok = false
650 exit
651 endon
652 endif
653
654 //Left here in case of future need...
655 // ////////////////// Other field validations///////////////////
656 // //z-terms-disc
657 // if terms-disc != SPACES
658 // get system-table
659 // on index sys-tbl-type sys-tbl-code
660 // key is "DD" terms-disc
661 // on error
662 // set ws-error-code = "0020"
663 // set ws-error-message = "Invalid terms code"
664 // //message "Invalid terms code"
665 // set lr-ok = false
666 // //exit(1)
667 // endon
668 // endif
669 // //z-dr-marketing-flag
670 // if dr-marketing-flag != SPACES
671 // get system-table
672 // key is 'CM' dr-marketing-flag
673 // on error
674 // set ws-error-code = "0021"
675 // set ws-error-message = 'Invalid marketing flag'
676 // //message 'Invalid marketing flag'
677 // set lr-ok = false
678 // //exit(1)
679 // endon
680 // endif
681 // //z-dr-company-mask
682 // if dr-company-mask != SPACES
683 // get system-table
684 // key is 'BC' dr-company-mask
685 // on error
686 // set ws-error-code = "0022"
687 // set ws-error-message = 'Invalid company flag'
688 // //message 'Invalid company flag'
689 // set lr-ok = false
690 // //exit(1)
691 // endon
692 // endif
693 // //z-dr-credit-letter-status
694 // if dr-credit-letter-status not in {'Y' 'N' 'X' ' '}
695 // set ws-error-code = "0023"
696 // set ws-error-message = "Cust Sign Ind. should be 'Y' , 'N' or 'X'"
697 // //message "Cust Sign Ind. should be 'Y' , 'N' or 'X'"
698 // set lr-ok = false
699 // //exit(1)
700 // endif
701 // //z-dr-pricing-category
702 // if dr-pricing-category != SPACES
703 // get system-table
704 // key is 'PE' dr-pricing-category
705 // on error
706 // set ws-error-code = "0024"
707 // set ws-error-message = 'Invalid pricing category '
708 // //message 'Invalid pricing category '
709 // set lr-ok = false
710 // //exit(1)
711 // endon
712 // endif
713 // //z-dr-curr-code
714 // if dr-curr-code != SPACES
715 // // get system-iso4217-currency-codes
716 // // on index si4217cc-currency-code
717 // // key is dr-curr-code
718 // get system-table
719 // key is 'CU' dr-curr-code
720 // on error
721 // set ws-error-code = "0025"
722 // set ws-error-message = 'Invalid currency code'
723 // //message 'Invalid currency code'
724 // set lr-ok = false
725 // //exit(1)
726 // endon
727 // endif
728 // //z-dr-delivery-route-code
729 // if dr-delivery-route-code != SPACES
730 // get system-carrier
731 // key is dr-delivery-route-code
732 // on error
733 // set ws-error-code = "0026"
734 // set ws-error-message = 'Invalid carrier code '
735 // //message 'Invalid carrier code '
736 // set lr-ok = false
737 // //exit(1)
738 // endon
739 // endif
740 // //z-dr-delivery-sequence-no
741 // if dr-delivery-sequence-no != 0
742 // if dr-delivery-route-code = SPACES
743 // set ws-error-code = "0027"
744 // set ws-error-message = 'Carrier code is blank, can not set route sequence no'
745 // //message 'Carrier code is blank, can not set route sequence no'
746 // set lr-ok = false
747 // //exit(1)
748 // else
749 // get system-carrier
750 // key is dr-delivery-route-code
751 // on error
752 // else
753 // if carrier-charge-method in {'R' 'X' 'S'}
754 // get system-carrier-routes
755 // on index car-route-code carrier-code
756 // key is str(z-dr-delivery-sequence-no) dr-delivery-route-code
757 // on error
758 // set ws-error-code = "0028"
759 // set ws-error-message = 'Invalid route sequence code for this carrier'
760 // //message 'Invalid route sequence code for this carrier'
761 // set lr-ok = false
762 // //exit(1)
763 // endon
764 // endif
765 // endon
766 // endif
767 // endif
768 // //z-dr-credit-id-no
769 // if dr-credit-id-no != SPACES
770 // get system-table
771 // key is 'DE' dr-credit-id-no
772 // on error
773 // set ws-error-code = "0029"
774 // set ws-error-message = 'Invalid customer extra code'
775 // //message 'Invalid customer extra code '
776 // set lr-ok = false
777 // //exit(1)
778 // endon
779 // endif
780 // //z-dr-mail-control-code
781 // if dr-mail-control-code not in {' ' 'N' 'I' 'J' 'S' 'D' 'L' '1' '2' '3' '4' '5' '6' '7' '8' '9' 'C' 'F' 'R' 'B'}
782 // set ws-error-code = "0030"
783 // set ws-error-message = "Mailing control should be ' ' ,'N', 'I', 'J', 'S' ,'D' ,'L', '1' to '9', 'C', 'F', 'R' or 'B'"
784 // //message "Mailing control should be ' ' ,'N', 'I', 'J', 'S' ,'D' ,'L', '1' to '9', 'C', 'F', 'R' or 'B'"
785 // set lr-ok = false
786 // //exit(1)
787 // endif
788 // //z-dr-industry-sub-group
789 // if dr-industry-sub-group != SPACES
790 // get system-table
791 // key is 'CG' dr-industry-sub-group
792 // on error
793 // set ws-error-code = "0031"
794 // set ws-error-message = 'Invalid industry sub group '
795 // //message 'Invalid industry sub group '
796 // set lr-ok = false
797 // //exit(1)
798 // endon
799 // endif
800endprocedure