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 sm35

Former Member
0 Likes
1,124

Hi All,

how to call batch input processing directly from the program when program is running to update/process the data wihout doing it manually go to sm35 and process the session?

Hi All,

how to call batch input processing directly from the program when program is running to update/process the data wihout doing it manually go to sm35 and process the session?

5 REPLIES 5
Read only

Former Member
0 Likes
804

Hi,

If thats your requirement, then its better to use CALL TRANSACTION.

Read only

amit_khare
Active Contributor
0 Likes
804

Use SUBMIT RSBDCSUB .

Check F1 for the options to use with it.

Read only

Former Member
0 Likes
804

Hi,

Try this Syntax

SUBMIT RSBDCSUB WITH MAPPE = P_NAME
WITH VON = SY-DATUM
WITH BIS = SY-DATUM
WITH FEHLER = ' '

TO SAP-SPOOL 
LIST NAME P_NAME 
LIST DATASET P_NAME 
COVER TEXT P_NAME 
NEW LIST IDENTIFICATION ' ' 
EXPORTING LIST TO MEMORY
AND RETURN.

Best regards,

raam

Read only

Former Member
0 Likes
804

hai

check this code

REPORT

NO STANDARD PAGE HEADING

LINE-SIZE 200

LINE-COUNT 300.

*--


DATA DECLARATION--


*---Types

DATA : BEGIN OF t_upload,

FIELD1(10),

FIELD2(2),

FIELD3(18),

FIELD4(35),

END OF t_upload.

*--- Tables

DATA : BEGIN OF i_bdcdata OCCURS 0."to hold the transaction record

INCLUDE STRUCTURE bdcdata.

DATA: END OF i_bdcdata.

DATA: i_upload LIKE STANDARD TABLE OF t_upload," to hold file data.

i_upload1 LIKE STANDARD TABLE OF t_upload." to hold file data.

*--- Work Areas

DATA: wa_upload2 LIKE t_upload,

wa_upload LIKE t_upload,

wa_upload1 LIKE t_upload.

*--- Variables

DATA: v_count1(4) TYPE n,

v_error TYPE c,

v_session(12),

v_field(21) TYPE c,

v_message(60) type 'C'.

*--Constants

DATA: c_open TYPE c VALUE '(',

c_close TYPE c VALUE ')',

c_x TYPE c VALUE 'X'.

*---Initialisation

initialization.

refresh : i_upload , i_upload1 ,i_bdcdata.

-------Selection Screen Design -


*Selection screen for input of upload file address

SELECTION-SCREEN SKIP 2.

SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME.

PARAMETERS : p_file LIKE rlgrap-filename OBLIGATORY.

SELECTION-SCREEN END OF BLOCK blk1.

---AT SELECTION SCREEN -


AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

*--For popup to select file.

PERFORM give_help.

-----START OF SELECTION -


START-OF-SELECTION.

*--Data upload using WS_Upload.

PERFORM get_data.

*-- OPEN SESSION

PERFORM open_group.

*--Insert transactions using BDCDATA table in the session.

PERFORM do_transaction .

*-- Close the session.

PERFORM close_group.

END-OF-SELECTION.

&----


*& Form f_get_data

&----


  • For data upload from external file.

----


FORM get_data.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

filename = p_file

filetype = 'DAT'

TABLES

data_tab = i_upload

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 <> 0.

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

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

ELSE.

DELETE I_UPLOAD INDEX 1.

ENDIF.

ENDFORM. " f_get_data

&----


*& Form F_open_group

&----


  • To open session in session management.

----


FORM open_group.

v_session = 'TCODE'.

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

client = sy-mandt

group = v_session

user = sy-uname

keep = 'X'.

ENDFORM. " F_open_group

&----


*& Form f_do_transaction

&----


  • Insert transactions in session after passing values to BDCDATA

----


FORM do_transaction.

LOOP AT i_upload INTO wa_upload .

*---- insert your generated codes from recording at SHDB here

*----- insertion ends

perform bdc_transaction using 'TCODE'.

REFRESH : I_BDCDATA.

CLEAR : WA_UPLOAD.

  • ENDIF.

ENDLOOP.

ENDFORM. " f_do_transaction

&----


*& Form bdc_dynpro

&----


  • For appending screen details to BDCDATA

----


FORM bdc_dynpro USING program dynpro.

CLEAR i_bdcdata.

i_bdcdata-program = program.

i_bdcdata-dynpro = dynpro.

i_bdcdata-dynbegin = 'X'.

APPEND i_bdcdata.

CLEAR i_bdcdata.

ENDFORM. "bdc_dynpro

&----


*& Form bdc_field

&----


  • For appending field details to bdcdata table

----


FORM bdc_field USING fnam fval.

CLEAR i_bdcdata.

i_bdcdata-fnam = fnam.

i_bdcdata-fval = fval.

APPEND i_bdcdata.

CLEAR i_bdcdata.

ENDFORM. " bdc_field

&----


*& Form bdc_transaction

&----


  • For inserting Transaction in the session

----


FORM bdc_transaction USING tcode.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

tcode = tcode

TABLES

dynprotab = i_bdcdata.

ENDFORM. " bdc_transaction

&----


*& Form F_close_group

&----


  • For closing the session created in Session manager SM35

----


FORM close_group.

CALL FUNCTION 'BDC_CLOSE_GROUP'.

concatenate 'Session ' v_session 'successfully created' into v_field.

MESSAGE v_field type 'I'..

CALL TRANSACTION 'SM35'.

ENDFORM. "f_close_group

&----


*& Form f_give_help

&----


  • For user help to select file

----


FORM give_help.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

mask = ',.,..'

mode = 'O'

IMPORTING

filename = p_file

EXCEPTIONS

inv_winsys = 1

no_batch = 2

selection_cancel = 3

selection_error = 4

OTHERS = 5.

IF sy-subrc <> 0 AND NOT sy-msgty IS INITIAL.

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

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

ENDIF.

ENDFORM. " f_give_help

----


End of Template -

thanks

sitaram

Read only

Former Member
0 Likes
804

Hi,

You can just do ...

Call Transaction 'SM35'.

or

Call Transaction 'SHDB'.

Reward if helpful.

Regards,

Syed