Question:
I have the same problem as 'flea' from the previous forum regarding the file upload to transc. cube.
In the Z_SEM_BPS_EXIT_FILE_LOAD function, if we chose to overwrite the existing data ( IF 1 = 1. REFRESH lt_data. ), previous/existing data is totally removed even though it's got different character selection.
For example, Jan 2005 -> revenue 100. When we upload the next month for Feb 2005 -> revenue 200, the Jan 2005 revenue becomes zeroed up.
Please help. Thanks.
Answer:
The reason that happens is because in your plannin level you have Jan 2005 as selection or may be you have nothing for Fiscal Year/period. The way to avoid this problem is change the piece of code
IF 1 = 0.
REFRESH lt_data.
ELSE.
lt_data = xth_data.
endif.
This will allow you to add to existing data. Hope this helps
Answer:
The reason that happens is because in your plannin level you have Jan 2005 as selection or may be you have nothing for Fiscal Year/period. The way to avoid this problem is change the piece of code
IF 1 = 0.
REFRESH lt_data.
ELSE.
lt_data = xth_data.
endif.
This will allow you to add to existing data. Hope this helps
Bhavesh Shah
Answer:
The reason that happens is because in your plannin level you have Jan 2005 as selection or may be you have nothing for Fiscal Year/period. The way to avoid this problem is change the piece of code
IF 1 = 0.
REFRESH lt_data.
ELSE.
lt_data = xth_data.
endif.
This will allow you to add to existing data. Hope this helps
Bhavesh Shah
Answer:
Hi,
Thank's for your suggestion. I've tried changing the code as suggested.
IF 1 = 0.
REFRESH lt_data.
ELSE.
lt_data = xth_data.
endif.
But I've just realized that the system doesn't keep the delta if we directly writing to the cube. So, if I tend to replace the existing data, it will just keep adding instead of replacing. For example: first data load is for Jan 2004 -> qty 20. The second load we want to replace qty 20 with 40. The data in the cube will end up Jan 2004 -> qty 60 instead of 40. No delta managed here.
Any idea? Please help. Thank you.
Answer:
Hi,
Change the piece of code in the loop as follows:
LOOP AT gt_file INTO ls_file.
CHECK sy-tabix > 1. " Skip first line with field names
CLEAR ls_data.
MOVE-CORRESPONDING ls_file TO ls_data-s_chas. " Map characteristics
MOVE-CORRESPONDING ls_file TO ls_data-s_kyfs. " Map key figures
*Add
DELETE TABLE lt_data FROM ls_data. "Delete the existing entry
*End of Add
COLLECT ls_data INTO lt_data.
ENDLOOP.
This should take care of your add vs. replace problem.
Let me know how it goes.
Thanks & Regards,
Bhavesh Shah
Answer:
Hi,
Change the piece of code in the loop as follows:
LOOP AT gt_file INTO ls_file.
CHECK sy-tabix > 1. " Skip first line with field names
CLEAR ls_data.
MOVE-CORRESPONDING ls_file TO ls_data-s_chas. " Map characteristics
MOVE-CORRESPONDING ls_file TO ls_data-s_kyfs. " Map key figures
*Add
DELETE TABLE lt_data FROM ls_data. "Delete the existing entry
*End of Add
COLLECT ls_data INTO lt_data.
ENDLOOP.
This should take care of your add vs. replace problem.
Let me know how it goes.
Thanks & Regards,
Bhavesh Shah
Answer:
Wow it works. Big thanks for you, Bhavesh.