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
524

Explain different mode in Call Transaction.

3 REPLIES 3
Read only

Former Member
0 Likes
404

CALL TRANSACTION tcod ... MODE mode

The specified processing mode can accept the following values:

'A' Display screen

'E' Display screen only if an error occurs

'N' No display

If the addition MODE is not specified, the processing mode is set to 'A' .

The MODE Parameter

You can use the MODE parameter to specify whether data transfer processing should be displayed as it happens. You can choose between three modes:

A Display all. All screens and the data that goes in them appear when you run your program.

N No display. All screens are processed invisibly, regardless of whether there are errors or not. Control returns to your program as soon as transaction processing is finished.

E Display errors only. The transaction goes into display mode as soon as an error in one of the screens is detected. You can then correct the error.

Have a look at below link for details:

[Using CALL TRANSACTION USING for Data Transfer |http://help.sap.com/saphelp_sm32/helpdata/en/fa/09715a543b11d1898e0000e8322d00/content.htm]

I hope it helps.

Thanks,

Vibha

Please mark all the useful answers

Read only

Former Member
0 Likes
404

Hi,

CALL TRANSACTION - bdc_options

Syntax

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

| [OPTIONS FROM opt] }

[MESSAGES INTO itab] ... .

Extras:

1. ... MODE mode

2. ... UPDATE upd

3. ... OPTIONS FROM opt

4. ... MESSAGES INTO itab

Effect

Control of batch input processing with the USING addition.

... MODE mode

Effect

The MODE addition determines the processing mode for batch input processing. As mode, you can specify a character-type data object. Its possible content and effect is displayed in the following table. Without use of one of the additions MODE or OPTIONS FROM, the effect is the same as if mode had the content "A".

mode Effect

"A" Processing with display of screens

"E" Display of screens only if an error occurs

"N" Processing without display of screens. If a breakpoint is reached in one of the called transactions, processing is terminated with sy-subrc same as 1001. The field sy-msgty contains "S", sy-msgid contains "00", sy-msgno contains "344", sy-msgv1 contains "SAPMSSY3", and sy-msgv2 contains "0131".

"P" Processing without display of the screens. If a breakpoint is reached in one of the called transactions, the system branches to the ABAP Debugger.

Others Like "A".

Read only

Former Member
0 Likes
404

hi check this program for the different modes in call transaction...

report zmppc018 no standard page heading

line-size 120

line-count 55

message-id zz.

Constants

constants : c_x type c value 'X'," Dynbegin

c_tcode type tstc-tcode value 'CA22'," Transaction Code

c_r(1) type c value 'R'," Task List type

c_O(1) type c value 'O',

c_fh(2) type c value 'FH'.

Variables

data : v_lines_in_xcel like sy-tabix,

v_matnr(18) type c, " Material Number

v_PLNNR like mapl-plnnr," Group

V_DATE(8) type c," System date

v_date1(4) type c,

v_date2(2) type c,

v_date3(2) type c,

V_COUNT TYPE I." Count

Internal table for BDCDATA Structure

data : begin of itab_bdc_tab occurs 0.

include structure bdcdata.

data : end of itab_bdc_tab.

Internal table for File

data : begin of t_file occurs 0,

matnr(18) type c, " Material #

werks(4) type c, " Plant

plnal(2) type n, " Group Counter

vornr(4) type n, " Op #

equnr(18) type c, " PRT Material #

steuf(4) type c, " Control Key

mgvgw(6) type n, " Qty

mgeinh(3) type c, " Qty Unit

end of t_file.

Internal table for Error Log

data : begin of i_error occurs 0,

matnr like mara-matnr,

werks like marc-werks,

vornr like plpo-vornr,

plnnr like plpo-plnnr,

text(90) type c,

end of i_error.

Selection-screen

selection-screen : begin of block blk with frame.

selection-screen: skip 1.

parameters : p_file like rlgrap-filename obligatory,

P_mode type c obligatory Default 'N'.

selection-screen : skip 1.

selection-screen : end of block blk.

at selection-screen on value-request for p_file.

F4 value for Input file

perform filename_get.

main processing

start-of-selection.

To get the data from file to Internal table

perform getdata_fromfile.

loop at t_file.

fill in bdc-data for Routing maintenance screens

perform bdc_build_script.

insert the bdc script as a BDC transaction

perform bdc_submit_transaction.

endloop.

top-of-page.

call function 'Z_HEADER'

EXPORTING

FLEX_TEXT1 =

FLEX_TEXT2 =

FLEX_TEXT3 =

.

skip 1.

write:/2 'Material #',24 'Plant',32 'Group',44 'Op #',

53 'Status Message'.

skip 1.

&----


*& Form filename_get

&----


F4 Value for Input File parameter

-


FORM filename_get.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

DEF_PATH = 'C:\Temp\ '

MASK = ',.,..'

MODE = 'O'

TITLE = 'Select File '(007)

IMPORTING

FILENAME = p_file

EXCEPTIONS

INV_WINSYS = 1

NO_BATCH = 2

SELECTION_CANCEL = 3

SELECTION_ERROR = 4

OTHERS = 5.

ENDFORM. " filename_get

&----


*& Form getdata_fromfile

&----


text

-


FORM getdata_fromfile.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

FILENAME = p_file

FILETYPE = 'DAT'

TABLES

DATA_TAB = t_file

EXCEPTIONS

CONVERSION_ERROR = 1

FILE_OPEN_ERROR = 2

FILE_READ_ERROR = 3

INVALID_TYPE = 4

NO_BATCH = 5

UNKNOWN_ERROR = 6

INVALID_TABLE_WIDTH = 7

GUI_REFUSE_FILETRANSFER = 8

CUSTOMER_ERROR = 9

OTHERS = 10.

if sy-subrc eq 0.

sort t_file by matnr werks plnal vornr .

clear v_lines_in_xcel.

describe table t_file lines v_lines_in_xcel.

if v_lines_in_xcel is initial.

write: / 'No data in input file'.

stop.

endif.

else.

write:/ 'Error reading input file'.

stop.

endif.

ENDFORM. " getdata_fromfile

&----


*& Form bdc_build_script

&----


BDC Script

-


FORM bdc_build_script.

Get the material number from tables ZMSMI_FERR_RAW,

ZMSMI_SNAP_RAW and ZMSMI_SIMP_RAW

perform get_matnr.

Screen 1010.

perform bdc_screen using 'SAPLCPDI' '1010'.

perform bdc_field using 'BDC_OKCODE' '=VOUE'.

perform bdc_field using 'RC27M-MATNR' SPACE .

perform bdc_field using 'RC27M-WERKS' SPACE.

perform bdc_field using 'RC271-VBELN' SPACE.

perform bdc_field using 'RC271-POSNR' SPACE.

perform bdc_field using 'RC271-PSPNR' SPACE.

Clear v_plnnr.

Get the Group from MAPL Table

select single plnnr from mapl

into v_plnnr

where matnr = t_file-matnr

and werks = t_file-werks

and loekz = space

and plnty = c_r

and plnal = t_file-plnal.

perform bdc_field using 'RC271-PLNNR' v_plnnr.

Current date

MOVE SY-DATUM TO V_DATE.

perform get_date.

perform bdc_field using 'RC271-STTAG' V_DATE.

perform bdc_field using 'RC271-PLNAL' t_file-plnal.

Screen 5400

perform bdc_screen using 'SAPLCPDI' '5400'.

perform bdc_field using 'BDC_OKCODE' '=OSEA'.

Screen 1010

perform bdc_screen using 'SAPLCP02' '1010'.

perform bdc_field using 'BDC_OKCODE' '=ENT1'.

perform bdc_field using 'RC27H-VORNR' T_FILE-VORNR.

Screen 5400

perform bdc_screen using 'SAPLCPDI' '5400'.

perform bdc_field using 'BDC_OKCODE' '=FHUE'.

perform bdc_field using 'RC27X-FLG_SEL(01)' C_X.

Get the no of records from PLAS,PLPO and PLFH Tables

perform get_count.

Screen 0200

IF V_COUNT = 0.

perform bdc_screen using 'SAPLCFDI' '0200'.

perform bdc_field using 'BDC_OKCODE' '/EFIM'.

ELSEif v_count > 0.

Screen 0100

perform bdc_screen using 'SAPLCFDI' '0100'.

perform bdc_field using 'BDC_OKCODE' '/EFIM'.

ENDIF.

Screen 0230

perform bdc_screen using 'SAPLCFDI' '0200'.

perform bdc_field using 'BDC_OKCODE' '=BACK'.

perform bdc_field using 'PLFHD-MATNR' T_FILE-EQUNR.

perform bdc_field using 'PLFHD-STEUF' T_FILE-STEUF.

perform bdc_field using 'PLFHD-MGVGW' T_FILE-mgvgw.

perform bdc_field using 'PLFHD-MGEINH' T_FILE-MGEINH.

Screen 0100

perform bdc_screen using 'SAPLCFDI' '0100'.

perform bdc_field using 'BDC_OKCODE' '=BU'.

ENDFORM. " bdc_build_script

&----


*& Form get_matnr

&----


Get the material number from tables ZMSMI_FERR_RAW,

ZMSMI_SNAP_RAW and ZMSMI_SIMP_RAW

-


FORM get_matnr.

clear v_matnr.

case t_file-werks.

when '0101'.

select single cmatnr from zmsmi_simp_raw

into v_matnr where matnr = t_file-matnr.

if not v_matnr is initial.

clear t_file-matnr.

t_file-matnr = v_matnr.

endif.

when '0103'.

select single cmatnr from zmsmi_ferr_raw

into v_matnr where matnr = t_file-matnr.

if not v_matnr is initial.

clear t_file-matnr.

t_file-matnr = v_matnr.

endif.

when '0102' or '0110' or '0111' or '0112' or '0113'

or '0114' or '0115' or '0116' or '0117'.

select single cmatnr from zmsmi_snap_raw

into v_matnr where matnr = t_file-matnr.

if not v_matnr is initial.

clear t_file-matnr.

t_file-matnr = v_matnr.

endif.

endcase.

ENDFORM. " get_matnr

&----


*& Form bdc_screen

&----


BDC Script for Screen fields

-


-->P_PROG Program name

-->P_SCRN Screen Number

-


FORM bdc_screen USING p_prog

p_scrn.

clear itab_bdc_tab.

itab_bdc_tab-program = p_prog.

itab_bdc_tab-dynpro = p_scrn.

itab_bdc_tab-dynbegin = c_x.

append itab_bdc_tab.

ENDFORM. " bdc_screen

&----


*& Form bdc_field

&----


BDC Script for Screen fileds

-


-->P_NAM Field name

-->P_VAL Field value

-


FORM bdc_field USING p_nam

p_val.

clear itab_bdc_tab.

itab_bdc_tab-fnam = p_nam.

itab_bdc_tab-fval = p_val.

append itab_bdc_tab.

ENDFORM. " bdc_field

&----


*& Form bdc_submit_transaction

&----


BDC_INSERT Function Module

-


FORM bdc_submit_transaction.

call transaction c_tcode using itab_bdc_tab

mode p_mode update 'S'.

refresh itab_bdc_tab.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = SY-MSGID

LANG = '-E'

NO = SY-MSGNO

V1 = SY-MSGV1

V2 = SY-MSGV2

V3 = SY-MSGV3

V4 = SY-MSGV4

IMPORTING

MSG = i_error-text

EXCEPTIONS

NOT_FOUND = 1

OTHERS = 2.

i_error-matnr = t_file-matnr.

i_error-werks = t_file-werks.

i_error-plnnr = v_plnnr.

i_error-vornr = t_file-vornr.

append i_error.

clear i_error.

clear t_file.

ENDFORM. " bdc_submit_transaction

&----


*& Form get_date

&----


Converted date as per CA22 Transaction

-


FORM get_date.

clear : v_date,

v_date1,

v_date2,

v_date3.

v_date1 = sy-datum+0(4).

v_date2 = sy-datum+4(2).

v_date3 = sy-datum+6(2).

concatenate v_date2 v_date3 v_date1 into v_date.

ENDFORM. " get_date

&----


*& Form get_count

&----


text

-


FORM get_count.

clear v_count.

select count(*) into v_count

from plas as a inner join plpo as b on aplnty = bplnty

and aplnnr = bplnnr

and aplnkn = bplnkn

inner join plfh as c on cplnty = aplnty

and cplnnr = aplnnr

and cplnal = aplnal

and cplnfl = aplnfl

and cplnkn = bplnkn

where a~plnty = c_r

and a~plnnr = v_plnnr

and a~plnal = t_file-plnal

and c~objct = c_O

and a~loekz = space

and b~vornr = t_file-vornr

and c~objty = c_fh

and c~loekz = space.

ENDFORM. " get_count

end-of-selection.

Displaying Error Log

loop at i_error.

write:/2 i_error-matnr,24 i_error-werks,32 i_error-plnnr,

44 i_error-vornr,50 '-', 53 i_error-text.

endloop.

regards,

venkat