06-23-2008 9:09 AM
Hi ,
Please give me the logic as my requirement is very urgent/
I have a z table which have reason code as a field. DB table is
TFDM_WRITEOFF02.
If there is a new reason code entry, a check needs to be invoked to see if the reason code has a GL account associated with it in the table TFDM_WRITEOFF02 on the R/3 side. If it doesnu2019t, an error message saying u2018Reason code does not have a GL account associated with itu2019 needs to be thrown.
Give me the logic how to write this condition.
Points wil be awarded.
Regards
Sindhu
06-23-2008 9:13 AM
Hi there..
select single glaccount
from table TFDM_WRITEOFF02
into vl_glaccount
where reason_code eq reason code.
if sy-subrc NE 0.
message e001(Message class).
endif.
06-23-2008 9:13 AM
06-23-2008 9:18 AM
Hi ,
Please find belwo logic for ur requirement.
revrt back if any issues.
select REASON_CODE from ZTABLE into table itab < where =... > .
select REASON_CODE GL_ACCOUNT from table TFDM_WRITEOFF02 into table itab2
< where =... > .
--> now Itab contains reason codes.
--> now Itab2 contains gl_accounts.
loop at itab.
At new REASON_CODE. ( i.e whenever new reason code entry )
read table itab2 into wa2 with key
REASON_CODE = itab-REASON_CODE.
if sy-subrc = 0.
if wa2-gl_account is initial. ( i.e no Gl a/c associated with reason code)
message E(001) . (u2018Reason code does not have a GL account associated with itu2019 )
endif.
endif.
end at.
endloop.
Regards,
naveen
06-23-2008 3:11 PM
Try writing the Code yourself and use the F1 key or SAP Help. You might amaze yourself at what you can learn. If you still have problems, then post a thread.