on 06-06-2011 3:25 PM
Hello Experts,
I need your help in programming a routine in a dtp.
I have a DSO and want to load this data into a Cube. But I just want to load data if month of the first date (0bill_date) is not equal with the month of the second date (0serv_date).
Can anybody help me to create the coding?
thanks, but this does not work. now no data gets into the cube. before, just by comparing the two dates, everything worked fine. What can be the problem?
here you can see current coding:
$$ begin of routine - insert your code only below this line -
... "insert your code here
*-- fill table "MONITOR" with values of structure "MONITOR_REC"
*- to make monitor entries
... "to cancel the update process
raise exception type CX_RSROUT_ABORT.
DATA: v_rec LIKE sy-tabix.
LOOP AT SOURCE_PACKAGE ASSIGNING <source_fields>.
v_rec = sy-tabix.
IF <source_fields>-bill_date+4(2) EQ
<source_fields>-serv_date+4(2).
DELETE SOURCE_PACKAGE INDEX v_rec.
ENDIF.
ENDLOOP.
$$ end of routine - insert your code only before this line -
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you have to check the records coming from the source. the code is fine.
As per the logic used the records with same month in Bill date and serv date will be deleted.
Just make sure you have data at the source where month in Bill date and serv date is different.
If all the records in the source have same month for BIll date and Serv date then you would get zero records only.
--- Thanks...
i have stopped trying to delete lines from a package using an index.
for some reason removing lines reshuffles the package i guess.
what i usually do is creating an extra table l_t_result
whicj i populate with the lines i want to pass
at the end of the start routine (or end routine) i replace the source_package with the table l_t_result
Marco
Perfect, it works!
Just one more thing: routine currently compares the two dates. But I have to compare the monhs of the two dates (MM.YYYY).
How can I solve this problem?
regards
Jesper
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
some further questions :
- Do I need coding in global part?
- how to define "V_REC" ?
Actual Coding in start routine is as follows:
$$ begin of global - insert your declaration only below this line -
... "insert your code here
$$ end of global - insert your declaration only before this line -
METHODS
start_routine
IMPORTING
request type rsrequest
datapackid type rsdatapid
EXPORTING
monitor type rstr_ty_t_monitors
CHANGING
SOURCE_PACKAGE type tyt_SC_1
RAISING
cx_rsrout_abort.
METHODS
inverse_start_routine
IMPORTING
i_th_fields_outbound TYPE rstran_t_field_inv
i_r_selset_outbound TYPE REF TO cl_rsmds_set
i_is_main_selection TYPE rs_bool
i_r_selset_outbound_complete TYPE REF TO cl_rsmds_set
i_r_universe_inbound TYPE REF TO cl_rsmds_universe
CHANGING
c_th_fields_inbound TYPE rstran_t_field_inv
c_r_selset_inbound TYPE REF TO cl_rsmds_set
c_exact TYPE rs_bool.
ENDCLASS. "routine DEFINITION
$$ begin of 2nd part global - insert your code only below this line *
... "insert your code here
$$ end of 2nd part global - insert your code only before this line *
----
CLASS routine IMPLEMENTATION
----
*
----
CLASS lcl_transform IMPLEMENTATION.
----
Method start_routine
----
Calculation of source package via start routine
----
<-> source package
----
METHOD start_routine.
*=== Segments ===
FIELD-SYMBOLS:
<SOURCE_FIELDS> TYPE tys_SC_1.
DATA:
MONITOR_REC TYPE rstmonitor.
$$ begin of routine - insert your code only below this line -
... "insert your code here
*-- fill table "MONITOR" with values of structure "MONITOR_REC"
*- to make monitor entries
... "to cancel the update process
raise exception type CX_RSROUT_ABORT.
loop at source_package assigning <source_fields>.
v_rec = sy-tabix.
if <source_fields>-bill_date EQ <source_fields>-serv_date.
delete source_package index v_rec.
endloop.
$$ end of routine - insert your code only before this line -
ENDMETHOD. "start_routine
I am really an abap noob. Sorry for those questions....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
more or less....
start routine:
loop at source_package assignig <source_fields>
v_rec = sy-tabix.
if <source_fields>-bill_date EQ <source_fields>-serv_date.
delete source_package index v_rec.
endloop.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Arminder,
thank you for this hint.
Can you give me a quick impression of the abap code in start routine?
Regards
Jesper
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Instead of doing this in a DTP you can achieve the same in the start routine as well, just loop on the source package and convert the two dates into months and check them, if they are same then delete source_package for that record.
Regards,
Arminder
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.