Date post: | 31-Dec-2015 |
Category: |
Documents |
Upload: | aswin-dharmavaram |
View: | 55 times |
Download: | 3 times |
Transaction code SHDB is used for batch Input Recorder (Transaction Recorder) to record a series of transactions and their screens.
It mainly used for
Data transfer programs that use batch input or CALL TRANSACTION Batch input sessions Test data Function modules.
Steps to create a transaction recording
1. Enter the transaction code SHDB.2. Enter a name for recording.3. Choose create button4. Enter the transaction code which we want to record5. Choose Continue6. Execute the transaction7. Choose Get Transaction if no errors occurred8. Choose next Transaction if we want to record any other transactions also. And
continue the steps from 49. Save after the recording finished
Steps to process a recorded transaction
1. Enter the transaction code SHDB2. Choose Overview3. Point your mouse to the corresponding recording4. Choose execute5. Enter the processing mode (A , E or N)6. Enter the update mode (A, S or L )7. Press Enter
*************************************************************************************
Step1
Step2:
Continue
Select basic data1
Select tick mark and
Enter material desc and unit of mesure
Click on yes button
Click on save button, and back button
Select program
Select tick mark
Enter title and click on source code.
Click on local object
SESSION METHOD:
---------------
- It is one of the BDC techniques for uploading legacy data into SAP
- The data is transferring from the internal table to database table
through sessions.
- Data along with its action is stored in session.
- When the program has finished generating the session, you can run
the session to execute the transaction.
- Unless session is processed, the data is not transferred to
database tables.
- The following Function Modules are used in the session method.
1. BDC_OPEN_GROUP (Used to create the session)
Import Parameters :
USER - User Name
CLIENT - Client
GROUP - Name of the session
HOLD - The date when you want to process the session
KEEP - ‘X’ – retain session even after processing it
' ' - Delete the session after processing.
2. BDC_INSERT (Data is transferred to session)
Import Parameters :
TCODE - Transaction code
DYNPROTAB – BDCDATA table
3. BDC_CLOSE_GROUP (Used to close a session)
- Processing Steps
1. Generate the batch input session using function module
BDC_OPEN_GROUP.
2. The proceed as follows for each transaction that the session
contains:
a. In the BDCDATA structure, enter the value for all screens
and fields that must be processed in the transaction.
b. Use BDC_INSERT to transfer the transaction and the BDCDATA
structure to the session.
3. Close the batch input session with BDC_CLOSE_GROUP.
4. Start to process the generated session in T.Code SM35.
*&---------------------------------------------------------------------*
*& SELECTION-SCREEN
*&---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK bk1 WITH FRAME TITLE text-001.
PARAMETERS : p_fname TYPE localfile.
SELECTION-SCREEN END OF BLOCK bk1.
*&---------------------------------------------------------------------*
*& TYPES
*&---------------------------------------------------------------------*
* Type declaration for Customer data
TYPES: BEGIN OF t_mat,
matnr type mara-matnr,
mbrsh type mara-mbrsh,
mtart type mara-mtart,
maktx type MAKT-maktx,
meins type mara-meins,
END OF t_mat.
*&---------------------------------------------------------------------*
*& DATA
*&---------------------------------------------------------------------*
DATA: v_fname TYPE string,
* Internal Table Declaration for Customer data
i_mat TYPE STANDARD TABLE OF t_mat,
wa_mat TYPE t_mat,
* Internal Table Declaration for BDCDATA
wa_bdcdata TYPE bdcdata,
i_bdcdata TYPE STANDARD TABLE OF bdcdata.
*&---------------------------------------------------------------------*
*& AT SELECTION SCREEN
*&---------------------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
* F4 functionality for File Name
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ' '
IMPORTING
file_name = p_fname.
start-of-selection.
v_fname = p_fname.
* Upload data from flat file and store it in an Internal table
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_fname
filetype = 'ASC'
has_field_separator = 'X'
read_by_line = 'X'
TABLES
data_tab = i_MAT.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = 'ZCUST'
keep = 'X'
user = sy-uname
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 e000(zmsg) WITH 'Error while opening the session'.
ENDIF.
LOOP AT i_mat INTO wa_mat.
CLEAR wa_bdcdata.
REFRESH i_bdcdata[].
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'RMMG1-MATNR'
wa_mat-matnr.
perform bdc_field using 'RMMG1-MBRSH'
wa_mat-mbrsh.
perform bdc_field using 'RMMG1-MTART'
wa_mat-mtart.
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 'MAKT-MAKTX'
wa_mat-maktx.
perform bdc_field using 'BDC_CURSOR'
'MARA-MEINS'.
perform bdc_field using 'MARA-MEINS'
wa_mat-meins.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_CURSOR'
'SPOP-OPTION1'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = 'MM01'
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.
ENDLOOP.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
not_open = 1
queue_error = 2
OTHERS = 3.
*&--------------------------------------------------------------------*
*& Form BDC_DYNPRO New Screen
*&--------------------------------------------------------------------*
FORM bdc_dynpro USING program dynpro.
CLEAR wa_bdcdata.
wa_bdcdata-program = program.
wa_bdcdata-dynpro = dynpro.
wa_bdcdata-dynbegin = 'X'.
APPEND wa_bdcdata TO i_bdcdata.
ENDFORM. "BDC_DYNPRO
*----------------------------------------------------------------------*
* Insert field *
*----------------------------------------------------------------------*
FORM bdc_field USING fnam fval.
IF fval <> space.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = fnam.
wa_bdcdata-fval = fval.
APPEND wa_bdcdata TO i_bdcdata.
ENDIF.
ENDFORM. "BDC_FIELD
*****file******
MAT10 M FERT DESCP1 KG