Skip to Content
0

AS02 Update via CALL_TRANSACTION

Oct 13, 2017 at 08:07 PM

52

avatar image
Former Member

Hi all,

Trying to update Asset serial numbers via AS02 call_transaction in a report. For some reason, the SHDB recording I did works perfectly, yet when I use the BDC steps from it in the program, it doesn't work (I gave up on trying to use the std BAPI as it would say that the asset had been updated successfully when it hadn't)

LOOP AT gt_mseg.

REFRESH it_bdcdata.

IF NOT gt_mseg IS INITIAL.

PERFORM bdc_dynpro USING 'SAPLAIST' '0100'.

PERFORM bdc_field USING 'BDC_CURSOR' 'ANLA-ANLN2'.

PERFORM bdc_field USING 'BDC_OKCODE' '=MAST'.

PERFORM bdc_field USING 'ANLA-ANLN1' gt_mseg-anln1.

PERFORM bdc_field USING 'ANLA-ANLN2' '0'.

PERFORM bdc_field USING 'ANLA-BUKRS' gt_mseg-bukrs.

PERFORM bdc_dynpro USING 'SAPLAIST' '1000'.

PERFORM bdc_field USING 'BDC_OKCODE' '=BUCH'.

PERFORM bdc_field USING 'BDC_CURSOR' 'ANLA-SERNR'.

PERFORM bdc_field USING 'ANLA-SERNR' gt_mseg-sernr.

CALL TRANSACTION 'AS02' USING it_bdcdata

MODE 'N'

UPDATE 'A'.

ENDIF.

ENDLOOP.

ENDIF.

*---------------------------------------------------

* form for bdc dynpro

*---------------------------------------------------

FORM bdc_dynpro USING program

dynpro.

CLEAR it_bdcdata.

wa_bdcdata-program = program.

wa_bdcdata-dynpro = dynpro.

wa_bdcdata-dynbegin = 'X'.

APPEND wa_bdcdata TO it_bdcdata.

ENDFORM. "bdc_dynpro

*---------------------------------------------------

* form for bdc field

*---------------------------------------------------

FORM bdc_field USING fnam

fval.

wa_bdcdata-fnam = fnam.

wa_bdcdata-fval = fval.

APPEND wa_bdcdata TO it_bdcdata.

ENDFORM. "bdc_field

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Raymond Giuseppi
Dec 06, 2017 at 07:43 AM
0

The BAPI_FIXEDASSET_CHANGE should have done it (GENERALDATA[X]-SERIAL_NO). Did you get error in RETURN, did you execute BAPI_TRANSACTION_COMMIT when (if) no error returned?

If you stay with BDC

  • Use the MESSAGES INTO itab option in the CALL TRANSACTION statement and check value of sy-subrc after the statement
  • Try mode 'A' or 'E' during test sessions
  • Are you able to change the value for the same asset(s) when executing the transaction?
  • If (when) the dynpro (order subscreens, attachment of fields to subscreens) differs from an asset to another, look for Customizing (or ask functionals) Check Customizing transactions like AOLA and AOLK.
Share
10 |10000 characters needed characters left characters exceeded
Iftah Peretz
Dec 05, 2017 at 10:01 PM
0

Hey,

Use (see here for more):

...
CALL TRANSACTION 'AS02' USING it_bdcdata
MODE 'A'
UPDATE 'A'.
... 

to nrrow down the exact point where your program recording goes haywire.

Share
10 |10000 characters needed characters left characters exceeded