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: 

logic needed

Former Member
0 Kudos

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

4 REPLIES 4

former_member156446
Active Contributor
0 Kudos

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.

kesavadas_thekkillath
Active Contributor
0 Kudos

try some thng like "check" table..

Former Member
0 Kudos

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

Former Member
0 Kudos

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.