Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to find the changed fields in material master?

former_member806437
Participant
0 Kudos
1,425

Hi all,

I am new to SAP. Please help me in resolving the below issue.

I want to find the changes in material master of particular fields and upload a file on application server using AL11.

I tried to find the material changes using CDHDR. But the problem is how can I upload a file only when particular required fields are changed but not all the fields.

Thanks in advance.

1 ACCEPTED SOLUTION

venkateswaran_k
Active Contributor
1,023

Hi

Use the following query to get the output of changes - (alter it according to your requirement )

DATA : it_cdpos type STANDARD TABLE OF cdpos WITH HEADER LINE,
wa_cdpos type cdpos.

Ranges: s_fields for cdpos-fname.

select * into it_cdpos from cdhdr as a INNER JOIN cdpos as b on ( a~changenr = b~changenr )
WHERE a~objectclas = 'MATERIAL' AND a~objectid = <your material no> and
b~fname in s_fields and b~changind = 'U'.

The above it_cdpos will gives you list of materials that are changed.

Customize the where clause of cdhdr according to your requirement

5 REPLIES 5

Astashonok
Participant
0 Kudos
1,023

not clear. You are making an upload when the field on material master changes? Field change is your trigger?

former_member806437
Participant
0 Kudos
1,023

Yes, a file has to be uploaded when there is a change in data ( description , colour, chromaticty , weight etc ). But there are some fields whose data change I don't want to consider.

venkateswaran_k
Active Contributor
0 Kudos
1,023

Hi

Do you know what are all the fields you need to monitor. If so you can take them comparing CDHDR and CDPOS table

former_member806437
Participant
0 Kudos
1,023

Yes. There are about 25 to 27 fields.

May I know how can it be compared?

venkateswaran_k
Active Contributor
1,024

Hi

Use the following query to get the output of changes - (alter it according to your requirement )

DATA : it_cdpos type STANDARD TABLE OF cdpos WITH HEADER LINE,
wa_cdpos type cdpos.

Ranges: s_fields for cdpos-fname.

select * into it_cdpos from cdhdr as a INNER JOIN cdpos as b on ( a~changenr = b~changenr )
WHERE a~objectclas = 'MATERIAL' AND a~objectid = <your material no> and
b~fname in s_fields and b~changind = 'U'.

The above it_cdpos will gives you list of materials that are changed.

Customize the where clause of cdhdr according to your requirement