Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

Purpose

This page is particularly helpful for technical consultants working for SAP-retail and want to create / assign Merchandise category Hierarchy for the characteristic as we see in transaction WRFCHVALGRP.

Even if the function module to be used for this is not yet released by SAP but as of now , i could find only this way to create Merchandise Category using Function Module.

Overview

In this page ,we are considering that data is coming through IDOC and we have to create Merchandise Categories based on IDOC data .

Retrieve Idocs

  1. First , we will retrieve the idocs from table EDIDC based on Idoc Status =64 and ( other statuses as per Business functionality)

  2. Next we read the idoc segments from table EDID4 for all the document numbers retrieved form above step1.

  3. Before generating Merchandise Category Hierarchy ,first we would have to generate new Hierarchy id and get it assigned to the new merchandise category to be created.

    1. For this first get all Hierarchy Ids from  table wrf_hier_id. 
    2. If there is no hierarchy existing on database we start with 01
    3. For all the hierarchy ids retrived ,  use FM WRF_MAP_HIER_ID_TO_NUMBER to map Id to Number
    4. SOrt Converted numeric values
    5. Increment the number by 1 =>This number will be assigned to new hierarchy id
    6. Use function module WRF_MAP_NUMBER_TO_HIER_ID to map this newly generated number to hierarchy id

  4. Once Hierarchy id generated, get next free node number from WRF_HIER_NODES

  5. Prepare Insert internal Table :

             it_hier_ins-app_id            = < Application Id eg '02'>
             it_hier_ins-hier_id           = < Hierarchy id generated above>
             it_hier_ins-root_id           1.
             it_hier_ins-next_object_id    <Next free object id from WRF_HIER_OBJ table>
             it_hier_ins-next_node_id      = <Next free node id from table  wrf_hier_nodes>
             it_hier_ins-obj_ref           = <Characteristic Reference number >
             it_hier_ins-obj_struct        = ''WRF_OBJ_CHAR_VAL'.
             it_hier_ins-node_struct       = 'WRF_MATKL_RESTRICT'.
             it_hier_ins-flg_objstr_only   = 'X'
             it_hier_ins-flg_nodestr_only  'X'.
             APPEND it_hier_ins TO i_gt_t_hier_ins.

  6. Call Function  WRF_GENERIC_HIERARCHY_POSTING
      EXPORTING
               create_change_document 'X'
             TABLES
               t_hier_ins             i_gt_t_hier_ins       
    EXCEPTIONS
               posting_error          1
               OTHERS                 2.

    IF sy-subrc <> 0.  "Insert error

             CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
    ELSE.

    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

    Endif.

 


__________________________________________________________________________________________________________

Use this structure to help you compose your contributions for WIKI and at the same time will ensure spelling and grammar.

  • No labels