In SAP NetWeaver 7.4 checking of record existence is very simple and easy, all it can happen with simple key word line_exists
, it works very similar to READ TABLE .. TRANSPORTING NO FIELDS
Syntax: line_exists( <ITAB>[ <COLUMN1> = <VALUE> <COLUMN2> = <VALUE> ... ] ).
Example using line_exists ABAP 7.4
SELECT * FROM MARA INTO TABLE @DATA(IT_MARA) UP TO 50 ROWS WHERE MTART = 'FERT'. IF line_exists( it_mara[ matnr = '0001' ] ). WRITE:/ 'Records Exists'. ENDIF. IF NOT line_exists( it_mara[ matnr = '0002' ] ). write:/ 'No Record Exists'. ENDIF.
Using Multiple Columns to check for a record
SELECT * FROM MARA INTO TABLE @DATA(IT_MARA) UP TO 50 ROWS WHERE MTART = 'FERT'. IF line_exists( it_mara[ matnr = '0001' mtart = 'FERT' ] ). WRITE:/ 'Records Exists'. ENDIF.
Learner Questions
No Questions by learners, be first one to ask ..!!
Was this lesson helpful to you? Yes No 3 People out of 3 think this lesson helpful