cancel
Showing results for 
Search instead for 
Did you mean: 

The method to get the basic information of the business objects that are linked to ECR from /PLMI/CL_ECR_BO~CHECK_BEFORE_SAVE

Former Member
0 Kudos

Dear Expert,

I'm going to add the customer depending additional check logic to ECR saving.

For this purpose, I try to add the program to Class Interface:/PLMI/CL_ECR_BO~CHECK_BEFORE_SAVE by enhance function.

I understood a method to output the message to WebUI at ECR saving.

But I do not understand a method to get the basic information of the business objects that are linked to ECR.

Best Regards,

Seiichiro Otsuka

Accepted Solutions (1)

Accepted Solutions (1)

abhishek_gupta2
Participant
0 Kudos

Hello Seiichiro ,

Here the some API which will come handy for you .

For adding the custom logic for ECR on saving , use the enhancement spot /PLMB/ES_SPI ,

BADI : /PLMB/EX_SPI_TRANSACTION

Hope this helps ,

Abhishek.

Former Member
0 Kudos

Dear Mr. Gupta,

Thank you for your reply.

Your screenshot is very helpful for me.

I tried program under the method /plmb/if_ex_spi_transaction~after_check_before_save.

I understand that I should call the method: /plmi/cl_ecr_bo~get_change_items_all from this program.

But I can't export ECR information to this method because I don't have enough skill about programing.

I really appreciate if you can send the sample program about this method calling.

Thank you for advance,

Seiichiro Otsuka

abhishek_gupta2
Participant
0 Kudos

Dear Seiichiro ,

I think you are on wrong lines of implementation . You will not be able to get the ECR ID in the after_check_before_save method .

If you want to additional checks or validation for the change items , kindly implement the custom feeder class for change items and add custom logic for your change items .

By default following is the custom class for change items : /PLMI/CL_ECR_CHGITM_FED_ON.

You can make a setting in the customizing and define a new class zcl_ecr_chgitm_fed_on . Implement the following interface method /PLMI/IF_ECR_CHG_ITM~VALIDATE_ECR_ATTRIB and put you custom logic . As long as your validation fails , throw an error message and save will never happen .

Customizing :

Node --> PLM Web user interface ----> objects in plm web ui ---> engineering record ----> Make settings for engineering record .

Make changes in the feeder class as below :

Hope this helps ,

Thanks ,

Abhishek.

Former Member
0 Kudos

Dear Mr. Gupta,

Thank you for your reply.

I really appreciate your help.

I understood that I can make the item check program of ECR by zcl_ecr_chgitm_fed_on.

Please let me ask one more question.

Can I get the ECR detail information in this check program?

Because I'd like to make the program that compare ECR information (Ex. ECR status) and change items information (Ex. BOM status).


Best Regards,

Seiichiro Otsuka

abhishek_gupta2
Participant
0 Kudos

Dear Seiichiro ,

If you look at the signature of the interface /PLMI/IF_ECR_CHG_ITM which you need to add in the feeder class , you will notice that there are following importing parameters avialable :

IT_INTERNAL_KEY_INTID

IS_ECR_ID

IT_ECR_ATTRIB

So you have the ECR ID and attributes which shall solve ur case . If you still some more attributes , you can get the details as you know the ECR ID .

Thanks ,

Abhishek.

Former Member
0 Kudos

Dear Mr. Gupta,


Thank you for your reply.

I try to test but I can't get ECR detail information (Ex. ECR Status) from importing parameter.

Do I make a mistake?

My procedures are as follows.

1. Copy the feeder class /PLMI/CL_ECR_CHGITM_FED_ON and make the ZCL_ECR_CHGITM_FED_ON.

2. Change the Material BOM feeder class from /PLMI/CL_ECR_CHGITM_FED_ON to ZCL_ECR_CHGITM_FED_ON.

3. Set the Brake Point to Class Interface: ZCL_ECR_CHGITM_FED_ON Method: /PLMI/IF_ECR_CHG_ITM~VALIDATE_ECR_ATTRIB.

4. Open the ECR on NWBC.

5. Check the Import parameters.

<IS_ECR_ID>

<IT_INTERNAL_KEY_INTID>

<IT_ECR_ATTRIB>

Best Regards,

Seiichiro Otsuka

abhishek_gupta2
Participant
0 Kudos

Hi ,

If you see the code in the class /PLMI/CL_ECR_CHGITM_FED_ON. See the underlined piece of code below .

Get Otype details for Object ID

   APPEND /plmi/if_ecr_chg_itm~mv_otype_name TO lt_otype_name.

   CALL METHOD /plmi/cl_ecr_cust=>get_otype_cust

     EXPORTING

       it_otype_name = lt_otype_name

     IMPORTING

       et_otype_cust = lt_otype_cust.

* create local ECR attribute table

   READ TABLE lt_otype_cust INTO ls_otype_cust INDEX 1.

* collect all object id which is not initial

   LOOP AT it_internal_key_intid ASSIGNING <ls_internal_key_intid>

     WHERE internal_key IS NOT INITIAL.

     lv_index = sy-tabix.

*   get ECR attrib

     READ TABLE it_ecr_attrib ASSIGNING <ls_ecr_attrib> INDEX lv_index.

     IF sy-subrc = 0.

*     get field name of change relevance

       lo_struct_descr ?= cl_abap_structdescr=>describe_by_data( <ls_ecr_attrib> ).

       lt_fields = lo_struct_descr->get_ddic_field_list( p_including_substructres = abap_true ).

       READ TABLE lt_fields INTO ls_fields

         WITH KEY domname = '/PLMB/ECR_CHG_REL'.

       IF sy-subrc = 0.

*       get value of change relevance

         ASSIGN COMPONENT ls_fields-fieldname OF STRUCTURE <ls_ecr_attrib>

         TO <lv_value>.

*       object key is not validated when change relevance = Create or Not change relevant

         IF <lv_value> EQ 'CRE'.

           CONTINUE. "go to next key

         ENDIF.

       ENDIF.

     ENDIF.

*   convert key from ECR format to GOS format

     CALL METHOD /plmi/cl_ecr_services=>ecr_intern_to_gos_intern

       EXPORTING

         iv_otype_name       = /plmi/if_ecr_chg_itm~mv_otype_name

         iv_ecr_internal_key = <ls_internal_key_intid>-internal_key

       IMPORTING

         ev_gos_internal_key = ls_internal_key-internal_key

         et_messages         = lt_msg_cnv.

*   when conversion fails, update message and goto next key

     IF lt_msg_cnv IS NOT INITIAL.

       LOOP AT lt_msg_cnv ASSIGNING <ls_msg_cnv>.

         MOVE-CORRESPONDING <ls_msg_cnv> TO ls_message.

         ls_message-msg_index = lv_index.

         APPEND ls_message TO et_message.

       ENDLOOP.

       CONTINUE.

     ENDIF.

*   update local tables

     APPEND ls_internal_key TO lt_internal_key.

*   update mapping table

     ls_mapping-gos_internal_key = ls_internal_key-internal_key.

    ls_mapping-ecr_internal_key = <ls_internal_key_intid>-internal_key.  ( here , you get the ecr internal key )

     ls_mapping-src_node_id      = lv_index.

     APPEND ls_mapping TO lt_mapping.

   ENDLOOP.

Itself you will be able to find the internal key . You can just copy it from the method ( /PLMI/IF_ECR_CHG_ITM~VALIDATE_ECR_ATTRIB ) of class ( /PLMI/CL_ECR_CHGITM_FED_ON) and use this to get the ECR internal key . Once you have the ECR internal key , you can get all the information you want .

I am adding the snap shot to help you out which I have set during debugging .

Also note that there is also a BADI (/PLMI/EX_ECR_ENHANCEMENTS) , interface VALIDATE_ECR_ATTRIB, which can also solve your check scenario .

Hope this helps and now you can close this discussion .

Thanks ,

Abhishek.

Former Member
0 Kudos

Dear Mr. Gupta,

I thank you deeply.

I really appreciate your help.

Your reply helped me very much.

Best Regards,

Seiichiro Otsuka

Answers (1)

Answers (1)

Former Member
0 Kudos

They are called change items and you can query them using the method GET_CHANGE_ITEMS_ALL of the ABAP class /PLMI/CL_ECR_BO. ECRs are implemented using the Case Management APIs so experience in that helps. You shouldn't enhance the standard method, you should implement the enhancement spot /PLMB/ES_SPI instead.

Former Member
0 Kudos

Dear Mr. Kaski,

Thank you for your prompt reply.

I will try it.

Best Regards,

Seiichiro Otsuka.