Sorun Cevaplayalım

İşinizle ilgili öngörüler edinin, gerçek zamanlı bilgilere göre karar alın.

SAP Eğitim ve Sertifika Dönemleri

Uzmanlığınızı ve deneyiminizi SAP çözümleri kullanarak tasdik edin.

Çözüm Ekibi Başvurusu

Kullanıcılara hızlı ve pratik çözümler üreterek görev almak isteyenler.

SAP BLOG Insert and Change Inspections Plan Characteristic

SAP Blog

Kayıtlı Üye
Katılım
22 Ara 2017
Mesajlar
990
Tepki puanı
6
Introduction.

One of my recent experiences while doing S/4 HANA Implementation, I came across a requirement to develop a custom program to Insert, add, and replace the inspection plan Characteristic similar to transaction QP02.

but we have a standard transaction for inspection plan characteristic i.e. QS27. But it is not fulfilling my client business requirement.

Solution.

Standard transaction QS27 is using the batch input method to replace the inspection Characteristic, using the same method, I am able to append records at last in the in exiting inspection characteristics but not able to Insert the records into any position as per my business requirement.

I have the standard Function module to maintain the inspection plan, but it will not support inserting into any position similar to the transaction QP02.

To archive the functionalities I use the below code along with an implicit enhancement.

Kod:
 ls_inspection_characteristics-maintain_mode = 'C'. ls_inspection_characteristics-flag_bar_pointer = '0000000001'. ls_inspection_characteristics-sequence_no = '000000'. ls_inspection_characteristics-activity = list_i-vornr. " Activity ls_inspection_characteristics-operation_id = list_i-plnkn. ls_inspection_characteristics-inspchar = list_i-merk. ls_inspection_characteristics-mstr_char = rqpda-ers_mkmnr. ls_inspection_characteristics-pmstr_char = list_i-werk. ls_inspection_characteristics-vmstr_char = list_i-pmtversion. ls_inspection_characteristics-char_descr = ls_qpmt-kurztext. ls_inspection_characteristics-method = list_i-pmethode. ls_inspection_characteristics-pmethod = list_i-qmtb_werks. ls_inspection_characteristics-vmethod = list_i-pmtversion. ls_inspection_characteristics-dec_places = 2.
IF ls_qpmz-katab1 IS INITIAL. " Qualitative Characteristics ls_inspection_characteristics-quantitative_ind = 'X'. ls_inspection_characteristicsx-quantitative_ind = abap_true. IF gv_target_limit = abap_true.. ls_inspection_characteristics-target_val = list_i-sollwert. ls_inspection_characteristics-target_val_check_ind = abap_true. ls_inspection_characteristicsx-target_val = abap_true. ls_inspection_characteristicsx-target_val_check_ind = abap_true. ENDIF. IF gv_upper_limit = abap_true. ls_inspection_characteristics-up_tol_lmt = list_i-toleranzob. " Upper Limit ls_inspection_characteristics-up_tol_lmt_ind = abap_true. ls_inspection_characteristicsx-up_tol_lmt = abap_true. ls_inspection_characteristicsx-up_tol_lmt_ind = abap_true. ENDIF. IF gv_lower_limit = abap_true. ls_inspection_characteristics-lw_tol_lmt = list_i-toleranzun. " Lower Limit ls_inspection_characteristics-lw_tol_lmt_ind = abap_true.. " Lower Limit ls_inspection_characteristicsx-lw_tol_lmt = abap_true. ls_inspection_characteristicsx-lw_tol_lmt_ind = abap_true. ENDIF. ELSEIF ls_qpmz-katab1 IS NOT INITIAL. " Qualitative insp ls_inspection_characteristics-attribute_required_ind = abap_true. ls_inspection_characteristicsx-attribute_required_ind = abap_true. ls_inspection_characteristics-ind_selset_or_codegrp1 = 'X'. ls_inspection_characteristics-cat_type1 = '1'. ls_inspection_characteristics-sel_set1 = list_i-auswmenge2. ls_inspection_characteristics-psel_set1 = '1710'. ls_inspection_characteristicsx-cat_type1 = abap_true. ls_inspection_characteristicsx-ind_selset_or_codegrp1 = abap_true. ls_inspection_characteristicsx-sel_set1 = abap_true. ls_inspection_characteristicsx-psel_set1 = 'X'. ENDIF.
ls_inspection_characteristics-smpl_quant = '100'. ls_inspection_characteristics-smpl_unit = 'ST'. ls_inspection_characteristics-method = list_i-pmethode. ls_inspection_characteristics-pmethod = list_i-qmtb_werks. ls_inspection_characteristics-meas_value_confirm_ind = abap_true. ls_inspection_characteristicsx-meas_value_confirm_ind = abap_true. APPEND ls_inspection_characteristics TO lt_inspection_characteristics. CLEAR ls_inspection_characteristics. ls_inspection_characteristicsx-mstr_char = abap_true. ls_inspection_characteristicsx-pmstr_char = abap_true. ls_inspection_characteristicsx-vmstr_char = abap_true. ls_inspection_characteristicsx-char_descr = abap_true. ls_inspection_characteristicsx-method = abap_true. ls_inspection_characteristicsx-pmethod = abap_true.
* ls_inspection_characteristicsx-vmethod = abap_true.
** ls_inspection_characteristicsx-meas_unit = abap_true. ls_inspection_characteristicsx-dec_places = abap_true. ls_inspection_characteristicsx-sampling_procedure_ind = abap_true. ls_inspection_characteristicsx-smpl_procedure = abap_true. ls_inspection_characteristicsx-smpl_unit = abap_true. ls_inspection_characteristicsx-smpl_quant = abap_true. APPEND ls_inspection_characteristicsx TO lt_inspection_characteristicsx. CLEAR ls_inspection_characteristicsx. CALL FUNCTION 'BAPI_INSPECTIONPLAN_CHANGE' EXPORTING
* CHANGE_NO = key_date = sy-datum group = list_i-plnnr groupcounter = list_i-plnal
* MATERIAL = plant = list_i-werk
* TASK =
* TASK_X =
* MATERIAL_LONG = TABLES
* MATERIAL_TASK_ALLOCATIONS =
* MATERIAL_TASK_ALLOCATIONS_X =
* SEQUENCES =
* SEQUENCES_X =
* OPERATIONS =
* OPERATIONS_X =
* SUBOPERATIONS =
* SUBOPERATIONS_X =
* PRODUCTION_RESOURCES_TOOLS =
* PRODUCTION_RESOURCES_TOOLS_X = inspection_characteristics = lt_inspection_characteristics inspection_characteristics_x = lt_inspection_characteristicsx
* INSPECTION_VALUES =
* INSPECTION_VALUES_X =
* REFERENCED_OPERATIONS =
* TEXT =
* TEXT_ALLOCATIONS = return = lt_return. IF lt_return IS NOT INITIAL. READ TABLE lt_return INTO DATA(ls_return) WITH KEY type = 'E'. IF sy-subrc NE 0. MOVE TEXT-043 TO list_i-status. MODIFY list_i. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
* IMPORTING
* RETURN = . ELSE. MOVE TEXT-063 TO list_i-status. MODIFY list_i. ENDIF. ome_list-plnty = list_i-plnty. ome_list-plnnr = list_i-plnnr. ome_list-plnal = list_i-plnal. ome_list-plnfl = list_i-plnfl. ome_list-vornr = list_i-vornr. ome_list-mkmnr = list_i-merk. LOOP AT lt_return INTO ls_return. ome_list-text = ls_return-message. ome_list-msgv1 = ls_return-message_v1. ome_list-msgv2 = ls_return-message_v2. ome_list-msgv3 = ls_return-message_v3. ome_list-msgv4 = ls_return-message_v4. APPEND ome_list. ENDLOOP. ENDIF.

Below Enhancement required to set importing mode as ‘N’ which will come as Space from while performing Insert operation from FM.







Conclusion

I would like to share this because here I could not find anything similar to this. Hope it will help you.

Okumaya devam et...
 
Üst