Nothing Special   »   [go: up one dir, main page]

Documentación Costos de Importación PDF

Descargar como pdf o txt
Descargar como pdf o txt
Está en la página 1de 10

Desarrollo – Costeo de

Documentación del Requerimiento


importaciones
Proyecto: Signa Grain S.A. Fecha: 09/07/2017
Presentado por: Eder Esteban Ceballos - César Augusto López Astaiza

PRECONDICIONES

1 En el formulario de gestión de proyectos existe un campo para aplicar los costos de importación
cuando se tiene la información de los costos.

PROCESO

2 Al aplicar costos de importación el sistema valida que los conceptos obligatorios estén diligenciados
mediante las siguientes sentencias SQL en el Transaction Notification de SAP Business One.

---- Costos de importación ----


if @object_typeT= '234000021' and @transaction_typeT in ('U')
begin
if (SELECT U_SG_CostI
FROM OPMG
WHERE AbsEntry=@list_of_cols_val_tab_delT) = 'Y'
begin
DECLARE @PROYECTO AS VARCHAR(25)
SET @PROYECTO = (SELECT FIPROJECT FROM OPMG WHERE
AbsEntry=@list_of_cols_val_tab_delT)
IF NOT EXISTS (SELECT 1 FROM POR1 INNER JOIN OPOR P0 ON
P0.DocEntry=POR1.DocEntry
WHERE POR1.Project=@PROYECTO AND ItemCode='4001001' AND P0.CANCELED='N')
BEGIN
set @error=2341
set @error_message='Falta costo de importación: Flete internacional
Importacion'
END
IF NOT EXISTS (SELECT 1 FROM POR1 INNER JOIN OPOR P0 ON
P0.DocEntry=POR1.DocEntry
WHERE POR1.Project=@PROYECTO AND ItemCode='4001003' AND P0.CANCELED='N')
BEGIN
set @error=2343
set @error_message='Falta costo de importación: Gastos portuarios
importaciones'
END
IF NOT EXISTS (SELECT 1 FROM POR1 INNER JOIN OPOR P0 ON
P0.DocEntry=POR1.DocEntry

Consultores SAP BO Página 1 of 10 Documentación Costos de


importación.docx
Desarrollo – Costeo de
Documentación del Requerimiento
importaciones
Proyecto: Signa Grain S.A. Fecha: 09/07/2017
Presentado por: Eder Esteban Ceballos - César Augusto López Astaiza

WHERE POR1.Project=@PROYECTO AND ItemCode='4001004' AND P0.CANCELED='N')


BEGIN
set @error=2344
set @error_message='Falta costo de importación: Agenciamiento aduanero
importaciones'
END
IF NOT EXISTS (SELECT 1 FROM POR1 INNER JOIN OPOR P0 ON
P0.DocEntry=POR1.DocEntry
WHERE POR1.Project=@PROYECTO AND ItemCode='4001005' AND P0.CANCELED='N')
BEGIN
set @error=2345
set @error_message='Falta costo de importación: Fletes terrestre
Importaciones'
END
IF NOT EXISTS (SELECT 1 FROM PCH1 INNER JOIN OPCH ON
OPCH.DocEntry=PCH1.DocEntry
INNER JOIN OITM ON PCH1.ItemCode=OITM.ItemCode WHERE ISNULL(PCH1.Project,
OPCH.Project)=@PROYECTO AND OITM.InvntItem = 'Y')
BEGIN
set @error=23410
set @error_message='Falta entrada de materia prima'
END
end
end
-------------------------------

3 Una vez se cumplen las condiciones satisfactoriamente, el sistema crea un evento en el visor de
eventos de Windows con el fin de iniciar una tarea para ejecutar a través de Data transfer workbench
la creación de los costos de importación a aplicar.

Para Prosigna:

if @object_type= '234000021' and @transaction_type in ('U')


begin
if (SELECT U_SG_CostI
FROM OPMG
WHERE AbsEntry=@list_of_cols_val_tab_del) = 'Y'
begin
EXEC xp_cmdshell 'eventcreate /T INFORMATION /ID 14 /D "Crear precios de
entrega Prosigna"', NO_OUTPUT
end
end

Consultores SAP BO Página 2 of 10 Documentación Costos de


importación.docx
Desarrollo – Costeo de
Documentación del Requerimiento
importaciones
Proyecto: Signa Grain S.A. Fecha: 09/07/2017
Presentado por: Eder Esteban Ceballos - César Augusto López Astaiza

Para Signa:

if @object_type= '234000021' and @transaction_type in ('U')


begin
if (SELECT U_SG_CostI
FROM OPMG
WHERE AbsEntry=@list_of_cols_val_tab_del) = 'Y'
begin
EXEC xp_cmdshell 'eventcreate /T INFORMATION /ID 13 /D "Crear precios de
entrega Signa"', NO_OUTPUT
end
end

4 Para calcular los datos a ingresar en los costos de importación se utilizan las siguientes 3 vistas.

Cabecera del documento de precios de entrega:

VOIPF
SELECT T1.DocEntry AS ParentKey, T1.LineNum AS LineNumber, 'asPurchaseInvoice' AS
BaseDocumentType, T1.DocEntry AS BaseEntry, T1.LineNum AS BaseLine, T1.ItemCode AS
Number, REPLACE(T1.Quantity, ',', '.')
AS Quantity, REPLACE(T1.Quantity /
(SELECT SUM(T1.Quantity) AS Expr1
FROM dbo.PCH1 AS T1 INNER JOIN
dbo.OPCH AS T10 ON T10.DocEntry = T1.DocEntry INNER
JOIN
dbo.OITM AS T2 ON T2.ItemCode = T1.ItemCode AND
T2.InvntItem = 'Y'
WHERE (T10.CANCELED = 'N') AND (T1.DocEntry NOT IN
(SELECT DISTINCT BaseEntry
FROM dbo.RPC1
WHERE (BaseCard = T1.BaseCard))) AND
(T1.DocEntry NOT IN
(SELECT BaseEntry
FROM dbo.IPF1)) AND (ISNULL(T1.Project,
T10.Project) IN
(SELECT FIPROJECT
FROM dbo.OPMG
WHERE (U_SG_CostI = 'Y')))) * ISNULL
((SELECT SUM(ISNULL(P2.LineTotal, P1.LineTotal)) AS Expr1
FROM dbo.POR1 AS P1 INNER JOIN
dbo.OPOR AS P0 ON P0.DocEntry = P1.DocEntry LEFT
OUTER JOIN
dbo.PCH1 AS P2 ON P2.BaseEntry = P1.DocEntry AND
P2.BaseLine = P1.LineNum AND P2.DocEntry NOT IN
(SELECT DISTINCT BaseEntry
Consultores SAP BO Página 3 of 10 Documentación Costos de
importación.docx
Desarrollo – Costeo de
Documentación del Requerimiento
importaciones
Proyecto: Signa Grain S.A. Fecha: 09/07/2017
Presentado por: Eder Esteban Ceballos - César Augusto López Astaiza

FROM dbo.RPC1
WHERE (BaseType = 18))
WHERE (P1.ItemCode LIKE '4%') AND (P1.Project = ISNULL(T1.Project,
T10.Project)) AND (P0.CANCELED = 'N')), 0), ',', '.') AS AllocatedCostsLineTotal
FROM dbo.PCH1 AS T1 INNER JOIN
dbo.OPCH AS T10 ON T10.DocEntry = T1.DocEntry INNER JOIN
dbo.OITM AS T2 ON T2.ItemCode = T1.ItemCode AND T2.InvntItem = 'Y'
WHERE (T10.CANCELED = 'N') AND (T1.DocEntry NOT IN
(SELECT DISTINCT BaseEntry
FROM dbo.RPC1 AS RPC1_1
WHERE (BaseCard = T1.BaseCard))) AND (T1.DocEntry NOT IN
(SELECT BaseEntry
FROM dbo.IPF1 AS IPF1_1)) AND (ISNULL(T1.Project, T10.Project)
IN
(SELECT FIPROJECT
FROM dbo.OPMG AS OPMG_1
WHERE (U_SG_CostI = 'Y')))

Líneas de costo del documento de precios de entrega:

VOIPFD
SELECT DISTINCT T1.DocEntry AS ParentKey, T3.AlcCode AS LandedCostCode,
REPLACE(ISNULL
((SELECT SUM(ISNULL(P2.LineTotal, P1.LineTotal)) AS Expr1
FROM dbo.POR1 AS P1 INNER JOIN
dbo.OPOR AS P0 ON P0.DocEntry = P1.DocEntry LEFT
OUTER JOIN
dbo.PCH1 AS P2 ON P2.BaseEntry = P1.DocEntry AND
P2.BaseLine = P1.LineNum AND P2.DocEntry NOT IN
(SELECT DISTINCT BaseEntry
FROM dbo.RPC1
WHERE (BaseType = 18))
WHERE (P1.ItemCode = T3.U_COSTO_IMPORT) AND (P1.Project =
ISNULL(T1.Project, T10.Project)) AND (P0.CANCELED = 'N')), 0), ',', '.') AS Amount, 'tNO' AS
IncludeForCustoms
FROM dbo.PCH1 AS T1 INNER JOIN
dbo.OPCH AS T10 ON T10.DocEntry = T1.DocEntry INNER JOIN
dbo.OITM AS T2 ON T2.ItemCode = T1.ItemCode AND T2.InvntItem = 'Y' CROSS
JOIN
dbo.OALC AS T3
WHERE (T10.CANCELED = 'N') AND (T1.DocEntry NOT IN
(SELECT DISTINCT BaseEntry
FROM dbo.RPC1
WHERE (BaseCard = T1.BaseCard))) AND (T1.DocEntry NOT IN
(SELECT BaseEntry
FROM dbo.IPF1)) AND (ISNULL(T1.Project, T10.Project) IN
(SELECT FIPROJECT

Consultores SAP BO Página 4 of 10 Documentación Costos de


importación.docx
Desarrollo – Costeo de
Documentación del Requerimiento
importaciones
Proyecto: Signa Grain S.A. Fecha: 09/07/2017
Presentado por: Eder Esteban Ceballos - César Augusto López Astaiza

FROM dbo.OPMG
WHERE (U_SG_CostI = 'Y')))

Líneas de articulos del documento de precios de entrega:

VOIPFM
SELECT DISTINCT T1.DocEntry AS LandedCostNumber, T1.BaseCard AS VendorCode, 'COP'
AS DocumentCurrency
FROM dbo.PCH1 AS T1 INNER JOIN
dbo.OPCH AS T10 ON T10.DocEntry = T1.DocEntry INNER JOIN
dbo.OITM AS T2 ON T2.ItemCode = T1.ItemCode AND T2.InvntItem = 'Y'
WHERE (T10.CANCELED = 'N') AND (T1.DocEntry NOT IN
(SELECT DISTINCT BaseEntry
FROM dbo.RPC1
WHERE (BaseCard = T1.BaseCard))) AND (T1.DocEntry NOT IN
(SELECT BaseEntry
FROM dbo.IPF1)) AND (ISNULL(T1.Project, T10.Project) IN
(SELECT FIPROJECT
FROM dbo.OPMG
WHERE (U_SG_CostI = 'Y')))

5 Para ingresar los costos de importación se utilizan los siguientes archivos que contienen la
información que usa data transfer workbench para cargar los datos en SAP Business One.

Para Prosigna:

CI1.XML
<Transfer>
<Logon>
<UserName>manager</UserName>
<Password>CKrECJcIhMjKlL</Password>
<Company>PROSIGNA</Company>
<Server>SAPBO-SERVER\SIGNA</Server>
<UserAuthentication>False</UserAuthentication>
<Language />
<LicenseServer>
</LicenseServer>
<ChooseDB>True</ChooseDB>
<DBType>7</DBType>
<DBUser>sa</DBUser>
<SybasePort />
<DBPassword>RLrLfLqKpJ9KpNhJaJvLdLfDpC</DBPassword>
</Logon>
<ObjectCode>LandedCostsService</ObjectCode>
<FileExtractor>

Consultores SAP BO Página 5 of 10 Documentación Costos de


importación.docx
Desarrollo – Costeo de
Documentación del Requerimiento
importaciones
Proyecto: Signa Grain S.A. Fecha: 09/07/2017
Presentado por: Eder Esteban Ceballos - César Augusto López Astaiza

<Extorlogin>
<ExID>sa</ExID>
<ExPW>LNpJdJsMqK8LpNiK8LoMeIeCoD</ExPW>
<ExDSN>EDIPROSIGNA</ExDSN>
</Extorlogin>
<FilesTypes>3</FilesTypes>
<Files>
<LandedCost>SELECT [LandedCostNumber],[VendorCode],[DocumentCurrency] FROM
[VOIPFM]</LandedCost>
<LandedCost_ItemLines>SELECT
[ParentKey],[LineNumber],[BaseDocumentType],[BaseEntry],[Number],[Quantity],[AllocatedCost
sLineTotal],[BaseLine] FROM [VOIPF]</LandedCost_ItemLines>
<LandedCost_CostLines>SELECT
[ParentKey],[LandedCostCode],[Amount],[IncludeForCustoms] FROM
[VOIPFD]</LandedCost_CostLines>
</Files>
</FileExtractor>
<Map>
<Fields>
<LandedCost>
<SourceFields>
<RecordKey />
<LandedCostNumber />
<VendorCode />
<DocumentCurrency />
</SourceFields>
<TargetFields>
<RecordKey>RecordKey</RecordKey>
<LandedCostNumber>LandedCostNumber</LandedCostNumber>
<VendorCode>VendorCode</VendorCode>
<DocumentCurrency>DocumentCurrency</DocumentCurrency>
</TargetFields>
</LandedCost>
<LandedCost_ItemLines>
<SourceFields>
<RecordKey />
<ParentKey />
<LineNumber />
<BaseDocumentType />
<BaseEntry />
<Number />
<Quantity />
<AllocatedCostsLineTotal />
<BaseLine />
</SourceFields>
<TargetFields>
<RecordKey>RecordKey</RecordKey>

Consultores SAP BO Página 6 of 10 Documentación Costos de


importación.docx
Desarrollo – Costeo de
Documentación del Requerimiento
importaciones
Proyecto: Signa Grain S.A. Fecha: 09/07/2017
Presentado por: Eder Esteban Ceballos - César Augusto López Astaiza

<LineNumber>LineNumber</LineNumber>
<BaseDocumentType>BaseDocumentType</BaseDocumentType>
<BaseEntry>BaseEntry</BaseEntry>
<Number>Number</Number>
<Quantity>Quantity</Quantity>
<AllocatedCostsLineTotal>AllocatedCostsLineTotal</AllocatedCostsLineTotal>
<BaseLine>BaseLine</BaseLine>
</TargetFields>
</LandedCost_ItemLines>
<LandedCost_CostLines>
<SourceFields>
<RecordKey />
<ParentKey />
<LandedCostCode />
<Amount />
<IncludeForCustoms />
</SourceFields>
<TargetFields>
<RecordKey>RecordKey</RecordKey>
<LandedCostCode>LandedCostCode</LandedCostCode>
<Amount>Amount</Amount>
<IncludeForCustoms>IncludeForCustoms</IncludeForCustoms>
</TargetFields>
</LandedCost_CostLines>
</Fields>
</Map>
<Run>
<Import>1</Import>
<Rollback>True</Rollback>
<MaxError>10</MaxError>
<Update>0</Update>
<TestRun>0</TestRun>
<AddAllItems>Checked</AddAllItems>
<LineData>0</LineData>
<DataType>2</DataType>
<MultiThread>False</MultiThread>
<ThreadNum>4</ThreadNum>
</Run>
</Transfer>

Consultores SAP BO Página 7 of 10 Documentación Costos de


importación.docx
Desarrollo – Costeo de
Documentación del Requerimiento
importaciones
Proyecto: Signa Grain S.A. Fecha: 09/07/2017
Presentado por: Eder Esteban Ceballos - César Augusto López Astaiza

Para Signa:

CI2.XML
<Transfer>
<Logon>
<UserName>manager</UserName>
<Password>CKpCHMdJmLgJiM</Password>
<Company>SIGNA</Company>
<Server>SAPBO-SERVER\SIGNA</Server>
<UserAuthentication>False</UserAuthentication>
<Language />
<LicenseServer>
</LicenseServer>
<ChooseDB>True</ChooseDB>
<DBType>7</DBType>
<DBUser>sa</DBUser>
<SybasePort />
<DBPassword>OIrLcIpJpJ8LtJjL9KvLdLfDrE</DBPassword>
</Logon>
<ObjectCode>LandedCostsService</ObjectCode>
<FileExtractor>
<Extorlogin>
<ExID>sa</ExID>
<ExPW>PJqKfLrLsMaJtJjLfMuKcKkEqF</ExPW>
<ExDSN>EDISIGNA</ExDSN>
</Extorlogin>
<FilesTypes>3</FilesTypes>
<Files>
<LandedCost>SELECT [LandedCostNumber],[VendorCode],[DocumentCurrency] FROM
[VOIPFM]</LandedCost>
<LandedCost_ItemLines>SELECT
[ParentKey],[LineNumber],[BaseDocumentType],[BaseEntry],[Number],[Quantity],[AllocatedCost
sLineTotal],[BaseLine] FROM [VOIPF]</LandedCost_ItemLines>
<LandedCost_CostLines>SELECT
[ParentKey],[LandedCostCode],[Amount],[IncludeForCustoms] FROM
[VOIPFD]</LandedCost_CostLines>
</Files>
</FileExtractor>
<Map>
<Fields>
<LandedCost>
<SourceFields>
<RecordKey />
<LandedCostNumber />
<VendorCode />
<DocumentCurrency />
</SourceFields>

Consultores SAP BO Página 8 of 10 Documentación Costos de


importación.docx
Desarrollo – Costeo de
Documentación del Requerimiento
importaciones
Proyecto: Signa Grain S.A. Fecha: 09/07/2017
Presentado por: Eder Esteban Ceballos - César Augusto López Astaiza

<TargetFields>
<RecordKey>RecordKey</RecordKey>
<LandedCostNumber>LandedCostNumber</LandedCostNumber>
<VendorCode>VendorCode</VendorCode>
<DocumentCurrency>DocumentCurrency</DocumentCurrency>
</TargetFields>
</LandedCost>
<LandedCost_ItemLines>
<SourceFields>
<RecordKey />
<ParentKey />
<LineNumber />
<BaseDocumentType />
<BaseEntry />
<Number />
<Quantity />
<AllocatedCostsLineTotal />
<BaseLine />
</SourceFields>
<TargetFields>
<RecordKey>RecordKey</RecordKey>
<LineNumber>LineNumber</LineNumber>
<BaseDocumentType>BaseDocumentType</BaseDocumentType>
<BaseEntry>BaseEntry</BaseEntry>
<Number>Number</Number>
<Quantity>Quantity</Quantity>
<AllocatedCostsLineTotal>AllocatedCostsLineTotal</AllocatedCostsLineTotal>
<BaseLine>BaseLine</BaseLine>
</TargetFields>
</LandedCost_ItemLines>
<LandedCost_CostLines>
<SourceFields>
<RecordKey />
<ParentKey />
<LandedCostCode />
<Amount />
<IncludeForCustoms />
</SourceFields>
<TargetFields>
<RecordKey>RecordKey</RecordKey>
<LandedCostCode>LandedCostCode</LandedCostCode>
<Amount>Amount</Amount>
<IncludeForCustoms>IncludeForCustoms</IncludeForCustoms>
</TargetFields>
</LandedCost_CostLines>
</Fields>
</Map>

Consultores SAP BO Página 9 of 10 Documentación Costos de


importación.docx
Desarrollo – Costeo de
Documentación del Requerimiento
importaciones
Proyecto: Signa Grain S.A. Fecha: 09/07/2017
Presentado por: Eder Esteban Ceballos - César Augusto López Astaiza

<Run>
<Import>1</Import>
<Rollback>True</Rollback>
<MaxError>10</MaxError>
<Update>0</Update>
<TestRun>0</TestRun>
<AddAllItems>Checked</AddAllItems>
<LineData>0</LineData>
<DataType>2</DataType>
<MultiThread>False</MultiThread>
<ThreadNum>4</ThreadNum>
</Run>
</Transfer>

POSCONDICIONES

Precios de entrega creado en SAP.

Resultado: Se crea un documento de precios de entrega.

Consultores SAP BO Página 10 of 10 Documentación Costos de


importación.docx

También podría gustarte