0% found this document useful (0 votes)
42 views

Barış Batch Include-Zbdcrecx2

This document contains ABAP code for creating a batch input session to transfer data by calling transactions and filling in fields programmatically. It includes forms to open and close the batch input group, start new transactions and dynamic screens, and insert field values. Key functions used include BDC_OPEN_GROUP, BDC_CLOSE_GROUP, BDC_INSERT, and BDC_FIELD to programmatically control the session.

Uploaded by

Bora Gür
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

Barış Batch Include-Zbdcrecx2

This document contains ABAP code for creating a batch input session to transfer data by calling transactions and filling in fields programmatically. It includes forms to open and close the batch input group, start new transactions and dynamic screens, and insert field values. Key functions used include BDC_OPEN_GROUP, BDC_CLOSE_GROUP, BDC_INSERT, and BDC_FIELD to programmatically control the session.

Uploaded by

Bora Gür
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

***INCLUDE ZBDCRECX2.

* for programs doing a data transfer by creating a batch-input session


SELECTION-SCREEN begin of BLOCK qw121 WITH FRAME .
parameters group(12) obligatory.
parameters: user(12) default sy-uname obligatory.
parameters: keep as checkbox default 'X'.
parameters: fname like ibipparms-path obligatory.
SELECTION-SCREEN end of BLOCK qw121 .
*----------------------------------------------------------------------*
* data definition
*----------------------------------------------------------------------*
data: bdcdata like bdcdata occurs 0 with header line.
* messages of call transaction
data: messtab like bdcmsgcoll occurs 0 with header line.
* error session opened (' ' or 'X')
data: e_group_opened.
* message texts
tables: t100.

at selection-screen on value-request for fname.


call function 'F4_FILENAME'
importing
file_name = fname.

*----------------------------------------------------------------------*
* open dataset *
*----------------------------------------------------------------------*
form open_dataset using p_dataset.
open dataset p_dataset in text mode.
if sy-subrc <> 0.
write: / text-e00, sy-subrc.
stop.
endif.
endform.

*----------------------------------------------------------------------*
* create batchinput session *
* (not for call transaction using...) *
*----------------------------------------------------------------------*
form open_group.

write: /(20) 'Create group'(i01), group.


* open batchinput group
call function 'BDC_OPEN_GROUP'
exporting
client = sy-mandt
group = group
user = user
keep = keep.
write: /(30) 'BDC_OPEN_GROUP'(i02),
(12) 'returncode:'(i05),
sy-subrc.
endform.

*----------------------------------------------------------------------*
* end batchinput session *
* (call transaction using...: error session) *
*----------------------------------------------------------------------*
form close_group.

* close batchinput group


call function 'BDC_CLOSE_GROUP'.
write: /(30) 'BDC_CLOSE_GROUP'(i04),
(12) 'returncode:'(i05),
sy-subrc.
endform.

*----------------------------------------------------------------------*
* Start new transaction according to parameters *
*----------------------------------------------------------------------*
form bdc_transaction using tcode.
* batch input session
call function 'BDC_INSERT'
exporting
tcode = tcode
tables
dynprotab = bdcdata.
refresh bdcdata.
endform.

*----------------------------------------------------------------------*
* Start new screen *
*----------------------------------------------------------------------*
form bdc_dynpro using program dynpro.
clear bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
append bdcdata.
endform.

*----------------------------------------------------------------------*
* Insert field *
*----------------------------------------------------------------------*
form bdc_field using fnam fval.
clear bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
append bdcdata.
endform.

You might also like