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

hi experts

Former Member
0 Likes
448

Suppose you are provided 2 input files, one with the customer data used to create a customer and another with contracts data. You need to create customers using the first file and then create a contract for each of the customer using the second file. How can this be done using BDC ? Which batch method would be used and what is the procedure ?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
429

Hey fren,

You may go for a Session Method in BDC.

Try this way........

CALL FUNCTION 'BDC_OPEN_GROUP'.
 EXPORTING
   client                    = sy-mandt
*  DEST                      = FILLER8
   group                     = 'ABCD'
*  HOLDDATE                  = 
   keep                      = 'X'
   user                      = sy-uname
*  RECORD                    = FILLER1
*  PROG                      = SY-CPROG
* IMPORTING
*   QID                       =
   EXCEPTIONS
     client_invalid            = 1
     destination_invalid       = 2
     group_invalid             = 3
     group_is_locked           = 4
     holddate_invalid          = 5
     internal_error            = 6
     queue_error               = 7
     running                   = 8
     system_lock_error         = 9
     user_invalid              = 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.

CALL FUNCTION 'BDC_INSERT'.
   EXPORTING
     tcode                  = 'XD01'
*   POST_LOCAL             = NOVBLOCAL
*   PRINTING               = NOPRINT
*   SIMUBATCH              = ' '
*   CTUPARAMS              = ' '
    TABLES
      dynprotab              = t_customer
   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.

CALL FUNCTIION 'BDC_INSERT'.
   EXPORTING
     tcode                  = 'ME21'
*   POST_LOCAL             = NOVBLOCAL
*   PRINTING               = NOPRINT
*   SIMUBATCH              = ' '
*   CTUPARAMS              = ' '
    TABLES
      dynprotab              = t_contract
   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.

CALL FUNCTION 'BDC_CLOSE_GROUP.
  CALL FUNCTION 'BDC_CLOSE_GROUP'
    EXCEPTIONS
      not_open    = 1
      queue_error = 2
      OTHERS      = 3.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

Inspire if Helpful,

Thank you,

Warm regards,

Abhi

Suppose you are provided 2 input files, one with the customer data used to create a customer and another with contracts data. You need to create customers using the first file and then create a contract for each of the customer using the second file. How can this be done using BDC ? Which batch method would be used and what is the procedure ?

2 REPLIES 2
Read only

Former Member
0 Likes
430

Hey fren,

You may go for a Session Method in BDC.

Try this way........

CALL FUNCTION 'BDC_OPEN_GROUP'.
 EXPORTING
   client                    = sy-mandt
*  DEST                      = FILLER8
   group                     = 'ABCD'
*  HOLDDATE                  = 
   keep                      = 'X'
   user                      = sy-uname
*  RECORD                    = FILLER1
*  PROG                      = SY-CPROG
* IMPORTING
*   QID                       =
   EXCEPTIONS
     client_invalid            = 1
     destination_invalid       = 2
     group_invalid             = 3
     group_is_locked           = 4
     holddate_invalid          = 5
     internal_error            = 6
     queue_error               = 7
     running                   = 8
     system_lock_error         = 9
     user_invalid              = 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.

CALL FUNCTION 'BDC_INSERT'.
   EXPORTING
     tcode                  = 'XD01'
*   POST_LOCAL             = NOVBLOCAL
*   PRINTING               = NOPRINT
*   SIMUBATCH              = ' '
*   CTUPARAMS              = ' '
    TABLES
      dynprotab              = t_customer
   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.

CALL FUNCTIION 'BDC_INSERT'.
   EXPORTING
     tcode                  = 'ME21'
*   POST_LOCAL             = NOVBLOCAL
*   PRINTING               = NOPRINT
*   SIMUBATCH              = ' '
*   CTUPARAMS              = ' '
    TABLES
      dynprotab              = t_contract
   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.

CALL FUNCTION 'BDC_CLOSE_GROUP.
  CALL FUNCTION 'BDC_CLOSE_GROUP'
    EXCEPTIONS
      not_open    = 1
      queue_error = 2
      OTHERS      = 3.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

Inspire if Helpful,

Thank you,

Warm regards,

Abhi

Read only

0 Likes
429

hi dude

thanx for your ans...............