Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

Scenario: I came accross a scenario where the client wanted us to check for the number of records picked up during the full load.If the number of records were found to be zero, the load was to be terminated so that further loads do not happen as they would be incorrect if this load fetched zero records.

Solution: We created a program to check the number of records in table( in our case it was the PSA table) and terminate the process chain by using an error message if zero records were fetched. In our case, it was always a full load from ECC to BW, as it was a small table with limited entries and the table was supposed to be updated by a particular time in ECC  by the users'. There were other loads which were dependent on this load. so in case, this load did not fetch any records(because the table wasn't updated by the time process chain ran) other loads were supposed to stop.

The program:

REPORT  Z_CHECK_number_of _records.

DATA:
  o_ref TYPE REF TO data.
FIELD-SYMBOLS:
  <lt_table> TYPE STANDARD TABLE,
  <fs>       TYPE ANY,
  <field>    TYPE ANY,
  <field1>   TYPE ANY.
PARAMETERS:
  p_tab       TYPE tabname.       " Table name
  START-OF-SELECTION.
  CREATE DATA o_ref TYPE TABLE OF (p_tab).
  "ASSIGN p_field TO <field1>.
  ASSIGN o_ref->* TO <lt_table>.

  SELECT *
    INTO TABLE <lt_table>
    FROM (p_tab).
if ( sy-subrc NE 0 ).
  MESSAGE e213(/MAP/E).
endif.

When the program is run it asks for the name of the table for which the records are to be checked. Following is the screenshot of the selection screen:

While using this in a process chain, this has be inserted before the step where you want to stop the process chain.

Create a variant of this program by entering the name of the table in the selection screen and saving it.

Now select the process chain variant ABAP Program and insert this variant of the program.

Now, when the process chain runs, it encounters this step and checks for the number of records and sends ou an error message if it finds zero records.

2 Comments
Labels in this area