Hi Expert,
kindly need your help,
I have done created/ extended QM view and now i want to upload for inspection setup. I already search through SAP forums and follow the suggestions but it's still failed to upload the inspection setup.
Below is a part of code that i used to upload the inspection setup in QM view,
LOOP AT gt_upload_file INTO gw_upload_file.
CLEAR: gw_qmat.
bapimathead-material = gw_upload_file-col1.
bapimathead-quality_view = 'X'.
bapimathead-inp_fld_check = 'W'. " added by nliyanah
bapi_marc-plant = gw_upload_file-col2.
bapi_marcx-plant = gw_upload_file-col2.
" 1. Material Code
gw_qmat-material = gw_upload_file-col1.
" 2. Plant
gw_qmat-plant = gw_upload_file-col2.
" 3. Inspection Type
gw_qmat-insptype = gw_upload_file-col3.
" 4. Active
gw_qmat-ind_insptype_mat_active = gw_upload_file-col4.
" 5. HU
gw_qmat-ind_hu_inspection = gw_upload_file-col5.
"6. Function
gw_qmat-function = '009'.
APPEND gw_qmat TO gt_qmat.
ENDLOOP.
CALL FUNCTION 'BAPI_MATINSPCTRL_SAVEREPLICA'
TABLES
return = lt_return
inspectionctrl = gt_qmat.
READ TABLE lt_return WITH KEY type = 'E' TRANSPORTING NO FIELDS.
IF sy-subrc <> 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' .
IF sy-subrc = '0'.
MESSAGE I016(ZMAT).
ELSE.
gv_error = 1.
MESSAGE I008(ZMAT).
EXIT.
ENDIF.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
IF sy-subrc <> 0.
MESSAGE I009(ZMAT).
ENDIF.
gv_error = 1.
MESSAGE I015(ZMAT).
EXIT.
ENDIF.
Please advise,
Liyana