Application Development and Automation 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: 
Read only

urgent help

Former Member
0 Likes
975

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
915

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

7 REPLIES 7
Read only

Former Member
0 Likes
915

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!

Read only

Former Member
0 Likes
916

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

Read only

0 Likes
915

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

Read only

0 Likes
915

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

Read only

Former Member
0 Likes
915

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

Read only

Former Member
0 Likes
915

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

Read only

Former Member
0 Likes
915

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.