cancel
Showing results for 
Search instead for 
Did you mean: 

Urgent: ABAP routine in transfer rules

Former Member
0 Kudos

Hi,

when i am loading master data from R/3 into BW, i need to filter some records based on material type. there is no option in RSA6 (on R/3) or in Infopackage (BW) to make it available for filter.

So i assume i need to write ABAP routine in transfer rules. can some one help me with ABAP. i need to load the records only when MTART field(material type) in MARA is "FINI" or "RAW" and skip other records.

what is difference between deleting the whole data packet and deleting the record.

Thank you very much in advance

Regards

Emil

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

Write the below code in the start routine of your transfer rules.

Regards

Prakash

DATA: IT_DATA TYPE STANDARD TABLE OF TRANSFER_STRUCTURE

WITH HEADER LINE

WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.

DATA: S_DATA, T_DATA TYPE TRANSFER_STRUCTURE.

LOOP AT DATAPAK INTO S_DATA.

IF S_DATA-MTART EQ 'A' OR S_DATA-MTART EQ 'B'.

MOVE S_DATA TO T_DATA.

DELETE S_DATA.

ELSE.

DELETE S_DATA.

ENDIF.

APPEND T_DATA TO IT_DATA.

ENDLOOP.

CLEAR T_DATA.

DATAPAK[] = IT_DATA[].

Assigning points is a way of saying thanks on SDN!!

Former Member
0 Kudos

Hi Prakash, when i am using the code you have mentioned. i am getting the following error at this line <b>LOOP AT DATAPAK INTO S_DATA.</b>

<b>Error:</b> E:A line of "DATAPAK" and "S_DATA" are not mutually convertible in a Unicode program.

can some one please let me know where i am doing wrong.

thank you

emil

Former Member
0 Kudos

you can do it a lot simpler...

define a range for material type and store the ones you would like to keep

then delete all records from your data package which do not have a material type in that range

ranges: r_mtart for /BI0/PMATERIAL-MATL_TYPE.

r_mtart-sign = 'I'.

r_mtart-option = 'EQ'.

r_mtart-low = <your first value>.

append r_mtart.

r_mtart-low = <your second value>.

append r_mtart.

delete datapak where not matl_type in r_mtart.

Former Member
0 Kudos

use DATA_PAK

/manfred

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

as I undetstand it is - you need records where material type = FINI or RAW , if material type is the field in transfer structure or comm structure then simply write Start Routine in transfer structure / update rules like -

http://help.sap.com/saphelp_nw04/helpdata/en/b3/0ef3e8396111d5b2e80050da4c74dc/frameset.htm

Code will be - delete datapak where "filed" =

hope it helps

regards

Vikash

Former Member
0 Kudos

Hi Emil,

You Can filter by Using start Routine in Transfer Rules.

Gothrough this link

http://help.sap.com/saphelp_nw04/helpdata/en/b3/0ef3e8396111d5b2e80050da4c74dc/content.htm

Thanks,

-Vijay.