cancel
Showing results for 
Search instead for 
Did you mean: 

Product Category exist more than once, use input help

former_member190689
Contributor
0 Kudos

Hello Gurus,

     While going through the creation of SC , we started facing the issue while choosing the Product Category for Free Text. We are currently working on SAP SRM 7.0 Ehp2 . Now as we checked with SAP and SAP has provided a KBA " Please use the help , if product category is linked with multiple backend system" . Now we do have Product Category linked with Multiple backend system. We found a note  2005091 : Product category exists more than once; use input help . It helped but only for those Product Categories which are linked to single backend system. 

So in-order to solve this , we are looking for a solution to check the Product category based on the user . I also found the FM which could read the Product Category based on user.

Moreover while going through the code change /SAPSRM/WDC_DODC_SC_I_DES with the Webdynpro , has anyone done such kind of change . Or any idea of how to proceed , so that the Product Category is picked based on user profile in Org Structure.

Thanks

Gaurav Gautam

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Gaurav,

I have resigned to expect a solution from OSS. Therefore I reworked our dirty workaround to become a stable workaround. The logic now determines the product hierarchy GUID for the purchasing application and removes all category GUID that are not part of that hierarchy (see Tx. COMM_PRAPPLCAT). Note that we are on classic scenario with only one backend. So I don't now whether my workaround would work in extended scenario and/or with multiple backends.


ENHANCEMENT ZM_CHECK_PRODUCT_CATEGORY2_F01.    "active version
* 2014-10-10 José Andujar Garcia
* Workaround SAP bug: GETLIST does not take logsys into account, so more than one category is returned
* if equally named category ids exist in more than one hierarchy.

     DATA lv_pur_hierarchy TYPE comt_used_catgrp.
     CONSTANTS lc_purchasing TYPE comt_application VALUE '02'.

     IF ev_valid = /sapsrm/if_pdo_constants_gen_c=>gc_value_nonunique AND lv_lines > 1.
       " read hierarchy GUID for purchasing application - see Tx COMM_PRAPPLCAT
       CALL FUNCTION 'COM_HIERARCHY_READ_WITH_APPL'
       EXPORTING
         iv_application     = lc_purchasing
       IMPORTING
         ev_hierarchy_guid  = lv_pur_hierarchy.

       DELETE lt_category_ids
        WHERE hierarchy_guid <> lv_pur_hierarchy.

       IF LINES( lt_category_ids ) = 1.
         READ TABLE lt_category_ids INTO lt_category_ids_tmp INDEX 1.
         ev_category_guid  = lt_category_ids_tmp-category_guid.
         ev_valid = /sapsrm/if_pdo_constants_gen_c=>gc_value_valid.
       ENDIF.
     ENDIF.
ENDENHANCEMENT.


regards

José

former_member190689
Contributor
0 Kudos

Hello José Andujar Garcia ,

Great dude !! good to hear that . Even I did the complete coding  for multiple backend system and extended classic scenario.Below is the code. thank for your help Jose and Konstantin Anikeev . With your help I was able to code this. Please have a look . Right now its working fine in my system and very soon it will be on live.

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) Class /SAPSRM/CL_PDO_CHECK_VALUES, Interface /SAPSRM/IF_PDO_CHECK_VALUES, Method CHECK_PRODUCT_CATEGORY2, End                                     A

*$*$-Start: (1)---------------------------------------------------------------------------------$*$*

ENHANCEMENT ZSRM_CHECK_PRODUCT_CATEGORY2.    "active version

*  ************************************************************************

* Enhancement log:                                                    *

DATA: lt_attr_list TYPE bbpt_attr_list.

DATA: lt_attr_data TYPE bbpt_attr.

DATA: lt_attr_single TYPE bbps_attr_single .

DATA: lv_attr_vlist TYPE TABLE OF BBPt_ATTR_VALUES .

DATA: ls_attr_list TYPE bbp_attr_list.

DATA: ls_attr_data TYPE bbps_attr.

DATA: ls_attr_single TYPE bbps_attr_single.

DATA: lm_attr_vlist LIKE LINE OF lv_attr_vlist.

DATA: ln_attr_vlist TYPE bbpt_attr_values.

DATA: ln_attr_vlist1 like line of lm_attr_vlist.

DATA: et_comp TYPE  BBPT_ATTR_VALUES.

DATA: E_PARTNER TYPE  BBP_PDS_PARTNER_GET.

DATA: E_ORGUNIT TYPE  HRHCTOBJC.

DATA: es_comp TYPE BBPS_ATTR_VALUES.

DATA: ep_comp TYPE bbps_attr_values.

DATA: user_logsys TYPE c LENGTH 10.

DATA: user_comp TYPE c LENGTH 5.

DATA: logsys TYPE c LENGTH 10.

DATA: c1 TYPE c LENGTH 7,

       c2 TYPE c LENGTH 5,

       c3 TYPE c LENGTH 5,

       c4(4) TYPE c,

       lm_lines TYPE i.

***************************************************

     CLEAR ls_attr_list.

     ls_attr_list-attr_id = 'PRCAT'.

     APPEND ls_attr_list TO lt_attr_list.

***************************************************

CALL FUNCTION 'BBP_READ_ATTRIBUTES'

  EXPORTING

*   IV_OBJECT                     =

    IV_USER                       = sy-uname

*   IV_ORGUNIT                    =

*   IV_PARTNER                    =

*   IV_APPLIC                     =

*   IV_SCENARIO                   = 'BBP'

*   IV_ATTR_SINGLE                =

    IT_ATTR_LIST                  = lt_attr_list

  IMPORTING

    ET_ATTR                       = lt_attr_data

*   ET_ATTR_DFT                   =

    EV_ATTR_DFT_SINGLE            = lt_attr_single

* EXCEPTIONS

*   OBJECT_ID_NOT_FOUND           = 1

*   NO_ATTRIBUTES_REQUESTED       = 2

*   ATTRIBUTES_READ_ERROR         = 3

*   OTHERS                        = 4

           .

CALL FUNCTION 'BBP_OM_DETERMINE_COMPANY'

  EXPORTING

    I_USER_ID                         = sy-uname

*   I_ORGUNIT_ID                      =

*   I_PARTNER                         =

*   I_PARTNER_GUID                    =

*   I_LOGSYS                          =

  IMPORTING

    E_ORGUNIT                         = e_orgunit

    E_PARTNERS                        = e_partner

    ET_COMPC                          = et_comp

* EXCEPTIONS

*   NO_COMPANY_FOUND                  = 1

*   ATTRIBUTE_COMPANY_NOT_FOUND       = 2

*   NO_PARTNER_FUNCTION_FOUND         = 3

*   NO_BUSINESS_PARTNER_FOUND         = 4

*   NO_COCODE_FOUND                   = 5

*   OBJECT_ID_NOT_FOUND               = 6

*   INTERNAL_ERROR                    = 7

*   OTHERS                            = 8

           .

IF sy-subrc = 0.

   LOOP AT et_comp INTO es_comp. " reading the logical system based on the user from Organization Structure"

       ep_comp     = es_comp.

       user_logsys = ep_comp-value_logsys.

       user_comp   = ep_comp-value.

   ENDLOOP.

ENDIF.

     LOOP AT lt_attr_data INTO ls_attr_data . " vlist structure is inside the lt_attr_data .its structure inside table

         lm_attr_vlist = ls_attr_data-vlist[] .

         APPEND lm_attr_vlist TO lv_attr_vlist.

     ENDLOOP.

*DESCRIBE TABLE lv_attr_vlist LINES lm_lines.

   LOOP AT lv_attr_vlist INTO ln_attr_vlist" Reading the vlist structure data "

        LOOP AT ln_attr_vlist INTO ln_attr_vlist1. " Reading the logical system with Product Category Range from Structure Vlist.

          c1 = ln_attr_vlist1-value+0(8).

          c4 = ln_attr_vlist1-value+10(4).

          c2 = ln_attr_vlist1-value+30(4).

                   IF c1 = user_logsys AND  ( iv_category_id = c4 OR iv_category_id = c2 ) . " Reading the range values"

                           logsys = c1.

                   ELSEIF c1 = user_logsys AND ( iv_category_id >= c4 AND iv_category_id <= c2 ).

                           logsys = c1.

                     ENDIF.

         ENDLOOP.

   ENDLOOP.

IF  ev_valid  = /sapsrm/if_pdo_constants_gen_c=>gc_value_nonunique AND lv_lines > 1.

   LOOP AT lt_category_ids INTO lt_category_ids_tmp.

     IF lt_category_ids_tmp-logsys = logsys.

*do nothing here********************

       ELSE.

         DELETE lt_category_ids. " if no product category exist with the user then category id would be deleted "

       ENDIF.

   ENDLOOP.

       DESCRIBE TABLE lt_category_ids LINES lv_lines. " if product category exist with the user with the correct logical system , lv_lines= 1"

        IF lv_lines = 1.

          READ TABLE lt_category_ids INTO lt_category_ids_tmp INDEX 1.

          ev_category_guid  = lt_category_ids_tmp-category_guid.

          ev_valid = /sapsrm/if_pdo_constants_gen_c=>gc_value_valid.

        ENDIF.

ENDIF.

ENDENHANCEMENT.

*$*$-End:   (1)---------------------------------------------------------------------------------$*$*

   ENDMETHOD.


Thanks

Gaurav Gautam

former_member379156
Discoverer
0 Kudos

Hi

I had this same problem and found note 1890951 which explains that you need to use the search help for product category.  This makes you pick a logical system which then makes the same value returned from multiple backends unique.

Once I did this, I no longer received the error.  We are on SRM 7.13 (SRM 7 EHP3 SP08) if that helps.

Edit - I just re-read original post and realized that you were indeed following this note's instructions.  Just wanted to let you know that we definitely have 3 backends hooked up with the same Product Category values and using the search help works for us in EHP3 (SP08).

Cheers,

Scott

Message was edited by: Scott Harvey

former_member190689
Contributor
0 Kudos

Hi Scott Harvey,

The code which I wrote above was for multiple backend systems. But now sap has come up with the note with the above solution as well so you can refer to that or the above code .

http://service.sap.com/sap/support/notes/2124745.


Cheers

Gautam

Answers (4)

Answers (4)

Former Member
0 Kudos

UPDATE:

SAP found a solution finally. Note http://service.sap.com/sap/support/notes/2124745 solves the issue. With that I was able to remove the workaround.

best regards

José

Former Member
0 Kudos

Update:

SAP has reverted back the changes done for the sap note 2124745 and the latest SAP note on the issue is  2234368.  


2234368

https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/sno/ui_entry/entry.htm?param=69765F6D6F6465...

Regards,

Vishal Bansal

Former Member
0 Kudos

Here is a quick & dirty approach I have programmed on our dev system to proceed with our SAP SLC implementation.

ENHANCEMENT ZM_CHECK_PRODUCT_CATEGORY2_F01.    "active version
* 2014-10-10 José Andujar Garcia
* Workaround SAP bug: GETLIST does not take logsys into account, so more than one category is returned
* if equally named category ids exist in more than one hierarchy.
* see http://scn.sap.com/message/15428875 and OSS incident 943846
     CHECK sy-uname CP 'KS*'. "prevents OSS employee to run through this workaround. Keep analyzing, pal.
     IF ev_valid = /sapsrm/if_pdo_constants_gen_c=>gc_value_nonunique AND lv_lines > 1.
       "Here misses the determination of the user's log_sys. For the moment we use a literal.
       DELETE lt_category_ids WHERE logsys <> 'your_log_sys'.
       IF LINES( lt_category_ids ) = 1.
         READ TABLE lt_category_ids INTO lt_category_ids_tmp INDEX 1.
         ev_category_guid  = lt_category_ids_tmp-category_guid.
         ev_valid = /sapsrm/if_pdo_constants_gen_c=>gc_value_valid.
       ENDIF.
     ENDIF.
ENDENHANCEMENT.


I know this is no schoolbook-like solution, but at last we can continue with our tests.


regards

José

former_member190689
Contributor
0 Kudos

Hello José Andujar Garcia ,

     Did you able to figure it out??

BR

Gaurav Gautam

Former Member
0 Kudos

OSS is still working on it. Their first response was:

What you are facing is the standard behaviour. If the same product

category id is maintained in COMM_CATEGORY table for multiple Logical

systems than the error will be displayed in any case.

It has been reported many times by developer that they won't make a

check for logical system, the user has to select manually the proper

value.

This is what written in SAP note 1890951 - Error: Product category

exists more than once; use input help.

The circumstances you have described relate to a consulting issue

rather than giving evidence of a possible error and/or bug with

standard delivered SAP products and/or documentation.

Well, I insisted that this IS a program error as the user does select a logical system. So I asked them to go into this matter. I'm still waiting for a response.

kind regards

José

former_member190689
Contributor
0 Kudos

Hello José Andujar Garcia,

Please do let me know the reply from SAP. I am still finding difficulties while doing the enhancement.Its asking me for access key and the Spot in above the code and I can't change the standard code. Let me know how you made the enhancement.

Thanks

Gaurav Gautam

former_member190689
Contributor
0 Kudos

Hello Former Member,

     I have completed the dummy code and its working for me as well. But I am not sure how to read the product category based on user name. Do you have an Idea. Konstantin Anikeev , can you please provide some help in this.

Below is my code :-

ENHANCEMENT ZSRM_CHECK_PRODUCT_CATEGORY2.    "active version

DATA uname TYPE  sy-uname .

uname = sy-uname.

***************************************

IF  ev_valid  = /sapsrm/if_pdo_constants_gen_c=>gc_value_nonunique and lv_lines > 1.

   LOOP AT lt_category_ids INTO lt_category_ids_tmp.

   IF lt_category_ids_tmp-logsys = 'CT5_900'.

*do nothing here********************

ELSE.

    DELETE lt_category_ids.

   ENDIF.

   ENDLOOP.

         DESCRIBE TABLE lt_category_ids LINES lv_lines.

        IF lv_lines = 1.

          READ TABLE lt_category_ids INTO lt_category_ids_tmp INDEX 1.

          ev_category_guid  = lt_category_ids_tmp-category_guid.

          ev_valid = /sapsrm/if_pdo_constants_gen_c=>gc_value_valid.

        ENDIF.

ENDIF.

ENDENHANCEMENT.


As  you suggested to do the enhancement in the method . I did the same , but now I want to read the product categorys which are assigned under Extended Attributes to the user in PPOSA_BBP . How can I read that as its a structure BBPS_ATTR_PRCAT and only logsys , from prod and to prod are there. Any idea how can we achieve this.


Thanks in advance

Gaurav Gautam

konstantin_anikeev
Active Contributor
0 Kudos

Hi,

you can try the class /SAPSRM/CL_PDO_USER_CONTEXT

It has method /SAPSRM/IF_PDO_US_CONTEXT_CONS~GET_VALID_CATEGORIES

Regards

Konstantin

Former Member
0 Kudos

We are facing the same issue. Therefore I have opened an OSS ticket with the hints I got from this thread.

I found out that in /SAPSRM/IF_PDO_CHECK_VALUES~CHECK_PRODUCT_CATEGORY2 the call of FM COM_PRODUCT_CATEGORY_GETLIST does not take any LOGSYS into account which results in multiple rows returned. This leads to gc_value_nonunique.


regards

José

former_member190689
Contributor
0 Kudos

Hello José Andujar Garcia,

     Yes you are correct , even I found the same while debugging . I am checking on the enhancement part as suggested by Konstantin . We have to enhance in the FM  , under that method . But I am not able to find , how to get product category based on user from org structure.

BR

Gaurav

konstantin_anikeev
Active Contributor
0 Kudos

Hi Gaurav,

I have found the KBA 1890951 - Error: Product category exists more than once; use input help.

SAP says the ussie not to be solved.

I think these new KBA's were written by the person, who does not understand, how the system works / used. Of course in this place not all the product categories to be checked, but only assigned to the requester of the shopping cart.

But, I'm afraid you'll need an enhancement for that. For example, you can try to enhance the method

/SAPSRM/CL_CH_WD_DODM_SC_I_DSC->/SAPSRM/IF_CLL_DODM_SC_I_DESCR~ADD_DESCRIBED_ITEM_TO_TABLE

or even the method

/SAPSRM/CL_PDO_CHECK_VALUES->/SAPSRM/IF_PDO_CHECK_VALUES~CHECK_PRODUCT_CATEGORY2

Regards

Konstantin

former_member190689
Contributor
0 Kudos

Hello Konstantin Anikeev,

     Thanks Konstantin, for your support. I already decided for the enhancement , but was not sure from where to start.I will check with this method are try to figure our something. Will surely need your help .

Thanks

Gaurav Gautam

former_member190689
Contributor
0 Kudos

Hello Konstantin Anikeev,

     Would like to ask you , that if I code based on the user search , means product category which are assigned to the user in org structure will that work . Also how can I get search the product category based on user through org structure . Is there any FM/Badi , which I can use in the code .

BR

Gaurav

konstantin_anikeev
Active Contributor
0 Kudos

Hi Gaurav,

in your case it should be already a product category based on user in PPOSA

The issue is only if you enter product category manually

Regards

K

former_member190689
Contributor
0 Kudos

Hey Konstantin Anikeev,,

   Actually its not. Its searching the logical backend system  and as product category is linked with multiple backend system , the logical system goes blank and we get the error. Even though manually entered.

BR

Gaurav