cancel
Showing results for 
Search instead for 
Did you mean: 

Creating equipments using BDC

Former Member
0 Kudos

Hi

Have anyone used BDC to create and update equipments?

I am concerned about the performance, we have a volume of 50K per day. I am thinking of using BDC because we have added some fields to the 'Other' tab and we need to send some data into it.

I am unable to use any of the existing function modules like BAPI_EQUI_CREATE or ITOB_EQUI_CREATE because they don't support populating data into the EQUI table extensions. Any help on making the above FMs accept data for extended fields is appreciated.

Thanks

Prasad

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Prasad,

I had created a FM for creating Equipments.

Now as per your requirement, there are 2 ways of doing it:

1. Use BDC as suggested by everyone. This would be simple.

2.

a) Create a ZProgram, and use the FM ITOB_EQUI_CREATE to create an equipment. it will update all related fields in the standard tables for equipment.

b) Update the other fields (in Ztable) using an INSERT COMMAND, after the equipment is created successfully.

Hope it helps....

Lokesh

Pls. reward appropriate points

Former Member
0 Kudos

hi here is the code to create equipment using BDC

INCLUDE BDCRECX1.

TABLES: ANLA.

  • ADDITION TO STANDARD SELECTION SCREEN

SELECTION-SCREEN: BEGIN OF BLOCK A WITH FRAME TITLE TEXT-001.

PARAMETERS :FILENAME LIKE RLGRAP-FILENAME

DEFAULT 'C:\WINDOWS\Desktop\equi.txt'.

PARAMETER NOASSET AS CHECKBOX.

SELECTION-SCREEN: END OF BLOCK A.

DATA: BEGIN OF ITAB1 OCCURS 10,

1(18), " Equipment number

2(1), " Category

3(40), " Desc. of Tech. object

4(10), " Object Type

5(10), " Valid-from date

6(13), " Weight of object

7(3), " Unit of measure

8(18), " Size/dimension

9(18), " Start-up Date/ Date Of Allocation

10(16), " AcquisValue

11(5), " AcquisValue Unit

12(30), " Manufacturer of asset

13(3), " Country of manufacture

14(4), " Year of Manufacture

15(2), " Month of Construction

16(20), " Manufacturer model number

17(30), " Manuf. part number

18(30), " Manuf. serial number

19(4), " Maintenance plant

20(4), " Company COde

21(4), " Business Area

22(10), " Location of maintenance object

23(25), " Asset

24(12), " Cost Center

25(10), " Maintenance Planning Plant

26(3), " Planner Group for PM

27(7), " Main work center for maint tasks

28(4), " Plant ass. with main work center

ID(10), " Installation Date

IT(10), " Installation time

29(40), " Functional location

END OF ITAB1.

DATA: BEGIN OF ITAB_ERROR OCCURS 10,

3(40),

24(10),

END OF ITAB_ERROR.

*BOC ASIM(01)

DATA: BEGIN OF IERR_ASSET OCCURS 10,

23(25),

END OF IERR_ASSET.

DATA: BEGIN OF IERR_FUNC OCCURS 10,

29(40),

END OF IERR_FUNC.

*EOC ASIM(01)

DATA: BEGIN OF TPLNR OCCURS 10,

TPLNR LIKE IFLOT-TPLNR,

END OF TPLNR.

DATA: MKOSTL LIKE CSKS-KOSTL,

MTPLNR(40),

MANLN1 LIKE ANLA-ANLN1.

INITIALIZATION.

  • USING FUNCTION TO GET FILENAME ON VALUE-REQUEST

AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILENAME.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

DEF_PATH = 'c:\ '

MASK = '.,..'

MODE = 'O'

TITLE = 'Select File'

IMPORTING

FILENAME = FILENAME

EXCEPTIONS

INV_WINSYS = 1

NO_BATCH = 2

SELECTION_CANCEL = 3

SELECTION_ERROR = 4

OTHERS = 5.

IF SY-SUBRC NE 0.

FILENAME = SY-SUBRC.

ENDIF.

START-OF-SELECTION.

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

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

FILENAME = FILENAME

FILETYPE = 'DAT'

  • HEADLEN = ' '

  • LINE_EXIT = ' '

  • TRUNCLEN = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

DATA_TAB = ITAB1

EXCEPTIONS

CONVERSION_ERROR = 1

FILE_OPEN_ERROR = 2

FILE_READ_ERROR = 3

INVALID_TABLE_WIDTH = 4

INVALID_TYPE = 5

NO_BATCH = 6

UNKNOWN_ERROR = 7

GUI_REFUSE_FILETRANSFER = 8

OTHERS = 9

.

IF SY-SUBRC <> 0.

MESSAGE E002(ZPIRZADA).

  • sy-msgid type sy-msgty number sy-msgno

  • with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

*break abapdev.

SELECT TPLNR

INTO TABLE TPLNR

FROM IFLOT CLIENT SPECIFIED

WHERE MANDT = SY-MANDT.

*BREAK ABAPDEV.

PERFORM OPEN_GROUP.

LOOP AT ITAB1.

PERFORM BDC_DYNPRO USING 'SAPMIEQ0' '0100'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'RM63E-EQUNR'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

PERFORM BDC_FIELD USING 'RM63E-EQUNR'

ITAB1-1. " 'A-104'.

IF ITAB1-ID IS INITIAL. " change 22102003 - ZPIR

PERFORM BDC_FIELD USING 'RM63E-DATSL'

'01.01.1955'. " Valid on FIX

ELSE.

PERFORM BDC_FIELD USING 'RM63E-DATSL'

ITAB1-ID. " Put Instalatin Date in Valid

  • From

ENDIF.

PERFORM BDC_FIELD USING 'RM63E-EQTYP'

ITAB1-2. "'A'.

PERFORM BDC_DYNPRO USING 'SAPMIEQ0' '0101'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

PERFORM BDC_FIELD USING 'ITOB-BRGEW'

ITAB1-6. " '1.5'.

PERFORM BDC_FIELD USING 'ITOB-GEWEI'

ITAB1-7. " 'KG'.

PERFORM BDC_FIELD USING 'ITOB-GROES'

ITAB1-8. " '10X25X45'.

*perform bdc_field using 'ITOB-INVNR'

  • ''.

PERFORM BDC_FIELD USING 'ITOB-INBDT'

ITAB1-9. " '10.07.2002'.

PERFORM BDC_FIELD USING 'ITOB-EQART'

ITAB1-4. " 'Sui_CS_22'.

PERFORM BDC_FIELD USING 'ITOB-ANSWT'

ITAB1-10. " '1,169,000.0'.

PERFORM BDC_FIELD USING 'ITOB-WAERS'

ITAB1-11. " 'PKR'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'ITOB-SERGE'.

PERFORM BDC_FIELD USING 'ITOB-HERST'

ITAB1-12. " 'Toyota dell'.

PERFORM BDC_FIELD USING 'ITOB-HERLD'

ITAB1-13. " 'PK'.

PERFORM BDC_FIELD USING 'ITOB-TYPBZ'

ITAB1-16. " 'mODEL 123'.

PERFORM BDC_FIELD USING 'ITOB-BAUJJ'

ITAB1-14. " '2002'.

PERFORM BDC_FIELD USING 'ITOB-BAUMM'

ITAB1-15. " ''.

PERFORM BDC_FIELD USING 'ITOB-MAPAR'

ITAB1-17. " 'Part 456'.

PERFORM BDC_FIELD USING 'ITOB-SERGE'

ITAB1-18. " 'Serial 789'.

PERFORM BDC_FIELD USING 'ITOB-SHTXT'

ITAB1-3. " 'GAS TURBINE WATER WASH

*TROLLEY'.

*perform bdc_field using 'ITOB-DATAB'

  • '30.04.2003'.

PERFORM BDC_DYNPRO USING 'SAPMIEQ0' '0101'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=T\02'.

*perform bdc_field using 'ITOB-BRGEW'

  • '1.500'.

*perform bdc_field using 'ITOB-GEWEI'

  • 'KG'.

*perform bdc_field using 'ITOB-GROES'

  • '10X25X45'.

*perform bdc_field using 'ITOB-INBDT'

  • '10.07.2002'.

*perform bdc_field using 'ITOB-EQART'

  • 'SUI_CS_22'.

*perform bdc_field using 'ITOB-ANSWT'

  • '1,169,000.00'.

*perform bdc_field using 'ITOB-WAERS'

  • 'PKR'.

*perform bdc_field using 'BDC_CURSOR'

  • 'ITOB-SERGE'.

*perform bdc_field using 'ITOB-HERST'

  • 'Toyota dell'.

*perform bdc_field using 'ITOB-HERLD'

  • 'PK'.

*perform bdc_field using 'ITOB-TYPBZ'

  • 'mODEL 123'.

*perform bdc_field using 'ITOB-BAUJJ'

  • '2002'.

*perform bdc_field using 'ITOB-MAPAR'

  • 'PART 456'.

*perform bdc_field using 'ITOB-SERGE'

  • 'SERIAL 789'.

*perform bdc_field using 'ITOB-SHTXT'

  • 'GAS TURBINE WATER WASH TROLLEY'.

*perform bdc_field using 'ITOB-DATAB'

  • '30.04.2003'.

*

PERFORM BDC_DYNPRO USING 'SAPMIEQ0' '0101'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'ITOB-SWERK'.

PERFORM BDC_FIELD USING 'ITOB-SWERK'

ITAB1-19. " 'PPL'.

*perform bdc_field using 'ITOB-SHTXT'

  • 'GAS TURBINE WATER WASH TROLLEY'.

*perform bdc_field using 'ITOB-DATAB'

  • '30.04.2003'.

PERFORM BDC_DYNPRO USING 'SAPMIEQ0' '0101'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=T\03'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'ITOB-SWERK'.

*perform bdc_field using 'ITOB-SWERK'

  • 'PPL'.

*perform bdc_field using 'ITOB-SHTXT'

  • 'GAS TURBINE WATER WASH TROLLEY'.

*perform bdc_field using 'ITOB-DATAB'

  • '30.04.2003'.

PERFORM BDC_DYNPRO USING 'SAPMIEQ0' '0101'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

*perform bdc_field using 'ITOB-BUKRS'

  • itab1-20. " 'PPL'.

PERFORM BDC_FIELD USING 'ITOB-GSBER'

ITAB1-21. " '0100'.

*asset logic

IF NOASSET = 'X'.

ELSE.

IF NOT ITAB1-23 IS INITIAL.

SELECT SINGLE ANLN1

INTO MANLN1

FROM ANLA CLIENT SPECIFIED

WHERE MANDT = SY-MANDT

AND ( INVNR = ITAB1-23

OR INVZU = ITAB1-23 ).

IF SY-SUBRC = 0.

MOVE MANLN1 TO ITAB1-23.

PERFORM BDC_FIELD USING 'ITOB-ANLNR'

ITAB1-23. " '9000001'.

ELSE.

*BOC ASIM(01)

MOVE ITAB1-23 TO IERR_ASSET-23.

APPEND IERR_ASSET.

  • WRITE : /40 ' aSSET NOT FOUND FOR ',ITAB1-23.

*EOC ASIM(01)

ENDIF.

CLEAR MANLN1.

ENDIF.

ENDIF.

*cost center logic

  • Cost Center ........ Logic

IF ITAB1-24 IS INITIAL.

ELSE.

SELECT SINGLE KOSTL

INTO MKOSTL

FROM CSKS

WHERE ANRED = ITAB1-24.

IF SY-SUBRC = 0.

MOVE MKOSTL TO ITAB1-24.

ELSE.

MOVE ITAB1-24 TO ITAB_ERROR-24.

MOVE ITAB1-3 TO ITAB_ERROR-3.

APPEND ITAB_ERROR.

CLEAR ITAB1-24.

ENDIF.

ENDIF.

PERFORM BDC_FIELD USING 'ITOB-KOSTL'

ITAB1-24. " '999980'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'ITOBATTR-WERGW'.

*perform bdc_field using 'ITOB-IWERK'

  • itab1-25. " 'PPL'.

PERFORM BDC_FIELD USING 'ITOB-INGRP'

ITAB1-26. " 'cp1'.

PERFORM BDC_FIELD USING 'ITOBATTR-GEWRK'

ITAB1-27. " 'CS_INST'.

PERFORM BDC_FIELD USING 'ITOBATTR-WERGW'

ITAB1-28. " 'ppl'.

*perform bdc_field using 'ITOB-SHTXT'

  • 'GAS TURBINE WATER WASH TROLLEY'.

*perform bdc_field using 'ITOB-DATAB'

  • '30.04.2003'.

PERFORM BDC_DYNPRO USING 'SAPMIEQ0' '0101'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=T\04'.

*perform bdc_field using 'ITOB-BUKRS'

  • 'PPL'.

*perform bdc_field using 'ITOB-GSBER'

  • '0100'.

*perform bdc_field using 'ITOB-ANLNR'

  • '9000001'.

*perform bdc_field using 'ITOB-ANLUN'

  • '0'.

*perform bdc_field using 'ITOB-KOSTL'

  • '999980'.

*perform bdc_field using 'BDC_CURSOR'

  • 'ITOBATTR-WERGW'.

*perform bdc_field using 'ITOB-IWERK'

  • 'PPL'.

*perform bdc_field using 'ITOB-INGRP'

  • 'CP1'.

*perform bdc_field using 'ITOBATTR-GEWRK'

  • 'CS_INST'.

*perform bdc_field using 'ITOBATTR-WERGW'

  • 'PPL'.

*perform bdc_field using 'ITOB-SHTXT'

  • 'GAS TURBINE WATER WASH TROLLEY'.

*perform bdc_field using 'ITOB-DATAB'

  • '30.04.2003'.

PERFORM BDC_DYNPRO USING 'SAPMIEQ0' '0101'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=CIPL'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'ITOB-SHTXT'.

*perform bdc_field using 'ITOB-SHTXT'

  • 'GAS TURBINE WATER WASH TROLLEY'.

*perform bdc_field using 'ITOB-DATAB'

  • '30.04.2003'.

PERFORM BDC_DYNPRO USING 'SAPLIEL2' '0100'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'IEQINSTALL-TPLNR'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

IF ITAB1-29 IS INITIAL.

ELSE.

BREAK ABAPDEV.

CALL FUNCTION 'CONVERSION_EXIT_TPLNR_INPUT'

EXPORTING

INPUT = ITAB1-29

  • I_FLG_CHECK_INTERNAL = 'X'

IMPORTING

OUTPUT = MTPLNR

EXCEPTIONS

NOT_FOUND = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

*BOC ASIM(01)

MOVE ITAB1-29 TO IERR_FUNC-29.

APPEND IERR_FUNC.

  • WRITE : / ITAB1-29, ' fUNCTION LOCATION NOT FOUND'.

*EOC ASIM(01)

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  • ENDIF.

ELSE.

*BOC ASIM(02)

READ TABLE TPLNR WITH KEY TPLNR = MTPLNR.

IF SY-SUBRC = 0.

PERFORM BDC_FIELD USING 'IEQINSTALL-TPLNR'

ITAB1-29. "'PPL-SUI-CS-COMP-SML-A-GT101'.

ELSE.

MOVE ITAB1-29 TO IERR_FUNC-29.

APPEND IERR_FUNC.

  • WRITE : / ITAB1-29, ' fUNCTION LOCATION NOT FOUND'.

ENDIF.

*EOC ASIM(02)

ENDIF.

CLEAR : MTPLNR.

ENDIF.

IF NOT ITAB1-ID IS INITIAL.

PERFORM BDC_FIELD USING 'IEQINSTALL-DATUM'

ITAB1-ID. " '30.04.2003'.

PERFORM BDC_FIELD USING 'IEQINSTALL-UZEIT'

ITAB1-IT. " '14:51:45'.

ENDIF.

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

*perform bdc_dynpro using 'SAPLIEL2' '0100'.

*perform bdc_field using 'IEQINSTALL-TPLNR'

  • 'SUI-CS-COMP-SML-A-GT101'.

PERFORM BDC_DYNPRO USING 'SAPLIEL2' '0100'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'IEQINSTALL-DATUM'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=EXIT'.

*perform bdc_field using 'IEQINSTALL-DATUM'

  • '30.04.2003'.

*perform bdc_field using 'IEQINSTALL-UZEIT'

  • '14:51:45'.

PERFORM BDC_DYNPRO USING 'SAPMIEQ0' '0101'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=T\05'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'ITOB-SHTXT'.

*perform bdc_field using 'ITOB-SHTXT'

  • 'GAS TURBINE WATER WASH TROLLEY'.

*perform bdc_field using 'ITOB-DATAB'

  • '30.04.2003'.

*

PERFORM BDC_DYNPRO USING 'SAPMIEQ0' '0101'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=BU'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'ITOB-SHTXT'.

*perform bdc_field using 'ITOB-SHTXT'

  • 'GAS TURBINE WATER WASH TROLLEY'.

*perform bdc_field using 'ITOB-DATAB'

  • '30.04.2003'.

PERFORM BDC_TRANSACTION USING 'IE01'.

CLEAR BDCDATA.

REFRESH BDCDATA.

ENDLOOP.

PERFORM CLOSE_GROUP.

SKIP 2.

LOOP AT ITAB_ERROR.

WRITE 😕 ' Cost ceter not found for DESCRIPTION' ,

ITAB_ERROR-3,

'Old Cost Center Number' ,

ITAB_ERROR-24.

ENDLOOP.

SKIP.

*BOC ASIM(01)

WRITE : /20 ' aSSET NOT FOUND FOR '.

LOOP AT IERR_ASSET.

WRITE : /20 IERR_ASSET.

ENDLOOP.

SKIP.

WRITE : /20 ' Functional Location not found for: '.

LOOP AT IERR_FUNC.

WRITE : /20 IERR_FUNC.

ENDLOOP.

Former Member
0 Kudos

Hi Prasad,

<u><b>1)</b></u> You can extend this BAPI, just copy this to Z then change the BAPI acording to your requirment

<u><b>2)</b></u> Use LSMW, you have a option <b>Recording</b> in the LSMW, you do the recording and write the Code in the LSMW, so that you can upload the new fields data also

<u><b>3)</b></u> USe the BDC

Regards

Sudheer

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

You could use LSMW, but again, you have custom fields which will not be handled by the standard LSMW program. I guess you only have one choice, BDC.

Regards,

Rich Heilman