Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

data package error

Dear Guru,

I am trying to derive 2 more records out of 1 record in start routine.

I am using this code as reference:

DATA: wa_temp TYPE DATA_PACKAGE_STRUCTURE OCCURS 0 WITH HEADER LINE.

*Here we populate additional internal tables with values for February – December.

  • Original Data_Package will hold data for January

LOOP AT DATA_PACKAGE INTO wa_temp.

wa_temp-/BIC/New1Key3 = 'ABC'.

wa_temp-/BIC/BIC/KeyFigure01 = data_package-/BIC/KeyFigure01.

wa_temp-/BIC/BIC/KeyFigure02 = data_package-/BIC/KeyFigure02.

APPEND wa_temp.

wa_temp-/BIC/New2Key3 = 'DEF'.

wa_temp-/BIC/BIC/KeyFigure03 = data_package-/BIC/KeyFigure03.

wa_temp-/BIC/BIC/KeyFigure04 = data_package-/BIC/KeyFigure04.

APPEND wa_temp.

ENDLOOP.

  • Append data for February-December to January data

LOOP AT wa_temp.

APPEND wa_temp TO DATA_PACKAGE.

ENDLOOP.

ABORT = 0.

-


However, the Keyfigures are not populated with values as the source record.

Source record:

Key1 Key2 <blank key column> 100 200 300 400

Derived records (but not what is expected!):

Key1 Key2 New1Key3 100 200 0 0

Key1 Key2 New2Key3 100 200 0 0

  • 2nd derived record is assigned same value as 1st derived record. This is puzzling! The code specifically assigned to different KF columns, yet the result is perplexing.

I expected it to be :

Key1 Key2 New1Key3 100 200 <blank> <blank>

Key1 Key2 New2Key3 <blank> <blank> 300 400

I also tried hardcoding the assignment of KF values by actual values. That worked. Somehow, the key field is assigned properly but not the KF (data field) values.

Any idea?

Best Regards,

Suzie

replied

Hi,

Check the Code:

wa_temp-/BIC/New1Key3 = 'ABC'.

wa_temp-/BIC/BIC/KeyFigure01 = data_package-/BIC/KeyFigure01.

wa_temp-/BIC/BIC/KeyFigure02 = data_package-/BIC/KeyFigure02.

*Here you need to make KeyFigure03 and KeyFigure04 values blank before appending to wa_temp.

APPEND wa_temp.

wa_temp-/BIC/New2Key3 = 'DEF'.

wa_temp-/BIC/BIC/KeyFigure03 = data_package-/BIC/KeyFigure03.

wa_temp-/BIC/BIC/KeyFigure04 = data_package-/BIC/KeyFigure04.

*Also same make KeyFigure01 and KeyFigure02 values blanck

APPEND wa_temp.

**Refresh the data package..

REFRESH DATA_PACKAGE.

  • Append data for February-December to January data

LOOP AT wa_temp.

APPEND wa_temp TO DATA_PACKAGE.

ENDLOOP.

I hope this should work..

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question