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 Program

Former Member
0 Likes
704

After creating a batch in a program what code do i need to put in that program to process the batch immediately (in the same program)

4 REPLIES 4
Read only

Former Member
0 Likes
642

Hi,

If u r using Session Method, u need to goto SM35 and process it.

BDC RECORDING METHOD:

________________________

This is a predefined tool to create BDC code and screens for data migration. BDC Recording method allows the user to record the keystrokes done during data migration. This method can use only existing screens, i.e. predefined screens.

MM01 - Create Material

XD01 - Create Customer

XK01 - Create Vendor

VA01 - Create Sales Order

SHDB is the Transaction code to call Recording Method.

Navigations to use Recording Method:

-


SHDB -> Opens an interface -> Click on New Recordings pushbutton from appn. toolbar -> Specify Recording Name -> Specify Tcode (MM01) -> Click on Continue -> Opens MM01 Screen -> Specify Sample Data -> Click on Select View pushbutton from appn. toolbar -> Opens an interface -> Select First view (Basic Data 1) -> Click on Continue -> Opens another interface -> Specify short description for the material -> Specify units of measurement -> Save -> Opens an interface with defined field and their values -> Save -> Come back -> Select Recording Object -> Click on Program pushbutton from appn. toolbar to autogenerate the BDC source code -> Opens an interface -> Specify Program Name -> Select Transfer From Recording radiobutton -> Click on Source Code pushbutton -> Opens SE38 Editor with autogenerated code -> Specify following code after include statement:

include bdcrecx1.

DATA : BEGIN OF ITAB OCCURS 0,

STR(255),

END OF ITAB.

DATA ITAB1 LIKE MARA OCCURS 0 WITH HEADER LINE.

Specify following code after start-of-selection statement:

start-of-selection.

CALL FUNCTION 'UPLOAD'

EXPORTING

FILENAME = 'C:\COUP.TXT'

FILETYPE = 'ASC'

TABLES

DATA_TAB = ITAB.

LOOP AT ITAB.

SPLIT ITAB-STR AT ',' INTO ITAB1-MATNR ITAB1-MBRSH ITAB1-MTART

ITAB1-MEINS.

APPEND ITAB1.

ENDLOOP.

Specify Loop-Endloop statement for the bdc-dynpro, bdc-field and bdc_transaction statements as follows:

perform open_group.

LOOP AT ITAB1.

.

.

.

ENDLOOP

perform close_group.

-> Save -> Activate -> Execute -> Choose Call Transaction or Session method to process the datas.

The advantage of Recording Method is finally after executing the program, we can choose either Session method or Call Transaction method to upload the datas using predefind Tcode (MM01, MK01, VA01, XD01, XK01).

Hope this helps u,

Arunsri

Edited by: Arunsri on Apr 8, 2008 10:24 AM

Read only

Former Member
0 Likes
642

Hi,

You would have created a session which would hold all the fields required to be updated. So this session name should be used in your program through a function module.

Creating a program which is used to update the data through session method should have the follwing function modules. BDC_OPEN_GROUP(opens a new session in the background for a particular transaction for the input of data).BDC_INSERT(Inserts the data into the corresponding fields for any given transaction). BDC_CLOSE_GROUP(closes the session which was opened for data i/p). So in the function module BDC_INSERT you should give the name of the recorded session which was recorded using SM35 transaction.

Reward points if useful.

Thanks,

archana

Read only

0 Likes
642

the answers are very helpful and i thank you for that....

now i need to know how to use PROGRAM RSBDCSUB and submit my session name for processing

Read only

0 Likes
642

hi,

The ABAP program RSBDCSUB must be scheduled as a periodic job in the R/3 background processing system. RSBDCSUB checks for and starts any batch input sessions that have not yet been run. It schedules such sessions for immediate execution in the background processing system.

Procedure

Schedule RSBDCSUB to run periodically in one or more background jobs.

If you have regularly scheduled batch input runs, you can schedule separate jobs for each of the scheduled data transfers. The start time for the RSBDCSUB job can be set according to the batch input schedule. And you can use a variant to restrict RSBDCSUB only to the batch input sessions that you expect.

With RSBDCSUB, you can use all of the selection criteria offered on the batch input main menu to select sessions to run:

1. session name

2. date and time of generation

3. status: ready to run or held in the queue because of errors

STEPS

step 1: Create batch input session.

step 2: Call RSBDCSUB and entry batch input session name from step 1. use command : 'Program > Execute in Background'. Then I can define date/time to execute my batch input session.

Now I have "Queue ID" for this batch input.

In batch input overview (SM35), status of this batch input shows as "job".

step 3: Call RSBDCBTC and fill "Queue ID" from step 2, then save this as variant.

step 4: Call SM37 to define new job by use "RSBDCBTC" as ABAP program

and enter variant name from step 3.

Hope this helps.