Professional Documents
Culture Documents
LZSD GF Fe Colombiaf02
LZSD GF Fe Colombiaf02
LZSD GF Fe Colombiaf02
***INCLUDE LZSD_GF_FE_COLOMBIAF02 .
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form GENERAL_FC
*&---------------------------------------------------------------------*
FORM general_fc.
* <IssueDate>
PERFORM fill_issue_date USING gs_vbrk-fkdat
CHANGING gs_invoice-issuedate.
* <IssueTime>
PERFORM fill_issue_time USING gs_vbrk-fkdat
gs_vbrk-erzet
CHANGING gs_invoice-issuetime.
* <InvoiceTypeCode>
* C�digo Descripci�n
* 01 Factura de Venta Nacional
* 02 Factura de Exportaci�n
* 03 Factura por Contingencia Facturador
* 04 Factura por Contingencia DIAN
* 91 Nota Cr�dito
* 92 Nota D�bito
CASE gv_conting.
WHEN abap_true. " Informar contigencia a DIAN
MOVE gc_03 TO gs_invoice-invoicetypecode.
WHEN abap_false. " Envio normal a DIAN
MOVE gc_01 TO gs_invoice-invoicetypecode.
ENDCASE.
* <CustomizationID>
MOVE gc_10 TO gs_invoice-customizationid.
* <ID>
PERFORM remove_zero CHANGING gs_ferangos-nro.
CONCATENATE gs_ferangos-prefix gs_ferangos-nro INTO gs_invoice-id.
* <DocumentCurrencyCode>
MOVE gs_vbrk-waerk TO gs_invoice-documentcurrencycode.
* <AccountDocument>
MOVE gs_vbrk-vbeln TO ls_account-id.
* <OrderReference>
* <ID>
MOVE gs_order_text-ord_ref TO ls_orderreference-id.
* <IssueDate>
* move to ls_OrderReference-IssueDate.
* </OrderReference>
* <PEDReference>
MOVE gs_order_text-doc_ref TO gs_invoice-pedreference.
* </PEDReference>
* <AAJReference>
MOVE gs_order_text-cumpl TO gs_invoice-aajreference.
* </AAJReference>
*----------------------------------------------------------------------*
MOVE: ls_account TO gs_invoice-accountdocument,
ls_orderreference TO gs_invoice-orderreference.
*----------------------------------------------------------------------*
ENDFORM. "GENERAL_FC
*&---------------------------------------------------------------------*
*& Form EMISOR_FC
*&---------------------------------------------------------------------*
FORM emisor_fc.
* <AccountingSupplierParty>
* <AdditionalAccountID>
* Persona Jur�dica = 1
* Persona Natural = 2
TRANSLATE gs_comp_address-formofaddr TO UPPER CASE.
CASE gs_comp_address-formofaddr.
WHEN gc_empres1 OR gc_empres2.
MOVE gc_1 TO ls_account-additionalaccountid.
WHEN OTHERS.
MOVE gc_2 TO ls_account-additionalaccountid.
ENDCASE.
* <Party>
MOVE gc_31 TO ls_party-partyidentification.
* <ID>
MOVE gv_paval(9) TO ls_party-id.
* <schemeID>
lv_lenght = strlen( gv_paval ).
IF lv_lenght IS NOT INITIAL.
lv_lenght = lv_lenght - 1.
ENDIF.
MOVE gv_paval+lv_lenght(1) TO ls_party-schemeid.
* <PartyName>
MOVE gs_detail-comp_name TO ls_name-name.
* <PhysicalLocation>
* <Address>
* <ID>
PERFORM cut_last_chars USING 5
gv_city_code2
CHANGING gv_city_code2.
MOVE gv_city_code2 TO ls_address-id.
* <CityName>
MOVE gs_adrc2-city1 TO ls_address-cityname.
* <PostalZone>
MOVE gs_adrc2-post_code1 TO ls_address-postalzone.
* <CountrySubentity>
SELECT SINGLE bezei FROM t005u INTO ls_address-countrysubentity
WHERE spras EQ sy-langu AND
land1 EQ gs_adrc2-country AND
bland EQ gs_adrc2-region.
* <CountrySubentity>
MOVE gs_adrc2-region TO ls_address-countrysubentitycode.
* <AddressLine>
MOVE gs_adrc2-street TO ls_addressline1-line.
APPEND ls_addressline1 TO lt_addressline1.
* <Country>
MOVE gs_adrc2-country TO ls_country-identificationcode.
* <Name>
SELECT SINGLE landx FROM t005t INTO ls_country-name
WHERE spras EQ sy-langu AND
land1 EQ gs_adrc2-country.
* <PartyTaxScheme>
* <RegistrationName>
CONCATENATE gs_adrc2-name1 gs_adrc2-name2 INTO ls_scheme-registrationname.
* <TaxLevelCode>
CASE gs_vbrk-bukrs.
WHEN gc_4002.
CONCATENATE gc_o_13 gc_sep gc_o_15 gc_sep gc_o_23 INTO ls_scheme-
taxlevelcode.
WHEN gc_4003.
MOVE gc_r99pn TO ls_scheme-taxlevelcode.
ENDCASE.
* <TaxScheme>
* <ID>
SELECT SINGLE paval FROM t001z INTO ls_taxscheme-id
WHERE bukrs EQ gs_vbrk-bukrs AND
party EQ gc_j1aftv.
IF sy-subrc NE 0.
MOVE gc_01 TO ls_taxscheme-id.
ENDIF.
* <Name>
IF ls_taxscheme-id IS NOT INITIAL.
SELECT SINGLE nombre FROM zsd_tributos INTO ls_taxscheme-name
WHERE codigo EQ ls_taxscheme-id.
IF sy-subrc NE 0.
MOVE gc_iva TO ls_taxscheme-name.
ENDIF.
ENDIF.
* <SellerContact>
* <ElectronicMail>
SELECT SINGLE smtp_addr FROM adr6 INTO ls_contact-electronicmail
WHERE addrnumber EQ gs_adrc2-addrnumber.
*----------------------------------------------------------------------*
MOVE: ls_name TO ls_party-partyname,
lt_addressline1 TO ls_address-addressline,
ls_country TO ls_address-country,
ls_address TO ls_location-address,
ls_location TO ls_party-physicallocation,
ls_taxscheme TO ls_scheme-taxscheme,
ls_scheme TO ls_party-partytaxscheme,
ls_addressline2 TO ls_contact-addressline,
ls_contact TO ls_party-sellercontact,
ls_party TO ls_account-party,
ls_account TO gs_invoice-accountingsupplierparty.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form ADQUIRIENTE_FC
*&---------------------------------------------------------------------*
FORM adquiriente_fc.
*<AccountingCustomerParty>
* <AdditionalAccountID>
CASE gs_kna1-anred.
WHEN gc_empres1 OR gc_empres2.
MOVE gc_1 TO ls_accounting-additionalaccountid.
WHEN OTHERS.
MOVE gc_2 TO ls_accounting-additionalaccountid.
ENDCASE.
* <Party>
* <PartyIdentification>
MOVE gs_tipodociden-codigo TO ls_party-partyidentification.
* <PartyName>
* <Name>
CONCATENATE gs_kna1-name1 gs_kna1-name2 INTO ls_partyname-name SEPARATED BY
space.
* </PartyName>
* <PhysicalLocation>
* <Address>
* <ID>
PERFORM cut_last_chars USING 5
gv_city_code
CHANGING gv_city_code.
MOVE gv_city_code TO ls_address-id.
* <CityName>
MOVE gs_adrc-city1 TO ls_address-cityname.
* <PostalZone>
IF gs_kna1-pstlz IS NOT INITIAL.
MOVE gs_kna1-pstlz TO ls_address-postalzone.
ELSE.
MOVE gs_adrc-post_code1 TO ls_address-postalzone.
ENDIF.
* <CountrySubentity>
MOVE gv_denom TO ls_address-countrysubentity.
* <CountrySubentityCode>
MOVE gs_adrc-region TO ls_address-countrysubentitycode.
* <AddressLine>
* <Line>
MOVE gs_kna1-stras TO ls_addressline1-line.
* </AddressLine>
* <Country>
* <IdentificationCode>
MOVE gs_kna1-land1 TO ls_country1-identificationcode.
* <Name>
MOVE gv_land TO ls_country1-name.
* </Country>
* </Address>
* </PhysicalLocation>
* <PartyTaxScheme>
* <RegistrationName>
MOVE ls_partyname-name TO ls_partytaxscheme-registrationname.
* <TaxLevelCode>
MOVE gc_o_13 TO ls_partytaxscheme-taxlevelcode.
* <TaxScheme>
* <ID>
IF gs_kna1-fityp IS NOT INITIAL.
* MOVE gs_kna1-fityp TO ls_taxscheme-id. " MOD 16/09/2021
SELECT SINGLE codigo FROM zsd_fityp_fe " MOD 16/09/2021
INTO ls_taxscheme-id " MOD 16/09/2021
WHERE fityp EQ gs_kna1-fityp. " MOD 16/09/2021
IF sy-subrc NE 0. " MOD 16/09/2021
MOVE gc_01 TO ls_taxscheme-id. " MOD 16/09/2021
ENDIF. " MOD 16/09/2021
ELSE.
MOVE gc_01 TO ls_taxscheme-id.
ENDIF.
* <Name>
IF ls_taxscheme-id IS NOT INITIAL.
ENDIF.
* </TaxScheme>
* <CorporateRegistrationScheme>
* <RegistrationAddress>
* <ID>
PERFORM cut_last_chars USING 5
gv_city_code
CHANGING gv_city_code.
MOVE gv_city_code TO ls_registrationaddress-id.
* <CityName>
MOVE gs_adrc-city1 TO ls_registrationaddress-cityname.
* <PostalZone>
IF gs_kna1-pstlz IS NOT INITIAL.
MOVE gs_kna1-pstlz TO ls_registrationaddress-postalzone.
ELSE.
MOVE gs_adrc-post_code1 TO ls_registrationaddress-postalzone.
ENDIF.
* <CountrySubentity>
MOVE gv_denom TO ls_registrationaddress-countrysubentity .
* <CountrySubentityCode>
MOVE gs_adrc-region TO ls_registrationaddress-countrysubentitycode.
* <AddressLine>
* <Line>
MOVE gs_kna1-stras TO ls_addressline2-line.
* </AddressLine>
* <Country>
* <IdentificationCode>
MOVE gs_kna1-land1 TO ls_country2-identificationcode.
* <Name>
MOVE gv_land TO ls_country2-name.
* </Country>
* </RegistrationAddress>
* </PartyTaxScheme>
* <Person>
IF ls_accounting-additionalaccountid EQ gc_2.
* <FirstName>
MOVE: gs_adrc-name1 TO ls_person-firstname,
* <LastName>
gs_adrc-name3 TO ls_person-lastname,
* <MiddleName>
gs_adrc-name2 TO ls_person-middlename.
* </Person>
ENDIF.
* <Contact>
* <Name>
MOVE: gs_kna1-name1 TO ls_contact-name,
* <Telephone>
gs_kna1-telf1 TO ls_contact-telephone,
* <Mobilephone>
gs_kna1-telf2 TO ls_contact-mobilephone.
* <ElectronicMail>
SELECT SINGLE smtp_addr FROM adr6 INTO ls_contact-electronicmail
WHERE addrnumber EQ gs_kna1-adrnr.
* </Contact>
* <ClientCode>
* <ID>
MOVE gs_kna1-kunnr TO ls_clientcode-id.
* </ClientCode>
* </Party>
*</AccountingCustomerParty>
*----------------------------------------------------------------------*
MOVE: ls_partyname TO ls_party-partyname.
APPEND ls_addressline1 TO lt_addressline1.
MOVE: lt_addressline1 TO ls_address-addressline,
ls_country1 TO ls_address-country,
ls_address TO ls_physicallocation-address,
ls_physicallocation TO ls_party-physicallocation,
ls_taxscheme TO ls_partytaxscheme-taxscheme,
ls_addressline2 TO ls_registrationaddress-addressline,
ls_country2 TO ls_registrationaddress-country,
ls_registrationaddress TO ls_partytaxscheme-registrationaddress,
ls_partytaxscheme TO ls_party-partytaxscheme,
ls_person TO ls_party-person,
ls_contact TO ls_party-contact,
ls_clientcode TO ls_party-clientcode,
ls_party TO ls_accounting-party.
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
MOVE ls_accounting TO gs_invoice-accountingcustomerparty.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form INSTRUC_PAGO_FC
*&---------------------------------------------------------------------*
FORM instruc_pago_fc.
* <PaymentMeansCode>
* Transferencia D�bito Bancaria
MOVE gc_47 TO ls_paymentmeans-paymentmeanscode.
* <PaymentDueDate>
PERFORM terms_payment USING gs_vbrk-fkdat
gs_vbrk-zterm
CHANGING ls_paymentmeans-paymentduedate.
* <PaymentID>
MOVE 'Transferencia Bancaria'(t01) TO ls_paymentmeans-paymentid. " PDF CABECERA:
MEDIO DE PAGO
* <Note>
SELECT SINGLE vtext FROM tvzbt INTO ls_paymentmeans-note
WHERE spras EQ gc_s
AND zterm EQ gs_vbrk-zterm.
* </PaymentMeans>
*----------------------------------------------------------------------*
APPEND ls_paymentmeans TO lt_paymentmeans.
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
MOVE lt_paymentmeans TO gs_invoice-paymentmeans.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form DESCUENTOS_FC
*&---------------------------------------------------------------------*
FORM descuentos_fc.
* ls_allowancecharge-id
* ls_allowancecharge-chargeindicator
* ls_allowancecharge-allowancechargereasoncode
* ls_allowancecharge-allowancechargereason
* ls_allowancecharge-multiplierfactornumeric
* ls_allowancecharge-baseamount
* ls_allowancecharge-amount
*----------------------------------------------------------------------*
APPEND ls_allowancecharge TO lt_allowancecharge.
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
MOVE lt_allowancecharge TO gs_invoice-allowancecharge.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form MONEDA_FC
*&---------------------------------------------------------------------*
FORM moneda_fc.
IF gs_vbrk-waerk NE gc_cop.
* <CalculationRate>
PERFORM exchange_rate CHANGING ls_payment-calculationrate.
* <Date>
CONCATENATE gs_vbrk-fkdat(4) gs_vbrk-fkdat+4(2) gs_vbrk-fkdat+6(2)
INTO ls_payment-date SEPARATED BY abap_undefined.
ENDIF.
*----------------------------------------------------------------------*
MOVE ls_payment TO gs_invoice-paymentexchangerate.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form IMPUESTOS_FC
*&---------------------------------------------------------------------*
FORM impuestos_fc.
* <TaxTotal>
* <TaxAmount>
MOVE gs_vbrk-mwsbk TO lv_mwsbk.
IF gs_vbrk-mwsbk < 0.
lv_mwsbk = lv_mwsbk * ( -1 ).
ENDIF.
MOVE lv_mwsbk TO ls_taxtotal-taxamount.
CONDENSE ls_taxtotal-taxamount.
* <TaxSubtotal>
* <TaxableAmount>
LOOP AT gt_komv INTO ls_komv WHERE kschl EQ gc_mwst AND
kbetr IS NOT INITIAL.
ADD ls_komv-kawrt TO lv_kawrt.
ENDLOOP.
PERFORM currency_conv_to_external USING gs_vbrk-waerk
lv_kawrt
CHANGING lv_kawrt.
IF lv_kawrt < 0.
lv_kawrt = lv_kawrt * -1.
ENDIF.
MOVE lv_kawrt TO ls_taxsubtotal-taxableamount.
CONDENSE ls_taxsubtotal-taxableamount.
* <TaxAmount>
MOVE lv_mwsbk TO ls_taxsubtotal-taxamount.
CONDENSE ls_taxsubtotal-taxamount.
* ls_taxsubtotal-baseunitmeasure
* ls_taxsubtotal-unitcode
* ls_taxsubtotal-perunitamount
* <TaxCategory>
* <Percent>
LOOP AT gt_komv INTO ls_komv WHERE kschl EQ gc_mwst AND
kbetr IS NOT INITIAL.
lv_kbetr = ls_komv-kbetr / 10.
MOVE lv_kbetr TO ls_taxcategory-percent.
CONDENSE ls_taxcategory-percent.
EXIT.
ENDLOOP.
*----------------------------------------------------------------------*
MOVE ls_taxscheme TO ls_taxcategory-taxscheme.
MOVE ls_taxcategory TO ls_taxsubtotal-taxcategory.
APPEND ls_taxsubtotal TO lt_taxsubtotal.
MOVE lt_taxsubtotal TO ls_taxtotal-taxsubtotal.
APPEND ls_taxtotal TO lt_taxtotal.
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
MOVE lt_taxtotal TO gs_invoice-taxtotal.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form TOTALES_FC
*&---------------------------------------------------------------------*
FORM totales_fc.
* <LegalMonetaryTotal>
MOVE lv_subtotal TO ls_total-lineextensionamount.
CONDENSE ls_total-lineextensionamount.
* <TaxExclusiveAmount>
MOVE lv_impuestos TO ls_total-taxexclusiveamount.
CONDENSE ls_total-taxexclusiveamount.
* <TaxExclusiveBaseAmount>
MOVE lv_subtotal TO ls_total-taxexclusivebaseamount.
CONDENSE ls_total-taxexclusivebaseamount.
* <TaxInclusiveAmount>
MOVE lv_total TO ls_total-taxinclusiveamount.
CONDENSE ls_total-taxinclusiveamount.
* ls_total-allowancetotalamount.
* ls_total-allowancelineamount.
* ls_total-chargetotalamount.
* ls_total-prepaidamount.
* <PayableAmount>
MOVE lv_total TO ls_total-payableamount.
CONDENSE ls_total-payableamount.
* <PayableExpectedAmount>
MOVE lv_total TO ls_total-payableexpectedamount.
CONDENSE ls_total-payableexpectedamount.
* ls_total-taxbaseexemptamount.
* ls_total-taxbaseexcludedamount.
* ls_total-roundingamount.
* <TextAmount>
PERFORM currency_conv_to_internal USING gs_vbrk-waerk
lv_total
CHANGING lv_total_int.
PERFORM spell_amount USING lv_total_int
gs_vbrk-waerk
CHANGING ls_total-textamount.
* ls_total-quantitycountnumeric.
* ls_total-packquantitynumeric.
* ls_total-linecountnumeric.
*----------------------------------------------------------------------*
MOVE ls_total TO gs_invoice-legalmonetarytotal.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form DETALLES_FC
*&---------------------------------------------------------------------*
FORM detalles_fc.
* <InvoiceLine>
LOOP AT gt_vbrp INTO ls_vbrp.
* <ID>
ADD 1 TO lv_posnr.
MOVE lv_posnr TO ls_invoiceline-id.
* <StandardItemIdentification>
CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'
EXPORTING
input = ls_vbrp-matnr
IMPORTING
output = ls_item_stid-id
EXCEPTIONS
length_error = 1
OTHERS = 2.
MOVE gc_999 TO ls_item_stid-schemeid.
APPEND ls_item_stid TO lt_item_stid.
* </StandardItemIdentification>
* <SellersItemIdentification>
* </SellersItemIdentification>
*<InvoicedQuantity>
MOVE: ls_vbrp-fkimg TO lv_fkimg,
lv_fkimg TO ls_invoiceline-invoicedquantity.
CONDENSE ls_invoiceline-invoicedquantity.
*<UnitCode>
IF ls_vbrp-vrkme EQ gc_un.
MOVE gc_nar TO ls_invoiceline-unitcode.
ENDIF.
* <LineExtensionAmount>
MOVE ls_vbrp-netwr TO lv_lineextensionamount.
IF lv_lineextensionamount EQ 0.
* Valor neto sin informar en la factura & posici�n &
SHIFT ls_vbrp-posnr LEFT DELETING LEADING '0'.
MESSAGE e011(zfe_col) WITH ls_vbrp-vbeln ls_vbrp-posnr.
ELSEIF lv_lineextensionamount LT 0.
lv_lineextensionamount = lv_lineextensionamount * ( -1 ).
ENDIF.
MOVE lv_lineextensionamount TO ls_invoiceline-lineextensionamount.
CONDENSE ls_invoiceline-lineextensionamount.
* <NetLineExtensionAmount>
MOVE ls_vbrp-netwr TO lv_netwr.
IF lv_netwr < 0.
lv_netwr = lv_netwr * ( -1 ).
ENDIF.
MOVE: lv_netwr TO lv_netlineextensionamount,
lv_netlineextensionamount TO ls_invoiceline-netlineextensionamount.
* <Price>
* <PriceAmount>
lv_price_amount = lv_netwr / lv_fkimg.
MOVE lv_price_amount TO ls_price-priceamount.
CONDENSE ls_price-priceamount.
* <BaseQuantity>
MOVE: ls_vbrp-fkimg TO lv_basequantity,
lv_basequantity TO ls_price-basequantity.
CONDENSE ls_price-basequantity.
* <NetPriceAmount>
* MOVE ? TO ls_price-netpriceamount.
* CONDENSE ls_price-netpriceamount.
* </Price>
* <PricingReference>
* <PriceAmount>
* MOVE TO ls_pricingreference-priceAmount.
* <PriceTypeCode>
MOVE gc_01 TO ls_pricingreference-pricetypecode.
* </PricingReference>
* <Item>
* <Description>
MOVE ls_vbrp-arktx TO ls_item-descripcion.
* <Description> "Texto posicion
PERFORM read_text_pos USING ls_vbrp-vbeln ls_vbrp-posnr CHANGING ls_item-
descripcion2.
*ls_item-NOTE
*ls_item-PACKSIZENUMERIC
*ls_item-BRANDNAME
*ls_item-MODELNAME
* </Item>
*<TaxTotal>
* <TaxAmount>
MOVE ls_vbrp-mwsbp TO lv_mwsbp.
IF lv_mwsbp < 0.
lv_mwsbp = lv_mwsbp * ( -1 ).
ENDIF.
MOVE lv_mwsbp TO ls_taxtotal-taxamount.
CONDENSE ls_taxtotal-taxamount.
* <TaxSubtotal>
* <TaxableAmount>
MOVE lv_netwr TO ls_taxsubtotal-taxableamount.
CONDENSE ls_taxsubtotal-taxableamount.
* <TaxAmount>
MOVE lv_mwsbp TO ls_taxsubtotal-taxamount.
CONDENSE ls_taxsubtotal-taxamount.
* </TaxSubtotal>
*</TaxTotal>
* <Percent>
LOOP AT gt_komv INTO ls_komv WHERE kschl EQ gc_mwst AND
kbetr IS NOT INITIAL AND
kposn EQ ls_vbrp-posnr.
ENDLOOP.
* <Name>
SELECT SINGLE nombre FROM zsd_tributos INTO ls_taxscheme-name
WHERE codigo EQ ls_taxscheme-id.
ENDIF.
*----------------------------------------------------------------------*
MOVE: ls_taxscheme TO ls_taxcategory-taxscheme,
ls_taxcategory TO ls_taxsubtotal-taxcategory.
APPEND ls_taxsubtotal TO lt_taxsubtotal.
ENDLOOP.
*----------------------------------------------------------------------*
MOVE lt_invoiceline TO gs_invoice-invoiceline.
*----------------------------------------------------------------------*
* <Notes1>
* <Note/>
* </Notes1>
* <Notes2>
* <Note/>
MOVE gs_note_text-note2 TO ls_notes2-note.
* </Notes2>
* <Notes3>
* <Note/>
MOVE gs_note_text-note3 TO ls_notes3-note.
* </Notes3>
* <Notes4>
* <Note/>
* </Notes4>
* <Notes5>
* <Note/>
* </Notes5>
*----------------------------------------------------------------------*
MOVE: ls_notes2 TO gs_invoice-notes2,
ls_notes3 TO gs_invoice-notes3.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form ADJUNTOS_FC
*&---------------------------------------------------------------------*
FORM adjuntos_fc.
* <Adjuntos>
MOVE gv_smtp_addr TO ls_adjuntos-mailreceptor.
*----------------------------------------------------------------------*
MOVE ls_adjuntos TO gs_invoice-adjuntos.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form CONTROL_FC
*&---------------------------------------------------------------------*
FORM control_fc.
* <InvoiceControl>
MOVE gs_ferangos-resolucion TO ls_invoicecontrol-invoiceauthorization.
PERFORM remove_zero CHANGING ls_invoicecontrol-invoiceauthorization.
* <AuthorizationPeriod>
CONCATENATE gs_ferangos-begda(4)
gs_ferangos-begda+4(2)
gs_ferangos-begda+6(2)
INTO ls_period-startdate
SEPARATED BY '-'.
CONCATENATE gs_ferangos-endda(4)
gs_ferangos-endda+4(2)
gs_ferangos-endda+6(2)
INTO ls_period-enddate
SEPARATED BY '-'.
* <AuthorizedInvoices>
MOVE: gs_ferangos-prefix TO ls_invoices-prefix,
gs_ferangos-fromnumber TO ls_invoices-from,
gs_ferangos-tonumber TO ls_invoices-to,
gs_ferangos-technicalkey TO ls_invoices-technicalkey.
*------------------------------------.----------------------------------*
MOVE: ls_period TO ls_invoicecontrol-authorizationperiod,
ls_invoices TO ls_invoicecontrol-authorizedinvoices,
ls_invoicecontrol TO gs_invoice-invoicecontrol.
*----------------------------------------------------------------------*