10-03-2007 12:52 PM
10-03-2007 12:55 PM
Hi Rajan,
u can find some more threads related to ur question , by searching in the forum
Useful Steps For You
Following are the steps for bdc using recroding method
1. enter 'SHDB' transaction
2.click 'New Recording'
3. Fill recording name , transaction name and click on start recording .
4. enter one samle data in the new screen for the transaction displayed.
5.Go back to scrren of 'shdb' by clicking on back button.
6.select recording and click Program Tab
7.Enter prgram name nad neccesary details.
and u get the program prepared by sap for u
8.then use that proagram name in SE38 transaction
9.create internal table to read the data from text fiel in presenation server.
10.Perform open_group and close_group.
11.loop at iternal table which is filled by GUI_Upload.
and assign fileds of internal table to program fileds in the loop.
U r done with the BDC recording
Reward if helpful
Thanks
10-03-2007 1:00 PM
<b>This step-by-step code sample helps you upload data using BDC. </b>
Procedure
Give the t-code shdb in the command field.
Click the new recording button.
Give a name to the recording and the t-code you want to record.
E.g.:
Recording : ZMAT_UPLOAD
Transaction code : MM01
When you click save, it takes you to t-code (MM01) you would like to do recording for upload.
Record carefully. Fill in the details you want to upload. In this case I have entered the material no, industry sector, material type, material description and basic unit of measure.
Then the Transaction recorder edit recording ZMAT_UPLOAD screen is displayed. You can edit your recording or just save it and click back button.
Select your recording and click create program button.
Enter the program name say ZMAT_UPLOAD.Select the transfer from recording option. Save it.Give the program title, type as executable program and click source code button at the bottom.
Hope this is helpful,Do reward.
10-03-2007 1:01 PM
hi,
Do like this,
Goto T-code SHDB.
Goto New Recording and give name of that ans Transaction Code.
Now press Start Recording.
Suppose T-code is MM02.
Then Go through all the screen in which u want to make changes and change the fields u want to change but remember dont go to the screen u dont want to change otherwise recording would b wrong.
than save it and Back.
Now Press program button.
It will ask for name and now goto change mode of that program.
This is the program in which i have made changes in fields <b>matnr</b> and <b>brgew</b> in MM02.
REPORT zbdc_sess
NO STANDARD PAGE HEADING LINE-SIZE 255.
DATA: BEGIN OF record OCCURS 0,
matnr_001(018),
brgew_008(017),
END OF record.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
PARAMETER:file LIKE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK blk1.
DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = file.
START-OF-SELECTION.
PERFORM data_upload.
PERFORM open_group.
PERFORM bdcdata.
PERFORM close_group.
&----
*& Form data_upload
&----
text
----
FORM data_upload.
DATA: loc_file TYPE string.
loc_file = file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = loc_file
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = record.
ENDFORM. "data_upload
&----
*& Form bdc_dynpro
&----
text
----
-->PROGRAM text
-->DYNPRO text
----
FORM bdc_dynpro USING program dynpro.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. "bdc_dynpro
&----
*& Form bdc_field
&----
text
----
-->FNAM text
-->FVAL text
----
FORM bdc_field USING fnam fval.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDFORM. "bdc_dynpro
&----
*& Form bdcdata
&----
text
----
FORM bdcdata.
LOOP AT record.
REFRESH bdcdata.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0060'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RMMG1-MATNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=AUSW'.
PERFORM bdc_field USING 'RMMG1-MATNR'
record-matnr_001.
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)'
record-kzsel_01_002.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4004'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
*PERFORM bdc_field USING 'MAKT-MAKTX'
record-maktx_003.
*PERFORM bdc_field USING 'MARA-MEINS'
record-meins_004.
*PERFORM bdc_field USING 'MARA-MATKL'
record-matkl_005.
*PERFORM bdc_field USING 'MARA-BISMT'
record-bismt_006.
*PERFORM bdc_field USING 'MARA-MTPOS_MARA'
record-mtpos_mara_007.
PERFORM bdc_field USING 'BDC_CURSOR'
'MARA-BRGEW'.
PERFORM bdc_field USING 'MARA-BRGEW'
record-brgew_008.
*PERFORM bdc_field USING 'MARA-GEWEI'
record-gewei_009.
*PERFORM bdc_field USING 'MARA-NTGEW'
record-ntgew_010.
*PERFORM bdc_transaction USING 'MM02'.
PERFORM bdc_insert.
ENDLOOP.
ENDFORM. "bdcdata
&----
*& Form bdc_insert
&----
text
----
FORM bdc_insert.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = 'MM02'
TABLES
dynprotab = bdcdata.
ENDFORM. "bdc_insert
&----
*& Form open_group
&----
text
----
FORM open_group.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = 'ZBDC_SESS_D1'
keep = 'X'
user = sy-uname.
ENDFORM. "open_group
&----
*& Form close_group
&----
text
----
FORM close_group.
CALL FUNCTION 'BDC_CLOSE_GROUP'.
CALL TRANSACTION 'SM35'.
ENDFORM. "close_group
This is the <b>session method</b>.
u can do this by <b>call transaction</b> method also like this.
REPORT zbdc_call
NO STANDARD PAGE HEADING LINE-SIZE 255.
DATA: BEGIN OF record OCCURS 0,
data element: MATNR
matnr_001(018),
data element: BRGEW
brgew_008(017),
END OF record.
End generated data section ***
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
PARAMETER:file LIKE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK blk1.
DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = file.
START-OF-SELECTION.
PERFORM data_upload.
PERFORM bdcdata.
CALL TRANSACTION 'MM02' USING BDCDATA MODE 'A' UPDATE 'A'.
&----
*& Form data_upload
&----
text
----
FORM data_upload.
DATA:loc_file TYPE string.
loc_file = file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = loc_file
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = record
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.
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_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
&----
*& Form bdc_field
&----
text
----
-->FNAM text
-->FVAL text
----
FORM bdc_field USING fnam fval.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDFORM. "bdc_field
&----
*& Form bdcdata
&----
text
----
FORM bdcdata.
LOOP AT record.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0060'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RMMG1-MATNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=AUSW'.
PERFORM bdc_field USING 'RMMG1-MATNR'
record-matnr_001.
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'
'=BU'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MARA-BRGEW'.
PERFORM bdc_field USING 'MARA-BRGEW'
record-brgew_008.
ENDLOOP.
ENDFORM. "bdcdata
hope it will b useful.
Reward if useful.
10-03-2007 1:03 PM
Use Tcode SHDB
new recording , give a name and execute the transaction screens u need by giving sample data. once you finish, goto ur recording and in application tool bar u can see options to generate program/ function modules using ur recording.
10-03-2007 1:18 PM
Hi
<b>SHDB - Record a transaction</b>
This transaction allows a user to record keystrokes and other keyboard actions so that they may be incorporated into a BDC session. While any session may be recorded, it does not mean that the recording can be used to create a session. Within a recording individual screens may not be allowed.
Customized screens may present a problem. Only use the non-customized screens to record sessions.
In this example, the transaction MM is recorded.
Enter transaction SHDB, also called The Transaction Recorder:Recording Overview.
Click on the "New Recording button"
To start a new recording, enter a recording name (up to 10 letters) in the field labeled "Recording," and the Transaction Code MM01. Click either the "Start Recording" button or the green check mark at the bottom of the screen.
Recording the session:
Once the Start Recording button is pressed, the system displays the screens for the transaction code requested. Enter each field needed for the transaction, and proceed to the following screen. A "recording running" message may appear between screens. During a recorded session screen interaction time is extended.
Completing the transaction
End the transaction normally. When completed, the Transaction Recorder: Edit Recording screen is shown, Click the Save icon, which saves the recording. Green arrow back to the starting point (Transaction Recorder).
<b>Reward if usefull</b>
10-03-2007 1:22 PM