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

Any bdc program related to SD , MM or PP with Tcodes

Any bdc program related to SD , MM or PP with Tcodes

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 09:43 AM

    Hi,

    Check the following link:

    http://sap-img.com/bdc.htm

    Regards,

    Bhaskar

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 30, 2007 at 09:44 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 30, 2007 at 09:44 AM

    <b>Hi.. Here s a BDC program for ME01...</b>

    REPORT zhzl_bdcme01

    NO STANDARD PAGE HEADING LINE-SIZE 255.

    TYPE-POOLS: truxs.

    TYPES : BEGIN OF tp_data,

    matnr TYPE eord-matnr,

    werks TYPE eord-werks,

    vdatu(8) TYPE c,

    *EORD-VDATU,

    bdatu(8) TYPE c,

    *EORD-BDATU,

    lifnr TYPE eord-lifnr,

    ekorg TYPE eord-ekorg,

    reswk TYPE eord-reswk,

    *meins type EORD-MEINS,

    ebeln TYPE eord-ebeln,

    ebelp(5) TYPE c,

    feskz TYPE rm06w-feskz,

    notkz TYPE eord-notkz,

    autet TYPE eord-autet,

    END OF tp_data.

    DATA : t_data TYPE STANDARD TABLE OF tp_data,

    wa_data TYPE tp_data,

    t_data1 TYPE STANDARD TABLE OF tp_data,

    wa_data1 TYPE tp_data,

    len(4) TYPE c,

    len1(4) TYPE c,

    c(2) TYPE c,

    c1(2) TYPE c,

    d(2) TYPE c,

    d1(2) TYPE c,

    w_str(40) TYPE c.

    DATA : w_file TYPE string,

    w_rc TYPE sy-subrc.

    DATA: it_raw TYPE truxs_t_text_data.

    PARAMETERS : p_file LIKE rlgrap-filename OBLIGATORY.

    INCLUDE bdcrecx1.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

    CALL FUNCTION 'F4_FILENAME'

    EXPORTING

    program_name = syst-cprog

    dynpro_number = syst-dynnr

    IMPORTING

    file_name = p_file.

    w_file = p_file.

    • PERFORM file_upload

    • TABLES t_data USING w_file CHANGING w_rc.

    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

    EXPORTING

    • I_FIELD_SEPERATOR =

    i_line_header = 'X'

    i_tab_raw_data = it_raw " WORK TABLE

    i_filename = p_file

    TABLES

    i_tab_converted_data = t_data[] "ACTUAL DATA

    EXCEPTIONS

    conversion_failed = 1

    OTHERS = 2.

    START-OF-SELECTION.

    DESCRIBE TABLE t_data LINES len.

    IF len < 10.

    CONCATENATE '000' len INTO len1.

    ENDIF.

    PERFORM open_group.

    c1 = 1.

    d1 = 1.

    CONCATENATE '0' c1 INTO c.

    LOOP AT t_data INTO wa_data.

    IF c = 1 AND d1 = 1.

    PERFORM bdc_dynpro USING 'SAPLMEOR' '0200'.

    PERFORM bdc_field USING 'BDC_CURSOR'

    'EORD-WERKS'.

    PERFORM bdc_field USING 'BDC_OKCODE'

    '/00'.

    PERFORM bdc_field USING 'EORD-MATNR'

    wa_data-matnr.

    PERFORM bdc_field USING 'EORD-WERKS'

    wa_data-werks.

    d1 = d1 + 1.

    ENDIF.

    IF c = 1.

    PERFORM bdc_dynpro USING 'SAPLMEOR' '0205'.

    CONCATENATE 'EORD-NOTKZ(' len1 ')' INTO w_str.

    PERFORM bdc_field USING 'BDC_CURSOR'

    w_str.

    • 'EORD-AUTET(len1)'.

    PERFORM bdc_field USING 'BDC_OKCODE'

    '=BU'.

    ENDIF.

    • if c = 19.

    CONCATENATE 'EORD-VDATU(' c ')' INTO w_str.

    PERFORM bdc_field USING w_str

    wa_data-vdatu.

    CONCATENATE 'EORD-BDATU(' c ')' INTO w_str.

    PERFORM bdc_field USING w_str

    wa_data-bdatu.

    CONCATENATE 'EORD-LIFNR(' c ')' INTO w_str.

    PERFORM bdc_field USING w_str

    wa_data-lifnr.

    CONCATENATE 'EORD-EKORG(' c ')' INTO w_str.

    PERFORM bdc_field USING w_str

    wa_data-ekorg.

    IF wa_data-reswk IS NOT INITIAL.

    CONCATENATE 'EORD-RESWK(' c ')' INTO w_str.

    PERFORM bdc_field USING w_str

    wa_data-reswk.

    ENDIF.

    IF wa_data-ebeln IS NOT INITIAL.

    CONCATENATE 'EORD-EBELN(' c ')' INTO w_str.

    PERFORM bdc_field USING w_str

    wa_data-ebeln.

    ENDIF.

    IF wa_data-ebelp IS NOT INITIAL.

    CONCATENATE 'EORD-EBELP(' c ')' INTO w_str.

    PERFORM bdc_field USING w_str

    wa_data-ebelp.

    ENDIF.

    IF wa_data-feskz IS NOT INITIAL.

    CONCATENATE 'RM06W-FESKZ(' c ')' INTO w_str.

    PERFORM bdc_field USING w_str

    wa_data-feskz.

    ENDIF.

    CONCATENATE 'EORD-NOTKZ(' c ')' INTO w_str.

    PERFORM bdc_field USING w_str

    wa_data-notkz.

    CONCATENATE 'EORD-AUTET(' c ')' INTO w_str.

    PERFORM bdc_field USING w_str

    wa_data-autet.

    c = c + 1.

    IF c < 10 .

    CONCATENATE '0' c INTO c.

    ENDIF.

    *for scroll down

    IF c = 19 .

    CONCATENATE 'EORD-EKORG(' len1 ')' INTO w_str.

    PERFORM bdc_field USING 'BDC_CURSOR'

    w_str.

    PERFORM bdc_field USING 'BDC_OKCODE'

    '=NS'.

    CLEAR c.

    c = 1.

    ENDIF.

    *end of changes

    ENDLOOP.

    PERFORM bdc_transaction USING 'ME01'.

    PERFORM close_group.

    &----


    *& Form file_upload

    &----


    • text

    ----


    • -->ITAB text

    • -->FP_FILE text

    • -->FP_RC text

    ----


    FORM file_upload TABLES itab USING fp_file TYPE string

    CHANGING fp_rc TYPE sy-subrc.

    .

    CALL FUNCTION 'GUI_UPLOAD'

    EXPORTING

    filename = fp_file

    filetype = 'ASC'

    has_field_separator = '#'

    • HEADER_LENGTH = 0

    • READ_BY_LINE = 'X'

    • DAT_MODE = ' '

    • CODEPAGE = ' '

    • IGNORE_CERR = ABAP_TRUE

    • REPLACEMENT = '#'

    • CHECK_BOM = ' '

    • NO_AUTH_CHECK = ' '

    • IMPORTING

    • FILELENGTH =

    • HEADER =

    TABLES

    data_tab = itab

    • EXCEPTIONS

    • FILE_OPEN_ERROR = 1

    • FILE_READ_ERROR = 2

    • NO_BATCH = 3

    • GUI_REFUSE_FILETRANSFER = 4

    • INVALID_TYPE = 5

    • NO_AUTHORITY = 6

    • UNKNOWN_ERROR = 7

    • BAD_DATA_FORMAT = 8

    • HEADER_NOT_ALLOWED = 9

    • SEPARATOR_NOT_ALLOWED = 10

    • HEADER_TOO_LONG = 11

    • UNKNOWN_DP_ERROR = 12

    • ACCESS_DENIED = 13

    • DP_OUT_OF_MEMORY = 14

    • DISK_FULL = 15

    • DP_TIMEOUT = 16

    • OTHERS = 17

    .

    IF sy-subrc <> 0.

    MESSAGE 'Data from the file is incorrect.' TYPE 'E'.

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

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

    ENDIF.

    ENDFORM. "file_upload

    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.