Question:
I am looking at using RETURN TABLES in some update rules to update an ODS w/ different grains of data. In looking at a solution, I have several questions.
Background: I have two ODS's, one at the Header Level and one at the Schedule Line level. I need to combine the data from both ODS's into one. (Header Key is 0DOC_NUMBER, Line level is 0DOC_NUMBER, 0SCHED_LINE, 0S_ORD_ITEM)
Currently if I just create update rules from both ODS's to the combined ODS, when drilling down by the Line level I have # or unassigned values for certain KF b/c they only exist at the Header level and not the line level.
Soluition: My solution is to split the header level information out to have multiple records to put the information in at the schedule line level.
PROGRAM UPDATE_ROUTINE.
*$*$ begin of global - insert your declaration only below this line *-*
* TABLES: ...
DATA: i_tabix LIKE sy-tabix.
*$*$ end of global - insert your declaration only before this line *-*
* The follow definition is new in the BW3.x
TYPES:
BEGIN OF DATA_PACKAGE_STRUCTURE.
INCLUDE STRUCTURE /BIC/CS8ZOVAHDR.
TYPES:
RECNO LIKE sy-tabix,
END OF DATA_PACKAGE_STRUCTURE.
DATA:
DATA_PACKAGE TYPE STANDARD TABLE OF DATA_PACKAGE_STRUCTURE
WITH HEADER LINE
WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
FORM startup
TABLES MONITOR STRUCTURE RSMONITOR "user defined monitoring
MONITOR_RECNO STRUCTURE RSMONITORS " monitoring with record n
DATA_PACKAGE STRUCTURE DATA_PACKAGE
USING RECORD_ALL LIKE SY-TABIX
SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS
CHANGING ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel update
*
*$*$ begin of routine - insert your code only below this line *-*
* fill the internal tables "MONITOR" and/or "MONITOR_RECNO",
* to make monitor entries
loop at DATA_PACKAGE.
i_tabix = sy-tabix.
if DATA_PACKAGE-S_ORD_ITEM is initial.
SELECT SCHED_LINE S_ORD_ITEM
INTO CORRESPONDING FIELDS OF DATA_PACKAGE
* INTO CORRESPONDING FIELDS OF DATA_PACKAGE_STRUCTURE
FROM /BIC/AZSLSORD00
WHERE DOC_NUMBER = DATA_PACKAGE-DOC_NUMBER.
* DATA_PACKAGE-SCHED_LINE = /BIC/AZSLSORD00-SCHED_LINE.
* DATA_PACKAGE-S_ORD_ITEM = /BIC/AZSLSORD00-S_ORD_ITEM.
APPEND DATA_PACKAGE.
ENDSELECT.
DELETE DATA_PACKAGE index i_tabix.
endif.
endloop.
* if abort is not equal zero, the update process will be canceled
ABORT = 0.
*$*$ end of routine - insert your code only before this line *-*
*
ENDFORM.
Answer:
hum... still not sure why you're using a return table for this
anyway, your coding can be improved... (remove red and insert green)
loop at DATA_PACKAGE where S_ORD_ITEM is initial.
i_tabix = sy-tabix.
if DATA_PACKAGE-S_ORD_ITEM is initial.
SELECT SCHED_LINE S_ORD_ITEM
INTO CORRESPONDING FIELDS OF DATA_PACKAGE
FROM /BIC/AZSLSORD00
WHERE DOC_NUMBER = DATA_PACKAGE-DOC_NUMBER.
APPEND DATA_PACKAGE.
ENDSELECT.
DELETE DATA_PACKAGE index i_tabix.
endif.
endloop.
delete DATA_PACKAGE where S_ORD_ITEM is initial.
btw you're only selecting the schedule line number and the order item from your ODS (and nothing else)?!
cheers,
El Belgio
Answer:
hum... still not sure why you're using a return table for this
On the code, I will check out your code changes. I appreciate the feedback.
btw you're only selecting the schedule line number and the order item from your ODS (and nothing else)?!
Yep, the way (in my mind) I am working this is I have Sched Line data from ODS_A, and Header data from ODS_B. They need to get updated to ODS_AB. The only common information between the two is the 0DOC_NUM.
I need to fille out ODS_B (Header) to match the grain of ODS_A (Which is the same grain in ODS_AB). Combining the information, I only need the Key to fill out the header information.
Chars A,B,C get filled from ODS_A, and Chars X,Y,Z get filled by ODS_B. The information from the header which I am filling in for these fields is OK (no miscalc of KF's or Chars).
- Stephen
Answer:
hum... still not sure why you're using a return table for this
On the code, I will check out your code changes. I appreciate the feedback.
btw you're only selecting the schedule line number and the order item from your ODS (and nothing else)?!
Yep, the way (in my mind) I am working this is I have Sched Line data from ODS_A, and Header data from ODS_B. They need to get updated to ODS_AB. The only common information between the two is the 0DOC_NUM.
I need to fille out ODS_B (Header) to match the grain of ODS_A (Which is the same grain in ODS_AB). Combining the information, I only need the Key to fill out the header information.
Chars A,B,C get filled from ODS_A, and Chars X,Y,Z get filled by ODS_B. The information from the header which I am filling in for these fields is OK (no miscalc of KF's or Chars).
- Stephen
Answer:
El Belgio wrote:
hum... still not sure why you're using a return table for this
your subject is about a return table... don't think there is a need for that or is it getting too hot in Belgium these days??
Answer:
It was my confusion that started it. I thought initially when posting that I might be using a return table (1 char to many) to get my results, but using either the start routine or InfoSet is the solution.
You are more then welcome to have all the rain we have been getting in Philadelphia to help cool you off.
Answer:
You are more then welcome to have all the rain we have been getting in Philadelphia to help cool you off.
Do you know that Belgium is "the country when rain is typical" ?!
El Belgio was just adding this remark to have an additional post; his aim being to be able to be the first belgian to reach the 1000th posting... (but as he is now back home, I have a chance to beat him tonight if I find some topics to answer before I leave...)
Answer:
El Belgio was just adding this remark to have an additional post; his aim being to be able to be the first belgian to reach the 1000th posting...
that's not my intention... hey, maybe I'll quit when I have reached 1000