java.lang.Object
de.hybris.platform.sap.sapordermgmtbol.transaction.salesdocument.backend.impl.erp.strategy.BaseMapper
de.hybris.platform.sap.sapordermgmtbol.transaction.salesdocument.backend.impl.erp.strategy.ItemMapper

public class ItemMapper extends BaseMapper
Class is responsible to map item (cart entry, oder entry) information between LO-API and the BOL layer. Used for reading and writing
  • Field Details

  • Constructor Details

    • ItemMapper

      public ItemMapper()
  • Method Details

    • setConverter

      public void setConverter(Converter converter)
      Parameters:
      converter -
    • setCustExit

      public void setCustExit(ERPLO_APICustomerExits custExit)
      Parameters:
      custExit -
    • setGenericFactory

      public void setGenericFactory(GenericFactory genericFactory)
      Bean constructor.

      Parameters:
      genericFactory - Factory to access SAP session beans
    • init

      public void init()
      Description copied from class: BaseMapper
      Bean initializer.

      Check if all mandatory values injected, else throw runtime error.

      Specified by:
      init in class BaseMapper
    • read

      public void read(com.sap.conn.jco.JCoTable ttItemComV, com.sap.conn.jco.JCoTable ttItemComR, com.sap.conn.jco.JCoTable ttItemVstatComV, com.sap.conn.jco.JCoTable ttItemSlineComV, com.sap.conn.jco.JCoStructure esError, TransactionConfiguration shop, ObjectInstances objInstMap, Map<String,String> itemKey, Map<String,Item> itemMap, Map<String,Map<String,String>> itemsPriceAttribMap, BackendState backendState, SalesDocument salesDocument)
      Reading item information from LO-API. The first 4 parameters are JCO tables containing item related information
      Parameters:
      ttItemComV -
      ttItemComR -
      ttItemVstatComV -
      ttItemSlineComV -
      esError - Error structure
      shop - Customizing
      objInstMap -
      itemKey - Map of item keys
      itemMap - Map of BOL items
      itemsPriceAttribMap -
      backendState -
      readParams -
      salesDocument -
    • handleTtItemComR

      protected Map<String,Item> handleTtItemComR(SalesDocument salesDoc, com.sap.conn.jco.JCoTable ttItemComR, TransactionConfiguration shop, Map<String,Item> itemMap)
      Handle data of TT_ITEM_COMR and fill item data. The HANDLE is the TechKey and is used as key in the HashMap
      Parameters:
      salesDoc -
      ttItemComR -
      shop -
      itemMap -
      Returns:
      Map of items, with their handles as key
    • mapItemComR

      protected void mapItemComR(SalesDocument salesDoc, com.sap.conn.jco.JCoTable ttItemComR, TransactionConfiguration shop, Item item)
      Maps the data for one item from the TT_ITEM_COMR table.
      Parameters:
      salesDoc -
      ttItemComR -
      shop -
      item -
    • getFieldNameForFreight

      protected String getFieldNameForFreight(SalesDocument salesDoc)
      Returns the field name for "Freight"
      Parameters:
      salesDoc - Sales document BO, contains the configuration we need to access
      Returns:
      field name for "Freight"
    • getFieldNameForNetValueWOFreight

      protected String getFieldNameForNetValueWOFreight(SalesDocument salesDoc)
      Returns the field name for "Net Value without Freight"
      Parameters:
      salesDoc - Sales document BO, contains the configuration we need to access
      Returns:
      field name for "Net Value without Freight"
    • generateSubtotalFieldName

      protected String generateSubtotalFieldName(String sourceWCB)
      Generates the subtotal field name
      Parameters:
      sourceWCB - Source for subtotal, read from configuration
      Returns:
      subtotal field name in backend interface
    • mapNullValuesToZero

      protected void mapNullValuesToZero(Item item)
      In case BE returns null for totalDiscount, item gets an initial BigDecimal
      Parameters:
      item -
    • handleTtItemSlineComV

      protected void handleTtItemSlineComV(com.sap.conn.jco.JCoTable slineComV, ObjectInstances objInstMap, Map<String,Item> itemMap)
      Fills the schedule line entries for all items and sets the requested delivery data (date and quantity) for each item. The first schedule line, which contains the entered quantity (WNENG is not zero) includes the manual entered quantity and requested delivery date of the item.
      Parameters:
      slineComV -
      objInstMap -
      itemMap - Map of BOL items where handle is key
    • handleTtItemComV

      protected void handleTtItemComV(Map<String,Item> itemMap, com.sap.conn.jco.JCoTable ttItemComV, boolean setIpcPriceAttributes, Map<String,Map<String,String>> itemsPriceAttribMap, Map<String,String> itemKey, BackendState baseR3Lrd)
      Handle data of TT_ITEM_COMV and fill item data. The HANDLE is the TechKey and is used as key in the HashMap
      Parameters:
      itemMap - Map of BOL items where handle is key
      ttItemComV -
      setIpcPriceAttributes -
      itemsPriceAttribMap -
      itemKey -
      baseR3Lrd -
    • mapItemComV

      protected void mapItemComV(Item item, com.sap.conn.jco.JCoTable ttItemComV, boolean setIpcPriceAttributes, Map<String,Map<String,String>> itemsPriceAttribMap, Map<String,String> itemKey, Map<String,Item> itemMap)
      Transfers the item data form ttItemComV to the ItemData.
      Parameters:
      item -
      ttItemComV -
      setIpcPriceAttributes -
      itemsPriceAttribMap -
      itemKey -
      itemMap - Map of BOL items where handle is key
    • handleItemUsages

      protected void handleItemUsages(com.sap.conn.jco.JCoTable ttItemComR, Map<String,Item> itemMap)
      Handles item usage information
      Parameters:
      ttItemComR -
      itemMap - Map of BOL items where handle is key
    • determineRootParentItem

      protected Item determineRootParentItem(Map<String,Item> itemMap, Item currItem)
      Determine the root item for a given BOL item
      Parameters:
      itemMap - Map of BOL items where handle is key
      currItem - BOL item we want to know the root item for
      Returns:
      Root item
    • getParentItem

      protected Item getParentItem(String handle, ObjectInstances objInstMap, Map<String,Item> itemMap)
      Returns the ItemData for a handle in the objInstMap table.
      Parameters:
      handle -
      objInstMap -
      itemMap -
      Returns:
      Item for handle
    • setDeliveryPriorityToHeader

      protected void setDeliveryPriorityToHeader(Header header, com.sap.conn.jco.JCoTable ttItemComV, Map<String,Item> itemMap)
      Sets delivery priority into the BOL header from a given item table record
      Parameters:
      header -
      ttItemComV -
      itemMap -
    • markInvalidItems

      protected void markInvalidItems(ItemList itemList, com.sap.conn.jco.JCoStructure esError)
      Parameters:
      itemList -
      esError - Error structure from LO-API RFC calls
    • determineItemPosnr

      protected int determineItemPosnr(Item item, int lastNumber)
      Determines a POSNR for items which have not been exchanged with LO-API so far. The method is called only once per item (if numberInt is initial)
      As default 10 is added to the last known number, as this corresponds to the standard SD customizing.
      Parameters:
      item - Sales document item (has not been exchanged with SD yet)
      lastNumber - number of previous item
      Returns:
      POSNR for new SD item
    • buildItemMap

      public Map<String,Item> buildItemMap(SalesDocument businessObjectInterface, ItemList itemList, Map<String,Item> itemsERPState, com.sap.conn.jco.JCoTable ttItemComV)
      Create a map with all items. The HANDLE is the TechKey and is used as key in the map
      Parameters:
      businessObjectInterface - BO we are dealing with
      itemList - list of items which we are going to create
      itemsERPState - map of buffered items which we read previously, and which haven't been touched
      ttItemComV - JCO Table reflecting the item information
      Returns:
      map of items, with handle as key
    • buildItemKeyMap

      public Map<String,String> buildItemKeyMap(com.sap.conn.jco.JCoTable ttItemKey)
      Builds a Map for the items to map the POSNR to the HANDLE.
      Parameters:
      ttItemKey -
      Returns:
      Map of items
    • write

      public void write(SalesDocument salesDoc, Set<String> itemsToBeChanged, BackendState salesDocR3Lrd, com.sap.conn.jco.JCoTable itemComV, com.sap.conn.jco.JCoTable itemComX, com.sap.conn.jco.JCoTable objInst) throws BackendConfigurationException
      Helper to fill item table before a LO-API update is done.
      Parameters:
      salesDoc - The sales document
      itemsToBeChanged -
      salesDocR3Lrd -
      itemComV - Item data (values)
      itemComX - Item data (change flag)
      objInst -
      Throws:
      BackendConfigurationException
    • handleTtItemVstatComV

      protected void handleTtItemVstatComV(com.sap.conn.jco.JCoTable ttItemVstatComV, ObjectInstances objInstMap, Map<String,Item> itemMap, Set<String> savedItemsMap)
      Handles the item status.
      Parameters:
      ttItemVstatComV -
      objInstMap -
      itemMap - Map of BOL items where handle is key
      savedItemsMap -