2006 Sep 08 11:01 AM
hi Friends,
Could u Please help me How to do This
LOOP at the results from the first step to select all records from table CDPOS where
OBJECTCLAS = CDHDR-OBJECTCLAS
AND OBJECTID = CDHDR-OBJECTID
AND CHANGENR = CDHDR-CHANGENR
AND TABNAME in S_TAB_NM
AND FNAME in S_FLD_NM
AND CHNGIND = CDHDR-CHNGIND
- do NOT retrieve ANY field!
IF at least one record is found (SY-SUBRC = 0)
THEN
save CDHDR-OBJECTID to an internal table
ELSE
Ignore the corresponding CDHDR record
ENDIF
ENDLOOP
IF some records have been saved during the above check
THEN
Remove duplicate condition numbers from table of saved records
ELSE
Create a trailer record with zero count
WRITE the validation report showing only the null trailer details
EXIT the program
ENDIF
I have Little Bit Confusion In this Help me how to do this
Please urgent
Regards
Srilavi
2006 Sep 08 11:06 AM
select OBJECTID CHANGENR
from CDHDR
into corresponding fields of table IT_CDHDR
where OBJECTCLAS = 'MATERIAL'
and UDATE = P_DATE.
if SY-SUBRC eq 0.
select OBJECTID from CDPOS into table
IT_CDPOS
for all entries in IT_CDHDR
where OBJECTCLAS eq 'MATERIAL' and
OBJECTID eq IT_CDHDR-OBJECTID and
CHANGENR eq IT_CDHDR-CHANGENR and
TABNAME in S_TAB_NM and
FNAME in S_TAB_NM and
( CHNGIND eq 'I' or CHNGIND eq 'U' ).
sort it_cdpos.
DELETE adjacent duplicates from it_cdpos.
describe table it_cdpos lines lrec.
if lrec = 0.
Create a trailer record with zero count
WRITE the validation report showing only the null
trailer details
EXIT.
ELSE.
Other processing logic
ENDIF
Message was edited by: Anurag Bankley
hi Friends,
Could u Please help me How to do This
LOOP at the results from the first step to select all records from table CDPOS where
OBJECTCLAS = CDHDR-OBJECTCLAS
AND OBJECTID = CDHDR-OBJECTID
AND CHANGENR = CDHDR-CHANGENR
AND TABNAME in S_TAB_NM
AND FNAME in S_FLD_NM
AND CHNGIND = CDHDR-CHNGIND
- do NOT retrieve ANY field!
IF at least one record is found (SY-SUBRC = 0)
THEN
save CDHDR-OBJECTID to an internal table
ELSE
Ignore the corresponding CDHDR record
ENDIF
ENDLOOP
IF some records have been saved during the above check
THEN
Remove duplicate condition numbers from table of saved records
ELSE
Create a trailer record with zero count
WRITE the validation report showing only the null trailer details
EXIT the program
ENDIF
I have Little Bit Confusion In this Help me how to do this
Please urgent
Regards
Srilavi
2006 Sep 08 11:05 AM
u can make join for given condn between <b>CDHDR</b>and <b>CDPOS</b> and retreive data into single itab.
in place of this
LOOP at the results from the first step to select all records from table CDPOS where
OBJECTCLAS = CDHDR-OBJECTCLAS
AND OBJECTID = CDHDR-OBJECTID
AND CHANGENR = CDHDR-CHANGENR
AND TABNAME in S_TAB_NM
AND FNAME in S_FLD_NM
AND CHNGIND = CDHDR-CHNGIND
- do NOT retrieve ANY field!
2006 Sep 08 11:06 AM
select OBJECTID CHANGENR
from CDHDR
into corresponding fields of table IT_CDHDR
where OBJECTCLAS = 'MATERIAL'
and UDATE = P_DATE.
if SY-SUBRC eq 0.
select OBJECTID from CDPOS into table
IT_CDPOS
for all entries in IT_CDHDR
where OBJECTCLAS eq 'MATERIAL' and
OBJECTID eq IT_CDHDR-OBJECTID and
CHANGENR eq IT_CDHDR-CHANGENR and
TABNAME in S_TAB_NM and
FNAME in S_TAB_NM and
( CHNGIND eq 'I' or CHNGIND eq 'U' ).
sort it_cdpos.
DELETE adjacent duplicates from it_cdpos.
describe table it_cdpos lines lrec.
if lrec = 0.
Create a trailer record with zero count
WRITE the validation report showing only the null
trailer details
EXIT.
ELSE.
Other processing logic
ENDIF
Message was edited by: Anurag Bankley
2006 Sep 08 11:12 AM
hi Anurag,
then how to do for this
IF at least one record is found (SY-SUBRC = 0)
THEN
save CDHDR-OBJECTID to an internal table
ELSE
Ignore the corresponding CDHDR record
ENDIF
ENDLOOP
IF some records have been saved during the above check
THEN
Remove duplicate condition numbers from table of saved records
ELSE
Create a trailer record with zero count
WRITE the validation report showing only the null trailer details
EXIT the program
ENDIF
I have Little Bit Confusion In this Help me how to do this
Please urgent
Regards
Srilavi
2006 Sep 08 11:14 AM
IF at least one record is found (SY-SUBRC = 0)
THEN
save CDHDR-OBJECTID to an internal table
ELSE
Ignore the corresponding CDHDR record
ENDIF
ENDLOOP
IF some records have been saved during the above check
THEN
Remove duplicate condition numbers from table of saved records
The whole of above part is taken care in the SELECT from CDPOS and the couple of statements after that where it deletes the duplicates etc.
Regards
Anurag
Please assign points for helpful answers
Message was edited by: Anurag Bankley
2006 Sep 08 11:08 AM
loop at results where
OBJECTCLAS = CDHDR-OBJECTCLAS
AND OBJECTID = CDHDR-OBJECTID
AND CHANGENR = CDHDR-CHANGENR
AND TABNAME in S_TAB_NM
AND FNAME in S_FLD_NM
AND CHNGIND = CDHDR-CHNGIND.
exit.
endloop.
if sy-subrc = 0. "If at least one record is found
move CDHDR-OBJECTID to itab-objectid.
append itab.
clear itab.
endif.
if not itab[] is initial.
delete adjacent duplicates from itab.
else.
write:/ 'no records found'.
exit.
endif.
Regards,
ravi
2006 Sep 08 11:10 AM
Hi
Here it goes...
loop at itab.
clear flg_found.
select .....
from CDPOS
where <conditions>
flg_found = 'X'.
endselect.
if flg_found = 'X'.
move itab-CDHDR to itab1-CDHDR.
append itab1.
clear itab1.
endif.
endloop.
if not itab1[] is initial.
sort itab1 by CDHDR.
delete adjacent duplicates from itab1 comparing CDHDR.
else.
<Create Trailer record with zero count>
endif.
<Write Trailer records...>
Hope it helps...
Regards,
Raj
2006 Sep 08 11:24 AM
Hi,
TABLES:CDPOS,CDHDR.
DATA:BEGIN OF ITAB OCCURS 0,
OBJECTID LIKE CDHDR-OBJECTID,
END OF ITAB.
DATA:COUNT TYPE I.
SELECT-OPTIONS:S_TAB_NM FOR CDPOS-TABNAME,
S_FLD_NM FOR CDPOS-FNAME.
SELECT * FROM CDPOS
WHERE
OBJECTCLAS = CDHDR-OBJECTCLAS
AND OBJECTID = CDHDR-OBJECTID
AND CHANGENR = CDHDR-CHANGENR
AND TABNAME IN S_TAB_NM
AND FNAME IN S_FLD_NM
AND CHNGIND = CDHDR-CHANGE_IND.
endselect.
<b>IF at least one record is found (SY-SUBRC = 0)
THEN
save CDHDR-OBJECTID to an internal table
ELSE
Ignore the corresponding CDHDR record
ENDIF</b>
IF SY-SUBRC = 0.
CDHDR-OBJECTID = ITAB-OBJECTID.
APPEND ITAB.
CLEAR ITAB.
ENDIF.
<b>IF some records have been saved during the above check
THEN
Remove duplicate condition numbers from table of saved records
ELSE
Create a trailer record with zero count
WRITE the validation report showing only the null trailer details
EXIT the program
ENDIF</b>
IF ITAB[] IS NOT INITIAL.
SORT ITAB BY OBJECTID.
DELETE ADJACENT DUPLICATES FROM ITAB COMPARING OBJECTID.
COUNT = COUNT + 1.
ELSE.
WRITE:/ 'no duplicates found, count 0'.
EXIT.
ENDIF.
Regards,
Sowjanya.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |