on 07-13-2017 4:23 PM
Hola amigos, quiero saber como puedo montar por SDK los (grupos de descuentos por socio de negocio específico) (Discount Groups type for Specific BP), debo insertar 230 socios de negocio con los items pero no quiero hacerlo por el DTW.
Adjunto un ejemplo de lo que quiero hacer.
Muchas gracias por su colaboración.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hola Adriana,
Puede utilizar el objeto DiscountGroups. Puedes encontrar más detalles en "sdk help".
Las muestras proporcionadas en "sdk help":
Adición de descuentos basados en grupos de elementos (Visual Basic)
' Get a business partner
Dim oBP As
SAPbobsCOM.BusinessPartners
oBP =
oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners)
oBP.GetByKey("C1")
' Indicate discounts are
based on item groups, that is,
' discounts apply
to items in the specified groups.
'
' The ObjectEntry property, below,
refers to an item group
oBP.DiscountBaseObject =
SAPbobsCOM.DiscountGroupBaseObjectEnum.dgboItemGroups
' Add discounts
oBP.DiscountGroups.ObjectEntry = "100"
oBP.DiscountGroups.DiscountPercentage =
10
oBP.DiscountGroups.Add()
oBP.DiscountGroups.ObjectEntry = "101"
oBP.DiscountGroups.DiscountPercentage =
12
oBP.Update()' Get a business partner
Agregar descuentos en función de las propiedades del artículo (Visual Basic)
' Get a business partner
Dim oBP As
SAPbobsCOM.BusinessPartners
oBP =
oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners)
oBP.GetByKey("C1")
' Indicate discounts are
based on item properties, that is,
' discounts
apply to items with the specified properties.
'
' The ObjectEntry property, below,
refers to an item property
oBP.DiscountBaseObject =
SAPbobsCOM.DiscountGroupBaseObjectEnum.dgboItemProperties
' Indicate that, if an item has more than one property,
apply
' the bigger
discount
oBP.DiscountRelations =
SAPbobsCOM.DiscountGroupRelationsEnum.dgrHighestDiscount
' Add discounts
oBP.DiscountGroups.ObjectEntry = "1"
oBP.DiscountGroups.DiscountPercentage =
20
oBP.DiscountGroups.Add()
oBP.DiscountGroups.ObjectEntry = "2"
oBP.DiscountGroups.DiscountPercentage =
25
oBP.Update()
Actualizar / eliminar descuento (Visual Basic)
Dim oBP As
SAPbobsCOM.BusinessPartners
Dim oDiscountGroup
As SAPbobsCOM.DiscountGroups
oBP =
oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners)
oBP.GetByKey("C1")
oDiscountGroup =
oBP.DiscountGroups
oDiscountGroup.SetCurrentLine(0)
oDiscountGroup.Delete()
oBP.Update()
Espero que ayude
Atte,
Diego Lother
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hola Adriana,
Para el código del Item, intente establecer la propiedad DiscountBaseObject con valor DiscountGroupBaseObjectEnum.dgboItems.
Por lo tanto, proporcione su código del item en la propiedad DiscountGroups.ObjectEntry.
Amuestra:
Dim oBp As BusinessPartners = oCompany.GetBusinessObject(BoObjectTypes.oBusinessPartners)
If oBp.GetByKey("C1") Then
oBp.DiscountBaseObject = DiscountGroupBaseObjectEnum.dgboItems
oBp.DiscountGroups.ObjectEntry = "I00001"
'ItemCode
oBp.DiscountGroups.DiscountPercentage = 10
oBp.DiscountGroups.Add()
oBp.DiscountGroups.ObjectEntry = "I00002"
oBp.DiscountGroups.DiscountPercentage = 12
End If
Espero que ayude,
Atte,
Diego Lother
Hola Adriana,
You are using a wrong enum. The correct is DiscountGroupBaseObjectEnum, not DiscountGroupDiscountTypeEnum.
Mira mi muestra:
BusinessPartners oBp = oCompany.GetBusinessObject(BoObjectTypes.oBusinessPartners);
if (oBp.GetByKey("C00001"))
{
oBp.DiscountBaseObject = DiscountGroupBaseObjectEnum.dgboItems;
oBp.DiscountGroups.ObjectEntry = "A00002"; //ItemCode
oBp.DiscountGroups.DiscountPercentage = 10;
oBp.DiscountGroups.Add();
oBp.DiscountGroups.ObjectEntry = "A00003";
oBp.DiscountGroups.DiscountPercentage = 12;
if (oBp.Update() != 0)
MessageBox.Show(oCompany.GetLastErrorDescription());
}
El resultado de mi código
Espero que ayude.
Atte,
Diego Lother
User | Count |
---|---|
103 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.