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 call transaction program

Former Member
0 Likes
510

hi,

can anyone send me a bdc call transaction program.it should include the usage of table control(by using page rolls for more no. of items).

in my program after taking the n lines that are visible on the screen of FB60 transaction it is giving a message that no (n+1)th row described for the screen.

so please see to this requirement and provide me a program

and if possible include even the error handling in the program.

thanks in advance and i will surely provide ten points if my requirement gets filled.

sultan.s.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
478

Hi,

For table control in bdc declare two variable as integer.

set the variable value as 0.In the program before the line

item perform statement set the counter value as 1.

count=count+1.then u hv to use the concantenate

statementfor the line items for example

concantenate '(lfa1-banks('count'))' into cval

perform bdc using cval.

during recording for the line items we hv record for the

next page also for the line item.goto standard tool bar u

hv to press the next page button.

if count=5.

perform bdc using p+ ->this for next page

endif

clear count.

http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm

http://www.sap-basis-abap.com/abap/handling-table-control-in-bdc.htm

Regards

Sudheer

3 REPLIES 3
Read only

Former Member
0 Likes
479

Hi,

For table control in bdc declare two variable as integer.

set the variable value as 0.In the program before the line

item perform statement set the counter value as 1.

count=count+1.then u hv to use the concantenate

statementfor the line items for example

concantenate '(lfa1-banks('count'))' into cval

perform bdc using cval.

during recording for the line items we hv record for the

next page also for the line item.goto standard tool bar u

hv to press the next page button.

if count=5.

perform bdc using p+ ->this for next page

endif

clear count.

http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm

http://www.sap-basis-abap.com/abap/handling-table-control-in-bdc.htm

Regards

Sudheer

Read only

Former Member
0 Likes
478

hi,

ex:

REPORT ZCALL_TRANS_TAB1 .

TABLES: LFA1,LFBK,lfb1.

data: BEGIN OF it_vendor occurs 0,

LIFNR LIKE LFA1-LIFNR,

bukrs like lfb1-bukrs,

END OF it_vendor.

DATA: BEGIN OF IT_BANK occurs 0,

LIFNR LIKE LFA1-LIFNR,

BANKS LIKE LFBK-BANKS,

BANKL LIKE LFBK-BANKL,

BANKN LIKE LFBK-BANKN,

koinh like lfbk-koinh,

END OF IT_BANK.

data: it_bdcdata like bdcdata occurs 0 with header line.

data: it_messages like bdcmsgcoll occurs 0 with header line.

***************************************************

*selection screen.

***************************************************

selection-screen: begin of block b1 with frame.

parameters: p_file like rlgrap-filename default 'c:/vendor.txt'

obligatory.

parameters: p_file1 like rlgrap-filename default 'c:/xyz.txt'

obligatory.

selection-screen: end of block b1.

***************************************************

*at selection screen.

***************************************************

at selection-screen on value-request for p_file.

perform f4_help using p_file.

at selection-screen on value-request for p_file1.

perform f4_help1 using p_file1.

***************************************************

*start of selection

***************************************************

start-of-selection.

*******uploading file

perform upload_file using p_file P_FILE1.

******open session.

perform populate_data.

&----


*& Form f4_help

&----


  • text

----


  • -->P_P_FILE text

----


form f4_help using p_p_file.

data: l_file type ibipparms-path.

call function 'F4_FILENAME'

importing

file_name = l_file.

p_file = l_file.

endform. " f4_help

&----


*& Form POPULATE_DATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form populate_data .

DATA: L_STRING TYPE STRing.

DATA: L_COUNTER(2) TYPE n.

loop at it_vendor.

perform bdc_dynpro using 'SAPMF02K' '0106'.

perform bdc_field using 'BDC_CURSOR'

'RF02K-D0130'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RF02K-LIFNR'

it_vendor-lifnr.

perform bdc_field using 'RF02K-BUKRS'

it_vendor-bukrs.

perform bdc_field using 'RF02K-D0130'

'X'.

perform bdc_dynpro using 'SAPMF02K' '0130'.

perform bdc_field using 'BDC_CURSOR'

'LFBK-bankn(03)'.

perform bdc_field using 'BDC_OKCODE'

'=UPDA'.

*********bank details

CLEAR l_COUNTER.

LOOP AT IT_BANK WHERE LIFNR = IT_VENDOR-LIFNR.

l_COUNTER = l_COUNTER + 1.

clear l_string.

CONCATENATE 'lfbk-banks(' l_counter ')' into l_string.

perform bdc_field using l_string

it_bank-banks.

clear l_string.

CONCATENATE 'lfbk-bankl(' l_counter ')' into l_string.

perform bdc_field using l_string

it_bank-bankl.

clear l_string.

CONCATENATE 'lfbk-bankn(' l_counter ')' into l_string.

perform bdc_field using l_string

it_bank-bankn.

endloop.

******CALL TRANSACTION.

call transaction 'FK02' using it_bdcdata mode 'A'

messages into it_messages.

write:/ sy-subrc.

perform format_messages.

clear it_bdcdata.

refresh it_bdcdata.

endloop.

endform. " POPULATE_DATA

&----


*& Form FORMAT_MESSAGES

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form format_messages .

data: l_msg(100).

loop at it_messages.

call function 'FORMAT_MESSAGE'

exporting

id = it_messages-msgid

lang = sy-langu

no = it_messages-msgnr

v1 = it_messages-msgv1

v2 = it_messages-msgv2

v3 = it_messages-msgv3

v4 = it_messages-msgv4

importing

msg = l_msg

exceptions

not_found = 1

others = 2

.

write:/ l_msg.

endloop.

endform. " FORMAT_MESSAGES

&----


*& Form bdc_dynpro

&----


  • text

----


  • -->P_0173 text

  • -->P_0174 text

----


form bdc_dynpro using value(p_program)

value(p_screen).

it_bdcdata-program = p_program.

it_bdcdata-dynpro = p_screen.

it_bdcdata-dynbegin = 'X'.

append it_bdcdata.

clear it_bdcdata.

endform. " bdc_dynpro

&----


*& Form bdc_field

&----


  • text

----


  • -->P_0178 text

  • -->P_0179 text

----


form bdc_field using value(p_fnam)

value(p_fval).

it_bdcdata-fnam = p_fnam.

it_bdcdata-fval = p_fval.

append it_bdcdata.

clear it_bdcdata.

endform. " bdc_field

&----


*& Form upload_file

&----


  • text

----


  • -->P_P_FILE text

  • -->P_P_FILE1 text

----


form upload_file using p_p_file

p_p_file1.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

  • CODEPAGE = ' '

FILENAME = P_P_FILE

FILETYPE = 'DAT'

  • HEADLEN = ' '

  • LINE_EXIT = ' '

  • TRUNCLEN = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • DAT_D_FORMAT = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

data_tab = IT_VENDOR

  • 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

  • NO_AUTHORITY = 10

  • OTHERS = 11

.

IF sy-subrc <> 0.

MESSAGE I000(ZZ) WITH 'UNABLE TO UPLOAD'.

STOP.

ENDIF.

*******UPLOADING BANK DETAILS

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

  • CODEPAGE = ' '

FILENAME = P_P_FILE1

FILETYPE = 'DAT'

  • HEADLEN = ' '

  • LINE_EXIT = ' '

  • TRUNCLEN = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • DAT_D_FORMAT = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

data_tab = IT_BANK

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

NO_AUTHORITY = 10

OTHERS = 11

.

IF sy-subrc <> 0.

MESSAGE I000(ZZ) WITH 'UNABLE TO UPLOAD'.

STOP.

ENDIF.

endform. " upload_file

&----


*& Form f4_help1

&----


  • text

----


  • -->P_P_FILE1 text

----


form f4_help1 using p_p_file1.

data:l_file1 type ibipparms-path.

CALL FUNCTION 'F4_FILENAME'

IMPORTING

FILE_NAME = l_file1.

p_file1 = l_file1.

endform. " f4_help1

http://sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm

Read only

0 Likes
478

hi sudha,

will this program works..if we got 6 records to updated, but there are only 4 visible lines in table control for customer bank details?