‎2008 Jul 08 11:09 AM
Hello Experts,
Can any one tell me how to
print the exception list of fields for which a match is not found in the below select statement.
SELECT b.fieldnm
FROM YRDBFH010 a, RSOSFIELDMAP b
where 1=1
and a.SOURCESYSTEM = b.LOGSYS
and a.datasource = b.oltpsource
and b.objvers = 'A'
and rtrim(a.sourcesystem)||rtrim(a.datasource) = :p_src_ds and a.psa_id like :p_psa_id
and b.iobjnm in ('0MATL_TYPE','0STOR_LOC','0SALESORG','0SHIP_TO', '0MATERIAL', 'YRDBMUG1', '0PLANT', '0COMP_CODE', '0SOLD_TO', '0DISTR_CHAN', '0DIVISION')
Points will be rewarded.
Thanks,
Varun
‎2008 Jul 08 11:24 AM
Hi Varun
try with follows,
SELECT fieldnm
FROM YRDBFH010
WHERE fieldnm NOT IN (SELECT b.fieldnm
FROM YRDBFH010 a, RSOSFIELDMAP b
where 1=1
and a.SOURCESYSTEM = b.LOGSYS
and a.datasource = b.oltpsource
and b.objvers = 'A'
and rtrim(a.sourcesystem)||rtrim(a.datasource) = :p_src_ds and a.psa_id like :p_psa_id
and b.iobjnm in ('0MATL_TYPE','0STOR_LOC','0SALESORG','0SHIP_TO', '0MATERIAL', 'YRDBMUG1', '0PLANT', '0COMP_CODE', '0SOLD_TO', '0DISTR_CHAN', '0DIVISION'))
I DONT HAVE YOUR FIELDS AND TABLE
SELECT WHAT YOU WANT IN THE TABLE AND USE WHERE CONDITION WITH NOT IN THEN PUT YOUR SELECT STATEMENT
REWARDS IF HELPFUL
‎2008 Jul 08 11:50 AM
Still I am not able to understand..could u please explain me still more clearly.
‎2008 Jul 08 11:59 AM
If i understand correctly...your requirement is to run a select statement....and then after the execution, you want to know for which fields did you select statement did not find a match and failed.
you can't know this directly from the select statement. Probably the best way to do it will be to select the data in the program (in an internal table) and then loop on that internal table (or read it as the case may be) to see if it contains the values you want to check.
if this is not your requirement...request you to please re-phrase it and make it a bit clearer
‎2008 Jul 08 12:10 PM
Hi
Try this...
SELECT b.fieldnm
FROM YRDBFH010 a, RSOSFIELDMAP b into wa_fieldnm
where 1=1
and a.SOURCESYSTEM = b.LOGSYS
and a.datasource = b.oltpsource
and b.objvers = 'A'
and rtrim(a.sourcesystem)||rtrim(a.datasource) = :p_src_ds and a.psa_id like :p_psa_id
and b.iobjnm in ('0MATL_TYPE','0STOR_LOC','0SALESORG','0SHIP_TO', '0MATERIAL', 'YRDBMUG1', '0PLANT', '0COMP_CODE', '0SOLD_TO', '0DISTR_CHAN', '0DIVISION')
if sy-subrc <> 0
append wa_fieldnm.
endif.
endselect.
Where wa_fieldnm has a field which is of type b.fieldnm
Regards
Abaper
‎2008 Jul 08 12:18 PM
Hi
Try this...
SELECT b.fieldnm
FROM YRDBFH010 a, RSOSFIELDMAP b into wa_fieldnm
where 1=1
and a.SOURCESYSTEM = b.LOGSYS
and a.datasource = b.oltpsource
and b.objvers = 'A'
and rtrim(a.sourcesystem)||rtrim(a.datasource) = :p_src_ds and a.psa_id like :p_psa_id
and b.iobjnm in ('0MATL_TYPE','0STOR_LOC','0SALESORG','0SHIP_TO', '0MATERIAL', 'YRDBMUG1', '0PLANT', '0COMP_CODE', '0SOLD_TO', '0DISTR_CHAN', '0DIVISION')
if sy-subrc <> 0 .
append wa_fieldnm.
endif.
endselect.
Where wa_fieldnm has a field which is of type b.fieldnm
Regards
Abaper
‎2008 Jul 08 12:44 PM
Still not getting anything..Please help
Edited by: Varun prasad on Jul 8, 2008 1:44 PM