Skip to Content
Author's profile photo Jazib Tariq

Asset Deletion Report through BDC Recording(SM35)

*&———————————————————————*
*& Report  ZAM_Asset_Deletion
*&
*&———————————————————————*
*&
*&
*&———————————————————————*

REPORT  ZAM_Asset_Deletion.

DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.

DATA: BEGIN OF record OCCURS 10,
ANLN1 TYPE ANLA-ANLN1,

ANLN2 TYPE ANLA-ANLN2,

END OF record.

SELECTION-SCREEN BEGIN OF BLOCK abc WITH FRAME TITLE text001.
PARAMETERS: file(128).
SELECTION-
SCREEN END OF BLOCK abc.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR file.
CALL FUNCTION ‘WS_FILENAME_GET’
EXPORTING
mask             = ‘,TXT FILE,*.txt,All Files,*.*. ‘
mode             = ‘o ‘
IMPORTING
filename         = file
EXCEPTIONS
inv_winsys       =
1
no_batch         =
2
selection_cancel =
3
selection_error  =
4
OTHERS           = 5.

***************************************************
*Transfer data from external file to internal table
***************************************************
START-
OF-SELECTION.
CALL FUNCTION ‘WS_UPLOAD’
EXPORTING
filename = file
filetype =
‘DAT’
TABLES
data_tab = record.

*******************************************
*Run Transaction Upload
*******************************************
START-
OF-SELECTION.

LOOP AT record.

PERFORM bdc_dynpro      USING ‘SAPLAIST’ ‘0100’.

PERFORM bdc_field       USING ‘BDC_CURSOR’
‘ANLA-BUKRS’ .

PERFORM bdc_field       USING ‘BDC_OKCODE’
‘=ENTEDEL’ .

PERFORM bdc_field       USING ‘ANLA-ANLN1’
record-
ANLN1 .

PERFORM bdc_field       USING ‘ANLA-ANLN2’
record-
ANLN2 .

  PERFORM bdc_field       USING ANLA-BUKRS’
‘1000’.

*******************************************

PERFORM bdc_dynpro      USING ‘SAPLAIST’ ‘0210’.

PERFORM bdc_field       USING ‘BDC_CURSOR’
‘RA02S-XPHYS’ .

PERFORM bdc_field       USING ‘BDC_OKCODE’
‘=BUCH’ .

PERFORM bdc_field       USING ‘RA02S-XPHYS’
‘X’ .

*******************************************

PERFORM bdc_dynpro      USING SAPLSPO1′ ‘0100’.

PERFORM bdc_field       USING ‘BDC_OKCODE’
=YES’ .

*******************************************
CALL TRANSACTION ‘AS06’ USING bdcdata MODE ‘E’.

REFRESH bdcdata.

ENDLOOP.
*<>******************************************************************************<>*
FORM bdc_field USING fnam fval.
*  IF FVAL <> NODATA.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
*  ENDIF.
ENDFORM.                    “BDC_FIELD

*  Form  BDC_DYNPRO
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-
program  = program.
bdcdata-
dynpro   = dynpro.
bdcdata-dynbegin =
‘X’.
APPEND bdcdata.
ENDFORM.                    “BDC_DYNPRO

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Jürgen Lins
      Jürgen Lins

      Frankly spoken, I call this undocumented coding.

      I can just know from the subject that it is done through SM36 and from the report title that it is about Asset Deletion

      If you create documents, then you can get a badge as Tutor.

      I understand a Tutor to explain the way from a problem to a solution. Just an answer does not teach me much, if I want to delete an equipment, then I can just hope that someone posted such document for equipments

      Author's profile photo Jazib Tariq
      Jazib Tariq
      Blog Post Author

      OK BRO.