Quantcast
Channel: SCN : Discussion List - Customer Relationship Management (SAP CRM)
Viewing all articles
Browse latest Browse all 4296

Product status not getting updated for product in CRM web ui

$
0
0

Hi CRM experts,

 

I am trying to update product status as active or inactive from the prsntation server by giving an input file having two fields product id and status.

 

I am using following code to update the same:

 

Data declaration:

lr_query_prod TYPEREFTO cl_crm_bol_dquery_service,
lwa_sel_tab     
TYPE genilt_selection_parameter,
rv_result       
TYPEREFTO if_bol_bo_col,
lr_product_ent     
TYPEREFTO cl_crm_bol_entity,
lr_prodstat 
TYPEREFTO  if_bol_bo_property_access,
lr_core
TYPEREFTO cl_crm_bol_core.

 

          lr_core = cl_crm_bol_core=>get_instance( ).
          lr_core->load_component_set(
'PROD_APPL' ).

 

  lr_query_prod = cl_crm_bol_dquery_service=>get_instance( iv_query_name = 'ProdAdvSearchRgProducts' ).

 

Loop at it_file  into wa_file.           

IF lr_query_prod ISBOUND.

            lwa_sel_tab-attr_name =
'PRODUCT_ID'.
            lwa_sel_tab-
sign = 'I'.
            lwa_sel_tab-option =
'EQ'.
            lwa_sel_tab-low = wa_file-product_id.

           
CALLMETHOD lr_query_prod->add_selection_param
             
EXPORTING
                iv_attr_name = lwa_sel_tab-attr_name
                iv_sign      = lwa_sel_tab-
sign
                iv_option    = lwa_sel_tab-option
                iv_low      = lwa_sel_tab-low.

            rv_result = lr_query_prod->get_query_result( ).
           
IF rv_result ISBOUND.
              lr_product_ent ?= rv_result->get_first( ).

             
IF lr_product_ent ISBOUND.

                lr_prodstat = lr_product_ent->get_related_entity( iv_relation_name =
'ProductStat').
               
IF lr_prodstat ISNOTBOUND.
                  lr_prodstat = lr_product_ent->create_related_entity( iv_relation_name =
'ProductStat').
               
ENDIF.

               
IF lr_prodstat ISBOUND.
                 
CALLMETHOD lr_prodstat->set_property
                   
EXPORTING
                      iv_attr_name =
'STAT'
                      iv_value    = wa_file-status.

                 
CALLMETHOD lr_prodstat->set_property
                   
EXPORTING
                      iv_attr_name =
'INACT'
                      iv_value    = space.

                 
CALLMETHOD lr_prodstat->set_property
                   
EXPORTING
                      iv_attr_name =
'STSMA'
                      iv_value    =
'ZPRODUCT'.

                  lr_core->modify( ).

               
ENDIF. "IF lr_prodstat IS BOUND.
             
ENDIF. "IF lr_product_ent IS BOUND.
           
ENDIF. "IF rv_result IS BOUND.
         
ENDIF. "IF lr_query_prod IS BOUND.

ENDLOOP.

 

But this is not updating anything.

 

Please guide me what is wrong in this and what things i need to check.

 

I am new to CRM ,so any inputs/help would be higly appreciated.

 

Attaching the sample screenshot of the field in web ui.

 

product.JPG


Viewing all articles
Browse latest Browse all 4296

Trending Articles