2007 Jun 13 12:00 PM
Hiii All
I have a requirement to upload data in Measurement point (PM)
Please let me know if there is any BAPI or any FM to achieve this like we have in purchase order uploading.
Regards
Hitesh Batra
2007 Jun 13 12:04 PM
Hi
I hope there is no suitable bapi/fun module for it
see the BDC program for it and use it with little changes if needed
REPORT zpm_measure_point_upload
NO STANDARD PAGE HEADING
LINE-SIZE 255.
Standard Include for Selection Screen
INCLUDE bdcrecx1.
Internal Table for Upload Data
DATA: BEGIN OF record OCCURS 0,
Initial Screen
mpoty(003), " MeasPoint Object
tplnr(040), " Functional Location
mptyp(001), " MeasPoint Category
General Data
psort(020), " Meas Position
pttxt(040), " Description
atnam(030), " Characteristic
decim(002), " Decimal Places
desic(022), " Target Value
dstxt(040), " Text
Additional Data
mrmac(022), " Upper Range Limit
mrmic(022), " Lower Range Limit
END OF record.
Parameters
PARAMETERS: p_file LIKE ibipparms-path. " Filename
At selection-screen on Value Request for file Name
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
Get the F4 Values for the File
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = p_file.
Start of Selection
START-OF-SELECTION.
Open the BDC Session
PERFORM open_group.
Upload the File into internal Table
CALL FUNCTION 'UPLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab = record
EXCEPTIONS
conversion_error = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 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.
ENDIF.
Upload the Data from Internal Table
LOOP AT record.
Initial Screen
PERFORM bdc_dynpro USING 'SAPLIMR0' '1110'.
PERFORM bdc_field USING 'BDC_CURSOR'
'IMPT-MPTYP'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RIMR0-MPOTY'
record-mpoty.
PERFORM bdc_field USING 'IMPT-MPTYP'
record-mptyp.
PERFORM bdc_field USING 'IFLOT-TPLNR'
record-tplnr.
General Data
PERFORM bdc_dynpro USING 'SAPLIMR0' '5110'.
PERFORM bdc_field USING 'BDC_CURSOR'
'IMPT-DSTXT'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ADPT'.
PERFORM bdc_field USING 'IMPT-PSORT'
record-psort.
PERFORM bdc_field USING 'IMPT-PTTXT'
record-pttxt.
PERFORM bdc_field USING 'IMPT-ATNAM'
record-atnam.
PERFORM bdc_field USING 'IMPT-DECIM'
record-decim.
PERFORM bdc_field USING 'RIMR0-DESIC'
record-desic.
PERFORM bdc_field USING 'IMPT-DSTXT'
record-dstxt.
Additional Data
PERFORM bdc_dynpro USING 'SAPLIMR0' '6110'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RIMR0-MRMIC'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=NEXT'.
PERFORM bdc_field USING 'RIMR0-MRMAC'
record-mrmac.
PERFORM bdc_field USING 'RIMR0-MRMIC'
record-mrmic.
PERFORM bdc_dynpro USING 'SAPLIMR0' '5110'.
PERFORM bdc_field USING 'BDC_CURSOR'
'IMPT-PSORT'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
Call the Transaction
PERFORM bdc_transaction USING 'IK01'.
ENDLOOP.
Close the BDC Session
PERFORM close_group.
<b>Reward points for useful Answers</b>
Regards
Anji