Skip to Content
author's profile photo Former Member
Former Member

Deletion of a record.

Hi,

the statement marked as bold is giving me an error:

"You have not specified the key field "MANDT". However, field "MANDT" is contained in the key of table "I_CAUFV". -

how shd i write the delete statement.

IF NOT I_CAUFV[] IS INITIAL.

*Select the material from mara that matches the current material from

*i_caufv.

SELECT * FROM MARA INTO TABLE I_MARA FOR ALL ENTRIES IN I_CAUFV

WHERE MATNR = I_CAUFV-PLNBEZ.

LOOP AT I_MARA.

*Select everything from ztype where the part type is equal to the part

*type for the current line in the loop at i_mara.

SELECT SINGLE * INTO IZTYPE FROM ZTYPE

WHERE ZTYPE = I_MARA-WRKST.

IF SY-SUBRC = 0.

*If this is a make part.

IF IZTYPE-ZMAKEBUY = 'M'.

*Move like fields from iztype to data_iztype.

MOVE IZTYPE-ZTYPE TO DATA_IZTYPE-ZTYPE.

*If this is a make part.

ELSEIF IZTYPE-ZMAKEBUY NE 'M'.

<b> DELETE TABLE i_Caufv WITH TABLE KEY PLNBEZ = I_MARA-MATNR .</b>

*Move the leading work order to the superior work order space.

  • MOVE: I_CAUFV-LEAD_AUFNR TO I_CAUFV-MAUFNR.

ENDIF.

ENDIF.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 20, 2006 at 04:05 PM

    Hi,

    DELETE i_Caufv WHERE PLNBEZ = I_MARA-MATNR .

    Cheers

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 20, 2006 at 04:05 PM

    hi kamlesh,

    [hope that PLNBEZ = I_MARA-MATNR are same..]

    read table i_caufv with key PLNBEZ = I_MARA-MATNR .

    if sy-subrc = 0.

    delete i_caufv where PLNBEZ = I_MARA-MATNR .

    endif.

    just check this code.

    regards,

    VIjay

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 20, 2006 at 04:09 PM

    I assume this may be a table with the key defined, so you need to always keep the key in mind when operating on the internal table. For example.

    
    data: i_caufv type hashed table of caufv 
                    with unique <b>key mandt</b> plnbez with header line.
    
    
    DELETE TABLE i_Caufv WITH TABLE KEY <b>MANDT  = sy-mandt</b>
                                        PLNBEZ = I_MARA-MATNR .
    .
    
    
    

    REgards,

    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.