‎2009 Sep 08 12:37 PM
pls give me code, how to write simple call transaction program
‎2009 Sep 08 12:46 PM
Hello Vikas,
SAP has lots of demo program. Please check the program DEMO_PROGRAM_CALL_TRANSACTION.
Anyways search in SDN for details.
BR,
Suhas
‎2009 Sep 08 1:00 PM
‎2009 Sep 08 12:54 PM
Hi Vikas,
Use this link
I am sure this is very useful link.
Regards,
Vijay
‎2009 Sep 08 1:03 PM
‎2009 Sep 08 1:05 PM
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