Skip to Content
0
Former Member
Jun 30, 2007 at 11:26 AM

PROBLEM IN BDC

14 Views

Hi,

I could not able to store flate file's data to internal table in ME41 screen, here i attached my BDC coding, give the solution for that problem,

REPORT ZUDAY_BDC_ME41 NO STANDARD PAGE HEADING LINE-SIZE 255.

INCLUDE BDCRECX1.

TABLES:EKPO.

DATA: BEGIN OF ITAB OCCURS 0,

NUMBER(3) TYPE C,

EMATN LIKE EKPO-EMATN,

TXZ01 LIKE EKPO-TXZ01,

MEINS LIKE EKPO-MEINS,

EEIND LIKE RM06E-EEIND,

END OF ITAB.

DATA: TEMP(20),

COUNT TYPE C VALUE 0,

ZERO TYPE C VALUE 0,

LVALUE TYPE I,

CTRL TYPE C.

START-OF-SELECTION.

PERFORM START.

SORT ITAB BY NUMBER.

PERFORM OPEN_GROUP.

LOOP AT ITAB.

IF ITAB-NUMBER <> LVALUE.

COUNT = 0.

LOOP AT ITAB WHERE NUMBER = ITAB-NUMBER.

COUNT = COUNT + 1.

ENDLOOP.

PERFORM BDC_DYNPRO USING 'SAPMM06E' '0300'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'EKKO-EKGRP'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

PERFORM BDC_FIELD USING 'RM06E-ASART'

'AN'.

PERFORM BDC_FIELD USING 'EKKO-SPRAS'

'EN'.

PERFORM BDC_FIELD USING 'RM06E-ANFDT'

'30.06.2007'.

PERFORM BDC_FIELD USING 'EKKO-ANGDT'

'10.07.2007'.

PERFORM BDC_FIELD USING 'EKKO-EKORG'

'4500'.

PERFORM BDC_FIELD USING 'EKKO-EKGRP'

'017'.

PERFORM BDC_FIELD USING 'RM06E-LPEIN'

'T'.

PERFORM BDC_DYNPRO USING 'SAPMM06E' '0301'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'EKKO-SUBMI'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

PERFORM BDC_FIELD USING 'EKKO-EKGRP'

'017'.

PERFORM BDC_FIELD USING 'EKKO-PINCR'

'10'.

PERFORM BDC_FIELD USING 'EKKO-SUBMI'

'3'.

PERFORM BDC_FIELD USING 'EKKO-SPRAS'

'EN'.

PERFORM BDC_FIELD USING 'EKKO-UPINC'

'1'.

PERFORM BDC_FIELD USING 'EKKO-ANGDT'

'10.07.2007'.

PERFORM BDC_DYNPRO USING 'SAPMM06E' '0320'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'RM06E-EEIND(01)'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

DO COUNT TIMES.

CTRL = COUNT.

CONCATENATE 'EKPO-EMATN(' ZERO CTRL ')' INTO TEMP.

CONDENSE TEMP NO-GAPS.

PERFORM BDC_FIELD USING TEMP ITAB-EMATN.

CONCATENATE 'EKPO-TXZ01(' ZERO CTRL ')' INTO TEMP.

CONDENSE TEMP NO-GAPS.

PERFORM BDC_FIELD USING TEMP ITAB-TXZ01.

CONCATENATE 'RM06E-ANMNG(' ZERO CTRL ')' INTO TEMP.

CONDENSE TEMP NO-GAPS.

PERFORM BDC_FIELD USING TEMP '500.00'."ITAB-ANMNG.

CONCATENATE 'EKPO-MEINS(' ZERO CTRL ')' INTO TEMP.

CONDENSE TEMP NO-GAPS.

PERFORM BDC_FIELD USING TEMP ITAB-MEINS.

CONCATENATE 'RM06E-EEIND(' ZERO CTRL ')' INTO TEMP.

CONDENSE TEMP NO-GAPS.

PERFORM BDC_FIELD USING TEMP ITAB-EEIND.

CONCATENATE 'EKPO-MATKL(' ZERO CTRL ')' INTO TEMP.

CONDENSE TEMP NO-GAPS.

PERFORM BDC_FIELD USING TEMP '201'. "ITAB-MATKL.

CONCATENATE 'EKPO-EMATN(' ZERO CTRL ')' INTO TEMP.

CONDENSE TEMP NO-GAPS.

PERFORM BDC_FIELD USING 'BDC_CURSOR' TEMP.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

ENDDO.

PERFORM BDC_DYNPRO USING 'SAPMM06E' '0140'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'EKKO-LIFNR'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

PERFORM BDC_FIELD USING 'EKKO-LIFNR'

'70000'.

PERFORM BDC_DYNPRO USING 'SAPMM06E' '0140'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'EKKO-LIFNR'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=BU'.

PERFORM BDC_FIELD USING 'EKKO-LIFNR'

'70000'.

PERFORM BDC_FIELD USING 'SZA1_D0100-TITLE_MEDI'

'Company'.

PERFORM BDC_FIELD USING 'ADDR1_DATA-NAME1'

'IBM Store'.

PERFORM BDC_FIELD USING 'ADDR1_DATA-SORT1'

'IBM'.

PERFORM BDC_FIELD USING 'ADDR1_DATA-STREET'

'2526 Yonge Street'.

PERFORM BDC_FIELD USING 'ADDR1_DATA-POST_CODE1'

'M4P 2H7'.

PERFORM BDC_FIELD USING 'ADDR1_DATA-CITY1'

'Toronto'.

PERFORM BDC_FIELD USING 'ADDR1_DATA-COUNTRY'

'CA'.

PERFORM BDC_FIELD USING 'ADDR1_DATA-REGION'

'ON'.

PERFORM BDC_FIELD USING 'ADDR1_DATA-TIME_ZONE'

'CST'.

PERFORM BDC_FIELD USING 'ADDR1_DATA-LANGU'

'EN'.

PERFORM BDC_FIELD USING 'SZA1_D0100-TEL_NUMBER'

'416-486-3006'.

PERFORM BDC_DYNPRO USING 'SAPLSPO1' '0300'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=YES'.

PERFORM BDC_TRANSACTION USING 'ME41'.

ENDIF.

ENDLOOP.

REFRESH BDCDATA.

PERFORM CLOSE_GROUP.

&----


*& Form START

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM START.

CALL FUNCTION 'UPLOAD'

EXPORTING

FILENAME = ' '

FILETYPE = ' '

TABLES

DATA_TAB = ITAB

EXCEPTIONS

CONVERSION_ERROR = 1

INVALID_TABLE_WIDTH = 2

INVALID_TYPE = 3

NO_BATCH = 4

UNKNOWN_ERROR = 5

GUI_REFUSE_FILETRANSFER = 6

OTHERS = 7.

IF SY-SUBRC <> 0.

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

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

ENDIF.

ENDFORM. " START