Quantcast
Viewing latest article 2
Browse Latest Browse All 8720

Resetting configuration sign after copy material

Hello at all,

 

we have the following tasks to realize:

- copy KMAT Material

- change the material type from KMAT to HALB

- delete configuration signs MARA-KZKFG / MARA-SATNR

 

The first and the second point is done and not longer a problem. But the deleting of the configuration signs seems to be not possible.

 

By the way -> Customizing

- MTART KMAT is KZKFG obligatory

- MTART HALB is KZKFG open

 

This is the coding I'm using. What's wrong with it that nothing will happen?

 

 

DATA ls_mara TYPE mara_ueb.

DATA lt_mara TYPE TABLE OF mara_ueb.

DATA lt_merrdat TYPE TABLE OF merrdat.

DATA lt_mtart TYPE mat_mtart_tt.

DATA ls_mtart LIKE LINE OF lt_mtart.

DATA lt_error TYPE TABLE OF merrdat.

DATA lt_mara_ueb TYPE TABLE OF mara_ueb.

DATA lt_field_res TYPE TABLE OF mfieldres.

DATA ls_field_res LIKE LINE OF lt_field_res.

 

 

SELECT SINGLE *

  FROM mara

  INTO CORRESPONDING FIELDS OF ls_mara

  WHERE matnr EQ 'XYZ4711'.

 

IF sy-subrc <> 0.

 

  1. ENDIF.

 

ls_mara-matnr = 'XYZ4711'.

ls_mara-mtart = 'KMAT'.

*CLEAR ls_mara-kzkfg.

*CLEAR ls_mara-satnr.

ls_mara-tcode = 'MM02'.

ls_mara-tranc = ls_mara-tranc + 1.

ls_mara-d_ind = ls_mara-d_ind + 1.

APPEND ls_mara TO lt_mara.

 

ls_field_res-fname = 'MARA-KZKFG'.

ls_field_res-tranc = ls_mara-tranc.

ls_field_res-d_ind = ls_mara-tranc.

APPEND ls_field_res TO lt_field_res.

 

ls_field_res-fname = 'MARA-SATNR'.

ls_field_res-tranc = ls_mara-tranc.

ls_field_res-d_ind = ls_mara-tranc.

APPEND ls_field_res TO lt_field_res.

 

CALL FUNCTION 'MATERIAL_MAINTAIN_DARK'

  EXPORTING

    p_kz_no_warn           = 'X'

    kz_prf                 = ''    "W"

    iv_change_doc_tcode    = 'Field Res'

  TABLES

    amara_ueb              = lt_mara

    amfieldres             = lt_field_res

    amerrdat               = lt_merrdat

  EXCEPTIONS

    kstatus_empty          = 1

    tkstatus_empty         = 2

    t130m_error            = 3

    internal_error         = 4

    too_many_errors        = 5

    update_error           = 6

    error_propagate_header = 7

    OTHERS                 = 8.

 

IF sy-subrc <> 0.

* Implement suitable error handling here

  1. ENDIF.

 

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  EXPORTING

    wait = 'X'

* IMPORTING

*   RETURN        =

  .


Viewing latest article 2
Browse Latest Browse All 8720

Trending Articles