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

simple bdc call transaction program

Former Member
0 Likes
5,020

pls give me code, how to write simple call transaction program

5 REPLIES 5
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,337

Hello Vikas,

SAP has lots of demo program. Please check the program DEMO_PROGRAM_CALL_TRANSACTION.

Anyways search in SDN for details.

BR,

Suhas

Read only

Former Member
0 Likes
2,337

how to get DEMO_PROGRAM_CALL_TRANSACTION

Read only

Former Member
0 Likes
2,337

Hi Vikas,

Use this link

http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3417200%29ID0606667850DB0148093883533921056...

I am sure this is very useful link.

Regards,

Vijay

Read only

Former Member
Read only

Former Member
0 Likes
2,337

Hi, first fallow the steps.

Step 1

Execute transaction recorder, transaction SHDB.

Step 2

Enter name for recording (XD01).

Step 3

Enter transaction to be executed.

Step 4

The transaction will now be executed, simply perform the actions that are mandatory

Step 5

Once you have finished the recording and selected the save button or exited the transaction you

Will be presented with the following information. This details the screens and fields that have been

Processed during the recording and will be used as a basis to create BDC ABAP program.

Step 6

Select your record in SHDB and click on program and then give program name and select radio button "Transfor from recording" and then create you will get some code on your program.

Step 7

Double click on the include "bdcrecx1" select display and then copy the the required code.

&----


*& Report Z_VIJAY_BDC

*&

&----


*&

*&

&----


REPORT Z_VIJAY_BDC_XD01.

DATA : BEGIN OF ITAB OCCURS 1,

F1 TYPE KUNNR,

F2 TYPE KTOKD,

F3 TYPE BUKRS,

F4 TYPE VKORG,

F5 TYPE VTWEG,

F6 TYPE SPART,

F7 TYPE NAME1,

F8 TYPE LAND1,

F9 TYPE SPRAS,

END OF ITAB.

DATA : BDCDATA TYPE BDCDATA OCCURS 1 WITH HEADER LINE.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'C:\VIJAY.TXT'

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

DATA_TAB = ITAB.

**LOOP AT ITAB.

**WRITE : / ITAB-F1,

    • ITAB-F2,

    • ITAB-F3,

    • ITAB-F4,

    • ITAB-F5,

    • ITAB-F6,

    • ITAB-F7,

    • ITAB-F8.

**ENDLOOP.

**

LOOP AT ITAB.

REFRESH BDCDATA.

PERFORM BDC_DYNPRO USING 'SAPMF02D' '0100'.

PERFORM BDC_FIELD USING 'BDC_CURSOR' 'RF02D-REF_KUNNR'.

PERFORM BDC_FIELD USING 'BDC_OKCODE' '/00'.

PERFORM BDC_FIELD USING 'RF02D-KUNNR' ITAB-F1.

PERFORM BDC_DYNPRO USING 'SAPMF02D' '7100'.

PERFORM BDC_FIELD USING 'RF02D-KTOKD' ITAB-F2.

PERFORM BDC_FIELD USING 'RF02D-KUNNR' ''.

PERFORM BDC_FIELD USING 'RF02D-BUKRS' ITAB-F3.

PERFORM BDC_FIELD USING 'RF02D-VKORG' ITAB-F4.

PERFORM BDC_FIELD USING 'RF02D-VTWEG' ITAB-F5.

PERFORM BDC_FIELD USING 'RF02D-SPART' ITAB-F6.

PERFORM BDC_DYNPRO USING 'SAPMF02D' '0110'.

PERFORM BDC_FIELD USING 'BDC_CURSOR' 'KNA1-SPRAS'.

PERFORM BDC_FIELD USING 'BDC_OKCODE' '=UPDA'.

PERFORM BDC_FIELD USING 'KNA1-NAME1' ITAB-F7.

PERFORM BDC_FIELD USING 'KNA1-LAND1' ITAB-F8.

PERFORM BDC_FIELD USING 'KNA1-SPRAS' ITAB-F9.

CALL TRANSACTION 'XD01' USING BDCDATA MODE 'A'.

ENDLOOP.

----


  • 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.

IF FVAL <> SPACE.

CLEAR BDCDATA.

BDCDATA-FNAM = FNAM.

BDCDATA-FVAL = FVAL.

APPEND BDCDATA.

ENDIF.

ENDFORM.

This is the sample code for XD01 please go through this.

Thanks & Regards,

Vijay