Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BDC issue

Former Member
0 Likes
532

Hi this is saroj.

(1) i have issue bdc.i have done bdc by call transaction method.

suppose i have 100 records.90 are uploaded.10 not uploaded.

how to handle the error and how to upload the rest 10 records.

(2) suppose data is in unix file.how to upload the unix file in bdc.

please answer the questions.

regards

saroj kanta maharana

4 REPLIES 4
Read only

Former Member
0 Likes
484

using BDC message you can handle..

try to use session the error records which are not uploaded will create session ..

next try to run the session with the 10 records which are not updated..

see the sample code..


  CALL TRANSACTION 'ME22'
             USING bdc_tab
              MODE w_lmode
              UPDATE 'S'
          MESSAGES INTO message_tab.       "all the error messages are stored in message_tab

* Error handling
  READ TABLE message_tab WITH KEY msgtyp = 'E'
  IF sy-subrc NE 0.
    LOOP AT message_tab.
      MOVE message_tab-msgnr TO message_no.
      MOVE message_tab-msgv1 TO message_v1.
      MOVE message_tab-msgv2 TO message_v2.
      MOVE message_tab-msgv3 TO message_v3.
      MOVE message_tab-msgv4 TO message_v4.

      CALL FUNCTION 'BAPI_MESSAGE_GETDETAIL'
        EXPORTING
          id         = message_tab-msgid
          number     = message_no
          language   = message_tab-msgspra
          textformat = textformat
          message_v1 = message_v1
          message_v2 = message_v2
          message_v3 = message_v3
          message_v4 = message_v4
        IMPORTING
          message    = err_msg_tab-message
          return     = return.
      APPEND err_msg_tab.
    ENDLOOP.

    CONCATENATE 'GM' sy-datum sy-uzeit INTO group.   "Group is the session name
    MOVE 'ME22' TO tcode.                                            "Pass your t-code

    CALL FUNCTION 'BDC_OPEN_GROUP'
      EXPORTING
        client   = sy-mandt
        group    = group
        user     = sy-uname
        keep     = keep
        holddate = holddate.

    CALL FUNCTION 'BDC_INSERT'
      EXPORTING
        tcode     = tcode
      TABLES
        dynprotab = bdc_tab.

    CALL FUNCTION 'BDC_CLOSE_GROUP'.
ENDIF.

Prabhudas

Read only

Former Member
0 Likes
484

(2) suppose data is in unix file.how to upload the unix file in bdc.

to upload the Unix file..

you need to use FTP_connect ..FTP_command ...FTP_disconnect.. function modules

if it is application server..use open data set read data set and close dataset..

Prabhudas

Read only

manubhutani
Active Contributor
0 Likes
484

Hi

To capture error in call transaction method - use

call transaction PA30 using t_bdcdata

mode n

update S

messages in t_bdcmsgcoll

where t_bdcmsgcoll is type bdcmsgcoll

use function module 'format_message' to get those error and success messages.

for those records where error is occured, you can display to the user and then after correfting those errors

run call transation for only those records.

and to read the file from unix server , use open dataset and read dataset.

then use this data accordingly in your recording

thanks. let me know if u have further queres..

Read only

Former Member
0 Likes
484

ANSWERED