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 read data AT END OF using two fields

former_member459142
Participant
0 Kudos

Hi

i have a itab which have matnr , plant and many fields

i m using


AT END OF MATNR.
.............
ENDAT.

here condition on only MATNR

i want condition on PLANT also

so how i read this itab using MATNR and PLANT using AT END OF

thanks

1 ACCEPTED SOLUTION

santosh_kumarm
Participant
0 Kudos

Hi Prashant,

use the below logic for your requriement. control break statements work with one key fields.

for multiple key fields you have to use another logic.

use the below logic for your requirement

data : lv_matnr like mara-matnr,

lv_werks like marc-werks.

clear : lv_matnr , lv_werks.

loop at itab.

at first.

lv_matnr = itab-matnr.

lv_werks = itab-werks.

endat.

if lv_matnr ne itab-matnr and lv_werks ne itab-werks.

<write logic for your process>.

lv_matnr = itab-matnr.

lv_werks = itab-werks.

else.

<write logic for your process>.

endif.

endloop.

hope it shall be useful.

Regards

Santosh.

Edited by: Santosh Kumar on Apr 22, 2009 9:03 AM

6 REPLIES 6

Former Member
0 Kudos

Hi

First field of internal table should be MATNR and second field is PLANT then

use like this

At END oF PLANT

-


endat

Kiran

santosh_kumarm
Participant
0 Kudos

Hi Prashant,

use the below logic for your requriement. control break statements work with one key fields.

for multiple key fields you have to use another logic.

use the below logic for your requirement

data : lv_matnr like mara-matnr,

lv_werks like marc-werks.

clear : lv_matnr , lv_werks.

loop at itab.

at first.

lv_matnr = itab-matnr.

lv_werks = itab-werks.

endat.

if lv_matnr ne itab-matnr and lv_werks ne itab-werks.

<write logic for your process>.

lv_matnr = itab-matnr.

lv_werks = itab-werks.

else.

<write logic for your process>.

endif.

endloop.

hope it shall be useful.

Regards

Santosh.

Edited by: Santosh Kumar on Apr 22, 2009 9:03 AM

Former Member
0 Kudos

if u want to use

AT END OF MATNR

then in ur table itab WERKS should come before MATNR.

SORT ITAB BY WERKS MATNR.

now u can use

AT END OF MATNR.

By this it will automatically take into consideration plant as well. In fact whatever fields are there before material no. in ur table structure the end of will be trigerred on those as well. So if u want only plant and matnr, then keep werks as 1st field and matnr as 2nd field.

Former Member
0 Kudos

hi

at end of matnr

at end of plant.

endat.

endat .

hope it will work.

Former Member
0 Kudos

AT END OF MATNR.

  • Write your code.

AT END OF PLANT.

  • Write your code.

ENDAT.

ENDAT.

Regards,

Joan

0 Kudos

Hi,

You can write it as :

AT END OF MATNR.

  • Write your code.

ENDAT.

AT END OF PLANT.

  • Write your code.

ENDAT.

If value of PLANT MATNR changes the part will be executed.

Hope it helps.

Regards,

Komal