-
Notifications
You must be signed in to change notification settings - Fork 0
/
Z_J1B1_COPIA_NF
1086 lines (937 loc) · 36.2 KB
/
Z_J1B1_COPIA_NF
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
*&---------------------------------------------------------------------*
*& Report Z_J1B1_COPIA_NF
*& Eberton Sobreira - 14/10/2019
*& Criar nota fiscal por referência
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
report z_j1b1_copia_nf.
tables: j_1bnfdoc, j_1bnflin.
types:
begin of ty_header,
"branch like j_1bnfdoc-branch, " Local de negócios
bukrs like j_1bnfdoc-bukrs, " Empresa
docnum like j_1bnfdoc-docnum,
nfenum like j_1bnfdoc-nfenum, "Nr NF-e
docdat like j_1bnfdoc-docdat,
observat like j_1bnfdoc-observat,
nftype like j_1bnfdoc-nftype,
parid like j_1bnfdoc-parid,
parvw like j_1bnfdoc-parvw,
inco1 like j_1bnfdoc-inco1,
inco2 like j_1bnfdoc-inco2,
anzpk like j_1bnfdoc-anzpk,
shpunt like j_1bnfdoc-shpunt,
ntgew like j_1bnfdoc-ntgew,
brgew like j_1bnfdoc-brgew,
gewei like j_1bnfdoc-gewei,
end of ty_header,
begin of ty_itens,
itmnum like j_1bdylin-itmnum,
itmtyp like j_1bdylin-itmtyp,
matnr like j_1bdylin-matnr,
werks like j_1bdylin-werks,
maktx like j_1bdylin-maktx,
matkl like j_1bdylin-matkl,
menge like j_1bdylin-menge,
meins like j_1bdylin-meins,
netpr like j_1bdylin-netpr,
netwr like j_1bdylin-netwr,
cfop like j_1bdylin-cfop,
taxlw1 like j_1bdylin-taxlw1,
taxlw2 like j_1bdylin-taxlw2,
matorg like j_1bdylin-matorg,
matuse like j_1bdylin-matuse,
nbm like j_1bdylin-nbm,
taxlw4 like j_1bdylin-taxlw4,
taxlw5 like j_1bdylin-taxlw5,
docref like j_1bdylin-docref,
itmref like j_1bdylin-itmref,
cod_cta like j_1bdylin-cod_cta,
end of ty_itens,
begin of ty_tax,
itmnum like j_1bnfstx-itmnum,
taxtyp like j_1bnfstx-taxtyp,
base like j_1bnfstx-base,
rate like j_1bnfstx-rate,
taxval like j_1bnfstx-taxval,
excbas like j_1bnfstx-excbas,
othbas like j_1bnfstx-othbas,
end of ty_tax,
begin of ty_msg,
seqnum like j_1bnfftx-seqnum,
message like j_1bnfftx-message,
end of ty_msg.
*Tabela Interna
data: ti_bdc type table of bdcdata,
ti_message type table of bdcmsgcoll,
ti_itens type table of ty_itens,
ti_tax type table of ty_tax,
ti_msg type table of ty_msg.
*Work Area
data: wa_bdc type bdcdata,
wa_params type ctu_params,
wa_message type bdcmsgcoll,
wa_header type ty_header,
wa_item type ty_itens,
wa_tax type ty_tax,
wa_msg type ty_msg.
* Variáveis
data:
wx_idxtax type i value 0,
wx_countitens type i value 0,
wx_curitem type i value 1,
wx_curtax type i value 0,
wx_observacao type j_1bnfdoc-observat,
"wx_curdate(10) type c,
wx_refdocdate(10) type c,
wx_newdate(10) type c,
wx_numnfe(9) type c," VALUE '1',
wx_ctanalit(10) type c,
wx_cfop(7) type c,
"wx_dirICMS(4) type c,
"wx_dirIPI(4) type c,
"wx_dirCOFINS(4) type c,
"wx_dirPIS(4) type c,
wx_docref type j_1bnfdoc-docnum,
wx_itmnum type j_1bdylin-itmnum,
wx_qttaxitem type i,
wx_qtmsgsori type i,
wx_netpr(16) type c,
wx_menge(16) type c,
wx_nextcode(5) type c,
wx_bundle(1) type c value 'N'. "Pacote. Sobrescreve Taxas, CFOP, etc.
data: wx_bun_taxlw1(3) type c, wx_bun_taxlw2(3) type c, wx_bun_taxlw4(3) type c, wx_bun_taxlw5(3) type c.
"Copiar de
selection-screen begin of block b1 with frame title text-t01.
parameters: p_docnum type j_1bnfdoc-docnum obligatory matchcode object j1ba.
selection-screen end of block b1.
"Para o Parceiro
selection-screen begin of block b2 with frame title text-t02.
parameters: p_parvw type j_1bdydoc-parvw,
p_parid type j_1bdydoc-parid,
p_parid1 type j_1bdydoc-parid.
selection-screen end of block b2.
"Com os parâmetros
selection-screen begin of block b3 with frame title text-t03.
parameters: p_branch type j_1bnfdoc-branch obligatory, "Local de negócios
p_nftype type j_1bnfdoc-nftype, "Categoria NF
p_docdat type j_1bnfdoc-docdat obligatory, "Data do Documento
p_nvcfop type j_1bdylin-cfop, "Novo CFOP
"P_NVICMS TYPE J_1BDYLIN-TAXLW1, "Novo Direito Fiscal ICMS
"P_NVIPI TYPE J_1BDYLIN-TAXLW2, "Novo Direito Fiscal IPI
"P_NVCOFI TYPE J_1BDYLIN-TAXLW4, "Novo Direito Fiscal COFINS
"P_NVPIS TYPE J_1BDYLIN-TAXLW5, "Novo Direito Fiscal PIS
p_ctanl type j_1bdylin-cod_cta, "Código Conta Analítica
p_observ type j_1bnfdoc-observat,
p_savref as checkbox. "Gera na observação texto ref. a nf de origem e cria referência.
selection-screen end of block b3.
"Opções pré configuradas
selection-screen begin of block b4 with frame title text-t04.
parameters: p_cfeira as checkbox. "NF de Entrada de Retorno de Feira/Exposição
"p_fmth6 as checkbox, "Indica que é pra exportar registros da Construção Civil.
selection-screen end of block b4.
*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
* P_CFEIRA - NF de Entrada de Retorno de Feira/Exposição
* Ctg.NF - I0
* 50 (Suspenso) - Direito ICMS
* 49 (Outras) - Direito IPI
* 1914/2914 - CFOP
* OBSERVAÇÃO. REF NF 000XXX DE XX.XX.XXXX
*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
initialization.
p_docdat = sy-datum.
wx_bundle = 'N'.
start-of-selection.
if p_cfeira eq 'X'.
* Obrigar a informar o CFOP.
wx_bun_taxlw1 = '50'. "ICMS
wx_bun_taxlw2 = '49'. "IPI
wx_bun_taxlw4 = 'C08'. "COFINS
wx_bun_taxlw5 = 'P08'. "PIS
p_nvcfop = '1914/AA'. "Se ocorrer erro no CFOP a J1B1N vai chiar.
p_savref = 'X'.
p_nftype = 'I0'.
wx_bundle = 'S'.
endif.
"-- Primeiro Uso desta Aplicação:
" -- Dar entrada de Notas Fiscais de Remessa de Exporição/Feira (5914/6914) como (1914)
select "branch
bukrs "Empresa
docnum
nfenum "Nr NFe
docdat "Data do Documento
observat
nftype
parid
parvw
inco1
inco2
anzpk
shpunt
ntgew
brgew
gewei
into corresponding fields of wa_header
from j_1bnfdoc
where bukrs eq 'BR30' and
docnum eq p_docnum. "Nr Docto
"doctyp eq 1. "Nota fiscal
"direct eq 2. "Saída
endselect.
if sy-subrc ne 0.
message 'Documento não encontrado.' type 'I'.
stop.
endif.
* Data de Hoje
"write SY-DATUM to wx_curdate dd/mm/yyyy.
*replace all occurrences of '.' in wx_curdate with '/'.
* Data do Novo Documento
write p_docdat to wx_newdate dd/mm/yyyy.
replace all occurrences of '/' in wx_newdate with '.'.
* Data do Documento
write wa_header-docdat to wx_refdocdate dd/mm/yyyy.
*replace all occurrences of '.' in wx_refdocdate with '/'.
* NumNFe
write wa_header-nfenum to wx_numnfe.
"wx_numnfe = '256856'.
data nfeformat(9) type n.
unpack wx_numnfe to nfeformat.
* Docto de Referência.
write wa_header-docnum to wx_docref.
* ************************
* HEADER DA NF
* ************************
data: wx_nftype(2) type c, wx_parid(10) type c, wx_parvw(2) type c.
if p_nftype is initial.
wx_nftype = wa_header-nftype.
else.
wx_nftype = p_nftype.
endif.
if p_parid is initial.
wx_parid = wa_header-parid.
else.
wx_parid = p_parid.
"Se informou parceiro tem que informar a função.
if p_parvw is initial.
message 'Se informar o Parceiro tem que informar a Função do Parceiro.' type 'I'.
stop.
endif.
endif.
if p_parvw is initial.
wx_parvw = wa_header-parvw.
else.
wx_parvw = p_parvw.
"Se informou função parceiro tem que informar parceiro.
if p_parid is initial.
message 'Se informar a Função do Parceiro, tem que informar o ID do Parceiro.' type 'I'.
stop.
endif.
endif.
* TELA INICIAL
perform f_load_bdcdata using:
'X' 'SAPMJ1B1' '0900',
' ' 'J_1BDYDOC-NFTYPE' wx_nftype, "i0, i1, i8, etc...
' ' 'J_1BDYDOC-BUKRS' wa_header-bukrs, "Empresa
' ' 'J_1BDYDOC-BRANCH' p_branch, "Local de negócios
' ' 'J_1BDYDOC-PARVW' wx_parvw,
' ' 'J_1BDYDOC-PARID' wx_parid,
' ' 'J_1BDYLIN-INCLTX' 'X'.
if p_savref eq 'X'.
"REF NF 000123456 DE 01/01/2019'
wx_observacao = 'REF NF % DE & '.
replace '%' in wx_observacao with nfeformat.
replace '&' in wx_observacao with wx_refdocdate.
perform f_load_bdcdata using:
'X' 'SAPLJ1BB2' '2000',
' ' 'J_1BDYDOC-DOCDAT' wx_newdate,
' ' 'J_1BDYDOC-OBSERVAT' wx_observacao,
' ' 'J_1BDYDOC-DOCREF' wa_header-docnum,
' ' 'BDC_OKCODE' '=ADIT'.
else.
perform f_load_bdcdata using:
'X' 'SAPLJ1BB2' '2000',
' ' 'J_1BDYDOC-DOCDAT' wx_newdate,
' ' 'J_1BDYDOC-OBSERVAT' p_observ,
' ' 'BDC_OKCODE' '=ADIT'.
endif.
* ************************
* ITENS DA NF
* ************************
* Qtde Itens NF
select count( * )
into wx_countitens
from j_1bnflin
where docnum eq p_docnum.
* Obter Itens da NF
select itmnum
itmtyp
matnr
werks
maktx
matkl
menge
meins
netpr
netwr
cfop
taxlw1
taxlw2
matorg
matuse
nbm
taxlw4
taxlw5
docref
itmref
cod_cta
into table ti_itens
from j_1bnflin
where docnum eq p_docnum.
*IF p_nvicms IS INITIAL.
* wx_diricms = wa_item-taxlw1.
*ELSE.
* wx_diricms = p_nvicms.
*ENDIF.
*
*IF p_nvipi IS INITIAL.
* wx_diripi = wa_item-taxlw2.
*ELSE.
* wx_diripi = p_nvipi.
*ENDIF.
*
*IF p_nvcofi IS INITIAL.
* wx_dircofins = wa_item-taxlw4.
*ELSE.
* wx_dircofins = p_nvcofi.
*ENDIF.
*
*IF p_nvpis IS INITIAL.
* wx_dirpis = wa_item-taxlw5.
*ELSE.
* wx_dirpis = p_nvpis.
*ENDIF.
if p_ctanl is initial.
wx_ctanalit = wa_item-cod_cta.
else.
wx_ctanalit = p_ctanl.
endif.
loop at ti_itens into wa_item.
wx_itmnum = 0.
if p_savref eq 'X'.
wx_itmnum = wa_item-itmnum.
endif.
data wx_newcfop(7) type c.
if p_nvcfop is initial.
"Se não informado, copia.
wx_cfop = wa_item-cfop.
else.
"Se informado, pega o novo.
wx_cfop = p_nvcfop.
endif.
concatenate wx_cfop(4) '/' wx_cfop+4 into wx_newcfop.
data wx_meins(3) type c.
write wa_item-meins to wx_meins.
write wa_item-netpr to wx_netpr no-zero.
write wa_item-menge to wx_menge no-zero.
if wx_bundle eq 'S'.
perform f_load_bdcdata using:
'X' 'SAPLJ1BB2' '3000',
' ' 'J_1BDYLIN-ITMTYP' wa_item-itmtyp,
' ' 'J_1BDYLIN-MATNR' wa_item-matnr,
' ' 'J_1BDYLIN-WERKS' wa_item-werks,
' ' 'J_1BDYLIN-MAKTX' wa_item-maktx,
' ' 'J_1BDYLIN-MATKL' wa_item-matkl,
' ' 'J_1BDYLIN-MENGE' wx_menge,
' ' 'J_1BDYLIN-MEINS' wx_meins,
' ' 'J_1BDYLIN-NETPR' wx_netpr,
' ' 'J_1BDYLIN-CFOP' p_nvcfop,
' ' 'J_1BDYLIN-TAXLW1' wx_bun_taxlw1, "Direitos ICMS
' ' 'J_1BDYLIN-TAXLW2' wx_bun_taxlw2, "Direitos IPI
' ' 'J_1BDYLIN-MATORG' wa_item-matorg,
' ' 'J_1BDYLIN-MATUSE' wa_item-matuse,
' ' 'J_1BDYLIN-NBM' wa_item-nbm,
' ' 'J_1BDYLIN-TAXLW4' wx_bun_taxlw4, "Direitos COFINS
' ' 'J_1BDYLIN-TAXLW5' wx_bun_taxlw5, "Direitos PIS
' ' 'J_1BDYLIN-DOCREF' wx_docref, "Nr Doc original
' ' 'J_1BDYLIN-ITMREF' wx_itmnum, "Item Doc Original
' ' 'J_1BDYLIN-COD_CTA' wx_ctanalit,
' ' 'BDC_OKCODE' '=TAX'.
else.
if p_savref eq 'X'.
perform f_load_bdcdata using:
'X' 'SAPLJ1BB2' '3000',
' ' 'J_1BDYLIN-ITMTYP' wa_item-itmtyp,
' ' 'J_1BDYLIN-MATNR' wa_item-matnr,
' ' 'J_1BDYLIN-WERKS' wa_item-werks,
' ' 'J_1BDYLIN-MAKTX' wa_item-maktx,
' ' 'J_1BDYLIN-MATKL' wa_item-matkl,
' ' 'J_1BDYLIN-MENGE' wx_menge,
' ' 'J_1BDYLIN-MEINS' wx_meins,
' ' 'J_1BDYLIN-NETPR' wx_netpr, "Preço (da j1b1 aba Item)
' ' 'J_1BDYLIN-CFOP' wx_newcfop,
' ' 'J_1BDYLIN-TAXLW1' wa_item-taxlw1, "Direitos ICMS
' ' 'J_1BDYLIN-TAXLW2' wa_item-taxlw2, "Direitos IPI
' ' 'J_1BDYLIN-MATORG' wa_item-matorg,
' ' 'J_1BDYLIN-MATUSE' wa_item-matuse,
' ' 'J_1BDYLIN-NBM' wa_item-nbm,
' ' 'J_1BDYLIN-TAXLW4' wa_item-taxlw4, "Direitos COFINS
' ' 'J_1BDYLIN-TAXLW5' wa_item-taxlw5, "Direitos PIS
' ' 'J_1BDYLIN-DOCREF' wx_docref, "Nr Doc original
' ' 'J_1BDYLIN-ITMREF' wx_itmnum, "Item Doc Original
' ' 'J_1BDYLIN-COD_CTA' wx_ctanalit,
' ' 'BDC_OKCODE' '=TAX'.
else.
perform f_load_bdcdata using:
'X' 'SAPLJ1BB2' '3000',
' ' 'J_1BDYLIN-ITMTYP' wa_item-itmtyp,
' ' 'J_1BDYLIN-MATNR' wa_item-matnr,
' ' 'J_1BDYLIN-WERKS' wa_item-werks,
' ' 'J_1BDYLIN-MAKTX' wa_item-maktx,
' ' 'J_1BDYLIN-MATKL' wa_item-matkl,
' ' 'J_1BDYLIN-MENGE' wx_menge,
' ' 'J_1BDYLIN-MEINS' wx_meins,
' ' 'J_1BDYLIN-NETPR' wx_netpr, "Preço (da j1b1 aba Item)
' ' 'J_1BDYLIN-CFOP' wx_newcfop,
' ' 'J_1BDYLIN-TAXLW1' wa_item-taxlw1, "Direitos ICMS
' ' 'J_1BDYLIN-TAXLW2' wa_item-taxlw2, "Direitos IPI
' ' 'J_1BDYLIN-MATORG' wa_item-matorg,
' ' 'J_1BDYLIN-MATUSE' wa_item-matuse,
' ' 'J_1BDYLIN-NBM' wa_item-nbm,
' ' 'J_1BDYLIN-TAXLW4' wa_item-taxlw4, "Direitos COFINS
' ' 'J_1BDYLIN-TAXLW5' wa_item-taxlw5, "Direitos PIS
' ' 'J_1BDYLIN-COD_CTA' wx_ctanalit,
' ' 'BDC_OKCODE' '=TAX'.
endif.
endif.
"Conta a qtde de impostos do item atual.
select count( * )
from j_1bnfstx
into wx_qttaxitem
where docnum eq p_docnum and
itmnum eq wa_item-itmnum.
* IF wx_qttaxitem > 4.
* "if sy-subrc ne 0.
* message 'Erro ao localizar os impostos. Condicao nao esperada' type 'W'.
* stop.
* "endif.
* ENDIF.
if wx_bundle eq 'S'.
if p_cfeira eq 'X'. "Retorno Rem. Feira/Exposição
if wx_qttaxitem > 4.
message 'Retorno Rem. Feira/Exposição requer NF de referência com 4 Taxes apenas, ICMS, IPI PIS e COFINS.' type 'W'.
stop.
endif.
endif.
endif.
"Seleciona os Impostos.
select itmnum
taxtyp
base
rate
taxval
excbas
othbas
into table ti_tax
from j_1bnfstx
where docnum eq p_docnum and
itmnum eq wa_item-itmnum.
wx_idxtax = 1.
data: taxtyp_1(20) type c, base_1(20) type c, rate_1(20) type c, taxval_1(20) type c, excbas_1(20) type c, othbas_1(20) type c.
data: taxtyp_2(20) type c, base_2(20) type c, rate_2(20) type c, taxval_2(20) type c, excbas_2(20) type c, othbas_2(20) type c.
data: taxtyp_3(20) type c, base_3(20) type c, rate_3(20) type c, taxval_3(20) type c, excbas_3(20) type c, othbas_3(20) type c.
data: taxtyp_4(20) type c, base_4(20) type c, rate_4(20) type c, taxval_4(20) type c, excbas_4(20) type c, othbas_4(20) type c.
data: taxtyp_5(20) type c, base_5(20) type c, rate_5(20) type c, taxval_5(20) type c, excbas_5(20) type c, othbas_5(20) type c.
data: taxtyp_6(20) type c, base_6(20) type c, rate_6(20) type c, taxval_6(20) type c, excbas_6(20) type c, othbas_6(20) type c.
data: taxtyp_7(20) type c, base_7(20) type c, rate_7(20) type c, taxval_7(20) type c, excbas_7(20) type c, othbas_7(20) type c.
data: taxtyp_8(20) type c, base_8(20) type c, rate_8(20) type c, taxval_8(20) type c, excbas_8(20) type c, othbas_8(20) type c.
" Loop nos Impostos para coletar.
" Está feio isso mas é o que tem pra hoje. =(
loop at ti_tax into wa_tax.
data: wx_base(15) type c, wx_rate(6) type c, wx_taxval(15) type c, wx_excbas(15) type c, wx_othbas(15) type c, wx_netwr_item(15) type c.
write wa_tax-base to wx_base no-zero.
write wa_tax-rate to wx_rate no-zero.
write wa_tax-taxval to wx_taxval no-zero.
write wa_tax-excbas to wx_excbas no-zero.
write wa_tax-othbas to wx_othbas no-zero.
write wa_item-netwr to wx_netwr_item decimals 2.
if wx_idxtax eq 1. " ICMS
taxtyp_1 = wa_tax-taxtyp.
base_1 = wx_base.
rate_1 = wx_rate.
taxval_1 = wx_taxval.
excbas_1 = wx_excbas.
othbas_1 = wx_othbas.
endif.
if wx_idxtax eq 2. " IPI
taxtyp_2 = wa_tax-taxtyp.
base_2 = wx_base.
rate_2 = wx_rate.
taxval_2 = wx_taxval.
excbas_2 = wx_excbas.
othbas_2 = wx_othbas.
endif.
if wx_idxtax eq 3. "COFINS
taxtyp_3 = wa_tax-taxtyp.
base_3 = wx_base.
rate_3 = wx_rate.
taxval_3 = wx_taxval.
excbas_3 = wx_excbas.
othbas_3 = wx_othbas.
endif.
if wx_idxtax eq 4.
taxtyp_4 = wa_tax-taxtyp. "PIS
base_4 = wx_base.
rate_4 = wx_rate.
taxval_4 = wx_taxval.
excbas_4 = wx_excbas.
othbas_4 = wx_othbas.
endif.
if wx_idxtax eq 5.
taxtyp_5 = wa_tax-taxtyp.
base_5 = wx_base.
rate_5 = wx_rate.
taxval_5 = wx_taxval.
excbas_5 = wx_excbas.
othbas_5 = wx_othbas.
endif.
if wx_idxtax eq 6.
taxtyp_6 = wa_tax-taxtyp.
base_6 = wx_base.
rate_6 = wx_rate.
taxval_6 = wx_taxval.
excbas_6 = wx_excbas.
othbas_6 = wx_othbas.
endif.
if wx_idxtax eq 7.
taxtyp_7 = wa_tax-taxtyp.
base_7 = wx_base.
rate_7 = wx_rate.
taxval_7 = wx_taxval.
excbas_7 = wx_excbas.
othbas_7 = wx_othbas.
endif.
if wx_idxtax eq 8.
taxtyp_8 = wa_tax-taxtyp.
base_8 = wx_base.
rate_8 = wx_rate.
taxval_8 = wx_taxval.
excbas_8 = wx_excbas.
othbas_8 = wx_othbas.
endif.
wx_idxtax = wx_idxtax + 1.
endloop.
"Tem que direcionar os valores determinados pelos Direitos Fiscais em seu devido campo.
"50 - ICMS OUTRAS
"49 - IPI OUTRAS
if wx_bundle eq 'S'.
if p_cfeira eq 'X'.
taxtyp_1 = 'ICM0'. "ICMS
base_1 = '0'.
rate_1 = '0'.
taxval_1 = '0'.
excbas_1 = '0'.
othbas_1 = wx_netwr_item.
"OTHBAS_1 = WA_ITEM-netpr.
taxtyp_2 = 'IPI0'. "IPI
base_2 = '0'.
rate_2 = '0'.
taxval_2 = '0'.
excbas_2 = '0'.
othbas_2 = wx_netwr_item.
"OTHBAS_2 = WA_ITEM-netpr.
taxtyp_3 = 'ZCO1'. "COFINS
base_3 = '0'.
rate_3 = '0'.
taxval_3 = '0'.
excbas_3 = wx_netwr_item.
"EXCBAS_3 = wa_item-netpr.
othbas_3 = '0'.
taxtyp_4 = 'ZPI1'. "PIS
base_4 = '0'.
rate_4 = '0'.
taxval_4 = '0'.
excbas_4 = wx_netwr_item.
"EXCBAS_4 = wa_item-netpr.
othbas_4 = '0'.
endif.
endif.
"Salva os impostos
if wx_qttaxitem eq 1.
perform f_load_bdcdata using:
'X' 'SAPLJ1BB2' '3000',
' ' 'J_1BDYSTX-TAXTYP(01)' taxtyp_1,
' ' 'J_1BDYSTX-BASE(01)' base_1,
' ' 'J_1BDYSTX-RATE(01)' rate_1,
' ' 'J_1BDYSTX-TAXVAL(01)' taxval_1,
' ' 'J_1BDYSTX-EXCBAS(01)' excbas_1,
' ' 'J_1BDYSTX-OTHBAS(01)' othbas_1,
' ' 'BDC_OKCODE' '=TAB1'.
elseif wx_qttaxitem eq 2.
perform f_load_bdcdata using:
'X' 'SAPLJ1BB2' '3000',
' ' 'J_1BDYSTX-TAXTYP(01)' taxtyp_1,
' ' 'J_1BDYSTX-BASE(01)' base_1,
' ' 'J_1BDYSTX-RATE(01)' rate_1,
' ' 'J_1BDYSTX-TAXVAL(01)' taxval_1,
' ' 'J_1BDYSTX-EXCBAS(01)' excbas_1,
' ' 'J_1BDYSTX-OTHBAS(01)' othbas_1,
' ' 'J_1BDYSTX-TAXTYP(02)' taxtyp_2,
' ' 'J_1BDYSTX-BASE(02)' base_2,
' ' 'J_1BDYSTX-RATE(02)' rate_2,
' ' 'J_1BDYSTX-TAXVAL(02)' taxval_2,
' ' 'J_1BDYSTX-EXCBAS(02)' excbas_2,
' ' 'J_1BDYSTX-OTHBAS(02)' othbas_2,
' ' 'BDC_OKCODE' '=TAB1'.
elseif wx_qttaxitem eq 3.
perform f_load_bdcdata using:
'X' 'SAPLJ1BB2' '3000',
' ' 'J_1BDYSTX-TAXTYP(01)' taxtyp_1,
' ' 'J_1BDYSTX-BASE(01)' base_1,
' ' 'J_1BDYSTX-RATE(01)' rate_1,
' ' 'J_1BDYSTX-TAXVAL(01)' taxval_1,
' ' 'J_1BDYSTX-EXCBAS(01)' excbas_1,
' ' 'J_1BDYSTX-OTHBAS(01)' othbas_1,
' ' 'J_1BDYSTX-TAXTYP(02)' taxtyp_2,
' ' 'J_1BDYSTX-BASE(02)' base_2,
' ' 'J_1BDYSTX-RATE(02)' rate_2,
' ' 'J_1BDYSTX-TAXVAL(02)' taxval_2,
' ' 'J_1BDYSTX-EXCBAS(02)' excbas_2,
' ' 'J_1BDYSTX-OTHBAS(02)' othbas_2,
' ' 'J_1BDYSTX-TAXTYP(03)' taxtyp_3,
' ' 'J_1BDYSTX-BASE(03)' base_3,
' ' 'J_1BDYSTX-RATE(03)' rate_3,
' ' 'J_1BDYSTX-TAXVAL(03)' taxval_3,
' ' 'J_1BDYSTX-EXCBAS(03)' excbas_3,
' ' 'J_1BDYSTX-OTHBAS(03)' othbas_3,
' ' 'BDC_OKCODE' '=TAB1'.
elseif wx_qttaxitem eq 4.
perform f_load_bdcdata using:
'X' 'SAPLJ1BB2' '3000',
' ' 'J_1BDYSTX-TAXTYP(01)' taxtyp_1,
' ' 'J_1BDYSTX-BASE(01)' base_1,
' ' 'J_1BDYSTX-RATE(01)' rate_1,
' ' 'J_1BDYSTX-TAXVAL(01)' taxval_1,
' ' 'J_1BDYSTX-EXCBAS(01)' excbas_1,
' ' 'J_1BDYSTX-OTHBAS(01)' othbas_1,
' ' 'J_1BDYSTX-TAXTYP(02)' taxtyp_2,
' ' 'J_1BDYSTX-BASE(02)' base_2,
' ' 'J_1BDYSTX-RATE(02)' rate_2,
' ' 'J_1BDYSTX-TAXVAL(02)' taxval_2,
' ' 'J_1BDYSTX-EXCBAS(02)' excbas_2,
' ' 'J_1BDYSTX-OTHBAS(02)' othbas_2,
' ' 'J_1BDYSTX-TAXTYP(03)' taxtyp_3,
' ' 'J_1BDYSTX-BASE(03)' base_3,
' ' 'J_1BDYSTX-RATE(03)' rate_3,
' ' 'J_1BDYSTX-TAXVAL(03)' taxval_3,
' ' 'J_1BDYSTX-EXCBAS(03)' excbas_3,
' ' 'J_1BDYSTX-OTHBAS(03)' othbas_3,
' ' 'J_1BDYSTX-TAXTYP(04)' taxtyp_4,
' ' 'J_1BDYSTX-BASE(04)' base_4,
' ' 'J_1BDYSTX-RATE(04)' rate_4,
' ' 'J_1BDYSTX-TAXVAL(04)' taxval_4,
' ' 'J_1BDYSTX-EXCBAS(04)' excbas_4,
' ' 'J_1BDYSTX-OTHBAS(04)' othbas_4,
' ' 'BDC_OKCODE' '=TAB1'.
elseif wx_qttaxitem eq 5.
perform f_load_bdcdata using:
'X' 'SAPLJ1BB2' '3000',
' ' 'J_1BDYSTX-TAXTYP(01)' taxtyp_1,
' ' 'J_1BDYSTX-BASE(01)' base_1,
' ' 'J_1BDYSTX-RATE(01)' rate_1,
' ' 'J_1BDYSTX-TAXVAL(01)' taxval_1,
' ' 'J_1BDYSTX-EXCBAS(01)' excbas_1,
' ' 'J_1BDYSTX-OTHBAS(01)' othbas_1,
' ' 'J_1BDYSTX-TAXTYP(02)' taxtyp_2,
' ' 'J_1BDYSTX-BASE(02)' base_2,
' ' 'J_1BDYSTX-RATE(02)' rate_2,
' ' 'J_1BDYSTX-TAXVAL(02)' taxval_2,
' ' 'J_1BDYSTX-EXCBAS(02)' excbas_2,
' ' 'J_1BDYSTX-OTHBAS(02)' othbas_2,
' ' 'J_1BDYSTX-TAXTYP(03)' taxtyp_3,
' ' 'J_1BDYSTX-BASE(03)' base_3,
' ' 'J_1BDYSTX-RATE(03)' rate_3,
' ' 'J_1BDYSTX-TAXVAL(03)' taxval_3,
' ' 'J_1BDYSTX-EXCBAS(03)' excbas_3,
' ' 'J_1BDYSTX-OTHBAS(03)' othbas_3,
' ' 'J_1BDYSTX-TAXTYP(04)' taxtyp_4,
' ' 'J_1BDYSTX-BASE(04)' base_4,
' ' 'J_1BDYSTX-RATE(04)' rate_4,
' ' 'J_1BDYSTX-TAXVAL(04)' taxval_4,
' ' 'J_1BDYSTX-EXCBAS(04)' excbas_4,
' ' 'J_1BDYSTX-OTHBAS(04)' othbas_4,
' ' 'J_1BDYSTX-TAXTYP(05)' taxtyp_5,
' ' 'J_1BDYSTX-BASE(05)' base_5,
' ' 'J_1BDYSTX-RATE(05)' rate_5,
' ' 'J_1BDYSTX-TAXVAL(05)' taxval_5,
' ' 'J_1BDYSTX-EXCBAS(05)' excbas_5,
' ' 'J_1BDYSTX-OTHBAS(05)' othbas_5,
' ' 'BDC_OKCODE' '=TAB1'.
elseif wx_qttaxitem eq 6.
perform f_load_bdcdata using:
'X' 'SAPLJ1BB2' '3000',
' ' 'J_1BDYSTX-TAXTYP(01)' taxtyp_1,
' ' 'J_1BDYSTX-BASE(01)' base_1,
' ' 'J_1BDYSTX-RATE(01)' rate_1,
' ' 'J_1BDYSTX-TAXVAL(01)' taxval_1,
' ' 'J_1BDYSTX-EXCBAS(01)' excbas_1,
' ' 'J_1BDYSTX-OTHBAS(01)' othbas_1,
' ' 'J_1BDYSTX-TAXTYP(02)' taxtyp_2,
' ' 'J_1BDYSTX-BASE(02)' base_2,
' ' 'J_1BDYSTX-RATE(02)' rate_2,
' ' 'J_1BDYSTX-TAXVAL(02)' taxval_2,
' ' 'J_1BDYSTX-EXCBAS(02)' excbas_2,
' ' 'J_1BDYSTX-OTHBAS(02)' othbas_2,
' ' 'J_1BDYSTX-TAXTYP(03)' taxtyp_3,
' ' 'J_1BDYSTX-BASE(03)' base_3,
' ' 'J_1BDYSTX-RATE(03)' rate_3,
' ' 'J_1BDYSTX-TAXVAL(03)' taxval_3,
' ' 'J_1BDYSTX-EXCBAS(03)' excbas_3,
' ' 'J_1BDYSTX-OTHBAS(03)' othbas_3,
' ' 'J_1BDYSTX-TAXTYP(04)' taxtyp_4,
' ' 'J_1BDYSTX-BASE(04)' base_4,
' ' 'J_1BDYSTX-RATE(04)' rate_4,
' ' 'J_1BDYSTX-TAXVAL(04)' taxval_4,
' ' 'J_1BDYSTX-EXCBAS(04)' excbas_4,
' ' 'J_1BDYSTX-OTHBAS(04)' othbas_4,
' ' 'J_1BDYSTX-TAXTYP(05)' taxtyp_5,
' ' 'J_1BDYSTX-BASE(05)' base_5,
' ' 'J_1BDYSTX-RATE(05)' rate_5,
' ' 'J_1BDYSTX-TAXVAL(05)' taxval_5,
' ' 'J_1BDYSTX-EXCBAS(05)' excbas_5,
' ' 'J_1BDYSTX-OTHBAS(05)' othbas_5,
' ' 'J_1BDYSTX-TAXTYP(06)' taxtyp_6,
' ' 'J_1BDYSTX-BASE(06)' base_6,
' ' 'J_1BDYSTX-RATE(06)' rate_6,
' ' 'J_1BDYSTX-TAXVAL(06)' taxval_6,
' ' 'J_1BDYSTX-EXCBAS(06)' excbas_6,
' ' 'J_1BDYSTX-OTHBAS(06)' othbas_6,
' ' 'BDC_OKCODE' '=TAB1'.
elseif wx_qttaxitem eq 7.
perform f_load_bdcdata using:
'X' 'SAPLJ1BB2' '3000',
' ' 'J_1BDYSTX-TAXTYP(01)' taxtyp_1,
' ' 'J_1BDYSTX-BASE(01)' base_1,
' ' 'J_1BDYSTX-RATE(01)' rate_1,
' ' 'J_1BDYSTX-TAXVAL(01)' taxval_1,
' ' 'J_1BDYSTX-EXCBAS(01)' excbas_1,
' ' 'J_1BDYSTX-OTHBAS(01)' othbas_1,
' ' 'J_1BDYSTX-TAXTYP(02)' taxtyp_2,
' ' 'J_1BDYSTX-BASE(02)' base_2,
' ' 'J_1BDYSTX-RATE(02)' rate_2,
' ' 'J_1BDYSTX-TAXVAL(02)' taxval_2,
' ' 'J_1BDYSTX-EXCBAS(02)' excbas_2,
' ' 'J_1BDYSTX-OTHBAS(02)' othbas_2,
' ' 'J_1BDYSTX-TAXTYP(03)' taxtyp_3,
' ' 'J_1BDYSTX-BASE(03)' base_3,
' ' 'J_1BDYSTX-RATE(03)' rate_3,
' ' 'J_1BDYSTX-TAXVAL(03)' taxval_3,
' ' 'J_1BDYSTX-EXCBAS(03)' excbas_3,
' ' 'J_1BDYSTX-OTHBAS(03)' othbas_3,
' ' 'J_1BDYSTX-TAXTYP(04)' taxtyp_4,
' ' 'J_1BDYSTX-BASE(04)' base_4,
' ' 'J_1BDYSTX-RATE(04)' rate_4,
' ' 'J_1BDYSTX-TAXVAL(04)' taxval_4,
' ' 'J_1BDYSTX-EXCBAS(04)' excbas_4,
' ' 'J_1BDYSTX-OTHBAS(04)' othbas_4,
' ' 'J_1BDYSTX-TAXTYP(05)' taxtyp_5,
' ' 'J_1BDYSTX-BASE(05)' base_5,
' ' 'J_1BDYSTX-RATE(05)' rate_5,
' ' 'J_1BDYSTX-TAXVAL(05)' taxval_5,
' ' 'J_1BDYSTX-EXCBAS(05)' excbas_5,
' ' 'J_1BDYSTX-OTHBAS(05)' othbas_5,
' ' 'J_1BDYSTX-TAXTYP(06)' taxtyp_6,
' ' 'J_1BDYSTX-BASE(06)' base_6,
' ' 'J_1BDYSTX-RATE(06)' rate_6,
' ' 'J_1BDYSTX-TAXVAL(06)' taxval_6,
' ' 'J_1BDYSTX-EXCBAS(06)' excbas_6,
' ' 'J_1BDYSTX-OTHBAS(06)' othbas_6,
' ' 'J_1BDYSTX-TAXTYP(07)' taxtyp_7,
' ' 'J_1BDYSTX-BASE(07)' base_7,
' ' 'J_1BDYSTX-RATE(07)' rate_7,
' ' 'J_1BDYSTX-TAXVAL(07)' taxval_7,
' ' 'J_1BDYSTX-EXCBAS(07)' excbas_7,
' ' 'J_1BDYSTX-OTHBAS(07)' othbas_7,
' ' 'BDC_OKCODE' '=TAB1'.
elseif wx_qttaxitem eq 8.
perform f_load_bdcdata using:
'X' 'SAPLJ1BB2' '3000',
' ' 'J_1BDYSTX-TAXTYP(01)' taxtyp_1,
' ' 'J_1BDYSTX-BASE(01)' base_1,
' ' 'J_1BDYSTX-RATE(01)' rate_1,
' ' 'J_1BDYSTX-TAXVAL(01)' taxval_1,
' ' 'J_1BDYSTX-EXCBAS(01)' excbas_1,
' ' 'J_1BDYSTX-OTHBAS(01)' othbas_1,
' ' 'J_1BDYSTX-TAXTYP(02)' taxtyp_2,
' ' 'J_1BDYSTX-BASE(02)' base_2,
' ' 'J_1BDYSTX-RATE(02)' rate_2,
' ' 'J_1BDYSTX-TAXVAL(02)' taxval_2,
' ' 'J_1BDYSTX-EXCBAS(02)' excbas_2,
' ' 'J_1BDYSTX-OTHBAS(02)' othbas_2,
' ' 'J_1BDYSTX-TAXTYP(03)' taxtyp_3,
' ' 'J_1BDYSTX-BASE(03)' base_3,
' ' 'J_1BDYSTX-RATE(03)' rate_3,
' ' 'J_1BDYSTX-TAXVAL(03)' taxval_3,
' ' 'J_1BDYSTX-EXCBAS(03)' excbas_3,
' ' 'J_1BDYSTX-OTHBAS(03)' othbas_3,
' ' 'J_1BDYSTX-TAXTYP(04)' taxtyp_4,
' ' 'J_1BDYSTX-BASE(04)' base_4,
' ' 'J_1BDYSTX-RATE(04)' rate_4,
' ' 'J_1BDYSTX-TAXVAL(04)' taxval_4,
' ' 'J_1BDYSTX-EXCBAS(04)' excbas_4,
' ' 'J_1BDYSTX-OTHBAS(04)' othbas_4,
' ' 'J_1BDYSTX-TAXTYP(05)' taxtyp_5,
' ' 'J_1BDYSTX-BASE(05)' base_5,
' ' 'J_1BDYSTX-RATE(05)' rate_5,
' ' 'J_1BDYSTX-TAXVAL(05)' taxval_5,
' ' 'J_1BDYSTX-EXCBAS(05)' excbas_5,
' ' 'J_1BDYSTX-OTHBAS(05)' othbas_5,
' ' 'J_1BDYSTX-TAXTYP(06)' taxtyp_6,
' ' 'J_1BDYSTX-BASE(06)' base_6,
' ' 'J_1BDYSTX-RATE(06)' rate_6,
' ' 'J_1BDYSTX-TAXVAL(06)' taxval_6,
' ' 'J_1BDYSTX-EXCBAS(06)' excbas_6,
' ' 'J_1BDYSTX-OTHBAS(06)' othbas_6,
' ' 'J_1BDYSTX-TAXTYP(07)' taxtyp_7,
' ' 'J_1BDYSTX-BASE(07)' base_7,
' ' 'J_1BDYSTX-RATE(07)' rate_7,
' ' 'J_1BDYSTX-TAXVAL(07)' taxval_7,
' ' 'J_1BDYSTX-EXCBAS(07)' excbas_7,
' ' 'J_1BDYSTX-OTHBAS(07)' othbas_7,
' ' 'J_1BDYSTX-TAXTYP(08)' taxtyp_8,
' ' 'J_1BDYSTX-BASE(08)' base_8,
' ' 'J_1BDYSTX-RATE(08)' rate_8,
' ' 'J_1BDYSTX-TAXVAL(08)' taxval_8,
' ' 'J_1BDYSTX-EXCBAS(08)' excbas_8,
' ' 'J_1BDYSTX-OTHBAS(08)' othbas_8,
' ' 'BDC_OKCODE' '=TAB1'.
endif.
"Se é o último item, tem que ir para o Tab3 de Parceiro.
if wx_curitem eq wx_countitens.
"Vai pra tela de Parceiros
perform f_load_bdcdata using:
'X' 'SAPLJ1BB2' '2000',
' ' 'BDC_OKCODE' '=TAB3'.
else.
"Adiciona novo item.
perform f_load_bdcdata using:
'X' 'SAPLJ1BB2' '2000',
' ' 'BDC_OKCODE' '=ADIT'.
endif.
wx_curitem = wx_curitem + 1.
endloop.
"Conta a qtde de msgs da nf original (com as msgs automaticas).
select count( * )
from j_1bnfftx
into wx_qtmsgsori
where docnum eq p_docnum.
"AND MANUAL EQ 'X'.
"GOTO Mensagens
wx_nextcode = '=TAB4'.
"Se não tiver mensagem vai direto para a Tela de Transporte.
if wx_qtmsgsori eq 0.
"GOTO Transporte
wx_nextcode = '=TAB5'.
endif.
* Parceiro 2300
if p_parid1 is initial.
perform f_load_bdcdata using:
'X' 'SAPLJ1BB2' '2000',
' ' 'J_1BDYNAD-PARVW(01)' p_parvw,
' ' 'J_1BDYNAD-PARID(01)' p_parid,
' ' 'BDC_OKCODE' wx_nextcode.
"' ' 'BDC_OKCODE' '=TAB4'. "Vai pra tela de Mensagens
else.
perform f_load_bdcdata using:
'X' 'SAPLJ1BB2' '2000',
' ' 'J_1BDYNAD-PARVW(01)' p_parvw,
' ' 'J_1BDYNAD-PARID(01)' p_parid,
' ' 'J_1BDYNAD-PARVW(02)' 'SP',
' ' 'J_1BDYNAD-PARID(02)' p_parid1, "Parid do Transportador
' ' 'BDC_OKCODE' wx_nextcode.
"' ' 'BDC_OKCODE' '=TAB4'. "Vai pra tela de Mensagens
endif.
* MENSAGENS
if wx_nextcode eq '=TAB4'.
data fieldmsg(20) type c.
data wx_idxmsg type n value 0.
data qtdemsgsori type i value 0.
"Não copia mensagens automáticas.
select seqnum message
into table ti_msg
from j_1bnfftx
where docnum eq p_docnum
and manual eq 'X'
order by seqnum.
"Salva msgs a partir da qtde msg da nf original.
wx_idxmsg = wx_qtmsgsori.
loop at ti_msg into wa_msg.
wx_idxmsg = wx_idxmsg + 1.
concatenate 'J_1BDYFTX-MESSAGE(' wx_idxmsg ')' into fieldmsg.