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

syntax for call transaction

Former Member
0 Likes
19,702

hi frnds,

cld any one let me know the syntax for call transaction

in bdc??

thnx

daniel

11 REPLIES 11
Read only

Former Member
0 Likes
6,103

CALL TRANSACTION 'TCODE '

USING bdc_tab

MODE 'N'

UPDATE 'S'

MESSAGES INTO msgtab.

Read only

nikhil_chitre
Active Participant
0 Likes
6,103

Hi,

Have a look at below cod efor Reference.

Besides this there is good amount of information in F1 for CALL Transaction Keyword.

DATA class_name TYPE c LENGTH 30 VALUE 'CL_SPFLI_PERSISTENT'.

DATA: bdcdata_wa TYPE bdcdata,

bdcdata_tab TYPE TABLE OF bdcdata.

DATA opt TYPE ctu_params.

CLEAR bdcdata_wa.

bdcdata_wa-program = 'SAPLSEOD'.

bdcdata_wa-dynpro = '1000'.

bdcdata_wa-dynbegin = 'X'.

APPEND bdcdata_wa TO bdcdata_tab.

CLEAR bdcdata_wa.

bdcdata_wa-fnam = 'BDC_CURSOR'.

bdcdata_wa-fval = 'SEOCLASS-CLSNAME'.

APPEND bdcdata_wa TO bdcdata_tab.

CLEAR bdcdata_wa.

bdcdata_wa-fnam = 'SEOCLASS-CLSNAME'.

bdcdata_wa-fval = class_name.

APPEND bdcdata_wa TO bdcdata_tab.

CLEAR bdcdata_wa.

bdcdata_wa-fnam = 'BDC_OKCODE'.

bdcdata_wa-fval = '=CIDI'.

APPEND bdcdata_wa TO bdcdata_tab.

opt-dismode = 'E'.

opt-defsize = 'X'.

CALL TRANSACTION 'SE24' USING bdcdata_tab OPTIONS FROM opt.

Regards,

Nikhil

Read only

0 Likes
6,103

Hi,

suppose for MM01 transaction.

DATA: LW_BDCDATA TYPE BDCDATA,

LT_BDCDATA TYPE STANDARD TABLE OF BDCDATA,

LW_BDCMSGCOLL TYPE BDCMSGCOLL,

LT_BDCMSGCOLL TYPE STANDARD TABLE OF BDCMSGCOLL.

CALL TRANSACTION 'MM01 USING LT_BDCDATA MODE 'A'

UPDATE 'S' MESSAGES INTO LT_BDCMSGCOLL.

Regards.

Sriram

Read only

former_member125931
Active Participant
0 Likes
6,103

Hi,

check this : call transaction <Transaction code> USING bdc_tab

MODE <A/N/E>

UPDATE <S/A>

MESSAGES INTO msgtab.

Read only

Former Member
0 Likes
6,103

Hi Daniel,

CALL TRANSACTION <tcode>

USING <itab>

MODE <mode>

MESSAGES INTO <msgtab>.

tcode : The transaction code which we are calling.

itab : The internal table from which the data is passed.

mode : In which mode the execution is done(A/N/E)

A - All Screen Mdoe(Shows all screens while

execution)

N - No Screen Mode(Shows no screens)

E - Error Screen Mode(Shows the screens where

error occurs)

msgtab - In Call Transaction errors are handled explicity. All

the messages are passed into this table

Check this link for complete options of CALL TRANSACTION :

http://www.s001.org/ABAP-Hlp/abapcall_transaction.htm

Hope this helps you.

Regards,

Chandra Sekhar

Edited by: Chandrasekhar Gandla on Jul 21, 2008 5:21 AM

Read only

Former Member
0 Likes
6,103

hi..

syntax of CALL TRANSACTION is :-

CALL TRANSACTION <TCODE>

USING <ITAB TYPE BDCDATA STRUCTURE>

MODE <Display Mode> <DEFAULT A>

UPDTAE <UPDATE TYPE > <DEFAULT S>

MESSAGES INTO <Msg table> <BDCMSGCOLL structure>

T-code refers to the Transaction code.

The various display modes are

Mode Description

A Display all

E Display errors only

N No display

The mode parameter is very important and we can use any of these three modes

A: In this case when we run the program then all the screens and the data that goes

Into them will appear.

E: This can be used for displaying Errors only. In this case as soon as error in one of the screen is detected, the transaction goes into display mode, by which we can correct the error.

N: In this all screens are processed invisibly without notice into the points whether there are errors or not.

The various update modes are

Mode Description

S Synchronous

A Asynchronous

L Local update

A: Which means Asynchronous updating, the called transaction does not wait for any updates it produces to be completed in this mode. The updates to the SAP update service simply passed by it. Therefore this process is results in faster execution.

In order to process any larger amount of data, this processing is not recommended. The called transaction receives no completion message from the update module in this mode.

Moreover whether a called transaction ended with a successful update of the database or not, the calling data transfer program canu2019t determine that.

We need to use the update management facility (Transaction SM12) to check whether Updates have been terminated abnormally during the session processing. The error analysis and recovery are less convenient in Asynchronous updating.

S: The important of this mode is that the called transaction waits for any updates that it produces to be completed. Call transaction wait for updating to be completed, so the execution will be slow compared to Asynchronous updating. However the called transaction plays a vital role as it is able to return any update error message that occurs in the program. Therefore the analysis and recovery from the error will be easy for the user.

L: In this mode if we update data locally, the update of data will not be processed in a separate process, but in the process of calling program itself.

hope this will help you.

regards

lokesh

Read only

Former Member
0 Likes
6,103
Read only

former_member787646
Contributor
0 Likes
6,103

Hi

CALL TRANSACTION '<TCODE>' USING <bdcdata_tab >

... { {[MODE mode] [UPDATE upd]}

| [OPTIONS FROM opt] }

[MESSAGES INTO itab] ... . .

Hope this would help you.

Murthy

Read only

Former Member
0 Likes
6,103

CALL TRANSACTION 'TCODE'

USING bdctab

OPTIONS FROM

ZSETTING

MESSAGES INTO msgtab.

Before that you need to record the TCODE using SHDB and then append all teh values to BDCTAB.

ZSETTING is an itnernal table you can use for setting the screen mode. This we can u can easily debug the program jsut changing the value at internal table. You do't need to hardcode these settings.

Award points if you find this answer helpful to you.

Regards,

Giri

Read only

Former Member
0 Likes
6,103

Hi,

You can refer the below code for caaling a transaction inBDC.

*&---------------------------------------------------------------------
*Tables Declaration
*&---------------------------------------------------------------------*
TABLES: bdcdata, rlgrap.
*&---------------------------------------------------------------------

************************************************************************
*Parameters
***********************************************************************

PARAMETERS: file1 LIKE rlgrap-filename.

************************************************************************
*Internal Table Declarations
***********************************************************************

DATA: BEGIN OF itab OCCURS 0,
        matnr(18) TYPE c,    "MaterialNumber
        werks(4) TYPE c,     "Plant
        vdatu(10) TYPE c,    "Valid From Date
        bdatu(10) TYPE c,    "Valid To Date
        lifnr(10) TYPE c,    "Vendor Number
        ekorg(4) TYPE c,     "Purchasing Organization
        feskz TYPE c,        "Fixed
        autet TYPE c,        "MRP Indicator
     END OF itab.

DATA: bdcdata LIKE TABLE OF bdcdata WITH HEADER LINE.

************************************************************************
*Variables Declarations
***********************************************************************
DATA:  wa1 LIKE LINE OF itab. "Workarea for ITAB
DATA:  n TYPE i,              "Check
       count TYPE i.          "Count
DATA:  cnt(2),                "Counter
       wa(15).                "Workarea to hold concatenatedvalue
DATA   v_msg(100).            "Message
DATA:  flag.                  "Flag
DATA:  file TYPE string.      "File

************************************************************************
*Initialization event
***********************************************************************
INITIALIZATION.

************************************************************************
*At-selection-screen event
***********************************************************************

*To provide Input help for file name

AT SELECTION-SCREEN ON VALUE-REQUEST FOR file1.


CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = file1.

***********************************************************************
*START-OF-SELECTION EVENT
***********************************************************************

START-OF-SELECTION.

MOVE file1 TO file.

*File transfer from a file on the presentation server to an internal table itab.

CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = itab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

*To populate BDCdata and start data transfer

LOOP AT itab .

* To validate Plant range

IF itab-werks = '1000' OR itab-werks = '2000'
OR itab-werks = '1008'.

AT NEW werks.

CLEAR: n.
cnt = 1.

PERFORM bdc_dynpro USING 'SAPLMEOR' '0200'.
PERFORM bdc_field USING 'BDC_CURSOR'
'EORD-MATNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'EORD-MATNR'
itab-matnr.
PERFORM bdc_field USING 'EORD-WERKS'
itab-werks.
PERFORM bdc_dynpro USING 'SAPLMEOR' '0205'.


CONCATENATE 'EORD-EKORG(' cnt ')' INTO wa.

PERFORM bdc_field USING 'BDC_CURSOR'
wa.

PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
ENDAT.

IF n = 12.


READ TABLE bdcdata WITH KEY fval = '=BU'.
bdcdata-fval = '=NS'.
MODIFY bdcdata INDEX sy-tabix TRANSPORTING fval.


PERFORM bdc_dynpro USING 'SAPLMEOR' '0205'.
PERFORM bdc_field USING 'BDC_CURSOR'
'EORD-VDATU(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.

cnt = 2.
n = 2.
ENDIF.



CONCATENATE 'EORD-VDATU(' cnt ')' INTO wa.
PERFORM bdc_field USING wa
itab-vdatu.

CONCATENATE 'EORD-BDATU(' cnt ')' INTO wa.

PERFORM bdc_field USING wa
itab-bdatu.
CONCATENATE 'EORD-LIFNR(' cnt ')' INTO wa.
PERFORM bdc_field USING wa
itab-lifnr.
CONCATENATE 'EORD-EKORG(' cnt ')' INTO wa.
PERFORM bdc_field USING wa
itab-ekorg.
CONCATENATE 'RM06W-FESKZ(' cnt ')' INTO wa.
PERFORM bdc_field USING wa
itab-feskz.
CONCATENATE 'EORD-AUTET(' cnt ')' INTO wa.
PERFORM bdc_field USING wa
itab-autet.

IF n <> 12.
n = cnt.
ENDIF.
cnt = cnt + 1.


AT END OF werks.

*Call Transaction 'ME01: Maintain Source List with synchronous update and display screenu2019

*CALL TRANSACTION 'ME01' USING bdcdata*
*UPDATE 'S'*
*MODE 'A'.*

CLEAR:bdcdata,bdcdata[].


*Call function module FORMAT_MESSAGE.

CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
    id = sy-msgid
    lang = 'EN'
    no = sy-msgno
    v1 = sy-msgv1
    v2 = sy-msgv2
    v3 = sy-msgv3
    v4 = sy-msgv4
IMPORTING
   msg = v_msg.

WRITE:/ v_msg.
CLEAR: bdcdata,bdcdata[],flag.


ENDAT.

ENDIF.
ENDLOOP.


*----------------------------------------------------------------------*
* Start new screen *
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------
*&      Form  bdc_dynpro
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*

FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.

ENDFORM.                 u201Cbdc_dynpro

*----------------------------------------------------------------------*
* Insert field values
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------
*&      Form  bdc field
*&------------_ ---------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*

FORM bdc_field USING fnam fval.
IF NOT fval IS INITIAL.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDIF.
CLEAR wa.
ENDFORM.                        u201Cbdc_field
*----------------------------------------------------------------------

This will surley help.

plz reward if useful.

thanks,

dhanashri.

Read only

Former Member
0 Likes
6,103

HI

You should close this thread by rewarding some points to which ever answer is suitable to your kinda solution. If not post your query.

Regards,

giri