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

Former Member
0 Likes
657

Hi experts,

I want to send the error records from BDC Call transaction method to a BDC session.Can any body tell me How can we send ..with an example if possible?

Regards

Ravi.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
628

Ravi,

follow these steps.

1. bdc_open_group.

2. call transaction.

if sy-subrc <> 0.

bdc_insert.

endif.

3. bdc_close_group.

-Anu

7 REPLIES 7
Read only

Former Member
0 Likes
628

Use the following FM's

BDC_OPEN

BDC_INSERT

BDC_CLOSED

Read only

Former Member
0 Likes
628

use <b>FORMAT_MESSAGES</b> FM ...

Check

Regards,

Santosh

Read only

Former Member
0 Likes
629

Ravi,

follow these steps.

1. bdc_open_group.

2. call transaction.

if sy-subrc <> 0.

bdc_insert.

endif.

3. bdc_close_group.

-Anu

Read only

0 Likes
628

Hi All,

Thanks.Any examle code on this?

Read only

0 Likes
628

hi Ravi,

Check this out for that ..

REgards,

Santosh

Read only

0 Likes
628

You can use this as an idea:

*& call transaction and capture results
  CLEAR sy_int.
  CALL TRANSACTION 'FM27' USING bdcdata MODE p_dmode UPDATE 'S'.
  MOVE-CORRESPONDING sy TO sy_int.
  IF p_test NE 'X'.
    MOVE sy-msgv1 TO bppe_fund_ver-doc#.
  ENDIF.
  PERFORM get_message USING sy_int
                      CHANGING bppe_fund_ver-text.
  IF ( p_test = 'X' AND bppe_fund_ver-text(14) = 'Check complete' ) OR
     ( p_test = ' ' AND bppe_fund_ver-text(08) = 'Document' ) .
    bppe_fund_ver-subrc = 0.
  ELSE.
    IF p_test = 'X'.
      bppe_fund_ver-subrc = 1.
    ELSE.
      PERFORM batch_input USING 'FM27'.
      bppe_fund_ver-subrc = 1.
    ENDIF.
  ENDIF.

Rob

Read only

Former Member
0 Likes
628

Hi,

u can see the below code -

  • Open session

form open_session .

data: lv_sess type apqi-groupid value 'ZNAME'.

call function 'BDC_OPEN_GROUP'

exporting

client = sy-mandt

group = lv_sess

keep = 'X'

user = sy-uname

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 i999 with ' Error in opening session'.

endif.

endform. " open_session

*-- Insert

form insert_session using tcode type tstc-tcode .

call function 'BDC_INSERT'

exporting

tcode = tcode

tables

dynprotab = tb_bdcdata

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 i999 with ' Error in inserting the records'.

endif.

endform. " insert_session

  • Close

form close_session .

call function 'BDC_CLOSE_GROUP'

exceptions

not_open = 1

queue_error = 2

others = 3.

if sy-subrc <> 0.

message i999 with ' Error in closing the session'.

endif.

endform. " close_session