cancel
Showing results for 
Search instead for 
Did you mean: 

Delete DATA From Structure

11-22-2022 2:27 PM
shrgrl Participant
2321 views 6 comments Go to solution
0 Likes
SAP Managed Tags
Subscribe

Hi all,

I'm trying to delete a row from table.

My first conditions:

SELECT SINGLE mfrpn, ean11, matnr, prdha FROM mara INTO @DATA(ls_mara)
    WHERE matnr EQ @lv_matnr.

I have a table : ZADOBE_CODE

I need to check matnr and prdha and if I find same data in ZADOBE_CODE and ls_mara I should delete mfrpn. I wrote that:

SELECT SINGLE matnr, prdha FROM zadobe_code INTO @DATA(ls_zadobe_code)
    WHERE matnr EQ @ls_mara-matnr OR prdha EQ @ls_mara-prdha.

IF ls_zadobe_code IS NOT INITIAL.
"DELETE mfrpn FROM ls_mara.
ELSE.
ENDIF.

But my delete row is wrong. How can I write?

0 Likes

Accepted Solutions (1)

Accepted Solutions (1)

shrgrl
Participant
0 Likes

My solution is that:

CLEAR ls_mara-mfrpn.

Thanks for all helps.

Answers (4)

Answers (4)

roberto_forti
Contributor
0 Likes

Hi,

Try the following example:

Select fields (a~... , b~...) From ( mara as a LEFT OUTER JOIN zadobe_code as b ... )

Regards,

Eduardo-CE
Active Participant
0 Likes

FREE ls_mara-mfrpn.


0 Likes
DELETE FROM target INDEX 1.
Sandra_Rossi
Active Contributor
0 Likes

See ABAP doc:

Either use

DELETE FROM target [WHERE sql_cond]

or

DELETE target FROM source.
If you use the second form, source (the work area) must have same structure as target as said by SAP: "The content of the work area is not converted and is interpreted according to the structure of the DDIC database table or DDIC view."