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
534

Hi,

I have dought in BDC.

Here in BDC we have:

perform bdc_dynpro using 'SAPMF02K'

perform bdc_field using 'BDC_CURSOR'

'RF02K-KTOKK'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

I am not clear with these. Pls help me to make me understand clearly those...

Thanks

Seema

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
498

Hi Seema,

Basically BDC uses recording of a given transaction and then replay of the same with different sets of input data.

So when you record any transaction, the technical details about the transaction are automatically recorded by SHDB transaction. When you transfer this recording detail in to Program, system automatically generate the code.

Now this is the code where all the subroutines will be called related to this recording of transaction. The subroutines are called using PERFORM statement.

E.g. in your example it is PERFORM subroutine_name USING parameter values.

Hence here BDC_DYNPRO & BDC_FIELD are two subroutines. And these subroutines passes values for the defined parameters like Screen Number, Program Name, Whether a new screen has started in recording (Flag), actual values for the fields, the action codes like pressing Save button or pressing Enter key from recording.

For more details about what kind of parameters subroutine uses, just double click on Perform statement and it will take you to FORM - ENDFORM of the same. Here in Form you can see the type of parameters used.

1. PERFORM bdc_dynpro USING 'SAPMF02K'

Here Subroutine Name - BDC_DYNPRO

SAPMF02K - Program Name (Subroutine Parameter)

0100 - Screen Number (Subroutine Parameter)

2. PERFORM bdc_field USING 'BDC_CURSOR' 'RF02K-KTOKK'.

Here Subroutine Name - BDC_FIELD

BDC_CURSOR - It is subroutine parameter and specifies that the cursor will be now placed on the field of transaction mentioned along with it i.e. RF02K-KT0KK in this example

3. PERFORM bdc_field USING 'BDC_OKCODE' '/00'.

Here Subroutine Name - BDC_FIELD

BDC_OKCODE - Subroutine parameter which specifies the action code along with it. E.g. here it Enter key with code '/00'.

I think now it is clear to you.

Regards,

Rahman

5 REPLIES 5
Read only

Former Member
0 Likes
498

perform bdc_dynpro using 'SAPMF02K' -


Transaction Screen name at the time of recording

perform bdc_field using 'BDC_CURSOR'

'RF02K-KTOKK'.----


Particular Screen field of the Transaction at the time of recording

perform bdc_field using 'BDC_OKCODE'

'/00'. -


Enter . at the time of recording if ur press enter then it shows in coding in this way

Thanks

Message was edited by:

Pattan Naveen

Read only

Former Member
0 Likes
498

Dear Seema,

There are 5 parts in a BDC program .Each part is executed one after another.

1) Selection screen is used with a parameter to input the text file of TYPE RLGRAP-FILENAME . Various function modules like KD_GET_FILENAME_ON_F4 can be used to read the file name at runtime or the filename can be defaulted by using DEAULT clause in the parameter statement.

2) Open the text file for input.If file fails to open (SY-SUBRC NE 0) then stop the program with a error message.

OPEN DATASET filename FOR INPUT IN TEXT MODE is used to open the file.

3)Loop through the dataset using a loop statement like DO .. ENDDO with an EXIT statemenyt if no next record exists.

and filling the work structure which will hold the data for a single transaction in each loop pass.

Filling the BDC TABLE of TYPE BDCDATA in the loop for every record(equivalent to transaction) in the data set.

Submit the internal table containing bdc data for each and every transaction (internal table of TYPE BDCDATA is submitted for each transaction until all the records in the dataset are read) using

CALL TRANSACTION 'tr' USING I_bdcdata MODE 'N' UDATE 'S' .

DO

READ DATASET file INTO W_bdcdata

IF SY-SUBRC NE 0.

EXIT.

ENDIF.

PERFORM Fill_BDCDATA

PERFORM Submit_BDCDATA

ENDDO

4) Error handling when submission via CALL TRANSACTION fails ,either by using the internal table to be filled by the system messages which is of TYPE BDCMSGCOLS and can be specified in CALL TRANSACTION statement with the addition MESSAGES INTO .

Or error handling by sending the mail to a predefined recipient.

Or for each and every transaction that fails create a

single BDC SESSION by using BDC_OPEN_GROUP function module

and submitting the intenal bdc data table to it.

For each and every error a report should display them

all at the end of the program so that the transacton in error can be identified.

The approach of opening a BDC SESSION is often used with an error report when an error occurs as all the transaction in error can be seen and executed in the session manager .

5)Clean up actions.

Here clean up actions are performed like closing the dataset with CLOSE DATASET command ,closing any error

session if they were created using CLOSE_GROUP function module.and displaying the report .

To fill the bdc data table we should have all the information associated with the screens used in the transaction

and all the fields in those screens that will be filled by the CALL TRANSACTION statement.We can use BDC SESSION RECORDER or Transaction Recorder(Transaction SHDB) to get the information on the screens and the fields. The

data which is required to fill the internal table of TYPE BDCDATA is

Program Name

Screen Number

Screen Begin

Field Name

Field Value

Information on Field Name and Field Type can be used to create the structure that will be used to read records from the data set .

While filling the Field value in BDCDATA table care should be taken for special fields like 'BDC_CURSOR',' BDC_OKCODE'

Structure of BDCDATA table

PROGRAM Name of program

DYNPRO Number of screen

DYNBEGIN If New screen begins value ='X'

FNAM Field Name

FVAL Field Value

Structure of BDCMSGCOLL

MSGID Message ID

MSGTYP MessageType

MSGNR Message Number

MSGV1 1st placeholder

MSGV2 2nd Place Holder

NSGV3 3rd Placce Holder

MSGV4 4th Place Holder

To see all the messages stored by the system in the BDCMSGCOLS table we can use LOOP AT .ENDLOOP command.

Code to read internal table of type BDCMSGCOLS.

TABLE T100 HAS FOLLOWING FIELDS

SPRSL TYPE SPRAS (Language)

ARBGB TYPE ARBGP (BUSINESS AREA)

MSGNR Message number (3C)

TEXT Message Text (Type 73C)

LOOP AT MESSTAB. "Int Table of TYPE BDCMSGCOLS

SELECT SINGLE * FROM T100 WHERE SPRSL = MESSTAB-MSGSPRA

AND ARBGB = MESSTAB-MSGID

AND MSGNR = MESSTAB-MSGNR.

IF SY-SUBRC = 0.

L_MSTRING = T100-TEXT.

IF L_MSTRING CS '&1'.

REPLACE '&1' WITH MESSTAB-MSGV1 INTO L_MSTRING.

REPLACE '&2' WITH MESSTAB-MSGV2 INTO L_MSTRING.

REPLACE '&3' WITH MESSTAB-MSGV3 INTO L_MSTRING.

REPLACE '&4' WITH MESSTAB-MSGV4 INTO L_MSTRING.

ELSE.

REPLACE '&' WITH MESSTAB-MSGV1 INTO L_MSTRING.

REPLACE '&' WITH MESSTAB-MSGV2 INTO L_MSTRING.

REPLACE '&' WITH MESSTAB-MSGV3 INTO L_MSTRING.

REPLACE '&' WITH MESSTAB-MSGV4 INTO L_MSTRING.

ENDIF.

CONDENSE L_MSTRING.

WRITE: / MESSTAB-MSGTYP, L_MSTRING(250).

ELSE.

WRITE: / MESSTAB.

ENDIF.

ENDLOOP.

SKIP.

ENDIF.

Regards,

Abir

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

  • Do not forget to reward POINTS *

Read only

Former Member
0 Likes
498

Hi,

BDC_DYNRPRO : handles a program and screen.

BDC_FIELD : Puts a value on the screen.

BDC_OKCODE is the user command.

Thanks,

Mandeep

Read only

Former Member
0 Likes
498

hi

bdc_dynpro - calling the screen number and program name

bdc_field - this meand in that screen perticular field

bdc_field using 'BDC_OKCODE' - the action ur doing on the screen

IN BDC program before coding you will do some recodring by useing SHDB

in that SHDB you will record each screen

that screen flow is nothing but that which the code you have given

<b>To simulate user dialogue, you must know the following information:</b>Online program name,

Screen numbers,

Field names

Field values

The ‘BDCDATA’ ABAP Dictionary structure is used in a batch input program to collect this information for an entire transaction.

BDCDATA

1

1

1

\/

PROGRAM

DYNPRO

DYNBEGIN

FNAM

FVAL

Reward if usefull

Read only

Former Member
0 Likes
499

Hi Seema,

Basically BDC uses recording of a given transaction and then replay of the same with different sets of input data.

So when you record any transaction, the technical details about the transaction are automatically recorded by SHDB transaction. When you transfer this recording detail in to Program, system automatically generate the code.

Now this is the code where all the subroutines will be called related to this recording of transaction. The subroutines are called using PERFORM statement.

E.g. in your example it is PERFORM subroutine_name USING parameter values.

Hence here BDC_DYNPRO & BDC_FIELD are two subroutines. And these subroutines passes values for the defined parameters like Screen Number, Program Name, Whether a new screen has started in recording (Flag), actual values for the fields, the action codes like pressing Save button or pressing Enter key from recording.

For more details about what kind of parameters subroutine uses, just double click on Perform statement and it will take you to FORM - ENDFORM of the same. Here in Form you can see the type of parameters used.

1. PERFORM bdc_dynpro USING 'SAPMF02K'

Here Subroutine Name - BDC_DYNPRO

SAPMF02K - Program Name (Subroutine Parameter)

0100 - Screen Number (Subroutine Parameter)

2. PERFORM bdc_field USING 'BDC_CURSOR' 'RF02K-KTOKK'.

Here Subroutine Name - BDC_FIELD

BDC_CURSOR - It is subroutine parameter and specifies that the cursor will be now placed on the field of transaction mentioned along with it i.e. RF02K-KT0KK in this example

3. PERFORM bdc_field USING 'BDC_OKCODE' '/00'.

Here Subroutine Name - BDC_FIELD

BDC_OKCODE - Subroutine parameter which specifies the action code along with it. E.g. here it Enter key with code '/00'.

I think now it is clear to you.

Regards,

Rahman