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

Validation restriction in Customer master

Former Member
0 Likes
1,356

Hi All.

I have done validation for Customer master XD01,XD02) in class” IF_EX_CUSTOMER_ADD_DATA~CHECK_ALL_DATA” .

It ‘s working fine but same validation are getting triggered for “Create contact person”(VAP1/VAP2) also.

Because, that class is called in both program. So how can do restriction here ? my code should work when customer master is create/changed.

Please help me to restrict my code.

Thanks.

NJ

Hi All.

I have done validation for Customer master XD01,XD02) in class” IF_EX_CUSTOMER_ADD_DATA~CHECK_ALL_DATA” .

It ‘s working fine but same validation are getting triggered for “Create contact person”(VAP1/VAP2) also.

Because, that class is called in both program. So how can do restriction here ? my code should work when customer master is create/changed.

Please help me to restrict my code.

Thanks.

NJ

5 REPLIES 5
Read only

former_member219762
Contributor
0 Likes
865

Hi Nagraj,

          Check Transaction code SY-TCODE in your implementation.

Regards,

Sreenivas.

Read only

0 Likes
865

Hi Sree.

Thanks for your reply..Restriction by tcode will do if no any other options..right?  sametime i am not sure where ever it will affect .

regards.

NJ

Read only

0 Likes
865

Hi NJ,

I dont think there is any mistake in restricting it based on Sy-Tcode. If you are not sure from where else this is being triggered then do a negative check like

if sy-tcode NE VAP1 or VAP2

endif.

Regards,

Swarna

Read only

Former Member
0 Likes
865

Hi Nagaraj,

U could use a select query and get the records from CDHDR table and do the validation based on that value.

      SELECT objectclas

            objectid

            changenr

             udate

            tcode

            FROM cdhdr

            INTO TABLE gt_cdhdr

            FOR ALL ENTRIES IN gt_cust

            WHERE objectclas  EQ 'DEBI'

            AND objectid = gt_cust-kunnr

            AND change_ind IN ('U','I')

            AND udate   IN r_date

            AND tcode IN ('XD01','XD02').

Hope it helps.

Regards,

Adithi

Read only

RaymondGiuseppi
Active Contributor
0 Likes
865

You could memorize in an instance attribute of your implementation class the initial values of those fields (in a method like READ_ADD_ON_DATA) and in CHECK_ALL_DATA check first if data was changed.

But if the customer data are no longer valid, you could raise at least a warning message to inform current user ?

Regards,

Raymond