Skip to Content

Discount Groups

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.

captura.png (33.0 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jul 13, 2017 at 09:21 PM

    Hola Diego, no me sirve hacerlo de esta manera, porque no quiero dar (Discount %).

    I need import ( "Paid Qty" | "Free Qty" | "Max. Free Qty" | "Date From" | "Date To") and not found this.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 13, 2017 at 04:04 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • DIEGO LOTHER Leonardo José Vargas Hernández

      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

      img3.png (50.9 kB)