Application Development 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: 

ERROR WHILE RUNNING THE SESSION IN SM35

Former Member
0 Kudos

Hi all

when ever m running this session in SM35 , M getting error as :

"LEAVE TO TRANSACTION" MARA-BISMT is not allow

in batch input

REPORT YASEC_BDC_NIK_SESSION

no standard page heading

message-id zmm

line-count 65

line-size 150.

tables : mara.

*Top includr program

INCLUDE YNEW_MAIN_TOP.

*include yasec_bdc_nik_session_top.

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

***********selection screen *******************

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

selection-screen begin of block b1 with frame title text-001.

selection-screen skip.

PARAMETERS: p_ifile(128) TYPE c .

SELECTION-SCREEN SKIP.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.

PARAMETERS: rad1 TYPE c RADIOBUTTON GROUP 1 USER-COMMAND gr1,

rad2 TYPE c RADIOBUTTON GROUP 1 .

SELECTION-SCREEN SKIP.

PARAMETERS: p_sess TYPE c.

SELECTION-SCREEN END OF BLOCK b2.

SELECTION-SCREEN SKIP.

SELECTION-SCREEN END OF BLOCK b1.

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

                • Subroutine call***************************

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

INCLUDE YNEW_MAIN_F01.

*include yasec_bdc_nik_session_f01.

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

*********At selection event triggered *************

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

at selection-screen on value-request for p_ifile.

  • To get F4 help for the input file path

PERFORM f_f4_input_file.

AT SELECTION-SCREEN ON p_ifile.

  • To validate and upload the input file

PERFORM f_load_file.

AT SELECTION-SCREEN ON p_sess.

  • To validate the Number of Sessions field

IF rad2 IS NOT INITIAL AND sy-ucomm EQ c_onli.

PERFORM f_check_sessions.

ENDIF.

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

***********Start of selection *******************

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

start-of-selection.

*To process BDC

PERFORM f_process_bdc.

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

    • TOP OF PAGE

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

TOP-OF-PAGE.

  • Writes the report heading and for displaying line number.

PERFORM f_report_header.

TYPES : BEGIN OF t_final,

matnr(50) TYPE c,

bismt(18) type c,

end of t_final.

TYPES: BEGIN OF t_fdata,

data(256) TYPE c,

END OF t_fdata.

TYPES: BEGIN OF t_error,

message(100) TYPE c,

END OF t_error.

*Internal table declarations

*Internal table to load the data from the file that is changed throgh BDC

DATA : i_final TYPE STANDARD TABLE OF t_final,

wa_final TYPE t_final.

*Internal table to store the error messages

DATA : i_error TYPE STANDARD TABLE OF t_error,

wa_error TYPE t_error.

*Internal table to load the raw data

DATA : i_fdata TYPE STANDARD TABLE OF t_fdata,

wa_fdata TYPE t_fdata.

*Internal table to store records of BDC

DATA : i_bdcdata TYPE STANDARD TABLE OF bdcdata INITIAL SIZE 0,

wa_bdcdata TYPE bdcdata.

  • Internal table to store BDC messages

DATA: i_bdcmsgcoll TYPE STANDARD TABLE OF bdcmsgcoll INITIAL SIZE 0,

wa_bdcmsgcoll TYPE bdcmsgcoll.

*----


  • VARIABLE DECLARATIONS

*----


DATA: v_ifile TYPE string,

v_input TYPE i,

c_delimiter TYPE c VALUE 'X',

v_mode TYPE c VALUE 'A',

v_sessions TYPE i.

*----


  • CONSTANTS

*----


CONSTANTS : c_flagx TYPE c VALUE 'X',

c_slash TYPE c VALUE '/',

c_onli(4) TYPE c VALUE 'ONLI',

c_vl02(4) TYPE c VALUE 'VL02',

c_s TYPE c VALUE 'A'.

FORM f_f4_input_file .

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = syst-cprog

dynpro_number = syst-dynnr

IMPORTING

file_name = p_ifile.

ENDFORM. " f_f4_input_file

&----


*& Form f_load_file

&----


FORM f_load_file .

v_ifile = p_ifile.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = v_ifile

filetype = 'ASC'

  • has_field_separator = 'X'

TABLES

data_tab = i_fdata

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.

*Text-103-Input file does not exist.

MESSAGE e000 WITH text-103 .

ELSEIF NOT i_fdata IS INITIAL.

DELETE i_fdata WHERE data = space.

DESCRIBE TABLE i_fdata LINES v_input.

ENDIF.

IF v_input EQ 0.

  • Text-104 - Input file is empty.

MESSAGE e000 WITH text-104 .

ENDIF.

ENDFORM. " f_load_file

&----


*& Form f_check_sessions

&----


FORM f_check_sessions .

IF p_sess IS INITIAL.

MESSAGE e000 WITH text-106.

ELSE.

v_sessions = v_input DIV p_sess.

ENDIF.

ENDFORM. " f_check_sessions

&----


*& Form f_process_bdc

&----


  • text

----


FORM f_process_bdc.

LOOP AT i_fdata INTO wa_fdata.

SPLIT wa_fdata AT cl_abap_char_utilities=>horizontal_tab

INTO wa_final-matnr

wa_final-bismt.

APPEND wa_final TO i_final.

CLEAR wa_fdata.

ENDLOOP.

IF rad1 = c_flagx.

PERFORM f_passbdc_vl02.

ELSEIF rad2 = c_flagx.

PERFORM f_sessions_vl02.

ENDIF.

ENDFORM. "f_process_bdc

*

&----


  • To populate the Screen information

----


  • p_program Program Name

  • p_dynpro Screen Number

----


FORM bdc_dynpro USING p_program TYPE any

p_dynpro TYPE any.

CLEAR wa_bdcdata.

  • Populate the BDC structure with the Screen Information.

  • Move the Program name PROGRAM

wa_bdcdata-program = p_program.

  • Move the Screen Number DYNPRO

wa_bdcdata-dynpro = p_dynpro.

  • Indicate the beginning of a new screen

wa_bdcdata-dynbegin = c_flagx.

APPEND wa_bdcdata TO i_bdcdata.

ENDFORM. "f_bdc_dynpro

&----


*& Form f_passbdc_vl02

&----


  • text

----


FORM f_passbdc_vl02.

DATA: l_lines_im TYPE i.

SORT i_final BY matnr ASCENDING.

CLEAR wa_final.

LOOP AT i_final INTO wa_final.

CLEAR: i_bdcmsgcoll[],

wa_bdcmsgcoll,

wa_bdcdata.

CLEAR: i_bdcdata[].

perform bdc_dynpro using 'SAPLMGMM' '0060'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-MATNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RMMG1-MATNR'

wa_final-matnr.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(01)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'MSICHTAUSW-KZSEL(01)'

'X'.

perform bdc_dynpro using 'SAPLMGMM' '4004'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'MARA-BISMT'.

perform bdc_field using 'MARA-BISMT'

wa_final-bismt.

perform bdc_dynpro using 'SAPLSPO1' '0300'.

perform bdc_field using 'BDC_OKCODE'

'=YES'.

perform bdc_transaction using 'MM02'.

perform bdc_dynpro using 'SAPLMGMM' '0060'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-MATNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(01)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_dynpro using 'SAPLMGMM' '4004'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-MATNR'.

perform bdc_dynpro using 'SAPLSPO1' '0300'.

perform bdc_field using 'BDC_OKCODE'

'=YES'.

perform bdc_transaction using 'MM03'.

CALL TRANSACTION 'MM02' USING i_bdcdata

MODE v_mode

UPDATE c_s

MESSAGES INTO i_bdcmsgcoll.

  • If error occurred in call transaction 'VA02' then stores all

  • information of failed records into internal table i_error_im.

IF sy-subrc NE 0.

DESCRIBE TABLE i_bdcmsgcoll LINES l_lines_im.

CLEAR wa_bdcmsgcoll.

READ TABLE i_bdcmsgcoll INTO wa_bdcmsgcoll INDEX l_lines_im.

  • To capture success and error messages in BDC.

CALL FUNCTION 'FORMAT_MESSAGE' "#EC *

EXPORTING

id = wa_bdcmsgcoll-msgid

lang = wa_bdcmsgcoll-msgspra

no = wa_bdcmsgcoll-msgnr

v1 = wa_bdcmsgcoll-msgv1

v2 = wa_bdcmsgcoll-msgv2

v3 = wa_bdcmsgcoll-msgv3

v4 = wa_bdcmsgcoll-msgv4

IMPORTING

msg = wa_error-message

EXCEPTIONS

not_found = 1

OTHERS = 2.

IF sy-subrc <> 0.

ENDIF.

ELSE.

WRITE: text-111 COLOR 7.

ENDIF.

CLEAR: wa_final.

REFRESH i_bdcdata.

ENDLOOP.

ENDFORM. "f_passbdc_va02

&----


*& Form bdc_field

&----


  • text

----


  • -->P_FNAM text

  • -->P_FVAL text

----


FORM bdc_field USING p_fnam TYPE any

p_fval TYPE any.

CLEAR wa_bdcdata.

  • Populate the Field Name

wa_bdcdata-fnam = p_fnam.

  • Populate the field value

wa_bdcdata-fval = p_fval.

APPEND wa_bdcdata TO i_bdcdata.

ENDFORM. "f_bdc_field

&----


*& Form f_sessions_vl02

&----


  • text

----


FORM f_sessions_vl02 .

DATA: l_sindex TYPE sy-tabix VALUE 1,

l_eindex TYPE sy-tabix,

l_flag TYPE c VALUE space.

l_eindex = v_input.

SORT i_final BY matnr ASCENDING.

DO p_sess TIMES.

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

client = sy-mandt

group = 'Y_VL02_NIK'

user = sy-uname

  • keep = c_flagx

EXCEPTIONS

client_invalid = 1

destination_invalid = 2

group_invalid = 3

group_is_locked = 4

holddate_invalid = 5

internal_error = 6

queue_error = 7

running = 8

system_lock_error = 9

user_invalid = 10

OTHERS = 11.

IF sy-subrc <> 0.

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

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

ENDIF.

CLEAR wa_final.

CLEAR: i_bdcdata[].

LOOP AT i_final INTO wa_final FROM l_sindex TO l_eindex .

IF l_flag = v_sessions.

CLEAR l_flag.

EXIT.

ENDIF.

l_flag = l_flag + 1.

CLEAR: i_bdcdata[].

perform bdc_dynpro using 'SAPLMGMM' '0060'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-MATNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RMMG1-MATNR'

wa_final-matnr.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(01)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'MSICHTAUSW-KZSEL(01)'

'X'.

perform bdc_dynpro using 'SAPLMGMM' '4004'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'MARA-BISMT'.

perform bdc_field using 'MARA-BISMT'

wa_final-bismt.

perform bdc_dynpro using 'SAPLSPO1' '0300'.

perform bdc_field using 'BDC_OKCODE'

'=YES'.

perform bdc_transaction using 'MM02'.

perform bdc_dynpro using 'SAPLMGMM' '0060'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-MATNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(01)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_dynpro using 'SAPLMGMM' '4004'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-MATNR'.

perform bdc_dynpro using 'SAPLSPO1' '0300'.

perform bdc_field using 'BDC_OKCODE'

'=YES'.

perform bdc_transaction using 'MM03'.

l_sindex = l_sindex + 1.

ENDLOOP.

CALL FUNCTION 'BDC_CLOSE_GROUP'

EXCEPTIONS

not_open = 1

queue_error = 2

OTHERS = 3.

IF sy-subrc <> 0.

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

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

ENDIF.

ENDDO.

ENDFORM. " f_sessions_vl02

&----


*& Form f_report_header

&----


FORM f_report_header .

FORMAT COLOR COL_HEADING INTENSIFIED ON.

ULINE.

  • text-201 - Company: Carrier

  • text-102- Batch Data Communication.

  • text-202 - System: SAP

WRITE: /1 sy-vline,

3 text-201,

50 text-102,

100 text-202,

AT sy-linsz sy-vline.

  • text-203 - Program:

  • text-204 - Date/Time:

WRITE: /1 sy-vline,

3 text-203, sy-repid ,

100 text-204,sy-datum ,c_slash, sy-uzeit,

AT sy-linsz sy-vline.

  • text-205 - User ID:

  • text-206 - Page:

WRITE: /1 sy-vline,

3 text-205, sy-uname,

100 text-206, sy-pagno,

AT sy-linsz sy-vline.

FORMAT COLOR OFF.

ULINE.

ENDFORM. " f_report_header

FORM bdc_transaction USING tcode.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

tcode = tcode

TABLES

dynprotab = i_bdcdata

EXCEPTIONS

internal_error = 1

not_open = 2

queue_error = 3

tcode_invalid = 4

printing_invalid = 5

posting_invalid = 6

OTHERS = 7.

IF sy-subrc <> 0.

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

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

ELSE.

WRITE: / text-109 ,wa_final-matnr,

text-110 .

ENDIF.

ENDFORM. "bdc_transaction

2 REPLIES 2

Former Member
0 Kudos

please check this

check all perform bdcfield correct or not....

perform bdc_dynpro using 'SAPLMGMM' '0060'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-MATNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RMMG1-MATNR'

wa_final-matnr.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(01)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'MSICHTAUSW-KZSEL(01)'

'X'.

perform bdc_dynpro using 'SAPLMGMM' '4004'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'MARA-BISMT'.

perform bdc_field using 'MARA-BISMT'

wa_final-bismt.

perform bdc_dynpro using 'SAPLSPO1' '0300'.

perform bdc_field using 'BDC_OKCODE'

'=YES'.

perform bdc_transaction using 'MM02'.

perform bdc_dynpro using 'SAPLMGMM' '0060'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-MATNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(01)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_dynpro using 'SAPLMGMM' '4004'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-MATNR'.

perform bdc_dynpro using 'SAPLSPO1' '0300'.

perform bdc_field using 'BDC_OKCODE'

'=YES'.

perform bdc_transaction using 'MM03'.

0 Kudos

hi

even after trying these things m getting the same error

my text file is

48HG403304 testa

48HG403305 testb