Skip to Content

Product Catalogs in SAP can be created / changed manually via the transactions WWM1/WWM2 and displayed through WWM3.

However there is no direct function module or BAPI available in SAP to create /change the layout of an existing product catalog.

Just to give an idea about what a product catalog looks like I am posting some screenshots of both the header information and the layout information of a catalog.

The first screenshot shows the header/basic data of a product catalog which primarily consists of the customer, sales area information, currency and variants (which again consists of id, language and currency ).

screenshot 1.png

The second screenshot dispalys the layout area which has several nodes in a hierarchical fashion and the last node in a hierarchy contains the actual material information.

screenshot 2.png

Here the two nodes refer to a particular brand and product line of that brand .The last node (product line) actually contains the material information.

screenshot 3.png

The Texts checkbox is ticked which indicates that the layout area item has texts maintains which again can be seen from the “Texts” tab (second tab to the left on the upper echelon).

screenshot 4.png

Automatic creation/change of a product catalog layout through an ABAP report involves the use of several function modules clubbed together . The ABAP report can have the customer number and the reference catalog id(whose layout needs to be changed, here it is TEST_CAT1 in the example screenshot shown above) as selection screen parameters. The process of layout creation/change is a repetitive one once you get hold of the basic principle.

There are primarily five database tables involved in the layout creation :TWGV(Layout) , TWGLV(Layout Area) , TWGLVT(Layout Description) , WLBM (Layout Area Item)  and WLMT (Texts for Layout Area Item).

In order to create a layout of an empty catalog (which only has the basic information but no layout area nodes) or to change an existing layout of a catalog (there are nodes in the layout but they need to be changed) the process that needs to be followed consists of the following simple steps:

  1. Read the catalog information (stored in database table WWMI) through a function module which will take as input the catalog id and return the entire catalog header information. We need the catalog information to determine the layout number (each catalog has a unique layout number) as all successive operations will be done on the layout having this layout number.
  2. For each database table that will be affected, create an internal table(lt_table_new) with the data that needs to be populated in the layout and also an internal table(lt_table_old) with the data which at present exists in the layout (this may be blank , incase if the layout is empty) .
  3. Check if the new entries need to be inserted/updated /deleted  in/to/from the existing layout via a function module which will then return three tables (lt_table_ins/lt_table/upd/lt_table_del) based on the action required.
  4. Save the entries in the database by calling another function module which takes as input the three internal tables created in step 2.
  5. Make the database changes reflect in the product catalog layout by calling another function module which takes as input the three internal tables and also a flag (indicator) which tells it the name of the database table whose changes it needs to pick up.

     

This principle needs to be followed for all the five database tables  that will be impacted:

  1. TWGV
  2. TWGLV
  3. TWGLVT
  4. WLBM
  5. WLMT

Now comes the list of the function modules (a simple debugging of transaction WWM2 will lead you to these)

 

The function module needed to achieve step 1 above is :  

ADV_MED_READ

Step 2 above needs the main population logic as it is used to create the internal table containing the layout data that we need to see in our layout ultimately. The old layout data can obviously be retrieved from the base by simple select statements.

The function modules needed to achieve step 3 above are as follows:

  1. TWGV_CHECK_CHANGE
  2. TWGLV_CHECK_CHANGE
  3. TWGLVT_CHECK_CHANGE
  4. WLBM_CHECK_CHANGE
  5. WLMT_CHECK_CHANGE

  The function modules needed to achieve step 4 above are as follows:  

  1. TWGV_SAVE
  2. TWGLV_ SAVE
  3. TWGLVT_ SAVE
  4. WLBM_ SAVE
  5. WLMT_ SAVE

The function module needed to achieve step 5 above is :

PRODCAT_CHANGE_DATA_PICK_UP

Following is a screenshot of code snippet showing the sequence of application of these function modules for table WLMT:

screenshot 5.png

screenshot 6.png

A similar process needs to be followed for all the other relevant database tables as well.

The PRODCAT_CHANGE_DATA_PICK_UP function module can to be used only once at the end to pick up all the data changes from all the various database tables and make them reflect in the product catalog.

These steps if followed will get you a nice looking catalog layout creation once your report is run

Attached is a sample code illustrating the process . Thanks for reading

To report this post you need to login first.

7 Comments

You must be Logged on to comment or reply to a post.

  1. Yohan Dole

    Great Post.

    Was looking for a way to create product catalog through an RFC. This helped.

    Is it possible to add discount types / Grid values for the materials we add.

    Regards,

    Yohan

    (0) 
    1. Amrita Datta Gupta Post author

      Thanks Yohan.

      You can only add values to the fields present in the WLBM table ( the fields which are editable in WWM2 transaction ). Others you cannot manipulate using this method.

      Best regards,

      Amrita.

      (0) 
  2. Sudantha Gunawardena

    Hi Amrita,

    Thanks for the helpful article , but the the process you mention “pick up all the data changes from all the various database tables and make them reflect in the product catalog.” about ‘PRODCAT_CHANGE_DATA_PICK_UP’ is misleading .

    Actually this FM seems to used to create ” Product catalog: change documents” which is something like maintaining changelog.

    Anyhow the actual database update happens at each individual FM calls.

    (0) 

Leave a Reply