Skip to Content
author's profile photo Former Member
Former Member

how can we update mk01 with BDC call transaction method

can any one send the sample code for upload of MK01 using call transaction method.

its urgent..

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 20, 2006 at 09:15 PM

    Please go to SE38, and check the documentation of this program RFBIKR00. If you create a file with the exact requirements as listed in the documentation, this SAP standard program RFBIKR00 will do the rest.

    Note:-

    Vendor Information can be updated using Direct Input method. Transaction SXDA_TOOLS.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 21, 2006 at 05:08 AM

    Use the following code.

    &----


    *& Report ZMK01_VA01 *

    *& *

    &----


    *& *

    *& *

    &----


    REPORT Z_MK01 .

    • SOURCE INTERNAL TABLE

    DATA: BEGIN OF T_SOURCE OCCURS 0,

    LIFNR TYPE LIFNR,

    EKORG TYPE EKORG,

    KTOKK TYPE KTOKK,

    NAME1 TYPE NAME1,

    SORTL TYPE SORTL,

    LAND1 TYPE LAND1,

    WAERS TYPE WAERS,

    END OF T_SOURCE.

    *DATA: E_MESSAGE TYPE C.

    • ERROR MESSAGE TABLE

    DATA: T_ERRORMSG LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.

    • TARGET TABLE LIKE BDCDATA

    DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

    • TO UPLOAD DATA FROM LEGACY SYSTEM

    CALL FUNCTION 'WS_UPLOAD'

    EXPORTING

    • CODEPAGE = ' '

    FILENAME = 'D:\MK01.TXT'

    FILETYPE = 'DAT'

    • IMPORTING

    • FILELENGTH =

    TABLES

    data_tab = T_SOURCE

    EXCEPTIONS

    CONVERSION_ERROR = 1

    FILE_OPEN_ERROR = 2

    FILE_READ_ERROR = 3

    INVALID_TYPE = 4

    NO_BATCH = 5

    UNKNOWN_ERROR = 6

    INVALID_TABLE_WIDTH = 7

    GUI_REFUSE_FILETRANSFER = 8

    CUSTOMER_ERROR = 9

    NO_AUTHORITY = 10

    OTHERS = 11

    .

    IF sy-subrc <> 0.

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

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

    ENDIF.

    • TRANSFERING DATA FROM INTERNAL SOURCE TABLE TO TARGET TABLE

    LOOP AT T_SOURCE.

    REFRESH BDCDATA.

    perform bdc_dynpro using 'SAPMF02K' '0107'.

    perform bdc_field using 'BDC_CURSOR'

    'RF02K-LIFNR'.

    perform bdc_field using 'BDC_OKCODE'

    '/00'.

    perform bdc_field using 'RF02K-LIFNR'

    T_SOURCE-LIFNR.

    perform bdc_field using 'RF02K-EKORG'

    T_SOURCE-EKORG.

    perform bdc_field using 'RF02K-KTOKK'

    T_SOURCE-KTOKK.

    perform bdc_dynpro using 'SAPMF02K' '0110'.

    perform bdc_field using 'BDC_CURSOR'

    'LFA1-LAND1'.

    perform bdc_field using 'BDC_OKCODE'

    '/00'.

    perform bdc_field using 'LFA1-NAME1'

    T_SOURCE-NAME1.

    perform bdc_field using 'LFA1-SORTL'

    T_SOURCE-SORTL.

    perform bdc_field using 'LFA1-LAND1'

    T_SOURCE-LAND1.

    perform bdc_dynpro using 'SAPMF02K' '0120'.

    perform bdc_field using 'BDC_CURSOR'

    'LFA1-KUNNR'.

    perform bdc_field using 'BDC_OKCODE'

    '/00'.

    perform bdc_dynpro using 'SAPMF02K' '0310'.

    perform bdc_field using 'BDC_CURSOR'

    'LFM1-WAERS'.

    perform bdc_field using 'BDC_OKCODE'

    '/00'.

    perform bdc_field using 'LFM1-WAERS'

    T_SOURCE-WAERS.

    perform bdc_dynpro using 'SAPMF02K' '0320'.

    perform bdc_field using 'BDC_CURSOR'

    'RF02K-LIFNR'.

    perform bdc_field using 'BDC_OKCODE'

    '=ENTR'.

    perform bdc_dynpro using 'SAPLSPO1' '0300'.

    perform bdc_field using 'BDC_OKCODE'

    '=YES'.

    CALL TRANSACTION 'MK01' USING BDCDATA MODE 'A' MESSAGES INTO T_ERRORMSG.

    ENDLOOP.

    LOOP AT T_ERRORMSG.

    WRITE:/ 'MESSAGE TYPE',T_ERRORMSG-MSGTYP,

    'FIELDNAME WERE ERROR OCCURED', T_ERRORMSG-FLDNAME.

    *CALL FUNCTION 'FORMAT_MESSAGE'

    • EXPORTING

    • ID = T_ERRORMSG-MSGID

    • LANG = SY-LANGU

    • NO = T_ERRORMSG-MSGNR

    • V1 = T_ERRORMSG-MSGV1

    • V2 = T_ERRORMSG-MSGV2

    • V3 = T_ERRORMSG-MSGV3

    • V4 = T_ERRORMSG-MSGV4

    • IMPORTING

    • MSG = E_MESSAGE

    • EXCEPTIONS

    • NOT_FOUND = 1

    • OTHERS = 2

  • .

  • *IF sy-subrc <> 0.

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

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

    *ENDIF.

    *

    *WRITE:/ E_MESSAGE.

    ENDLOOP.

    ----


    • Start new screen *

    ----


    FORM BDC_DYNPRO USING PROGRAM DYNPRO.

    CLEAR BDCDATA.

    BDCDATA-PROGRAM = PROGRAM.

    BDCDATA-DYNPRO = DYNPRO.

    BDCDATA-DYNBEGIN = 'X'.

    APPEND BDCDATA.

    ENDFORM.

    ----


    • Insert field *

    ----


    FORM BDC_FIELD USING FNAM FVAL.

    IF FVAL <> SPACE.

    CLEAR BDCDATA.

    BDCDATA-FNAM = FNAM.

    BDCDATA-FVAL = FVAL.

    APPEND BDCDATA.

    ENDIF.

    ENDFORM.

    With Regards

    K Srinivas

Add a comment
10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.