Question:
My objective is to add a record for each month betweeen the Enter Date and the Completion Date (2 records for the example below) and change 0CALDAY to this new incremental month.
I currently have an ODS fed through a flat file with the following structure:
Key Fields: ZNOTIF, 0CALDAY
Data Fields: EnterDate, CompletionDate, #OutStanding
Sample Record:
ZNOTIF,0CALDAY,EnterDate,CompletionDate,#OutStanding
1000,01/01/2003, 01/01/2003,04/01/2003,1
Additional Records to Add:
ZNOTIF,0CALDAY,EnterDate,CompletionDate,#OutStanding
1000,02/01/2003, 01/01/2003,04/01/2003,1
1000,03/01/2003, 01/01/2003,04/01/2003,1
My first thoughts are that this can be accomplished with a return table. Since I can't use a return table on a key field (0calday), is there a way to do this with a return table off of one of the data fields and update a key field? Using my limited ABAP capabilities, my added records resulted in correct values for my key fields (znotif & 0calday) but blank values for all of the data fields.
Any help would be greatly appreciated.
John
Answer:
field? Using my limited ABAP capabilities, my added records resulted in correct values for my key fields (znotif & 0calday) but blank values for all of the data fields.
I think you are not so far from the solution,
you most probably just forgot to copy the values from the original record to the additional ones; that's it.
If you can't achieve it, paste the code here, plenty of people will try to help you.
Ch
Answer:
Thanks CHC,
Below is my first attempt at an abap routine so please be kind. As I mentioned before, the key fields (znotif and 0calday) are getting populated, but the only data field getting populated is the key figure which contains the routine with the return table (znotifout in this example).
Also, if you notice, I commented out the line: RESULT_TABLE = ICUBE_VALUES because I wasn't getting any data field values from the ICUBE_VALUES structure. So I used the COMM_STRUCTURE instead.
At the moment, I am not concerned with the month differences that span across years. I will tackle that issue later unless you know of a way to calculate month differences between dates.
I'm sure I've broken all kinds of ABAP rules but if you or anyone else could educate me, I would be most appreciative.
Thanks,
John
DATA: ENTER_DATE LIKE COMM_STRUCTURE-/BIC/ZENTER_DT,
COMP_DATE LIKE COMM_STRUCTURE-/BIC/ZCOMP_DT,
ENTER_DATE_YR(4) TYPE N,
ENTER_DATE_MO(2) TYPE N,
ENTER_DATE_DY(2) TYPE N,
COMP_DATE_YR(4) TYPE N,
COMP_DATE_MO(2) TYPE N,
COMP_DATE_DY(2) TYPE N,
DATE_DIFF TYPE N.
* RESULT_TABLE = ICUBE_VALUES .
MOVE-CORRESPONDING COMM_STRUCTURE TO RESULT_TABLE.
MOVE RESULT_TABLE-/BIC/ZENTER_DT(4) TO ENTER_DATE_YR.
MOVE RESULT_TABLE-/BIC/ZENTER_DT+4(2) TO ENTER_DATE_MO.
MOVE RESULT_TABLE-/BIC/ZENTER_DT+6(2) TO ENTER_DATE_DY.
MOVE RESULT_TABLE-/BIC/ZCOMP_DT(4) TO COMP_DATE_YR.
MOVE RESULT_TABLE-/BIC/ZCOMP_DT+4(2) TO COMP_DATE_MO.
MOVE RESULT_TABLE-/BIC/ZCOMP_DT+6(2) TO COMP_DATE_DY.
DATE_DIFF = COMP_DATE_MO - ENTER_DATE_MO - 1.
DO DATE_DIFF TIMES.
ENTER_DATE_MO = ENTER_DATE_MO + 1.
CONCATENATE ENTER_DATE_YR ENTER_DATE_MO ENTER_DATE_DY INTO
RESULT_TABLE-CALDAY.
RESULT_TABLE-/BIC/ZNOTIFOUT = 1 .
APPEND RESULT_TABLE .
ENDDO.
ENTER_DATE_MO = ENTER_DATE_MO + 1 .
CONCATENATE ENTER_DATE_YR ENTER_DATE_MO ENTER_DATE_DY INTO
RESULT_TABLE-CALDAY.
RESULT_TABLE-/BIC/ZNOTIFOUT = 0 .
RESULT_TABLE-/BIC/ZNOTIFCOM = 1 .
APPEND RESULT_TABLE .
* if abort is not equal zero, the update process will be canceled
ABORT = 0.
Answer:
if you're using return tables you need to fill your characteristics in the table as well (not via the "normal" way).
cheers,
El Belgio
Answer:
you need to fill your characteristics in the table as well (not via the "normal" way).
could you be more specific? Must all characteristics and keyfigures be assigned in the code?
Thanx, David
Answer:
yep
what you're doing is replacing the individual rules by an internal table, so everything needs to be in that internal table.
cheers,
El Belgio
Answer:
you have a table like this
key1 attriba attribb attribc
what you are trying to do is to split it into
key1a attriba attribb attribc
key1b attriba attribb attribc
key1c attriba attribb attribc
what your code actually do is
key1a attriba attribb attribc
key1b
key1c
because you forgot to move attriba attribb attribc to the newly created record
'hope the belgian team made it clear
Ch
Answer:
The only way I was able to update all the data fields for each record was to have a return table routine for each data field in the update rules. The routines are identical except for the statement that updates the target data field before appending the result table. When I try to update multiple data fields in one routine, only the data field that contains the routine is being updated.
Please help if you can. Maintaining multiple routines is a pain in the A.
Gracias.
Answer:
I resolved the problem with splitting in Start Routine.....in the update rules the only way is maintaining multiple routines !!!!!
_________________
Sorry for my english!!!!!