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

call transaction

Former Member
0 Likes
960

could i run the two transaction MM02.XD02 in a single call transaction??is it possible? how?

any body solve this plz send step by step plz.....?

could i run the two transaction MM02.XD02 in a single call transaction??is it possible? how?

any body solve this plz send step by step plz.....?

7 REPLIES 7
Read only

jayanthi_jayaraman
Active Contributor
0 Likes
928

Hi,

No you cannot use one call transaction statement for calling two tcodes.

Read only

0 Likes
928

Why do you want to do this?

It is not possible to call 2 transaction in single CALL Transaction statement.

Regards,

Mohan

Read only

Former Member
0 Likes
928

Sheik,

check this code....

REPORT zra_gl_cr NO STANDARD PAGE HEADING LINE-SIZE 255.

TYPE-POOLS: truxs.

DATA: it_raw TYPE truxs_t_text_data.

DATA:messtab1 LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.

DATA:messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.

DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.

DATA: BEGIN OF i_mess OCCURS 0,

l_mstring(480),

msgnr(5),

msgv1(15),

END OF i_mess.

DATA:i_mess1 LIKE i_mess OCCURS 0 WITH HEADER LINE.

DATA: l_mstring(480),l_mstring1(480).

DATA: BEGIN OF it_itab OCCURS 0,

saknr(10), "G/L a/c number.

bukrs(4), "Company Code.

ktoks(4), "G/L a/c group.

xplacct(1), "P&L statement account.

xbilk(1), "Balance sheet account.

txt20_ml(20), "G/L a/c short text.

txt50_ml(50), "G/L a/c long text.

waers(5), "Account currency.

MWSKZ(2),

mitkz(1), "Reconciliation a/c for a/c type.

xopvw(1), "Open item management

xkres(1), "Line item display.

zuawa(3), "Sort Key.

fstag(4), "Field status group.

xintb(1), "Post automatically only.

hbkid(5), "House bank.

hktid(5), "Account id.

vzskz(2), "Interest indicator

END OF it_itab.

DATA: hdate LIKE sy-datum.

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

          • Selection Screen *****

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

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 5(15) text-103. " FOR FIELD P_FILE1.

SELECTION-SCREEN POSITION 25.

PARAMETERS : p_file1 LIKE rlgrap-filename.

SELECTION-SCREEN END OF LINE.

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

          • Initialization *****

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

INITIALIZATION.

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

          • At Selection Screen *****

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

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.

  • Perform file_selection will help to select the location of the file

PERFORM file_selection.

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

          • Start-Of-Selection *****

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

START-OF-SELECTION.

  • Perform data_upload will help to upload the data from the flat file

  • to the internal table.

PERFORM data_upload.

  • PERFORM open_group.

  • Peform bdc_upload will help to upload the data from the internal

  • table into its respective fields.

  • PERFORM bdc_fspo.

PERFORM bdc_upload.

PERFORM exp_log.

  • PERFORM close_group.

  • Perform display_log will prepare a log for the data that has been

  • uploaded

  • PERFORM display_log.

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

        • End-Of-Selection ****

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

END-OF-SELECTION.

&----


*& Form file_selection

&----


  • To select the location of the file

----


FORM file_selection .

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

def_filename = ' '

def_path = 'C:\'

mask = ',.txt,.xls.'

mode = 'O'

title = 'Open a excel file'

IMPORTING

filename = p_file1

EXCEPTIONS

inv_winsys = 1

no_batch = 2

selection_cancel = 3

selection_error = 4

OTHERS = 5.

ENDFORM. " file_selection

&----


*& Form data_upload

&----


  • To upload the data from the file location to the internal table.

----


FORM data_upload .

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

EXPORTING

  • I_FIELD_SEPERATOR =

i_line_header = 'X'

i_tab_raw_data = it_raw

i_filename = p_file1

TABLES

i_tab_converted_data = it_itab

EXCEPTIONS

conversion_failed = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM. " data_upload

&----


*& Form bdc_upload

&----


  • To upload the data from the internal table into its respective fields.

----


FORM bdc_upload .

LOOP AT it_itab.

perform bdc_dynpro using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.

perform bdc_field using 'BDC_OKCODE'

'=ACC_CRE'.

perform bdc_field using 'BDC_CURSOR'

'GLACCOUNT_SCREEN_KEY-SAKNR'.

perform bdc_field using 'GLACCOUNT_SCREEN_KEY-SAKNR'

it_itab-SAKNR.

perform bdc_field using 'GLACCOUNT_SCREEN_KEY-BUKRS'

it_itab-BUKRS.

perform bdc_dynpro using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.

perform bdc_field using 'BDC_OKCODE'

'=2102_GROUP'.

perform bdc_field using 'BDC_CURSOR'

'GLACCOUNT_SCREEN_COA-KTOKS'.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-KTOKS'

it_itab-KTOKS.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-XPLACCT'

it_itab-XPLACCT.

perform bdc_dynpro using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.

perform bdc_field using 'BDC_OKCODE'

'=2102_BS_PL'.

perform bdc_field using 'BDC_CURSOR'

'GLACCOUNT_SCREEN_COA-XBILK'.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-KTOKS'

it_itab-KTOKS.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-XPLACCT'

it_itab-XPLACCT.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-XBILK'

it_itab-XBILK.

perform bdc_dynpro using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.

perform bdc_field using 'BDC_OKCODE'

'=ENTER'.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-KTOKS'

it_itab-KTOKS.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-XBILK'

it_itab-XBILK.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-TXT20_ML'

it_itab-TXT20_ML.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-TXT50_ML'

it_itab-TXT50_ML.

perform bdc_field using 'BDC_CURSOR'

'GLACCOUNT_SCREEN_COA-BILKT'.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-BILKT'

it_itab-saknr.

PERFORM bdc_dynpro USING 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=TAB02'.

PERFORM bdc_field USING 'BDC_CURSOR'

'GLACCOUNT_SCREEN_COA-KTOKS'.

PERFORM bdc_field USING 'GLACCOUNT_SCREEN_COA-KTOKS'

it_itab-ktoks.

PERFORM bdc_field USING 'GLACCOUNT_SCREEN_COA-TXT20_ML'

it_itab-txt20_ml.

PERFORM bdc_field USING 'GLACCOUNT_SCREEN_COA-TXT50_ML'

it_itab-txt50_ml.

perform bdc_field using 'BDC_CURSOR'

'GLACCOUNT_SCREEN_COA-BILKT'.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-BILKT'

it_itab-saknr.

****

perform bdc_dynpro using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.

perform bdc_field using 'BDC_OKCODE'

'=TAB02'.

perform bdc_field using 'BDC_CURSOR'

'GLACCOUNT_SCREEN_COA-KTOKS'.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-KTOKS'

it_itab-KTOKS.

perform bdc_field using 'BDC_CURSOR'

'GLACCOUNT_SCREEN_COA-KTOKS'.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-KTOKS'

it_itab-KTOKS.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-XBILK'

it_itab-XBILK.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-TXT20_ML'

it_itab-TXT20_ML.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-TXT50_ML'

it_itab-TXT50_ML.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-BILKT'

it_itab-saknr.

perform bdc_dynpro using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.

perform bdc_field using 'BDC_OKCODE'

'=ENTER'.

perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-WAERS'

it_itab-waers.

perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-MWSKZ'

it_itab-MWSKZ.

perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-MITKZ'

it_itab-mitkz.

perform bdc_field using 'BDC_CURSOR'

'GLACCOUNT_SCREEN_CCODE-XOPVW'.

perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-XOPVW'

it_itab-XOPVW.

perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-XKRES'

it_itab-XKRES.

perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-ZUAWA'

it_itab-ZUAWA.

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

PERFORM bdc_field USING 'GLACCOUNT_SCREEN_COA-XPLACCT'

it_itab-xplacct.

PERFORM bdc_field USING 'GLACCOUNT_SCREEN_COA-XBILK'

it_itab-xbilk.

  • IF it_itab-xbilk = 'X'.

*

  • PERFORM bdc_dynpro USING 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.

  • PERFORM bdc_field USING 'BDC_OKCODE'

  • '=TAB03'.

  • PERFORM bdc_field USING 'BDC_CURSOR'

  • 'GLACCOUNT_SCREEN_CCODE-WAERS'.

  • PERFORM bdc_field USING 'GLACCOUNT_SCREEN_CCODE-WAERS'

  • it_itab-waers.

*

  • PERFORM bdc_field USING 'GLACCOUNT_SCREEN_CCODE-XOPVW'

  • it_itab-xopvw.

  • PERFORM bdc_field USING 'GLACCOUNT_SCREEN_CCODE-MITKZ'

  • it_itab-mitkz.

  • ENDIF.

  • PERFORM bdc_field USING 'GLACCOUNT_SCREEN_CCODE-XKRES'

  • it_itab-xkres.

  • PERFORM bdc_field USING 'GLACCOUNT_SCREEN_CCODE-ZUAWA'

  • it_itab-zuawa.

*

  • PERFORM bdc_dynpro USING 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.

*

  • PERFORM bdc_field USING 'BDC_OKCODE'

  • '=SAVE'.

  • PERFORM bdc_field USING 'BDC_CURSOR'

  • 'GLACCOUNT_SCREEN_CCODE-FSTAG'.

  • PERFORM bdc_field USING 'GLACCOUNT_SCREEN_CCODE-FSTAG'

  • it_itab-fstag.

  • PERFORM bdc_field USING 'GLACCOUNT_SCREEN_CCODE-XINTB'

  • it_itab-xintb.

  • PERFORM bdc_field USING 'GLACCOUNT_SCREEN_CCODE-HBKID'

  • it_itab-hbkid.

  • PERFORM bdc_field USING 'GLACCOUNT_SCREEN_CCODE-HKTID'

  • it_itab-hktid.

  • PERFORM bdc_field USING 'GLACCOUNT_SCREEN_CCODE-VZSKZ'

  • it_itab-vzskz.

perform bdc_dynpro using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.

perform bdc_field using 'BDC_OKCODE'

'=TAB03'.

perform bdc_field using 'BDC_CURSOR'

'GLACCOUNT_SCREEN_CCODE-WAERS'.

perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-WAERS'

it_itab-WAERS.

perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-MWSKZ'

it_itab-MWSKZ.

perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-MITKZ'

it_itab-MITKZ.

perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-ZUAWA'

it_itab-ZUAWA.

perform bdc_dynpro using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.

perform bdc_field using 'BDC_OKCODE'

'=ENTER'.

perform bdc_field using 'BDC_CURSOR'

'GLACCOUNT_SCREEN_CCODE-FSTAG'.

perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-FSTAG'

it_itab-FSTAG.

perform bdc_dynpro using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.

perform bdc_field using 'BDC_OKCODE'

'=SAVE'.

perform bdc_field using 'BDC_CURSOR'

'GLACCOUNT_SCREEN_CCODE-FSTAG'.

perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-FSTAG'

it_itab-FSTAG.

  • PERFORM bdc_transaction USING 'FS00'.

CALL TRANSACTION 'FS00' USING bdcdata MODE 'A'

UPDATE 'S'

MESSAGES INTO messtab1.

PERFORM mess1.

REFRESH bdcdata[].

ENDLOOP.

ENDFORM. " bdc_upload

&----


*& Form bdc_fspo

&----


  • text

----


FORM bdc_fspo .

LOOP AT it_itab.

PERFORM bdc_dynpro USING 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=ACC_CRE'.

PERFORM bdc_field USING 'BDC_CURSOR'

'GLACCOUNT_SCREEN_KEY-SAKNR'.

PERFORM bdc_field USING 'GLACCOUNT_SCREEN_KEY-SAKNR'

it_itab-saknr.

PERFORM bdc_field USING 'GLACCOUNT_SCREEN_KEY-KTOPL'

'1000'.

PERFORM bdc_dynpro USING 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=2102_GROUP'.

PERFORM bdc_field USING 'BDC_CURSOR'

'GLACCOUNT_SCREEN_COA-KTOKS'.

PERFORM bdc_field USING 'GLACCOUNT_SCREEN_COA-KTOKS'

it_itab-ktoks.

PERFORM bdc_field USING 'GLACCOUNT_SCREEN_COA-XPLACCT'

it_itab-xplacct.

PERFORM bdc_field USING 'GLACCOUNT_SCREEN_COA-XBILK'

it_itab-xbilk.

PERFORM bdc_dynpro USING 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=SAVE'.

PERFORM bdc_field USING 'GLACCOUNT_SCREEN_COA-KTOKS'

it_itab-ktoks.

PERFORM bdc_field USING 'GLACCOUNT_SCREEN_COA-XPLACCT'

it_itab-xplacct.

PERFORM bdc_field USING 'BDC_CURSOR'

'GLACCOUNT_SCREEN_COA-TXT50_ML'.

PERFORM bdc_field USING 'GLACCOUNT_SCREEN_COA-TXT20_ML'

it_itab-txt20_ml.

PERFORM bdc_field USING 'GLACCOUNT_SCREEN_COA-TXT50_ML'

it_itab-txt50_ml.

*perform bdc_transaction using 'FSP0'.

CALL TRANSACTION 'FSP0' USING bdcdata MODE 'A'

UPDATE 'S'

MESSAGES INTO messtab.

PERFORM mess.

REFRESH bdcdata[].

ENDLOOP.

ENDFORM. " bdc_fspo

&----


*& Form mess

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM mess . "fsp0

LOOP AT messtab.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

id = messtab-msgid

lang = messtab-msgspra

no = messtab-msgnr

v1 = messtab-msgv1

v2 = messtab-msgv2

v3 = messtab-msgv3

v4 = messtab-msgv4

IMPORTING

msg = l_mstring

EXCEPTIONS

not_found = 1

OTHERS = 2.

CONDENSE l_mstring.

i_mess1-l_mstring = l_mstring(250).

i_mess1-msgnr = messtab1-msgnr.

i_mess1-msgv1 = messtab1-msgv1.

APPEND i_mess1.

ENDLOOP.

ENDFORM. " mess

&----


*& Form mess1

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM mess1 . "fs00

LOOP AT messtab1.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

id = messtab1-msgid

lang = messtab1-msgspra

no = messtab1-msgnr

v1 = messtab1-msgv1

v2 = messtab1-msgv2

v3 = messtab1-msgv3

v4 = messtab1-msgv4

IMPORTING

msg = l_mstring1

EXCEPTIONS

not_found = 1

OTHERS = 2.

CONDENSE l_mstring1.

i_mess-l_mstring = l_mstring1(250).

i_mess-msgnr = messtab1-msgnr.

i_mess-msgv1 = messtab1-msgv1.

APPEND i_mess.

ENDLOOP.

ENDFORM. " mess1

&----


*& Form exp_log

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM exp_log .

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'c:\temp\error_fsp0.txt'

filetype = 'DAT'

TABLES

data_tab = i_mess1.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'c:\temp\error_fs00.txt'

filetype = 'DAT'

TABLES

data_tab = i_mess.

ENDFORM. " exp_log

&----


*& Form bdc_dynpro

&----


  • text

----


  • -->PROGRAM text

  • -->DYNPRO text

----


FORM bdc_dynpro USING program dynpro.

CLEAR bdcdata.

bdcdata-program = program.

bdcdata-dynpro = dynpro.

bdcdata-dynbegin = 'X'.

APPEND bdcdata.

ENDFORM. "BDC_DYNPRO

----


  • Insert field *

----


FORM bdc_field USING fnam fval.

CLEAR bdcdata.

bdcdata-fnam = fnam.

bdcdata-fval = fval.

APPEND bdcdata.

ENDFORM. "BDC_Field

Don't forget to reward if useful.....

Read only

Former Member
0 Likes
928

hi,

go for session method to work with multiple transaction codes at a time.

reward points if useful,

regards,

seshu.

Read only

Former Member
0 Likes
928

Hi,

by using call transaction method. It would be the same as running one transaction, you would simply do each the same way, in one program, if that is the requirement.

<b>Reward points</b>

Regards

Read only

Former Member
0 Likes
928

HI.

No You cant use two transaction code in call transaction.

but session method allowed to two transaction code.

reward all helpfull answers.

Jay

Message was edited by:

Jay j

Read only

Former Member
0 Likes
928

see the next link:

<a href="https://forums.sdn.sap.com/click.jspa?searchID=6931591&messageID=2982057">https://forums.sdn.sap.com/click.jspa?searchID=6931591&messageID=2982057</a>

cordial greetings