cancel
Showing results for 
Search instead for 
Did you mean: 

Routine

Former Member
0 Kudos

Hello, I'm looking for a dtp routine which deletes records. The scenario is we have a open hub which generates a flat file for Fed ex. There are some materials that I do not want to send in my flat file and want to delete in dtp routine. Does anyone have a sample dtp routine with this type of requirement please or help me writing one routine?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

former_member220624
Contributor
0 Kudos

Hi Sunil,

Instead of writing a routine you can eliminate the records using the exclude filter option in the DTP.

Or is there any specific requirement which can only be achieved by a routine?

Regards,

Amit

Answers (2)

Answers (2)

former_member183519
Contributor
0 Kudos

Hello Sunil,

Instead of looping, you can declare ranges table , include material(or whatever field as per your requirement) , then directly use Where Clause to delete those entries...

Sample code:-

Scenario A:-

**declare range table:

Ranges: S_matnr FOR MARA-MATNR.

*** insert material number which you want to delete...

S_matnr-sign = 'I'.

S_matnr-option = 'EQ'.

S_matnr-low = 'Material1'.

APPEND S_matnr.

S_matnr-sign = 'I'.

S_matnr-option = 'EQ'.

S_matnr-low = 'Material2 '.

APPEND S_matnr.

** finally delete those material from Internal table.

DELETE SOURCE_PACKAGE WHERE MATNR IN S_MATNR.

Scenario 2:-

**Delete balnk entries

DELETE SOURCE_PACKAGE WHERE MATNR = ' '.


***all this type of requirement of deletion , write code in START_ROUTINE.

*** avoid Looping on source/result as much as possible



Regards,

Hitesh

karthik_vasudevan
Active Contributor
0 Kudos

Hi Sunil

The deletion of records is possible in transformation level. In DTP level, you can filter out the records that you don't need.

On what condition, you need the deletion/filter to function?

For example, if you don't want to send any blank materials, below is the code which you could use in transformation end routine.

LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS>

DELETE RESULT_PACKAGE IF MATERIAL = ' '.

ENDLOOP.

You can simply filter out blank materials in DTP level. This is a simple scenario. Please give us your condition for deletion, we could work out something

Regards

Karthik

Former Member
0 Kudos

Hello sirs, thanks for your responses. I don't want to use transformation routine and I can not use exclude feature as I have 10 materials to exclude. I'm I had one material I could use exclude but I tried excluding 10 materials and they still go through but dtp exclude works fine for 1 material so that means I have no option but to write a routine in dtp.

Thanks.

karthik_vasudevan
Active Contributor
0 Kudos

Hi Sunil

In DTP filter selections, you could very well use 10 materials to exclude. There will not be any problems at all if you know the material numbers exactly.

As you have tried this and got some issues which you say, could you please give us some more details on this.

We could definitely do this using DTP filter and thats the purpose of having DTP filters

Regards

Karthik

former_member220624
Contributor
0 Kudos

Hi Sunil,

You can very well exclude 10 materials in the DTP filter.

Do you face any problems while doing so ?

If yes,please let us know.

Regards,

Amit

Former Member
0 Kudos

Sir, this is what I did. I put one material number and put it in dtp filter and set it NOT EQUAL to. Ran my process, I got a file without that material. Then I added the other 9 materials and set them all NOT EQUAL TO. Like before but this time dtp ignored my NOT EQUAL TO definition and sent me all materials INCLUDING the 10 that I want to exclude.

Tell me if I am doing something wrong. I get a warning when activating my dtp saying that excluding multiple entries may lead to wrong results.

Please help.

Thanks.

karthik_vasudevan
Active Contributor
0 Kudos

Hi Sunil

The DTP filter will never allow materials as you explained. Could you please share the screenshots of the filter screen and the dtp monitor's header tab screen

Before doing the second load, have you deleted the first load because the first load contains all those 9 materials in it.

Regards

Karthik

Former Member
0 Kudos

Hi Sunil,

I think you deviated from Kathik's advice a little. I believe you have mentioned NOT EQUAL TO in 'Select Single Values' section of multiple selection. What you need to do it mention all your material in 'Exclude Single Values' section of multiple selection. Then you should be fine.

when you mention many NOT EQUAL TO in Select Single Values then the backend operation in system is build with OR and it gives incorrect results. Thats why you have warning .

Thanks

Amit

karthik_vasudevan
Active Contributor
0 Kudos

Good one Amit . That should be the case

former_member183012
Active Contributor
0 Kudos

Hi Sunil,

I am agree with Amit.you can try to exclude 10 materials in DTP filter and check.

Can you try this.

Regards,

Ganesh Bothe