Skip to Content
0
Former Member
Nov 02, 2006 at 04:34 PM

Gather All Data Packages in Start Routine - logic error in ABAP?

174 Views

Hi Gurus,

A previous post yielded a clever way of collecting all Data Packages in a Start Routine in the Update Rules so they could be sorted and processed at the same time rather than process the packages one at a time. Problem is... I can't get it to work past the first data package.

If I try to debug, multiple dialog sessions start and the program falls over itself.

Can anyone see anything obviously wrong with the code?

  • Global Data Defs

DATA: BEGIN OF i_all_data_packages OCCURS 100. "store for all data packagaes

INCLUDE STRUCTURE /BIC/CS8ZSDG_O02. "my source ODS

DATA: END OF i_all_data_packages.

DATA: l_datpkid_fld(30) TYPE c

VALUE 'G_S_OBJECT-DATAPAKID',

l_datrequ_fld(30) TYPE c

VALUE 'G_S_OBJECT-REQUEST'.

DATA: g_records_required(10) type n,

l_tot_recs(10) type n.

DATA: l_data_packet_id type RSDATAPID,

l_request type RSREQUNR.

DATA: i_rsmonfact LIKE rsmonfact OCCURS 500 WITH HEADER LINE,

l_wa_i_rsmonfact LIKE rsmonfact OCCURS 500 WITH HEADER LINE.

$$ begin of routine

  • Assign a memory area (mem_area) to the field symbol <fs>.

ASSIGN (l_datpkid_fld) TO <l_datapakid>.

l_data_packet_id = <l_datapakid>.

ASSIGN (l_datrequ_fld) TO <l_request>.

l_request = <l_request>.

  • Check first data packet get packet data for request

IF l_data_packet_id = '000001'.

CLEAR: l_tot_recs.

REFRESH i_all_data_packages.

SELECT * FROM rsmonfact INTO TABLE i_rsmonfact

WHERE rnr = l_request.

  • Loop through packets adding the # of total records

LOOP AT i_rsmonfact INTO l_wa_i_rsmonfact.

g_records_required = g_records_required

+ l_wa_i_rsmonfact-req_select.

ENDLOOP.

ENDIF.

APPEND LINES OF DATA_PACKAGE TO i_all_data_packages.

CLEAR DATA_PACKAGE.

REFRESH DATA_PACKAGE.

l_tot_recs = l_tot_recs + RECORD_ALL.

  • Move all data into the data_package table

IF l_tot_recs = g_records_required.

DATA_PACKAGE[] = i_all_data_packages[].

********************************************

  • Start of Processing Logic

********************************************

  • endless loop for testing

  • Data: i_flag.

  • While i_flag eq ''.

  • Endwhile.

  • Addnl processing is in here - it works OK for 1

  • data package

ENDIF.

ABORT = 0.

(added this to say what the problem was - I needed to have set the Infopackage as 'Into PSA and Subsequently into Data Targets' for this to work. It actually said to do this in the original post but I forgot to)

Regards,

Deano

Message was edited by: Dean Stubbs