cancel
Showing results for 
Search instead for 
Did you mean: 

Start Routine

Former Member
0 Kudos

Hi,

I searhed all the threads could not get a solution . i written start routine with help of ABAPer. i have some syntax error .

i know If it is standard ODS (0fiar_o03)code below like this.

data : i_fiar like /BI0/AFIAR_O0300,

Can any one guide me how to write above code if it customized ODS(ZFIAP_O3).

Regards

Rk

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

It will be same.

i_fiar like /BI0/aZFIAP_O300.

Or you may define one table using fields and then type.

TYPES: BEGIN OF table1,

field 1 TYPE /bic/aZFIAP_O300-/bic/Info Obgect1,

field 2 TYPE /bic/aZFIAP_O300-/bic/Info Object 2,

END OF table1.

DATA: i_fiar like table1

I hopw it will work.

Thanks,

S

Former Member
0 Kudos

Hi,

Thank you very much for your reply.

Regards

Rk

Former Member
0 Kudos

Hi,

i written code and getting below error.Can you please guide me.

E:Field "FISCYEAR" unknown

data : i_tab like DATA_PACKAGE,
         it_tab like TABLE OF i_tab,
         it_tab1 like TABLE OF i_tab.
  data : i_fiar like /BIc/AzFIAp_O300,
         it_fiar LIKE TABLE OF i_fiar.
  data : loopx LIKE sy-tabix.


  refresh : it_tab, it_fiar, it_tab1.

  it_tab[] = DATA_PACKAGE[].
  it_tab1[] = it_tab[].
  DELETE it_tab1 where INV_DOC_NO is INITIAL.
  sort it_tab1 by INV_DOC_NO inv_item comp_code inv_year.
  delete ADJACENT DUPLICATES FROM it_tab1
      COMPARING INV_DOC_NO inv_item comp_code inv_year.

  if not it_tab1[] is INITIAL.
    SELECT *
      from /BIc/AzFIAp_O300
      into TABLE it_fiar
      FOR ALL ENTRIES IN it_tab1
      where AC_DOC_NO = it_tab1-inv_doc_no
      and   item_num  = it_tab1-inv_item
      and   comp_code = it_tab1-comp_code
      and   fiscyear  = it_tab1-inv_year.

    sort it_fiar by AC_DOC_NO item_num comp_code fiscyear.
  endif.

  

loop at it_tab into i_tab where INV_DOC_NO is not INITIAL.

loopx = sy-tabix.

clear : i_fiar.

READ TABLE it_fiar into i_fiar with key ac_doc_no = i_tab-inv_doc_no

item_num = i_tab-inv_item comp_code = i_tab-comp_code

fiscyear = i_tab-inv_year BINARY SEARCH.

if sy-subrc eq 0.

i_tab-DOC_DATE = i_fiar-DOC_DATE.

i_tab-netdueDATE = i_fiar-netdueDATE.

modify it_tab FROM i_tab INDEX loopx TRANSPORTING doc_date

netduedate.

endif.

endloop.

  refresh : DATA_PACKAGE.
  DATA_PACKAGE[] = it_tab[].

* 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.

Edited by: rama krishan on Jul 8, 2010 11:59 AM

Answers (1)

Answers (1)

former_member181964
Active Contributor
0 Kudos

Hi,

Start Routine:

The start routine is run for each data package at the start of the transformation. The start routine has a table in the format of the source structure as input and output parameters. It is used to perform preliminary calculations and store these in a global data structure or in a table. This structure or table can be accessed from other routines. You can modify or delete data in the data package.

Eg:

Suppose you are loading some records from an ODS to one Infocube,there are around 1000 Account number,but you want to exclude 5 Account numbers,so you can write a Start routine where you will delete all records related to these account numbers

http://help.sap.com/saphelp_nw2004s/helpdata/en/43/c3963dfbde4dede10000000a422035/content.htm

Using Lookup Code you can do it. See the below sample code, I have data in another DSO1, but while loading to different DSO2, I'm refering the DSO1 and bringing the Data from DSO1 and loading into DSO2.

Write the code like below in BW 3.5.

DATA: BEGIN OF t_batch OCCURS 0,
	material LIKE /BIC/AZIC_O0600-material,
	plant LIKE /BIC/AZIC_O0600-plant,
	stor_loc LIKE /BIC/AZIC_O0600-stor_loc,
	batch LIKE /BIC/AZIC_O0600-batch.
      END OF t_batch.


SELECT MATERIAL PLANT STOR_LOC BATCH FROM /BIC/AZIC_O0600 INTO t_batch for all entries in DATA_PACKAGE
WHERE
 material = DATA_PACKAGE-material  and
 plant    = DATA_PACKAGE-PLANT     and
 stor_loc = DATA_PACKAGE-stor_loc.

 ABORT = 0.



"This code is at field level routine.

SORT t_batch by material batch stor_loc.

Read table t_btach with key material = COMM_STRUCTURE-material
                            plant    = COMM_STRUCTURE-plant    
                            stor_loc = COMM_STRUCTURE-stor_loc.

If sy-subrc = 0.

  RESULT = t_batch-PLANT.

else.
  RESULT = ''.
endif.

ENDIF.

ENDLOOP.

http://help.sap.com/saphelp_nw2004s/helpdata/en/43/c3963dfbde4dede10000000a422035/content.htm

Thanks

Reddy