Structure of BDCMSGCOLL

Can any Please Explain me the structure of BGCMSGCOLL?
Points will be awarded to the appropriate answer..
Thnks and rgds,
GIri

Hai Giri
Check the following Code
it will gives you how to use BDCMSGCOLL
report Z_CALLTRANS_VENDOR_01
no standard page heading line-size 255.
Generated data section with specific formatting - DO NOT CHANGE ***
data: begin of it_lfa1 occurs 0,
KTOKK like lfa1-ktokk,
NAME1 like lfa1-name1,
SORTL like lfa1-sortl,
LAND1 like lfa1-land1,
end of it_lfa1.
End generated data section ***
data : it_bdc like bdcdata occurs 0 with header line.
*DATA: IT_MESSAGES TYPE TABLE OF BDCMSGCOLL WITH HEADER LINE.
*DATA: LV_MESSAGE(255).
data : it_messages like bdcmsgcoll occurs 0 with header line.
data : V_message(255).
data : V_flag.
data : V_datum1 type sy-datum.
data : begin of it_mesg occurs 0,
message(100),
end of it_mesg.
*V_datum1 = sy-datum-1.
parameters : P_Sess like APQI-GROUPID.
start-of-selection.
perform Get_data.
*perform open_group.
loop at it_lfa1.
perform bdc_dynpro using 'SAPMF02K' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-KTOKK'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-KTOKK'
it_lfa1-KTOKK.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-LAND1'.
perform bdc_field using 'BDC_OKCODE'
'=UPDA'.
perform bdc_field using 'LFA1-NAME1'
it_lfa1-name1.
perform bdc_field using 'LFA1-SORTL'
it_lfa1-sortl.
perform bdc_field using 'LFA1-LAND1'
it_lfa1-land1.
call transaction 'XK01' using it_bdc
mode 'N'
update 'S'
messages into it_messages.
if sy-subrc <> 0.
if V_flag <> 'X'.
perform open_group.
V_flag = 'X'.
endif.
perform bdc_transaction. "using 'XK01'.
endif.
perform format_messages.
refresh : it_bdc,it_messages.
endloop.
if V_flag = 'X'.
perform close_group.
endif.
*& Form Get_data
text
--> p1 text
<-- p2 text
FORM Get_data .
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:\srinu_vendor.txt'
FILETYPE = 'DAT'
TABLES
DATA_TAB = it_lfa1
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. " Get_data
*& Form bdc_dynpro
text
-->P_0061 text
-->P_0062 text
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR it_BDC.
it_BDC-PROGRAM = PROGRAM.
it_BDC-DYNPRO = DYNPRO.
it_BDC-DYNBEGIN = 'X'.
APPEND it_BDC.
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
CLEAR it_BDC.
it_BDC-FNAM = FNAM.
it_BDC-FVAL = FVAL.
APPEND it_BDC.
ENDFORM.
*& Form format_messages
text
--> p1 text
<-- p2 text
FORM format_messages .
loop at it_messages.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = it_messages-MSGID
LANG = 'EN'
NO = it_messages-MSGNR
V1 = it_messages-MSGV1
V2 = it_messages-MSGV2
V3 = it_messages-MSGV3
V4 = it_messages-MSGV4
IMPORTING
MSG = V_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 : / V_message.
clear : V_message.
endloop.
ENDFORM. " format_messages
*& Form open_group
text
--> p1 text
<-- p2 text
FORM open_group .
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = P_Sess
HOLDDATE = V_datum1
KEEP = 'X'
USER = SY-UNAME
IF SY-SUBRC = 0.
write : / 'Session Creating wit Name : ',P_Sess.
ENDIF.
ENDFORM. " open_group
*& Form close_group
text
--> p1 text
<-- p2 text
FORM close_group .
CALL FUNCTION 'BDC_CLOSE_GROUP'.
ENDFORM. " close_group
*& Form bdc_transaction
text
-->P_0132 text
FORM bdc_transaction. "USING VALUE(P_0132).
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'XK01'
POST_LOCAL = NOVBLOCAL
PRINTING = NOPRINT
SIMUBATCH = ' '
CTUPARAMS = ' '
TABLES
DYNPROTAB = it_bdc
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN = 2
QUEUE_ERROR = 3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 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. " bdc_transaction
batch input methods using sessions, CALL TRANSACTION USING processing does not provide any special handling for incorrect transactions. There is no restart capability for transactions that contain errors or produce update failures.
You can handle incorrect transactions by using update mode S (synchronous updating) and checking the return code from CALL TRANSACTION USING. If the return code is anything other than 0, then you should do the following:
write out or save the message table
use the BDCDATA table that you generated for the CALL TRANSACTION USING to generate a batch input session for the faulty transaction. You can then analyze the faulty transaction and correct the error using the tools provided in the batch input management facility.
Thanks & regards
Sreeni

Similar Messages

  • How to store BDC error messages into oracle database table?

    Hello Experts,
    I have a peculier requirement wherein I need to store the error messages occured while executing the transaction using BDC (Call Transaction Method) in an Oracle Database table format. Is that possible, if yes, how?
    Thanks in advance.

    Hi,
    Structure of BDCMSGCOLL.
    TCODE -> BDC Transaction code
    DYNAME -> Batch input module name
    DYNUMB -> Batch input screen number
    MSGTYP ->Batch input message type
    MSGSPRA -> Language ID of a message
    MSGID -> Batch input message ID
    MSGNR -> Batch input message number
    MSGV1 -> Variable part of a message
    MSGV2 -> Variable part of a message
    MSGV3 -> Variable part of a message
    MSGV4 -> Variable part of a message
    FLDNAME -> Field name
    Ex :
    DATA : BDCMSGCOLL TYPE TABLE OF BDCMSGCOLL WITH HEADER LINE,
    BDCDATA TYPE TABLE OF BDCDATA WITH HEADER LINE.
    CALL TRANSACTION 'MM01' USING BDCDATA MODE N UPDATE S MESSAGES INTO BDCMSGCOLL.
    IF SY-SUBRC 0.
    PERFORM ERR.
    CLEAR I_MSG.
    REFRESH I_MSG.
    ENDIF.
    *& Form ERR
    text
    --> p1 text
    <-- p2 text
    form ERR .
    DATA V_MSG(255) TYPE C.
    READ TABLE I_MSG WITH KEY MSGTYP = 'E'.
    IF SY-SUBRC = 0.
    CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
    ID = I_MSG-MSGID
    LANG = 'E'
    NO = I_MSG-MSGNR
    V1 = I_MSG-MSGV1
    V2 = I_MSG-MSGV2
    V3 = I_MSG-MSGV3
    V4 = I_MSG-MSGV4
    IMPORTING
    MSG = V_MSG
    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 V_MSG. " Error Message Displayed Here.
    CLEAR V_MSG.
    ENDIF.
    endform. " ERR
    hope this will help you.
    Reward if found helpfull,
    Cheers,
    Chaitanya.

  • Create material master data

    Dear sir,
      how to create a material data using mm01.
    explain step by step procdure..

    Hi
    Transaction Recorder (SHDB)
    How to Upload Presentation Server Flat file to SAP R/3 system???
    How to upload application server file to R/3 system?
    Definition
    Example - Call Transaction Method
    <b>Transaction Recorder (SHDB)</b>
    Before you work with the Batch Input methods, you should know the purpose of the tool
    Transaction Recorder.
    Use:
    You can use the transaction recorder to record a series of transactions and their screens.
    Features:
    You can use the recording to create
    Data transfer programs that use batch input or CALL TRANSACTION
    Batch input sessions
    Test data
    Function modules.
    Note: It doesn’t record F1, F4 and Scrollbar movements
    <b>Upload Flat file from Presentation Server to SAP R/3</b>
    CALL FUNCTION ‘GUI_UPLOAD'
    EXPORTING
    CODEPAGE = ‘IBM'
    FILENAME = P_UFILE
    FILETYPE = 'DAT'
    TABLES
    DATA_TAB = INT_TAB
    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
    OTHERS = 10 .
    IF SY-SUBRC NE 0.
    MESSAGE E999(FR) WITH 'ERROR IN FILE UPLOAD'.
    ENDIF.
    <b>Upload file from application server to SAP R/3</b>
    Open the the application server file
    OPEN DATASET <dsn> FOR INPUT <mode>
    Read the data from application server file
    READ DATASET <dsn> INTO <wa>
    And then close the application server file
    CLOSE DATASET <dsn>
    Definition- Declaring BDC Table
    DATA: BDC_TAB LIKE STANDARD TABLE OF
    BDCDATA INITIAL SIZE 6
    WITH HEADER LINE .
    The internal table used to collect the transaction’s information must be declared “LIKE BDCDATA”.
    <b>Filling BDC Table – Method #1</b>
    FORM FILL_BDC_TAB.
    REFRESH BDC_TAB.
    CLEAR BDC_TAB.
    BDC_TAB-PROGRAM = ‘SAPMF02K’.
    BDC_TAB-DYNPRO = ‘01016’.
    BDC_TAB-DYNBEGIN = ‘X’.
    APPEND BDC_TAB.
    CLEAR BDC_TAB.
    BDC_TAB-FNAM = ‘RF02K-LIFNR’.
    BDC_TAB-FVAL = ‘TEST1’.
    APPEND BDC_TAB.
    CLEAR BDC_TAB.
    BDC_TAB-FNAM = ‘RF02K-D0010’.
    BDC_TAB-FVAL = ‘X’.
    APPEND BDC_TAB.
    CLEAR BDC_TAB.
    BDC_TAB-PROGRAM = ‘SAPMF02K’.
    BDC_TAB-DYNPRO = ‘0110’.
    BDC_TAB-DYNBEGIN = ‘X’.
    APPEND BDC_TAB.
    CLEAR BDC_TAB.
    BDC_TAB-FNAM = ‘LFA1-STRAS’.
    BDC_TAB-FVAL = ‘123 Main St.’.
    APPEND BDC_TAB.
    CLEAR BDC_TAB.
    BDC_TAB-FNAM = ‘BDC_OKCODE’.
    BDC_TAB-FVAL = ‘/11’.
    APPEND BDC_TAB.
    ENDFORM.
    <b>Filling BDC Table – Method #2</b>
    FORM FILL_BDC_TAB.
    REFRESH BDC_TAB.
    PERFORM POPULATE_BDC_TAB
    USING:
    ‘1’ ‘SAPMF02K’ ‘0106’,
    ‘ ‘ ‘RF02K-LIFNR’ ‘TEST1’,
    ‘ ‘ ‘RF02K-D0010’ ‘X’,
    ‘1’ ‘SAPMF02K’ ‘0110’,
    ‘ ‘ ‘LFA1-STRAS’, ‘123 Main St.’,
    ‘ ‘ ‘BDC_OKCODE’, ‘/11’.
    ENDFORM.
    FORM POPULATE_BDC_TAB USING FLAG VAR1 VAR2.
    CLEAR BDC_TAB.
    IF FLAG = ‘1’.
    BDC_TAB-PROGRAM = VAR1.
    BDC_TAB-DYNPRO = VAR2..
    BDC_TAB-DYNBEGIN = ‘X’.
    ELSE.
    BDC_TAB-FNAM = VAR1.
    BDC_TAB-FVAL = VAR2.
    ENDIF.
    APPEND BDC_TAB.
    ENDFORM.
    This two subroutine method to fill the BDC table is preferable because the “POPULATE_BDC_TABLE” subroutine is reusable throughout all batch input programs.
    <b>Example #1 - Change Vendor (Call Transaction Method)</b>
    <b>Example #1- Declaration Section</b>
    REPORT Y180DM10.
    DATA: BDC_TAB LIKE STANDARD TABLE OF
    BDCDATA INITIAL SIZE 6 WITH HEADER LINE.
    INFILE(20) VALUE ‘/tmp/bc180_file4’.
    DATA: BEGIN OF INREC.
    VENDNUM LIKE LFA1-LIFNR.
    STREET LIKE LFA1-STRAS.
    END OF INREC.
    PARAMETERS: DISPMODE DEFAULT ‘A’,
    UPDAMODE DEFAULT ‘S’.
    START-OF-SELECTION.
    OPEN DATASET INFILE
    FOR INPUT IN TEXT MODE.
    DO.
    READ DATASET INFILE INTO INREC.
    IF SY-SUBRC < > 0. EXIT. ENDIF.
    PERFORM FILL_BDC_TAB.
    CALL TRANSACTION ‘FK02’
    USING BDC_TAB
    MODE DISPMODE
    UPDATE UPDAMODE.
    IF SY-SUBRC < > 0.
    WRITE: /‘ERROR’.
    ENDIF.
    ENDDO.
    CLOSE DATASET INFILE.
    <b>synchronous updating</b>
    DO.
    PERFORM FILL_BDC_TAB.
    CALL TRANSACTION ‘FK02’
    USING BDC_TAB
    MODE ‘N’
    UPDATE ‘S’.
    IF SY-SUBRC < > 0.
    WRITE: /‘ERROR’.
    ENDIF.
    ENDDO.
    With synchronous updating, we can check SY-SUBRC to determine the success of the transaction and the actual update to the database.
    <b>asynchronous updating</b>
    DO.
    PERFORM FILL_BDC_TAB.
    CALL TRANSACTION ‘FK02’
    USING BDC_TAB
    MODE ‘N’
    UPDATE ‘A’.
    IF SY-SUBRC < > 0.
    WRITE: /‘ERROR’.
    ENDIF.
    ENDDO.
    With asynchronous updating, we can check SY-SUBRC to determine the success of the transaction only, not the actual update to the database.
    <b>Error Handling</b>
    Write an error report.
    Send the record(s) in error to an error file.
    Create a batch input session with the record(s) in error.
    To store error messages ( CALL TRANSACTION )
    data: begin of Tab_Mess occurs 0.
    include structure bdcmsgcoll.
    data : end of Tab_Mess,
    CALL TRANSACTION ‘FK02’ USING BDC_TAB MODE ‘N’ UPDATE ‘S’
    MESSAGES INTO TAB_MESS.
    IF SY-SUBRC NE 0.
    WRITE: / Tab_MESS-TCODE, Tab_MESS-DYNUMB, Tab_MESS-MSGTYP ,
    Tab_MESS-MSGID.
    ENDIF.
    <b>i am giving you example for Change Vendor you practice for ur tcode</b>
    For our example, we will use the “Change Vendor” transaction (“FK02”) to add a street address to an already existing vendor.
    <b>Step #1</b>
    Use “System&#61664;Status” menu path to determine online program name (SAPMF02K), screen number (0110)
    <b>Step #2</b>
    Use “F1” key and “Technical Info” pushbutton in each screen field to be filled to determine the field name.
    <b>Step #3</b>
    Determine how to proceed in the transaction
    (save the record by clicking on the ‘Save’ pushbutton or pressing the ‘F11’ key).
    <b>BDC Table Contents</b>
    After researching the transaction we can determine the contents of the BDC table.
    PROGRAM DYNPRO DYNBEGIN FNAM FVAL
    SAMPF02K 0106 X
    RF02K-LIFNR TEST1
    RF02K-D0110 X
    SAMPF02K 0110 X
    LFA1-STRAS 123 Main St.
    BDC_OKCODE /11
    <b>Batch Input Methods</b>
    “CALL TRANSACTION USING”
    STATEMENT
    Call transaction - for data transfer
    Processing batch input data with CALL TRANSACTION USING is the faster of the two recommended data transfer methods. In this method, legacy data is processed inline in your data transfer program.
    Syntax:
    CALL TRANSACTION <tcode>
    USING <bdc_tab>
    MODE <mode>
    UPDATE <update>
    A Display all
    E Display errors only
    N No display
    S Synchronous
    A Asynchronous
    L Local update
    <b>The process flow of CALL TRANSACTION</b>
    A program that uses CALL TRANSACTION USING to process legacy data should execute thefollowing steps:
    Prepare a BDCDATA structure for the transaction that you wish to run.
    Prepare a internal table to store error messages Tab_Mess like structure of BDCMSGCOLL.
    With a CALL TRANSACTION USING statement, call the transaction and prepare the BDCDATA structure. For example:
    CALL TRANSACTION ‘MM01' USING BDCDATA MODE 'A' UPDATE 'S'. MESSAGES INTO TAB_MESS.
    IF SY-SUBRC <> 0.
    <Error_handling>.
    ENDIF.
    <b>Overview of Batch Input Session</b>
    The first batch input method is to create a batch input session. It is the processing of this batch input session that updates the database, not the execution of the batch input program. i am giving you example for Change Vendor you practice for ur tcode
    For our example, we will use the “Change Vendor” transaction (“FK02”) to add a street address to an already existing vendor.
    <b>Step #1</b>
    Use “System&#61664;Status” menu path to determine online program name (SAPMF02K), screen number (0110)
    <b>Step #2</b>
    Use “F1” key and “Technical Info” pushbutton in each screen field to be filled to determine the field name.
    <b>Step #3</b>
    Determine how to proceed in the transaction
    (save the record by clicking on the ‘Save’ pushbutton or pressing the ‘F11’ key).
    <b>BDC Table Contents</b>
    After researching the transaction we can determine the contents of the BDC table.
    PROGRAM DYNPRO DYNBEGIN FNAM FVAL
    SAMPF02K 0106 X
    RF02K-LIFNR TEST1
    RF02K-D0110 X
    SAMPF02K 0110 X
    LFA1-STRAS 123 Main St.
    BDC_OKCODE /11
    <b>Batch Input Methods</b>
    “CALL TRANSACTION USING”
    STATEMENT
    Call transaction - for data transfer
    Processing batch input data with CALL TRANSACTION USING is the faster of the two recommended data transfer methods. In this method, legacy data is processed inline in your data transfer program.
    Syntax:
    CALL TRANSACTION <tcode>
    USING <bdc_tab>
    MODE <mode>
    UPDATE <update>
    A Display all
    E Display errors only
    N No display
    S Synchronous
    A Asynchronous
    L Local update
    <b>The process flow of CALL TRANSACTION</b>
    A program that uses CALL TRANSACTION USING to process legacy data should execute thefollowing steps:
    Prepare a BDCDATA structure for the transaction that you wish to run.
    Prepare a internal table to store error messages Tab_Mess like structure of BDCMSGCOLL.
    With a CALL TRANSACTION USING statement, call the transaction and prepare the BDCDATA structure. For example:
    CALL TRANSACTION ‘MM01' USING BDCDATA MODE 'A' UPDATE 'S'. MESSAGES INTO TAB_MESS.
    IF SY-SUBRC <> 0.
    <Error_handling>.
    ENDIF.
    <b>Overview of Batch Input Session</b>
    The first batch input method is to create a batch input session. It is the processing of this batch input session that updates the database, not the execution of the batch input program.
    <b>Reward if usefull</b>

  • Bdc to upload a transaction

    Hello experts.
    My requirement is like this, please help me.
    i want to pass data to ke21 transaction. I am fetching data from different tables based on different conditions as per our requirement. i will be having all the data in the internal table .
    Now i want to populate the ke21 with the internal table data. I want to populate only 5 screens and rest of the screens i want to ignore it . So please tell me how to write the bdc for this requirement . we will sechudle in the background this job everyday. So please tell me which method to use session or call transaction. Please tell me step by step process what to do.
    thanks for all the replies.

    Hi
    <b>the BDC program should be in this format</b>
    Transaction Recorder (SHDB)
    How to Upload Presentation Server Flat file to SAP R/3 system???
    How to upload application server file to R/3 system?
    Definition
    Example - Call Transaction Method
    <b>Transaction Recorder (SHDB)</b>
    Before you work with the Batch Input methods, you should know the purpose of the tool
    Transaction Recorder.
    Use:
    You can use the transaction recorder to record a series of transactions and their screens.
    Features:
    You can use the recording to create
    Data transfer programs that use batch input or CALL TRANSACTION
    Batch input sessions
    Test data
    Function modules.
    Note: It doesn’t record F1, F4 and Scrollbar movements
    <b>Upload Flat file from Presentation Server to SAP R/3</b>
    CALL FUNCTION ‘GUI_UPLOAD'
    EXPORTING
    CODEPAGE = ‘IBM'
    FILENAME = P_UFILE
    FILETYPE = 'DAT'
    TABLES
    DATA_TAB = INT_TAB
    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
    OTHERS = 10 .
    IF SY-SUBRC NE 0.
    MESSAGE E999(FR) WITH 'ERROR IN FILE UPLOAD'.
    ENDIF.
    <b>Upload file from application server to SAP R/3</b>
    Open the the application server file
    OPEN DATASET <dsn> FOR INPUT <mode>
    Read the data from application server file
    READ DATASET <dsn> INTO <wa>
    And then close the application server file
    CLOSE DATASET <dsn>
    <b>Definition- Declaring BDC Table</b>
    DATA: BDC_TAB LIKE STANDARD TABLE OF
    BDCDATA INITIAL SIZE 6
    WITH HEADER LINE .
    The internal table used to collect the transaction’s information must be declared “LIKE BDCDATA”.
    <b>Filling BDC Table – Method #1</b>
    FORM FILL_BDC_TAB.
    REFRESH BDC_TAB.
    CLEAR BDC_TAB.
    BDC_TAB-PROGRAM = ‘SAPMF02K’.
    BDC_TAB-DYNPRO = ‘01016’.
    BDC_TAB-DYNBEGIN = ‘X’.
    APPEND BDC_TAB.
    CLEAR BDC_TAB.
    BDC_TAB-FNAM = ‘RF02K-LIFNR’.
    BDC_TAB-FVAL = ‘TEST1’.
    APPEND BDC_TAB.
    CLEAR BDC_TAB.
    BDC_TAB-FNAM = ‘RF02K-D0010’.
    BDC_TAB-FVAL = ‘X’.
    APPEND BDC_TAB.
    CLEAR BDC_TAB.
    BDC_TAB-PROGRAM = ‘SAPMF02K’.
    BDC_TAB-DYNPRO = ‘0110’.
    BDC_TAB-DYNBEGIN = ‘X’.
    APPEND BDC_TAB.
    CLEAR BDC_TAB.
    BDC_TAB-FNAM = ‘LFA1-STRAS’.
    BDC_TAB-FVAL = ‘123 Main St.’.
    APPEND BDC_TAB.
    CLEAR BDC_TAB.
    BDC_TAB-FNAM = ‘BDC_OKCODE’.
    BDC_TAB-FVAL = ‘/11’.
    APPEND BDC_TAB.
    ENDFORM.
    <b>Filling BDC Table – Method #2</b>
    FORM FILL_BDC_TAB.
    REFRESH BDC_TAB.
    PERFORM POPULATE_BDC_TAB
    USING:
    ‘1’ ‘SAPMF02K’ ‘0106’,
    ‘ ‘ ‘RF02K-LIFNR’ ‘TEST1’,
    ‘ ‘ ‘RF02K-D0010’ ‘X’,
    ‘1’ ‘SAPMF02K’ ‘0110’,
    ‘ ‘ ‘LFA1-STRAS’, ‘123 Main St.’,
    ‘ ‘ ‘BDC_OKCODE’, ‘/11’.
    ENDFORM.
    FORM POPULATE_BDC_TAB USING FLAG VAR1 VAR2.
    CLEAR BDC_TAB.
    IF FLAG = ‘1’.
    BDC_TAB-PROGRAM = VAR1.
    BDC_TAB-DYNPRO = VAR2..
    BDC_TAB-DYNBEGIN = ‘X’.
    ELSE.
    BDC_TAB-FNAM = VAR1.
    BDC_TAB-FVAL = VAR2.
    ENDIF.
    APPEND BDC_TAB.
    ENDFORM.
    This two subroutine method to fill the BDC table is preferable because the “POPULATE_BDC_TABLE” subroutine is reusable throughout all batch input programs.
    <b>Example #1 - Change Vendor (Call Transaction Method)</b>
    Example #1- Declaration Section
    REPORT Y180DM10.
    DATA: BDC_TAB LIKE STANDARD TABLE OF
    BDCDATA INITIAL SIZE 6 WITH HEADER LINE.
    INFILE(20) VALUE ‘/tmp/bc180_file4’.
    DATA: BEGIN OF INREC.
    VENDNUM LIKE LFA1-LIFNR.
    STREET LIKE LFA1-STRAS.
    END OF INREC.
    PARAMETERS: DISPMODE DEFAULT ‘A’,
    UPDAMODE DEFAULT ‘S’.
    START-OF-SELECTION.
    OPEN DATASET INFILE
    FOR INPUT IN TEXT MODE.
    DO.
    READ DATASET INFILE INTO INREC.
    IF SY-SUBRC < > 0. EXIT. ENDIF.
    PERFORM FILL_BDC_TAB.
    CALL TRANSACTION ‘FK02’
    USING BDC_TAB
    MODE DISPMODE
    UPDATE UPDAMODE.
    IF SY-SUBRC < > 0.
    WRITE: /‘ERROR’.
    ENDIF.
    ENDDO.
    CLOSE DATASET INFILE.
    <b>synchronous updating</b>
    DO.
    PERFORM FILL_BDC_TAB.
    CALL TRANSACTION ‘FK02’
    USING BDC_TAB
    MODE ‘N’
    UPDATE ‘S’.
    IF SY-SUBRC < > 0.
    WRITE: /‘ERROR’.
    ENDIF.
    ENDDO.
    With synchronous updating, we can check SY-SUBRC to determine the success of the transaction and the actual update to the database.
    <b>asynchronous updating</b>
    DO.
    PERFORM FILL_BDC_TAB.
    CALL TRANSACTION ‘FK02’
    USING BDC_TAB
    MODE ‘N’
    UPDATE ‘A’.
    IF SY-SUBRC < > 0.
    WRITE: /‘ERROR’.
    ENDIF.
    ENDDO.
    With asynchronous updating, we can check SY-SUBRC to determine the success of the transaction only, not the actual update to the database.
    <b>Error Handling</b>
    Write an error report.
    Send the record(s) in error to an error file.
    Create a batch input session with the record(s) in error.
    To store error messages ( CALL TRANSACTION )
    data: begin of Tab_Mess occurs 0.
    include structure bdcmsgcoll.
    data : end of Tab_Mess,
    CALL TRANSACTION ‘FK02’ USING BDC_TAB MODE ‘N’ UPDATE ‘S’
    MESSAGES INTO TAB_MESS.
    IF SY-SUBRC NE 0.
    WRITE: / Tab_MESS-TCODE, Tab_MESS-DYNUMB, Tab_MESS-MSGTYP ,
    Tab_MESS-MSGID.
    ENDIF.
    <b>i am giving you example for Change Vendor you practice for ur tcode</b>
    For our example, we will use the “Change Vendor” transaction (“FK02”) to add a street address to an already existing vendor.
    <b>Step #1</b>
    Use “System&#61664;Status” menu path to determine online program name (SAPMF02K), screen number (0110)
    <b>Step #2</b>
    Use “F1” key and “Technical Info” pushbutton in each screen field to be filled to determine the field name.
    <b>Step #3</b>
    Determine how to proceed in the transaction
    (save the record by clicking on the ‘Save’ pushbutton or pressing the ‘F11’ key).
    <b>BDC Table Contents</b>
    After researching the transaction we can determine the contents of the BDC table.
    PROGRAM DYNPRO DYNBEGIN FNAM FVAL
    SAMPF02K 0106 X
    RF02K-LIFNR TEST1
    RF02K-D0110 X
    SAMPF02K 0110 X
    LFA1-STRAS 123 Main St.
    BDC_OKCODE /11
    <b>Batch Input Methods</b>
    “CALL TRANSACTION USING”
    STATEMENT
    <b>Call transaction - for data transfer</b>
    Processing batch input data with CALL TRANSACTION USING is the faster of the two recommended data transfer methods. In this method, legacy data is processed inline in your data transfer program.
    Syntax:
    CALL TRANSACTION <tcode>
    USING <bdc_tab>
    MODE <mode>
    UPDATE <update>
    A Display all
    E Display errors only
    N No display
    S Synchronous
    A Asynchronous
    L Local update
    <b>The process flow of CALL TRANSACTION</b>
    A program that uses CALL TRANSACTION USING to process legacy data should execute thefollowing steps:
    Prepare a BDCDATA structure for the transaction that you wish to run.
    Prepare a internal table to store error messages Tab_Mess like structure of BDCMSGCOLL.
    With a CALL TRANSACTION USING statement, call the transaction and prepare the BDCDATA structure. For example:
    CALL TRANSACTION ‘MM01' USING BDCDATA MODE 'A' UPDATE 'S'. MESSAGES INTO TAB_MESS.
    IF SY-SUBRC <> 0.
    <Error_handling>.
    ENDIF.
    <b>Overview of Batch Input Session</b>
    The first batch input method is to create a batch input session. It is the processing of this batch input session that updates the database, not the execution of the batch input program.
    <b>Reward if usefull</b>

  • GOA Error tracking in SRM

    Hello All
    I wanted to check what are the contracts are held up in the IDOC error blareL-RELEAVE VALUES TO sap srm FROM ecc.
    How can i extract a report what are the GOA contracts are in IDOC error  state while posting to SRM GOA release value
    We may not have time to look each idoc erorr and do not want to see the which contract has an eror
    i want a report
    - What are contrcts RELEASE values are held up in the idoc(BLAREL) . i AWARE BD87/WE09/WE02 .
    GOA Contract number - Outbound -with error message
    Any help is appreciated
    regards
    Muthu

    hi Praveen,
    <u><b>Batch Input</b></u>
    Errors occured during Batch input sessions can corrected manually, when we re-process the session from SM35. Also you can analyze the errors from SM35 itself, before you re-process the same session.
    1->goto SM35, select the session which resulted in error.
    2->choose button <b>Analysis</b> or <b>Log</b> to see the errors
    30>choose button <b>Process</b> to re-process the session
    and manually enter the faulty values
    <u><b>Call transaction</b></u>
    you have to collect the error messages into an internal table of structure <b>BDCMSGCOLL</b> and output/download the errors so that the end user can know which records are giving error. There is no option to re-process these records directly.
    But you can do it in a different way. collect the records which are gives error and generate a session for these records only. Now the user can run the session online and correct the entries.
    data itab type table of BDCMSGCOLL
    Call transaction 'XK01' MODE 'A'  UPDATE 'S' MESSAGES INTO itab
    *mode A = display all screens. (E = errors only, N = no display)
    Hope this helps,
    Sajan Joseph.

  • Skipping errors in call transcation

    hi all ,
             please help me to find out how i can skip errors in call trnacastion method and take next data ignoring this data if msg type is 'E' . my prob is if the msg type is E it wont get skipped
    and wont take next data and wont give error logs

    while running BDC using Call transaction method use structure type BDCMSGCOLL and collect the message in that structure
    Put the condition the Message Type is 'E'
    Skip the record and continue.
    Or else if you know which record will get error hard code that record to skip.

  • BDC messages - URGENT HELP NEEDED

    Hi All,
    I have a ALV. The user gets a buttons in the toolbar, which executes a BDC in the Background. the BDC is called using Call transaction method. The messages are collected in an internal Table of type BDCMSGCOLL .
      I need to know how do i print these messages on a new screen with ICONS.
    Please HELP.
    Thanks

    Hi,
    whenever user press the pushbutton it will execute the table in background.
    for this requirement plz use the sm37 there u can run the bdc program in that u provide the job name and jobcount.
    plz give  the structure name bdcmsgcoll and i u want only the error message plz specify the mode as E and updated u can choose what ever u want.
    Rgds,
    P.Naganjana Reddy

  • While uploading data into the r/3 using call transaction or session method

    hi experts
    while uploading data into the r/3 using call transaction or session method error occured in the middle of the processing then how these methods behaves it transfers next records or not?

    hai
    Session method: The records are not added to the database until the session is processed. sy-subrc is not returned. Error logs are created for error records. Updation in database table is always Synchronous.
    Call Transaction method: The records are immediately added to the database table. sy-subrc is returned to 0 if successful. Error logs are not created and hence the errors need to be handled explicitly. Updation in database table is either Synchronous or Asynchronous.
    While to transfer the data from the through if any errors occurs until the errors are the complete the data is not transfer to the SAP system.
    the system compulsory shows the errors. that errors are stored into the error logs (Transaction is SM35).
    so the session method should not return any value.
    In call transaction method data is directly pass to the SAP system.
    So its compulsory return the value.
    Because of the call transaction is the function.
    A function should return the value mandatory
    In session method errors stroed in SYSTEM GENRATED ERROR LOG.
    IN CALL TRANSACTION TO CAPTURE THE ERRORS WE SHOULD PERFORM THE FOLLOWING.
    FIRST ME MUST DECLARE AN INTERNAL TABLE WITH THE STRUCTURE OF BDCMSGCOLL TABLE.
    THEN WHILE WRITING THE CALL TRANSACTION STATEMENT WE SHOULD PUT THE 'E' MODE FOR CAPTURING ALL THE ERRORS.
    THEN FINALLY THE CAPTURED ERRORS MUST TO SENT TO THE INTERNAL TABLE WHICH WE DECLARED IN THE BEGINNING WITH BDCMSGCOLL BY USING THE FUNCTION MODULE "FORMAT_MESSAGE"
    AND THUS THE ERROR MESSAGES WILL BE SENT TO THE INTERNAL TABLE WHICH WE DECLARED AT THE BEGINNING.

  • Give a BDC example by Direct Input Method

    pl give step by step procedure...
    Thanks guyz

    Hi
    this is the common procedure for all BDc programs
    <b>the BDC program should be in this format</b>
    Transaction Recorder (SHDB)
    How to Upload Presentation Server Flat file to SAP R/3 system???
    How to upload application server file to R/3 system?
    Definition
    Example - Call Transaction Method
    <b>Transaction Recorder (SHDB)</b>
    Before you work with the Batch Input methods, you should know the purpose of the tool
    Transaction Recorder.
    Use:
    You can use the transaction recorder to record a series of transactions and their screens.
    Features:
    You can use the recording to create
    Data transfer programs that use batch input or CALL TRANSACTION
    Batch input sessions
    Test data
    Function modules.
    Note: It doesn’t record F1, F4 and Scrollbar movements
    <b>Upload Flat file from Presentation Server to SAP R/3</b>
    CALL FUNCTION ‘GUI_UPLOAD'
    EXPORTING
    CODEPAGE = ‘IBM'
    FILENAME = P_UFILE
    FILETYPE = 'DAT'
    TABLES
    DATA_TAB = INT_TAB
    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
    OTHERS = 10 .
    IF SY-SUBRC NE 0.
    MESSAGE E999(FR) WITH 'ERROR IN FILE UPLOAD'.
    ENDIF.
    U<b>pload file from application server to SAP R/3</b>
    Open the the application server file
    OPEN DATASET <dsn> FOR INPUT <mode>
    Read the data from application server file
    READ DATASET <dsn> INTO <wa>
    And then close the application server file
    CLOSE DATASET <dsn>
    <b>Definition- Declaring BDC Table</b>
    DATA: BDC_TAB LIKE STANDARD TABLE OF
    BDCDATA INITIAL SIZE 6
    WITH HEADER LINE .
    The internal table used to collect the transaction’s information must be declared “LIKE BDCDATA”.
    <b>Filling BDC Table – Method #1</b>
    FORM FILL_BDC_TAB.
    REFRESH BDC_TAB.
    CLEAR BDC_TAB.
    BDC_TAB-PROGRAM = ‘SAPMF02K’.
    BDC_TAB-DYNPRO = ‘01016’.
    BDC_TAB-DYNBEGIN = ‘X’.
    APPEND BDC_TAB.
    CLEAR BDC_TAB.
    BDC_TAB-FNAM = ‘RF02K-LIFNR’.
    BDC_TAB-FVAL = ‘TEST1’.
    APPEND BDC_TAB.
    CLEAR BDC_TAB.
    BDC_TAB-FNAM = ‘RF02K-D0010’.
    BDC_TAB-FVAL = ‘X’.
    APPEND BDC_TAB.
    CLEAR BDC_TAB.
    BDC_TAB-PROGRAM = ‘SAPMF02K’.
    BDC_TAB-DYNPRO = ‘0110’.
    BDC_TAB-DYNBEGIN = ‘X’.
    APPEND BDC_TAB.
    CLEAR BDC_TAB.
    BDC_TAB-FNAM = ‘LFA1-STRAS’.
    BDC_TAB-FVAL = ‘123 Main St.’.
    APPEND BDC_TAB.
    CLEAR BDC_TAB.
    BDC_TAB-FNAM = ‘BDC_OKCODE’.
    BDC_TAB-FVAL = ‘/11’.
    APPEND BDC_TAB.
    ENDFORM.
    <b>Filling BDC Table – Method #2</b>
    FORM FILL_BDC_TAB.
    REFRESH BDC_TAB.
    PERFORM POPULATE_BDC_TAB
    USING:
    ‘1’ ‘SAPMF02K’ ‘0106’,
    ‘ ‘ ‘RF02K-LIFNR’ ‘TEST1’,
    ‘ ‘ ‘RF02K-D0010’ ‘X’,
    ‘1’ ‘SAPMF02K’ ‘0110’,
    ‘ ‘ ‘LFA1-STRAS’, ‘123 Main St.’,
    ‘ ‘ ‘BDC_OKCODE’, ‘/11’.
    ENDFORM.
    FORM POPULATE_BDC_TAB USING FLAG VAR1 VAR2.
    CLEAR BDC_TAB.
    IF FLAG = ‘1’.
    BDC_TAB-PROGRAM = VAR1.
    BDC_TAB-DYNPRO = VAR2..
    BDC_TAB-DYNBEGIN = ‘X’.
    ELSE.
    BDC_TAB-FNAM = VAR1.
    BDC_TAB-FVAL = VAR2.
    ENDIF.
    APPEND BDC_TAB.
    ENDFORM.
    This two subroutine method to fill the BDC table is preferable because the “POPULATE_BDC_TABLE” subroutine is reusable throughout all batch input programs.
    Example #1 - Change Vendor (Call Transaction Method)
    <b>Example #1- Declaration Section</b>
    REPORT Y180DM10.
    DATA: BDC_TAB LIKE STANDARD TABLE OF
    BDCDATA INITIAL SIZE 6 WITH HEADER LINE.
    INFILE(20) VALUE ‘/tmp/bc180_file4’.
    DATA: BEGIN OF INREC.
    VENDNUM LIKE LFA1-LIFNR.
    STREET LIKE LFA1-STRAS.
    END OF INREC.
    PARAMETERS: DISPMODE DEFAULT ‘A’,
    UPDAMODE DEFAULT ‘S’.
    START-OF-SELECTION.
    OPEN DATASET INFILE
    FOR INPUT IN TEXT MODE.
    DO.
    READ DATASET INFILE INTO INREC.
    IF SY-SUBRC < > 0. EXIT. ENDIF.
    PERFORM FILL_BDC_TAB.
    CALL TRANSACTION ‘FK02’
    USING BDC_TAB
    MODE DISPMODE
    UPDATE UPDAMODE.
    IF SY-SUBRC < > 0.
    WRITE: /‘ERROR’.
    ENDIF.
    ENDDO.
    CLOSE DATASET INFILE.
    <b>synchronous updating</b>
    DO.
    PERFORM FILL_BDC_TAB.
    CALL TRANSACTION ‘FK02’
    USING BDC_TAB
    MODE ‘N’
    UPDATE ‘S’.
    IF SY-SUBRC < > 0.
    WRITE: /‘ERROR’.
    ENDIF.
    ENDDO.
    With synchronous updating, we can check SY-SUBRC to determine the success of the transaction and the actual update to the database.
    <b>asynchronous updating</b>
    DO.
    PERFORM FILL_BDC_TAB.
    CALL TRANSACTION ‘FK02’
    USING BDC_TAB
    MODE ‘N’
    UPDATE ‘A’.
    IF SY-SUBRC < > 0.
    WRITE: /‘ERROR’.
    ENDIF.
    ENDDO.
    With asynchronous updating, we can check SY-SUBRC to determine the success of the transaction only, not the actual update to the database.
    <b>Error Handling</b>
    Write an error report.
    Send the record(s) in error to an error file.
    <b>Create a batch input session with the record(s) in error.</b>
    To store error messages ( CALL TRANSACTION )
    data: begin of Tab_Mess occurs 0.
    include structure bdcmsgcoll.
    data : end of Tab_Mess,
    CALL TRANSACTION ‘FK02’ USING BDC_TAB MODE ‘N’ UPDATE ‘S’
    MESSAGES INTO TAB_MESS.
    IF SY-SUBRC NE 0.
    WRITE: / Tab_MESS-TCODE, Tab_MESS-DYNUMB, Tab_MESS-MSGTYP ,
    Tab_MESS-MSGID.
    ENDIF.
    <b>i am giving you example for Change Vendor you practice for ur tcode</b>
    For our example, we will use the “Change Vendor” transaction (“FK02”) to add a street address to an already existing vendor.
    <b>Step #1</b>
    Use “System&#61664;Status” menu path to determine online program name (SAPMF02K), screen number (0110)
    <b>Step #2</b>
    Use “F1” key and “Technical Info” pushbutton in each screen field to be filled to determine the field name.
    <b>Step #3</b>
    Determine how to proceed in the transaction
    (save the record by clicking on the ‘Save’ pushbutton or pressing the ‘F11’ key).
    <b>BDC Table Contents</b>
    After researching the transaction we can determine the contents of the BDC table.
    PROGRAM DYNPRO DYNBEGIN FNAM FVAL
    SAMPF02K 0106 X
    RF02K-LIFNR TEST1
    RF02K-D0110 X
    SAMPF02K 0110 X
    LFA1-STRAS 123 Main St.
    BDC_OKCODE /11
    <b>Batch Input Methods</b>
    “CALL TRANSACTION USING”
    STATEMENT
    Call transaction - for data transfer
    Processing batch input data with CALL TRANSACTION USING is the faster of the two recommended data transfer methods. In this method, legacy data is processed inline in your data transfer program.
    Syntax:
    CALL TRANSACTION <tcode>
    USING <bdc_tab>
    MODE <mode>
    UPDATE <update>
    A Display all
    E Display errors only
    N No display
    S Synchronous
    A Asynchronous
    L Local update
    <b>The process flow of CALL TRANSACTION</b>
    A program that uses CALL TRANSACTION USING to process legacy data should execute thefollowing steps:
    Prepare a BDCDATA structure for the transaction that you wish to run.
    Prepare a internal table to store error messages Tab_Mess like structure of BDCMSGCOLL.
    With a CALL TRANSACTION USING statement, call the transaction and prepare the BDCDATA structure. For example:
    CALL TRANSACTION ‘MM01' USING BDCDATA MODE 'A' UPDATE 'S'. MESSAGES INTO TAB_MESS.
    IF SY-SUBRC <> 0.
    <Error_handling>.
    ENDIF.
    <b>Overview of Batch Input Session</b>
    The first batch input method is to create a batch input session. It is the processing of this batch input session that updates the database, not the execution of the batch input program.
    <b>
    Reward if usefull</b>

  • Writing a Batch Input or Call Transaction program for transaction code MMAM

    Hi All,
    I'm writing a Batch Input or Call Transaction program for transaction code MMAM (Changing Material Type). The program was able to run but somehow I was not able to capture the log of the output after running MMAM. The log was not part of the SY-MESSAGE so adding in MESSTAB into call transaction doesn't help while BDC session logs shows only the transaction was processed.
    Anyone has encounter such problems before?
    Regards,
    Ramu.

    Hi
    Overview of Batch Input Session
    The first batch input method is to create a batch input session. It is the processing of this batch input session that updates the database, not the execution of the batch input program. i am giving you example for Change Vendor you practice for ur tcode
    For our example, we will use the “Change Vendor” transaction (“FK02”) to add a street address to an already existing vendor.
    Step #1
    Use “System&#61664;Status” menu path to determine online program name (SAPMF02K), screen number (0110)
    Step #2
    Use “F1” key and “Technical Info” pushbutton in each screen field to be filled to determine the field name.
    Step #3
    Determine how to proceed in the transaction
    (save the record by clicking on the ‘Save’ pushbutton or pressing the ‘F11’ key).
    The process flow of CALL TRANSACTION
    A program that uses CALL TRANSACTION USING to process legacy data should execute thefollowing steps:
    Prepare a BDCDATA structure for the transaction that you wish to run.
    Prepare a internal table to store error messages Tab_Mess like structure of BDCMSGCOLL.
    With a CALL TRANSACTION USING statement, call the transaction and prepare the BDCDATA structure. For example:
    CALL TRANSACTION ‘MM01' USING BDCDATA MODE 'A' UPDATE 'S'. MESSAGES INTO TAB_MESS.
    IF SY-SUBRC <> 0.
    <Error_handling>.
    ENDIF.
    Overview of Batch Input Session
    The first batch input method is to create a batch input session. It is the processing of this batch input session that updates the database, not the execution of the batch input program

  • I Need Navigation about BDC Upload

    Need Navigation about BDC Upload

    Hi
    <b>the BDC program should be in this format</b>
    Transaction Recorder (SHDB)
    How to Upload Presentation Server Flat file to SAP R/3 system???
    How to upload application server file to R/3 system?
    Definition
    <b>Example - Call Transaction Method</b>
    <b>Transaction Recorder (SHDB)</b>
    Before you work with the Batch Input methods, you should know the purpose of the tool
    Transaction Recorder.
    <b>Use:</b>
    You can use the transaction recorder to record a series of transactions and their screens.
    <b>Features:</b>
    You can use the recording to create
    Data transfer programs that use batch input or CALL TRANSACTION
    Batch input sessions
    Test data
    Function modules.
    Note: It doesn’t record F1, F4 and Scrollbar movements
    <b>Upload Flat file from Presentation Server to SAP R/3</b>
    CALL FUNCTION ‘GUI_UPLOAD'
    EXPORTING
    CODEPAGE = ‘IBM'
    FILENAME = P_UFILE
    FILETYPE = 'DAT'
    TABLES
    DATA_TAB = INT_TAB
    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
    OTHERS = 10 .
    IF SY-SUBRC NE 0.
    MESSAGE E999(FR) WITH 'ERROR IN FILE UPLOAD'.
    ENDIF.
    <b>Upload file from application server to SAP R/3</b>
    Open the the application server file
    OPEN DATASET <dsn> FOR INPUT <mode>
    Read the data from application server file
    READ DATASET <dsn> INTO <wa>
    And then close the application server file
    CLOSE DATASET <dsn>
    Definition- Declaring BDC Table
    DATA: BDC_TAB LIKE STANDARD TABLE OF
    BDCDATA INITIAL SIZE 6
    WITH HEADER LINE .
    The internal table used to collect the transaction’s information must be declared “LIKE BDCDATA”.
    <b>Filling BDC Table – Method #1</b>
    FORM FILL_BDC_TAB.
    REFRESH BDC_TAB.
    CLEAR BDC_TAB.
    BDC_TAB-PROGRAM = ‘SAPMF02K’.
    BDC_TAB-DYNPRO = ‘01016’.
    BDC_TAB-DYNBEGIN = ‘X’.
    APPEND BDC_TAB.
    CLEAR BDC_TAB.
    BDC_TAB-FNAM = ‘RF02K-LIFNR’.
    BDC_TAB-FVAL = ‘TEST1’.
    APPEND BDC_TAB.
    CLEAR BDC_TAB.
    BDC_TAB-FNAM = ‘RF02K-D0010’.
    BDC_TAB-FVAL = ‘X’.
    APPEND BDC_TAB.
    CLEAR BDC_TAB.
    BDC_TAB-PROGRAM = ‘SAPMF02K’.
    BDC_TAB-DYNPRO = ‘0110’.
    BDC_TAB-DYNBEGIN = ‘X’.
    APPEND BDC_TAB.
    CLEAR BDC_TAB.
    BDC_TAB-FNAM = ‘LFA1-STRAS’.
    BDC_TAB-FVAL = ‘123 Main St.’.
    APPEND BDC_TAB.
    CLEAR BDC_TAB.
    BDC_TAB-FNAM = ‘BDC_OKCODE’.
    BDC_TAB-FVAL = ‘/11’.
    APPEND BDC_TAB.
    ENDFORM.
    <b>Filling BDC Table – Method #2</b>
    FORM FILL_BDC_TAB.
    REFRESH BDC_TAB.
    PERFORM POPULATE_BDC_TAB
    USING:
    ‘1’ ‘SAPMF02K’ ‘0106’,
    ‘ ‘ ‘RF02K-LIFNR’ ‘TEST1’,
    ‘ ‘ ‘RF02K-D0010’ ‘X’,
    ‘1’ ‘SAPMF02K’ ‘0110’,
    ‘ ‘ ‘LFA1-STRAS’, ‘123 Main St.’,
    ‘ ‘ ‘BDC_OKCODE’, ‘/11’.
    ENDFORM.
    FORM POPULATE_BDC_TAB USING FLAG VAR1 VAR2.
    CLEAR BDC_TAB.
    IF FLAG = ‘1’.
    BDC_TAB-PROGRAM = VAR1.
    BDC_TAB-DYNPRO = VAR2..
    BDC_TAB-DYNBEGIN = ‘X’.
    ELSE.
    BDC_TAB-FNAM = VAR1.
    BDC_TAB-FVAL = VAR2.
    ENDIF.
    APPEND BDC_TAB.
    ENDFORM.
    This two subroutine method to fill the BDC table is preferable because the “POPULATE_BDC_TABLE” subroutine is reusable throughout all batch input programs.
    Example #1 - Change Vendor (Call Transaction Method)
    <b>Example #1- Declaration Section</b>
    REPORT Y180DM10.
    DATA: BDC_TAB LIKE STANDARD TABLE OF
    BDCDATA INITIAL SIZE 6 WITH HEADER LINE.
    INFILE(20) VALUE ‘/tmp/bc180_file4’.
    DATA: BEGIN OF INREC.
    VENDNUM LIKE LFA1-LIFNR.
    STREET LIKE LFA1-STRAS.
    END OF INREC.
    PARAMETERS: DISPMODE DEFAULT ‘A’,
    UPDAMODE DEFAULT ‘S’.
    START-OF-SELECTION.
    OPEN DATASET INFILE
    FOR INPUT IN TEXT MODE.
    DO.
    READ DATASET INFILE INTO INREC.
    IF SY-SUBRC < > 0. EXIT. ENDIF.
    PERFORM FILL_BDC_TAB.
    CALL TRANSACTION ‘FK02’
    USING BDC_TAB
    MODE DISPMODE
    UPDATE UPDAMODE.
    IF SY-SUBRC < > 0.
    WRITE: /‘ERROR’.
    ENDIF.
    ENDDO.
    CLOSE DATASET INFILE.
    <b>synchronous updating</b>
    DO.
    PERFORM FILL_BDC_TAB.
    CALL TRANSACTION ‘FK02’
    USING BDC_TAB
    MODE ‘N’
    UPDATE ‘S’.
    IF SY-SUBRC < > 0.
    WRITE: /‘ERROR’.
    ENDIF.
    ENDDO.
    With synchronous updating, we can check SY-SUBRC to determine the success of the transaction and the actual update to the database.
    <b>asynchronous updating</b>
    DO.
    PERFORM FILL_BDC_TAB.
    CALL TRANSACTION ‘FK02’
    USING BDC_TAB
    MODE ‘N’
    UPDATE ‘A’.
    IF SY-SUBRC < > 0.
    WRITE: /‘ERROR’.
    ENDIF.
    ENDDO.
    With asynchronous updating, we can check SY-SUBRC to determine the success of the transaction only, not the actual update to the database.
    <b>Error Handling</b>
    Write an error report.
    Send the record(s) in error to an error file.
    Create a batch input session with the record(s) in error.
    To store error messages ( CALL TRANSACTION )
    data: begin of Tab_Mess occurs 0.
    include structure bdcmsgcoll.
    data : end of Tab_Mess,
    CALL TRANSACTION ‘FK02’ USING BDC_TAB MODE ‘N’ UPDATE ‘S’
    MESSAGES INTO TAB_MESS.
    IF SY-SUBRC NE 0.
    WRITE: / Tab_MESS-TCODE, Tab_MESS-DYNUMB, Tab_MESS-MSGTYP ,
    Tab_MESS-MSGID.
    ENDIF.
    <b>i am giving you example for Change Vendor you practice for ur tcode</b>
    For our example, we will use the “Change Vendor” transaction (“FK02”) to add a street address to an already existing vendor.
    <b>Step #1</b>
    Use “System&#61664;Status” menu path to determine online program name (SAPMF02K), screen number (0110)
    <b>Step #2</b>
    Use “F1” key and “Technical Info” pushbutton in each screen field to be filled to determine the field name.
    <b>Step #3</b>
    Determine how to proceed in the transaction
    (save the record by clicking on the ‘Save’ pushbutton or pressing the ‘F11’ key).
    <b>BDC Table Contents</b>
    After researching the transaction we can determine the contents of the BDC table.
    PROGRAM DYNPRO DYNBEGIN FNAM FVAL
    SAMPF02K 0106 X
    RF02K-LIFNR TEST1
    RF02K-D0110 X
    SAMPF02K 0110 X
    LFA1-STRAS 123 Main St.
    BDC_OKCODE /11
    <b>Batch Input Methods</b>
    “CALL TRANSACTION USING”
    STATEMENT
    <b>Call transaction - for data transfer</b>Processing batch input data with CALL TRANSACTION USING is the faster of the two recommended data transfer methods. In this method, legacy data is processed inline in your data transfer program.
    Syntax:
    CALL TRANSACTION <tcode>
    USING <bdc_tab>
    MODE <mode>
    UPDATE <update>
    A Display all
    E Display errors only
    N No display
    S Synchronous
    A Asynchronous
    L Local update
    <b>The process flow of CALL TRANSACTION</b>
    A program that uses CALL TRANSACTION USING to process legacy data should execute thefollowing steps:
    Prepare a BDCDATA structure for the transaction that you wish to run.
    Prepare a internal table to store error messages Tab_Mess like structure of BDCMSGCOLL.
    With a CALL TRANSACTION USING statement, call the transaction and prepare the BDCDATA structure. For example:
    CALL TRANSACTION ‘MM01' USING BDCDATA MODE 'A' UPDATE 'S'. MESSAGES INTO TAB_MESS.
    IF SY-SUBRC <> 0.
    <Error_handling>.
    ENDIF.
    <b>Overview of Batch Input Session</b>
    The first batch input method is to create a batch input session. It is the processing of this batch input session that updates the database, not the execution of the batch input program.
    <b>Reward if usefull</b>

  • Message type in BDCMSGCOLL Structure in Call transaction using BDCDATA

    Hi,
    We are facing issue while capturing message in BDCMSGCOLL structure in Call transaction using bdcdata. The message which are like
    Message 'Message Text' Type 'S' Display LIke 'E' .
    This message is captured as Success on the Message structure instead of error & user are asking to update it as Error as it is looking like Error message to the end user.
    Please provide resolution to the issue.
    Regards,
    Kapil

    Hi Venkat,
    I am not doing any upload, i am just doing a replay of the transaction ME21 & in that there are many error message which encounter while creating a PO but when i have check the logic , they are basically a success message which are display like Error so when i have called ME21 transaction using below statement
    call transaction ME21 using BDCDATA
                                            into messages bdcmsgcoll.
    I am getting the message as success only since the message are of type success but as they are display like E , so user want that in msgcoll structure these messages must be shown as Error.
    Regards,
    Kapil.

  • Selecting into an internal table with deep structure

    Hi,
    I am working in ECC 6.0 now and it is giving me a syntax error for the following code.
    types: tt_bdc type standard table of bdcmsgcoll
          with default key.
    data:  begin of t_test occurs 0,
            vbeln like vbak-vbeln,
            tab   type tt_bdc,
          end of t_test.
    select vbeln from vbak into table t_test
      where aedat > '20081101'.
    The error is:
    +The work area (or internal table) "T_TEST" is not flat, or contains
    reference or internal tables as components . components. components.
    components. components.+
    I've done this in countless other programs in the past.  How can I use a deep structure this way?  What am I missing?
    Thanks very much!

    Will this solve ur requirement -
    types: tt_bdc type standard table of bdcmsgcoll
          with default key.
    data:  begin of t_test occurs 0,
            vbeln like vbak-vbeln,
            tab   type tt_bdc,
          end of t_test.
    select vbeln from vbak into
      CORRESPONDING FIELDS OF TABLE t_test
      where aedat > '20081101'.

  • What is the name of the structure that is generated ina a recording

    hi
    what is the name of the structure that is generated ina a recording  using transaction recorder.

    Hi,
    to store data use BDCDATA  structure which holds the field name and field values.
    BDCMSGCOLL is the structure which will holds the message numbers after calling the TCode in your BDC program.
    it holds which records error records by msg type E.
    You can find which records are error records while uploading data.
    in call transaction method it will use for error records .
    Reward points if usefull.

  • Table control ,BDCMSGCOLL help

    hi guys can u plz gimme a simple code along with a small description related to table control &BDCMSGCOLL & plzzzzzzzzzzzzz tell me exactly waat is happening in d code

    HI Crandall ,
    Check out the following documentation and sample code example
    Update Source List by Material Group - MM01
    The SCREEN SEQUENCE FOLLOWS
    4.6x.
    Update Source List by Material Group
    Blocking / Unblocking the Vendor
    The Vendor code is retrieve from the Purchasing Info Record
    REPORT ZSOURCE.
    TABLES: EORD,
            EINA,
            MARC.
    Batch Input Name
    PARAMETERS P-BTCHSN(12)            DEFAULT 'ME01'.
    Vendor Code
    PARAMETERS P-LIFNR LIKE LFA1-LIFNR DEFAULT 'XXXXX'.
    Material Group
    PARAMETERS P-MATKL LIKE MARA-MATKL DEFAULT 'XXXXXXX'.
    Plants
    PARAMETERS P-WERKS LIKE EORD-WERKS DEFAULT 'XX'.
    Tick Block/Untick Unblock
    PARAMETERS P-NOTKZ LIKE EORD-NOTKZ DEFAULT 'X'.
    Auto / Manual run the Batch Input Program
    PARAMETERS P-RUN   AS CHECKBOX     DEFAULT 'X'.
    INTERNAL TABLE FOR DATA
    DATA:  BEGIN OF ULTAB OCCURS 50,
             MATNR LIKE EORD-MATNR,   "Material No.
             WERKS LIKE EORD-WERKS,   "Plants
             ZEORD LIKE EORD-ZEORD,   "NO
             LIFNR LIKE EINA-LIFNR,   "Vendor Code
           END OF ULTAB.
    INTERNAL TABLE FOR BATCH INPUT DATA
    DATA: BEGIN OF IPUTTAB OCCURS 50.
            INCLUDE STRUCTURE BDCDATA.
    DATA: END OF IPUTTAB.
    INTERNAL TABLE FOR BATCH INPUT ERROR MESSAGE.
    DATA: BEGIN OF MESSTAB OCCURS 50.
            INCLUDE STRUCTURE BDCMSGCOLL.
    DATA: END OF MESSTAB.
    DATA: C_TAXKM LIKE MG03STEUER-TAXKM VALUE '1',
          W-LINE-NO TYPE I.
    REFRESH ULTAB.
    SELECT * FROM EINA WHERE LIFNR = P-LIFNR
                         AND LOEKZ = SPACE.
      SELECT SINGLE * FROM MARC WHERE MATNR = EINA-MATNR
                                  AND WERKS = P-WERKS.
      CHECK MARC-LVORM = SPACE.
      CLEAR ULTAB.
      SELECT * FROM EORD WHERE MATNR = EINA-MATNR
                           AND WERKS = P-WERKS
                           AND LIFNR = P-LIFNR.
         ULTAB-MATNR = EORD-MATNR.
         ULTAB-WERKS = EORD-WERKS.
         ULTAB-ZEORD = EORD-ZEORD.
         ULTAB-LIFNR = EORD-LIFNR.
         APPEND ULTAB.
      ENDSELECT.
      IF SY-SUBRC = 4.
         ULTAB-MATNR = EINA-MATNR.
         ULTAB-WERKS = P-WERKS.
         ULTAB-ZEORD = ''.
         ULTAB-LIFNR = EINA-LIFNR.
         APPEND ULTAB.
      ENDIF.
    ENDSELECT.
    CHECK WHETHER TABLE IS EMPTY
    IF ULTAB[] is initial.
       WRITE: / 'TABLE EMPTY'.
    ENDIF.
    Create Batch session
      PERFORM CRE-BATCH-SESS.
    LOOP TABLE TO CREATE SCREEN INPUT
    SORT.
    LOOP AT ULTAB.
      REFRESH IPUTTAB.
      PERFORM SCREEN1.
      PERFORM SCREEN2.
      PERFORM PRN_ULTAB.
      PERFORM CLOSE-SESS.
    ENDLOOP.
    CALL FUNCTION 'BDC_CLOSE_GROUP'.
    END OF MAIN PROGRAM
    FORM SCREEN1.
    SCREEN #1: INITAL SCREEN FOR MAINTAINING SOURCE LIST
      CLEAR IPUTTAB.
      IPUTTAB-PROGRAM = 'SAPLMEOR'.
      IPUTTAB-DYNPRO  =  '200'.
      IPUTTAB-DYNBEGIN = 'X'.
      APPEND IPUTTAB.
    Source List : Material No.
      CLEAR IPUTTAB.
      IPUTTAB-FNAM = 'EORD-MATNR'.
      IPUTTAB-FVAL =  ULTAB-MATNR.
      APPEND IPUTTAB.
    Source List : Plants.
      CLEAR IPUTTAB.
      IPUTTAB-FNAM = 'EORD-WERKS'.
      IPUTTAB-FVAL =  ULTAB-WERKS.
      APPEND IPUTTAB.
    ENDFORM.
    FORM        : SCREEN1                                               *
    FORM SCREEN2.
    Modify screen for SOURCE LIST
      CLEAR IPUTTAB.
      IPUTTAB-PROGRAM = 'SAPLMEOR'.
      IPUTTAB-DYNPRO  =  '205'.
      IPUTTAB-DYNBEGIN = 'X'.
      APPEND IPUTTAB.
      CLEAR IPUTTAB.
      IPUTTAB-FNAM = 'EORD-VDATU(1)'.
      IPUTTAB-FVAL = '01.01.2001'.
      APPEND IPUTTAB.
      CLEAR IPUTTAB.
      IPUTTAB-FNAM = 'EORD-BDATU(1)'.
      IPUTTAB-FVAL = '31.12.9999'.
      APPEND IPUTTAB.
      CLEAR IPUTTAB.
      IPUTTAB-FNAM = 'EORD-LIFNR(1)'.
      IPUTTAB-FVAL = P-LIFNR.
      APPEND IPUTTAB.
      CLEAR IPUTTAB.
      IPUTTAB-FNAM = 'EORD-EKORG(1)'.
      IPUTTAB-FVAL = 'ALL'.
      APPEND IPUTTAB.
      CLEAR IPUTTAB.
      IPUTTAB-FNAM = 'EORD-NOTKZ(1)'.
      IPUTTAB-FVAL = P-NOTKZ.
      APPEND IPUTTAB.
      CLEAR IPUTTAB.
      IPUTTAB-FNAM = 'EORD-AUTET(1)'.
      IPUTTAB-FVAL = '1'.
      APPEND IPUTTAB.
    Specify that we are now done with this screen (Save it with F11)
      CLEAR IPUTTAB.
      IPUTTAB-FNAM = 'BDC_OKCODE'.
      IPUTTAB-FVAL = '/11'.
      APPEND IPUTTAB.
    ENDFORM.
    FORM        : CLOSE-SESS                                            *
    DESCRIPTION : CLOSE THE SESSION                                     *
    FORM CLOSE-SESS.
    closing the session.
    IF P-RUN = 'X'.
    Auto run the Batch Input Program
    CALL TRANSACTION 'ME01'
              USING  IPUTTAB
              MODE   'E'
              UPDATE 'S'
              MESSAGES INTO MESSTAB.
    ELSE.
    Maual run the Batch Input Program
    CALL FUNCTION 'BDC_INSERT'
           EXPORTING
                TCODE     = 'ME01'
           TABLES
                DYNPROTAB = IPUTTAB.
    ENDIF.
    ENDFORM.
    FORM        : PRN-ULTAB                                             *
    DESCRIPTION : PRINT OK TABLE                                        *
    FORM PRN_ULTAB.
      WRITE: / ULTAB-MATNR, ULTAB-WERKS, ULTAB-ZEORD, ULTAB-LIFNR.
      W-LINE-NO = W-LINE-NO + 1.
    WRITE: '      RECORD# ', W-LINE-NO.
    ENDFORM.
    FORM        : CRE-BATCH-SESS                                        *
    DESCRIPTION : CREATE BATCH SESSION                    *
    FORM CRE-BATCH-SESS.
    Create BTCI session **
    CALL FUNCTION 'BDC_OPEN_GROUP'
         EXPORTING
              CLIENT = SY-MANDT
              GROUP  = P-BTCHSN
              USER   = SY-UNAME
              KEEP   = 'X'.
    ENDFORM.
    Good Luck and thanks
    AK

Maybe you are looking for

  • Not receiving email? Check your modem/router!!!

    Hi all. My Logoc board fried last week and server/mail server was offline for that time. Everything worked up to that point. When I got the server back from the genious bar with a new logic board mail and web refused to work. I could send email and s

  • How to resize the DEFAULT tablespace...

    When I use "Portal Configuration Assistant" to Install Oracle Portal, I got an alert from step 5 of 6 : "The Portal Configuration Assistant has halted because it has detected that the amount of free space available in the Default tablespace is less t

  • Nokia e75

    hi, i got a problem with my nokia e75, for some reason i cant update it, tried directly via the phone and via the updater and it keeps failing when trying via the phone i get "connection error" when searching for updates, but i can connect to the int

  • Update table

    Hi,      I had a custom table i_dsc. eg:data:   begin of i_dsc occurs 0.                                 include structure zm_dsc. the custom table zm_dsc has many fields i added a new field in the custom table zz_netwr .i would like to fill the fiel

  • Adobe After Effect on Xsan Volume

    Is there anybody using Adobe After Effect(AE) 6.5 on Xsan Volume in PowerMac G5? In doing 2k or 4k DI work, AE browses many of sequence files (maybe up to 10,000 files in a folder) File type is Cineon( *.cin), and file size is about 12MB for 2k, 48MB