Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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


DATA: END OF i_all_data_packages.

DATA: l_datpkid_fld(30) TYPE c


l_datrequ_fld(30) TYPE c


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.



APPEND LINES OF DATA_PACKAGE TO i_all_data_packages.



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


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)



Message was edited by: Dean Stubbs

Accepted Solutions (0)

Answers (3)

Answers (3)

Active Contributor
0 Kudos

In case anyone comes across this thread in future, I suggest that a better solution (BW 7.0 onwards) is to use semantic groups to ensure that records you need together in a package are all together.

Former Member
0 Kudos


How did this code work for you for collecting all data packages in the start routine?I have the same situation. I want to sort all data packages in the start routine.

Thank you in advance


Edited by: Sherman Ames on Aug 3, 2009 5:50 PM

Edited by: Sherman Ames on Aug 3, 2009 5:51 PM

Active Contributor
0 Kudos

Really I don't understand the meaning of the following varaible:



Did you try to debug it with a normal simulate update from PSA? Or did you debug with the infinite loop and SM50?

What I undestand, you try to store all data_package in an internal table.

But for One loading the system can get difference processing (could be parallel) and different instance of memory for the update program. I don't think that every Instance share the same global are. This assumption is fondamental for your routine!!



Former Member
0 Kudos

Hi Sergio,

Thanks for taking a look. As you were posting I think I must have been too as I managed to solve the problem.

I can gather all the data packages together before processing using the ABAP code if I use the Infopackage setting 'Into PSA' and 'Subsequently into Data Targets'.

The RECORD_ALL just holds the last row # of the package and l_tot_recs simply acts as a place to cumulatively total this for each data package as it passes through the 'collect' part of the code.



Former Member
0 Kudos

hi Dean Stubbs,

Have you found the solution to your problem? We are encountering the same problem on how to handle all data packages in start routine. We would be very appreciated if you can let us know on how to define all data packages in start routine!

Thanks alot!