cancel
Showing results for 
Search instead for 
Did you mean: 

sub query in Start routine

Former Member
0 Kudos

Hi,

I need to use sub-query to check whether data exist in a table, if yes then delete. For that I am trying this code in Start Routine. It shows some weird syntax error - E:Method "" is unknown or PROTECTED or PRIVATE

DELETE SOURCE_PACKAGE WHERE CSM_CASE IN ( SELECT CSM_CASE FROM /BIC/AZDPM_DS300 ).

Any thoughts please.

Regards

Vikash

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Not sure why sub queries don't work in start routnies? Changed the code.

dennis_scoville4
Active Contributor
0 Kudos

Open SQL subquerieis for ABAP Dictionary tables works in Start Routines, but in your case you were trying to put an Open SQL subquery in an internal table manipulation statement. That's why it choked on it.

dennis_scoville4
Active Contributor
0 Kudos

Your best bet for this would be to LOOP through source_package and do SELECT SINGLE.

Global Declarations


DATA: l_tabix TYPE sy-tabix.

Routine


CLEAR: l_tabix.

LOOP AT source_package
  ASSIGNING <source_fields>.

  l_tabix = sy-tabix.

  SELECT SINGLE
    csm_case
  FROM
    /bic/azdpm_ds300
  WHERE
    csm_case EQ <source_fields>-csm_case.

  IF sy-subrc EQ 0.

    DELETE
      source_package
    INDEX
      l_tabix.

  ENDIF.

ENDLOOP.