cancel
Showing results for 
Search instead for 
Did you mean: 

Start Routine Issue for 2LIS_03_BF

erdem_sephanelioglu
Participant
0 Kudos

Hi all,

As I am having mismatch with stock amounts in 0IC_C03, I am applying a solution according to OSS note. My issue is implementing lines in the start routine

The part I am adding is

loop at SOURCE_PACKAGE.

    if SOURCE_PACKAGE-stockcat eq 'V' or

       SOURCE_PACKAGE-stocktype eq 'V'.

      delete SOURCE_PACKAGE.

    endif.

  endloop.

* if abort is not equal zero, the update process will be canceled

  ABORT = 0.

* INSERT END

and the error message I got at the bottom is

E: At "LOOP AT itab", one of the additions "INTO", "ASSIGNING", or "TRANSPORTING NO FIELDS" is required. in the 00 context.

My aim is to define a code part to delete some records. I am poor with ABAP skills. I appreciate your help on that.

Regards.

Eddy.

Accepted Solutions (0)

Answers (2)

Answers (2)

hendrik_brandes
Contributor
0 Kudos

Hello,

the correct syntax is LOOP AT itab ASSIGING <source_fields>.

But: Try this:

DELETE SOURCE_PACKAGE WHERE stockcat = 'V' OR stocktype = 'V'.

Kind regards,

Hendrik

erdem_sephanelioglu
Participant
0 Kudos

Hi Hendrik,

It gives the same error as well

E:Field "SOURCE_PACKAGE" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement. "DATA" statement.

The code is

DELETE SOURCE_PACKAGE WHERE SOURCE_fields-stockcat eq 'V' or

        SOURCE_fields-stocktype eq 'V'.

Eddy.


hendrik_brandes
Contributor
0 Kudos

Hello Eddy,

i just try this in my system:

    METHOD start_routine.
*=== Segments ===

    FIELD-SYMBOLS:
      <SOURCE_FIELDS>    TYPE _ty_s_SC_1.

    DATA:
      MONITOR_REC     TYPE rstmonitor.

*$*$ begin of routine - insert your code only below this line        *-*
... "insert your code here
*--  fill table "MONITOR" with values of structure "MONITOR_REC"
*-   to make monitor entries
... "to cancel the update process
*    raise exception type CX_RSROUT_ABORT.
  delete source_package where calmonth = '012012'.

*$*$ end of routine - insert your code only before this line         *-*
  ENDMETHOD.

and this could by compiled without any problems.

You do not have to specify any structure/workareas when using delete-statement directly. Just specify your fields from _ty_s_sc_1.

Kind regards,

Hendrik

purvang_zinzuwadia
Active Participant
0 Kudos

Hello Eddy,

I think you are getting error because the place where your are putting your code is incorrect i.e. SOURCE_PACKAGE is used out of scope of class lcl_transform.

put your code between lines

    METHOD start_routine.

and

   ENDMETHOD.

you will find a line with comment that

   *$*$ begin of routine - insert your code only below this line        *-*
    ... "insert your code here

inside start_routine method.

Your code should work there.

hope this helps.

Regards,

Purvang

erdem_sephanelioglu
Participant
0 Kudos

Thank you guys,

You are totally correct. After I relocated the command line the code worked fine...

Now I will check if the code is working.

Thx.

E.

Former Member
0 Kudos

Hi Eddy,

Please use below code:

LOOP AT SOURCE_PACKAGE ASSIGNING SOURCE_FIELDS.

IF SOURCE_FIELDS-STOCKCAT EQ 'V' OR

    SOURCE_FIELDS-STOCKTYPE EQ 'V'.

DELETE SOURCE_PACKAGE.

ENDIF.

ENDLOOP.

Regards,

Deepak Chavan.

erdem_sephanelioglu
Participant
0 Kudos

Hi Deepak,

Thank you for the response, when I update the lines per your prompt, I receive this message:

E:Field "SOURCE_PACKAGE" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement.

I am seeing

CHANGING

           SOURCE_PACKAGE              type _ty_t_SC_1

so I expect there would no be a "SOURCE_PACKAGE is unknown" issue.

By the way my code part is as below:

loop at SOURCE_PACKAGE ASSIGNING <source_fields>.

     if SOURCE_fields-stockcat eq 'V' or

        SOURCE_fields-stocktype eq 'V'.

       delete SOURCE_PACKAGE.

     endif.

   endloop.

Former Member
0 Kudos

oh strange !! Can you try below from Hendrik?

DELETE SOURCE_PACKAGE WHERE stockcat = 'V' OR stocktype = 'V'.

this will also do.

Regards,

Deepak Chavan.

erdem_sephanelioglu
Participant
0 Kudos

I am having the same message below after change the code statement.

Could you please see the attachment.

Eddy

Former Member
0 Kudos

Hello Eddy,

Please put your code in "Begin of Routine " and "End of Routine part."

You are using gloabl section hence error message is coming.

Regards

Deepak Chavan.