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_member530652
Participant
0 Likes
360

When we upload data using upload function module then i am not getting why to put code created by SHDB in that report programm???........plz tell me exact relation betn SHDB and report program which uploads data.

2 REPLIES 2
Read only

Former Member
0 Likes
326

hi,

SHDB for recording....

And SM35 is to process a session in case u use BDC Session method.

Check out these links for more details

http://www.sapbrain.com/TUTORIALS/TECHNICAL/BDC_tutorial.html

http://www.sap-img.com/abap/learning-bdc-programming.htm

http://www.sap-img.com/bdc.htm

www.sappoint.com/abap/bdcconcept.pdf

http://www.sap-img.com/abap/learning-bdc-programming.htm

http://www.sapdevelopment.co.uk/bdc/bdchome.htm

http://www.planetsap.com/bdc_main_page.htm

even LSMW is other option.

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

Bdc uses shdb for recording the first transaction .Give your session name

Then press new recording.

Give name and the transaction .

Start recording .

Give all the required fields .You will get a tabular content .

Use this to program bdc in se38 .

After programming goto sm35 .

Give the session name .

select the session and click on process .

Select the type of process , Backgroun , foreground or display error only .

Select extended log ,Expert mode .

Example program :

TYPES : BEGIN OF STRUCT ,

MATNR TYPE RMMG1-MATNR ,

END OF STRUCT.

DATA :W_GRPID TYPE APQI-GROUPID .

DATA :IT_MARA TYPE TABLE OF STRUCT WITH HEADER LINE,

IT_BDCDATA TYPE TABLE OF BDCDATA WITH HEADER LINE,

GT_CNT TYPE MARA-BISMT .

initialization.

SELECT MATNR

FROM MARA

INTO CORRESPONDING FIELDS OF TABLE IT_MARA

up to 10 rows

WHERE MTART = 'HAWA'.

W_GRPID = 'SESSION-ID'.

START-OF-SELECTION.

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

GROUP = W_GRPID

KEEP = 'X'

USER = SY-UNAME.

IF SY-SUBRC 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

LOOP AT IT_MARA.

GT_CNT = GT_CNT + 1.

PERFORM : F001-BDC_A USING 'SAPLMGMM' '0060' 'X',

F002-BDC_B USING 'RMMG1-MATNR' IT_MARA-MATNR ,

F002-BDC_B USING 'BDC_OKCODE' '/00',

F001-BDC_A USING 'SAPLMGMM' '0070' 'X',

F002-BDC_B USING 'MSICHTAUSW-KZSEL(01)' 'X' ,

F002-BDC_B USING 'MSICHTAUSW-KZSEL(02)' 'X' ,

F002-BDC_B USING 'BDC_OKCODE' '=ENTR',

F001-BDC_A USING 'SAPLMGMM' '4004' 'X',

F002-BDC_B USING 'MARA-BISMT' GT_CNT ,

F002-BDC_B USING 'BDC_OKCODE' '=BU',

F003-BDC_C USING 'MM02'.

ENDLOOP.

CALL FUNCTION 'BDC_CLOSE_GROUP' .

IF SY-SUBRC 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF..

&----


*& Form F001-BDC_A

&----


text

-


-->PROGRAM text

-->DYNPRO text

-->DYNBEG text

-


FORM F001-BDC_A USING program dynpro dynbeg.

IT_BDCDATA-PROGRAM = PROGRAM.

IT_BDCDATA-dynpro = DYNPRO.

IT_BDCDATA-dynbegin = DYNBEG.

APPEND IT_BDCDATA .

CLEAR IT_BDCDATA.

ENDFORM. "F001-BDC_A

&----


*& Form F002-BDC_B

&----


text

-


-->FNAM text

-->FVAL text

-


FORM F002-BDC_B USING FNAM FVAL .

IT_BDCDATA-FNAM = FNAM .

IT_BDCDATA-FVAL = FVAL.

APPEND IT_BDCDATA .

CLEAR IT_BDCDATA.

ENDFORM. "F002-BDC_B

&----


*& Form F003-BDC_C

&----


text

-


-->P_0124 text

-


FORM F003-BDC_C USING TRCODE.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = TRCODE

TABLES

DYNPROTAB = IT_BDCDATA.

REFRESH IT_BDCDATA.

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

Regards

Read only

Former Member
0 Likes
326

Hi Sandeep,

The following may be helpful regarding BDC and give u a fair idea of what is happening with SHDB.

What is BDC

BDC ( Batch Data Communication ) is used for uploading mass data into SAP system. In SAP system BDC also referred to batch input or data tranfer.

Typical Uses

Typical uses of batch input include the one-time import of data from a legacy system into a newly installed R/3 System. Another typical use is for periodic transfers of data from external systems or legacy systems that are still in use into SAP.

Background of BDC

To ensure data consistency in SAP system, we must not update SAP data directly from ABAP program. We must upload data through similar program flow compared to manual input by user. SAP provide this by BDC. BDC works by simulating the user input from transactional screen via an ABAP program. This means that you do not bypass any of the standard SAP consistency checks, authorisations, update conjunction tables, etc.

How it works

Data input entered by user simulated in BDC by data packet. The transaction then started using this internal table as the input and executed in the background.

Data packet is an internal table has a structure of BDCDATA, it has fields:

1. PROGRAM (program name)

2. DYNPRO (screen number)

3. DYNBEGIN (New screen start) X=new screen

4. FNAM (Field name)

5. FVAL (Field value)

Data packet contain of screen by screen packets. One screen packet contain:

1. Screen no

2. Cursor position

3. User command

4. Input fields

To accomodate you to build data packet, SAP provide BDC recording in tcode SHDB.

Do following action:

1. Go to tcode SHDB

2. click "New recording", enter recording name to identified your record, and TCode to be recorded.

3. You will enter recording mode of the transaction, simulate action you want to perform in this transaction

4. At the end it will result internal table ready to upload to data transfer methods (Call transaction or BDC sessions).

After internal table created then we pass this to data transfer methods. There are two alternatives of data transfer methods, using Call Transaction or BDC session.

Call transaction performed by calling command ‘Call Transaction’. ABAP program must do the error handling based on returning table from call transaction command. It is used for real-time interfaces and custom error handling & logging features. This is suitable when processing sequential update, it means, next data will depend on previous data.

In BDC Sessions, the ABAP program creates a session with all the transactional data, and this session can be viewed, scheduled and processed (using Transaction SM35) at a later time. The latter technique has a built-in error processing mechanism too.

Reward if helpful.

Thankyou,

Regards.