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-Direct Input

Former Member
0 Likes
3,823

Please give an example for Direct Input method in BDC.When it is used? what is the advantage and disadvantage?

6 REPLIES 6
Read only

ak_upadhyay
Contributor
0 Likes
1,294

Hi,

Direct Input (DI) programs work exactly similar to BI

programs. But the only difference is, instead of processing

screens they validate fields and directly load the data

into tables using standard function modules. For this

reason, DI programs are much faster (RMDATIND - Material

Master DI program works at least 5 times faster) than the

BDC counterpart and so ideally suited for loading large

volume data. DI programs are not available for all

applicatioDirect Input.

direct input is to use Without calling the screens but all

the validations should be done and only for master datas

upload.

Direct Input method:

1. Only for error free datas and also master data

updation.

2. It will directly updates the database table. No

screens involved.

3. Transaction BMVO or Program RBMVSHOW has been

usedn areas.

Thus a program using direct input must care for

intermittent commits to avoid an overflow of the lock

tables. For master data, a lock table overflow may occur

for more than (roughly) 2000 cases.

Although direct input does not do any screen input, the

same routines are passed as BDC with (simulated) screen

input

Have a look on the following code



TABLES: kna1.
DATA: fname(25) VALUE 'D:\ABAP EVE\ffiel1.txt'.
DATA: BEGIN OF itab1 OCCURS 0,
str(255),
END OF itab1.
DATA: itab2 TYPE kna1 OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = 'D:\ABAP EVE\ffiel1.txt'
filetype = 'ASC'
TABLES
data_tab = itab1
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.
WRITE:/ 'sorry'.
ELSE.
LOOP AT itab1.
SPLIT itab1-str AT ',' INTO itab2-kunnr itab2-name1.
APPEND itab2.
ENDLOOP.
IF sy-subrc = 0.
LOOP AT itab2.
WRITE:/ itab2-kunnr,itab2-name1.
INSERT INTO kna1 VALUES itab2.
ENDLOOP.
IF sy-subrc = 0.
WRITE:/ 'inserted'.
ELSE.
WRITE:/ 'not inserted'.
ENDIF.
ELSE.
WRITE:/ 'fail'.
ENDIF.
ENDIF.

Store the folowing data in notepad with "ffile1.txt" fielname

10001,Sadney

10003,Yogesh

20005,Madan

and place this in D:\ABAP EVE\ folder.

Check ur database table(KNA1).

Reward points if useful....

Regards

AK

Read only

Former Member
0 Likes
1,294

Hi,

It just used to upload the data into database tables and make

some modifications before inserting into database tables.

Have a look on the following code

TABLES: kna1.

DATA: BEGIN OF itab1 OCCURS 0,

str(255),

END OF itab1.

DATA: itab2 TYPE kna1 OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

filename = 'D:\ABAP EVE\ffile1.txt'

filetype = 'ASC'

TABLES

data_tab = itab1

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.

WRITE:/ 'sorry'.

ELSE.

LOOP AT itab1.

SPLIT itab1-str AT ',' INTO itab2-kunnr itab2-name1.

APPEND itab2.

ENDLOOP.

IF sy-subrc = 0.

LOOP AT itab2.

WRITE:/ itab2-kunnr,itab2-name1.

INSERT INTO kna1 VALUES itab2.

ENDLOOP.

IF sy-subrc = 0.

WRITE:/ 'inserted'.

ELSE.

WRITE:/ 'not inserted'.

ENDIF.

ELSE.

WRITE:/ 'fail'.

ENDIF.

ENDIF.

Flat file:

10001,Sadney

10003,Yogesh

20005,Madan

Reward,if useful.

Thanks,

Chandu

Read only

Former Member
0 Likes
1,294

Hi Khanna Renga ,

Direct Input method is used for bulk transfer of data into SAP system.It results in faster execution since no screens are processed and the SAP database will be updated directly using the standard function modules.

Better example where direct input method will be used is... uploading the data for material master.....it includes lot of views so its very much difficult to capture all the views and record the tcode and map the data in such conditions its better to go with DI methods

Advantages:

in session method or Call Transaction method while uploading the data u do the validation by fallowing the screen sequence and field sequence where as in Direct Input validations can be done set of code so this make the process very fast so its advantageous to upload large amout of data.

you always use the standard sap provided program for this.

Here in Direct Input method very important thing is structure of flat file... so to know the structure first of all you have to download the data for one record into the internal table with the use of the same program then with the use of that structure u have to desing the flat file and upload the data.

Direct Input:

With direct input, the SAP function modules execute the consistency checks. However with batch input, these consistency checks are executed with help of the screens. This means that direct input has considerable performance advantages. But there are a few programs for direct input, you can use them if it accomplishes your goal. Direct Input programs work like that they update database tables directly. As you know that it is forbidden to update SAP database tables directly, since consistency and security should be considered. Exceptions are these direct input programs. So you are not able to write custom ABAP direct input programs. But of course you can write ABAP programs to update custom database tables (Z tables), if you are sure all about consistency.

SAP has created direct input programs because SAP wanted to enhance the batch input procedure, since batch input is slower. SAP offers the direct input technique, especially for transferring large amount of data. In contrast to batch input, this technique does not create sessions, but stores, updates, inserts data directly. To enter the data into the corresponding database tables directly, the system calls a number of function modules that execute any necessary checks. In case of errors, the direct input technique provides a restart mechanism. However, to able to activate the restart mechanism, direct input programs must be executed in the background only. To maintain and start these programs, use program RBMVSHOW or transaction BMV0.

Examples for direct input programs are:

RFBIBL00 - FI

RMDATIND - MM

RVAFSS00 - SD

RAALTD11 - AM

RKEVEXTO - CO-PA

Also have a look on below thread..

In contrast to batch input, this technique does not create sessions, but stores the data directly. It does not simulate the online transaction. To enter the data into the corresponding database tables directly, the system calls a number of function modules that execute any necessary checks. In case of errors, the direct input technique provides a restart mechanism. However, to be able to activate the restart mechanism, direct input programs must be executed in the background only. Direct input checks the data thoroughly and then updates the database directly.

Hope it will solve your doubts and problem..

Reward points if useful..

Thanks & Regards

ilesh 24x7

Read only

0 Likes
1,294

Dear nandaniya,

I used the std program RFBIDE00 to upload the customer master.

1. I just enterd the program in the se38 and executed .

2. Given the file adress location in the selection screen which appears.

3. It is showing the error "The file is not found".

  What i  did is right or not?

Is there any way to find the structure of the flat file that is to be entered in to the standard program.

Thanks.

Dhanunjay.

Read only

Former Member
0 Likes
1,294

hi check this...

To maintain and start these programs, use program RBMVSHOW or Transaction BMV0. It is better to use BDC method unless data volume is very high, as validations are very critical to data upload in SAP.

the example program for direct input is ...

regards,

venkat.

Read only

Former Member
0 Likes
1,294

Hai,

Direct Input method is used for bulk transfer of data into SAP system.It results in faster execution since no screens are processed and the SAP database will be updated directly using the standard function modules.

Better example where direct input method will be used is... uploading the data for material master.....it includes lot of views so its very much difficult to capture all the views and record the tcode and map the data in such conditions its better to go with DI methods

Advantages:

in session method or Call Transaction method while uploading the data u do the validation by fallowing the screen sequence and field sequence where as in Direct Input validations can be done set of code so this make the process very fast so its advantageous to upload large amout of data.

you always use the standard sap provided program for this.

Here in Direct Input method very important thing is structure of flat file... so to know the structure first of all you have to download the data for one record into the internal table with the use of the same program then with the use of that structure u have to desing the flat file and upload the data.

For Sample Code,Check this Thread,

Regards

Kiran Sure