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

Error in Asset Acquisition Interface

Former Member
0 Likes
397

Hi All,

We have an Interface which creates an Improvement asset & acquires it. When we see the asset details in AS03, on the Depreciation areas tab, depreciation key was getting blank. This whole process happens using three jobs in sequence.

The last job actually acquires the asset. When I debugged the job, I found that the error was coming from a function module exit. The part of the code which was pdating blank posting key is as below :-

IF sy-tcode = 'ABZON' OR
       sy-tcode = 'ABZO'  OR                                   
       sy-tcode = 'ABNA'  OR                                
       sy-tcode = 'AB01'  OR                                          

      lv_ddate = p_rbzdat.

    ENDIF.

 IF lv_flag = c_x.

    SELECT SINGLE  asset_class
                   fromdate
                   to_date
                   depr_key
           INTO    lwa_zfi_aatimesrs FROM zfi_aatimesrs
           WHERE  asset_class EQ p_anlkl   AND
                  fromdate    LE lv_ddate  AND
                  to_date     GE lv_ddate  AND
                  depr_area   EQ c_15.

    UPDATE anlb
    SET   afasl = lwa_zfi_aatimesrs-depr_key
    WHERE bukrs = p_bukrs
    AND   anln1 = p_anln1
    AND   anln2 = p_anln2
    AND   afabe = c_15.
  ENDIF. 

Here the LV_DATE was not getting populated & SELECT query was getting getting failed & the update statement was updating a blank depreciation key.

Here I cant put a sy-subrc check as the job will get cancelled.

Here there is no sy-tcode because we are using a File on Unix for the third job to run.

One strange thing, I have just put a condition as sy-tcode = ' ' & it is populating the LV_DATE & also the depriciation key.

But my doubt is since this user exit might have been used in many other objects it will have an impact.

Also what will be the SY-TCODE??

Can anybody please suggest a solution.

Regards

Abhii

1 REPLY 1
Read only

Former Member
0 Likes
349

Hello,

As i understood this, you are using an interface and not a particualr T-Code for this and that's the reason for the problem, as T-Code is initial.

As an alternative, check if you can set any not-used field (ex: text field) with a parameter to recognize the source of the Acquisition something like interface number or name. This field should be accessable in your exit.

If you can find something like this, then in your exit, when SY-TCODE is initial, check for this parameter value and if this value is as expected by you, then, you can use the same logic to populate ANLB.

Hope this helps.

Regards,

Pavan