CV upload in E-Rec
Hi,
I need to know steps to upload CVs in e-recruitment.
Hello,
in that case you will need to write your own ABAP program. You can use the FM BAPI_ERC_UPDATE_ATTACHMENT for this.
hope it helps
Koen Van Loocke
Similar Messages
-
I want to put header while stroing file in application server
Hi Guru,
Can anybody tell how to put header while stroing file in application server.
in the below pgm data is coming i want to put heading .if we see in al11 transaction the header should come .plese give on eg in the code itself.its urgent
eg:
material number
100
200
declarations...................................................
tables: bkpf. " Accounting Document Header
*"Selection screen elements............................................
parameters:
p_burks like bkpf-bukrs. " Company Code
select-options:
s_gjahr for bkpf-gjahr. " Fiscal year
Type declaration of the structure to hold Accounting Document Header*
data:
begin of fs_bkpf,
bukrs type bkpf-bukrs, " Company Code
belnr type bkpf-belnr, " Accounting Document Number
gjahr type bkpf-gjahr, " Fiscal year
blart type bkpf-blart, " Document type
bldat type bkpf-bldat, " Document date in document
end of fs_bkpf.
Internal table to hold Accounting Document Header *
data:
t_bkpf like standard table
of fs_bkpf.
Type declaration of the structure to hold file data *
data:
begin of fs_table,
str type string,
end of fs_table.
Internal table to hold file data *
data:
t_table like standard table
of fs_table.
field-symbols: <fs>.
*" Data declarations...................................................
Work variables *
data:
w_char(50) type c,
w_file_name(50) type c value 'YH645_050103'.
select bukrs " Company Code
belnr " Accounting Document Number
gjahr " Fiscal year
blart " Document type
bldat " Document date in document
from bkpf
into table t_bkpf
where bukrs eq p_burks
and gjahr in s_gjahr.
if sy-subrc eq 0.
loop at t_bkpf into fs_bkpf.
do.
assign component sy-index of structure fs_bkpf to <fs>.
if sy-subrc ne 0.
exit.
else.
move <fs> to w_char.
if sy-index eq 1.
fs_table-str = <fs>.
else.
concatenate fs_table-str ',' w_char into fs_table-str.
endif. " IF SY-INDEX...
endif. " IF SY-SUBRC...
enddo. " DO...
append fs_table to t_table.
endloop. " LOOP AT T_KNA1...
endif. " IF SY-SUBRC...
open dataset w_file_name for output in text mode encoding default.
loop at t_table into fs_table.
transfer fs_table-str to w_file_name.
endloop. " LOOP AT T_TABLE...Hi,
may i know what kind of heading you want to display?
like date, filename, time etc
then modify the below code:
*& Form send_statistic
Create the status Report on application Server
---> pv_rlines - Total No of Records in Internal table *
---> pv_slines - Total No of Successful records *
---> pv_elines - Total No of Errornous records *
---> pv_path - File Path where the file to be created *
---> pv_flag - Flag to check for A/c group *
FORM sub_send_statistic USING pv_rlines TYPE int4
pv_slines TYPE int4
pv_elines TYPE int4
pv_path TYPE salfile-longname
pv_name TYPE rlgrap-filename
pv_flag TYPE char1.
CLEAR : i_tab,
wa_tab.
Convert date to MM/DD/YYYY format
PERFORM date_convert.
Convert Time to HH:MM:SS format
CONCATENATE sy-uzeit+0(2)
c_colon
sy-uzeit+2(2)
c_colon
sy-uzeit+4(2)
INTO v_time1.
Build the Output File name
IF p_sold = c_x
AND pv_flag = c_x.
CONCATENATE c_objid
c_us
c_z001
c_us
sy-datum
c_us
sy-uzeit
INTO v_file.
ENDIF. " IF p_sold = c_x
IF p_cons = c_x.
CONCATENATE c_objid
c_us
c_z008
c_us
sy-datum
c_us
sy-uzeit
INTO v_file.
ELSEIF p_sold = c_x
AND pv_flag <> c_x.
CONCATENATE c_objid
c_us
sy-datum
c_us
sy-uzeit
INTO v_file.
ENDIF. " IF p_cons = c_x
Build the Complete Output File Path
CONCATENATE pv_path
c_slash
v_file
INTO v_outfile.
Populate the data required for output into an internal table and
then transfer the table contents to file on application server
DATA UPLOAD STATISTICS
wa_tab-rec = text-001.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
TITLE
IF p_sold = c_x
AND pv_flag <> c_x.
sy-title = text-t17.
ENDIF. " IF p_sold = c_x
IF p_sold = c_x
AND pv_flag = c_x.
sy-title = text-t16.
ENDIF. " IF p_sold = c_x
IF p_cons = c_x
AND pv_flag = c_x.
sy-title = text-t19.
ENDIF. " IF p_cons = c_x
wa_tab-rec+0(7) = text-002.
wa_tab-rec+7(60) = sy-title.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
Date & Time
wa_tab-rec+0(5) = text-012.
CONDENSE v_date NO-GAPS.
wa_tab-rec+6(10) = v_date.
wa_tab-rec+60(10) = text-003.
wa_tab-rec+70(15) = v_time1.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
Folder Name
wa_tab-rec+0(18) = text-005.
wa_tab-rec+19(72) = pv_path.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
File Name
wa_tab-rec+0(18) = text-006.
---Begin of addition -Shivakumar - 09-05-2007--
wa_tab-rec+19(72) = pv_name.
---Begin of addition -Shivakumar - 09-05-2007--
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
Records Read
CLEAR v_count.
v_data = pv_rlines.
v_count = STRLEN( v_data ).
CONDENSE v_data NO-GAPS.
wa_tab-rec+0(46) = text-007.
wa_tab-rec+47(4) = v_data.
APPEND wa_tab TO i_tab.
CLEAR : wa_tab,
v_data.
Successfull Records
CLEAR v_count.
v_data = pv_slines.
v_count = STRLEN( v_data ).
CONDENSE v_data NO-GAPS.
wa_tab-rec+0(46) = text-008.
wa_tab-rec+47(4) = v_data.
APPEND wa_tab TO i_tab.
CLEAR : wa_tab,
v_data.
Error Records
CLEAR v_count.
v_data = pv_elines.
v_count = STRLEN( v_data ).
CONDENSE v_data NO-GAPS.
wa_tab-rec+0(46) = text-009.
wa_tab-rec+47(4) = v_data.
APPEND wa_tab TO i_tab.
CLEAR : wa_tab,
v_data.
v_mesg = text-t04.
IF p_sold = c_x
AND pv_flag <> c_x.
MOVE i_tab TO i_file.
ENDIF. " IF p_sold = c_x
IF p_sold = c_x
AND pv_flag = c_x.
MOVE i_tab TO i_file1.
ENDIF. " IF p_sold = c_x
IF NOT i_tab IS INITIAL.
Open the file on Application server to write the report
OPEN DATASET v_outfile
FOR OUTPUT IN TEXT MODE
ENCODING DEFAULT MESSAGE v_mesg.
IF sy-subrc <> 0.
MESSAGE e000(zconversions) WITH v_mesg.
ELSE. " IF sy-subrc <> 0
Transfer details to the file on application server
CLEAR wa_tab.
LOOP AT i_tab INTO wa_tab.
TRANSFER wa_tab-rec TO v_outfile.
CLEAR wa_tab.
ENDLOOP. " LOOP AT i_tab INTO wa_tab
Close the file
CLOSE DATASET v_outfile.
ENDIF. " IF sy-subrc <> 0
ENDIF. " IF NOT i_tab IS INITIAL
ENDFORM. " Create_Report -
Output List to be downloaded to PC or to Unix server
Hi,
I have a requirement like this in selection screen I have two check boxes,
if user check the first button the Output should be downloaded to PC file path is given by user
if user check the second button the Output shold be written to Unix server.
thanks,
jeevi.Hi,
Use the file path while uploading the file again take the same file and concatenate the file name to be downloaded
below is used for writing into file name using the file path for uploading
*& Form send_statistic
Create the status Report on application Server
---> pv_rlines - Total No of Records in Internal table *
---> pv_slines - Total No of Successful records *
---> pv_elines - Total No of Errornous records *
---> pv_path - File Path where the file to be created *
---> pv_flag - Flag to check for A/c group *
FORM sub_send_statistic USING pv_rlines TYPE int4
pv_slines TYPE int4
pv_elines TYPE int4
pv_path TYPE salfile-longname
pv_name TYPE rlgrap-filename
pv_flag TYPE char1.
CLEAR : i_tab,
wa_tab.
Convert date to MM/DD/YYYY format
PERFORM date_convert.
Convert Time to HH:MM:SS format
CONCATENATE sy-uzeit+0(2)
c_colon
sy-uzeit+2(2)
c_colon
sy-uzeit+4(2)
INTO v_time1.
Build the Output File name
IF p_sold = c_x
AND pv_flag = c_x.
CONCATENATE c_objid
c_us
c_z001
c_us
sy-datum
c_us
sy-uzeit
INTO v_file.
ENDIF. " IF p_sold = c_x
IF p_cons = c_x.
CONCATENATE c_objid
c_us
c_z008
c_us
sy-datum
c_us
sy-uzeit
INTO v_file.
ELSEIF p_sold = c_x
AND pv_flag <> c_x.
CONCATENATE c_objid
c_us
sy-datum
c_us
sy-uzeit
INTO v_file.
ENDIF. " IF p_cons = c_x
Build the Complete Output File Path
CONCATENATE pv_path
c_slash
v_file
INTO v_outfile.
Populate the data required for output into an internal table and
then transfer the table contents to file on application server
DATA UPLOAD STATISTICS
wa_tab-rec = text-001.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
TITLE
IF p_sold = c_x
AND pv_flag <> c_x.
sy-title = text-t17.
ENDIF. " IF p_sold = c_x
IF p_sold = c_x
AND pv_flag = c_x.
sy-title = text-t16.
ENDIF. " IF p_sold = c_x
IF p_cons = c_x
AND pv_flag = c_x.
sy-title = text-t19.
ENDIF. " IF p_cons = c_x
wa_tab-rec+0(7) = text-002.
wa_tab-rec+7(60) = sy-title.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
Date & Time
wa_tab-rec+0(5) = text-012.
CONDENSE v_date NO-GAPS.
wa_tab-rec+6(10) = v_date.
wa_tab-rec+60(10) = text-003.
wa_tab-rec+70(15) = v_time1.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
Folder Name
wa_tab-rec+0(18) = text-005.
wa_tab-rec+19(72) = pv_path.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
File Name
wa_tab-rec+0(18) = text-006.
---Begin of addition -Shivakumar - 09-05-2007--
wa_tab-rec+19(72) = pv_name.
---Begin of addition -Shivakumar - 09-05-2007--
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
Records Read
CLEAR v_count.
v_data = pv_rlines.
v_count = STRLEN( v_data ).
CONDENSE v_data NO-GAPS.
wa_tab-rec+0(46) = text-007.
wa_tab-rec+47(4) = v_data.
APPEND wa_tab TO i_tab.
CLEAR : wa_tab,
v_data.
Successfull Records
CLEAR v_count.
v_data = pv_slines.
v_count = STRLEN( v_data ).
CONDENSE v_data NO-GAPS.
wa_tab-rec+0(46) = text-008.
wa_tab-rec+47(4) = v_data.
APPEND wa_tab TO i_tab.
CLEAR : wa_tab,
v_data.
Error Records
CLEAR v_count.
v_data = pv_elines.
v_count = STRLEN( v_data ).
CONDENSE v_data NO-GAPS.
wa_tab-rec+0(46) = text-009.
wa_tab-rec+47(4) = v_data.
APPEND wa_tab TO i_tab.
CLEAR : wa_tab,
v_data.
v_mesg = text-t04.
IF p_sold = c_x
AND pv_flag <> c_x.
MOVE i_tab TO i_file.
ENDIF. " IF p_sold = c_x
IF p_sold = c_x
AND pv_flag = c_x.
MOVE i_tab TO i_file1.
ENDIF. " IF p_sold = c_x
IF NOT i_tab IS INITIAL.
Open the file on Application server to write the report
OPEN DATASET v_outfile
FOR OUTPUT IN TEXT MODE
ENCODING DEFAULT MESSAGE v_mesg.
IF sy-subrc <> 0.
MESSAGE e000(zconversions) WITH v_mesg.
ELSE. " IF sy-subrc <> 0
Transfer details to the file on application server
CLEAR wa_tab.
LOOP AT i_tab INTO wa_tab.
TRANSFER wa_tab-rec TO v_outfile.
CLEAR wa_tab.
ENDLOOP. " LOOP AT i_tab INTO wa_tab
Close the file
CLOSE DATASET v_outfile.
ENDIF. " IF sy-subrc <> 0
ENDIF. " IF NOT i_tab IS INITIAL
ENDFORM. " Create_Report
Regards
Shiva -
E-Rec (ECC 6.0) Upload Resume
Hi,
I need to upload resumes to E-Rec(ECC 6.0) from .net and attach it with applicant. When i tested the BAPI_ERC_UPDATE_ATTACHMENT BAPI, i am getting "attachement cannot be saved".
any help is appreciated.
Regards,
VenkatHi Mark
Please put this request in the correct forum of CRM Middleware.
I am sure your will get the right help from the middleware experts.
Regards -
To upload a RTF and a PDF file to SAP R/3 and print the same through SAP
Hi,
I have a requirement to upload a PDF file and a RTF file to SAP R/3 and print the same.
I wrote the following code for uploading a RTF file to SAP R/3 and print the same. However, the problem is , the formatting present in the RTF document( bold/italics..etc) is not being reflected when I do the 'print-preview' after the executing the code below :
report z_test_upload .
data: begin of itab occurs 0,
rec type string,
end of itab.
data: options like itcpo.
data: filename type string,
count type i.
data: filetype(10) type c value 'ASC'.
DATA: HEADER LIKE THEAD OCCURS 0 WITH HEADER LINE.
DATA: NEWHEADER LIKE THEAD OCCURS 0 WITH HEADER LINE.
DATA: ITFLINE LIKE TLINE OCCURS 0 WITH HEADER LINE.
DATA: RTFLINE LIKE HELP_STFA OCCURS 0 WITH HEADER LINE.
DATA: string_len TYPE i,
n1 TYPE i.
selection-screen begin of block b1.
parameter: p_file1(128) default 'C:\test_itf.rtf'.
selection-screen end of block b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file1.
start-of-selection.
move p_file1 to filename.
call function 'GUI_UPLOAD'
EXPORTING
filename = filename
filetype = filetype
TABLES
data_tab = itab
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.
loop at itab.
string_len = strlen( itab-rec ).
n1 = string_len DIV 134.
ADD 1 TO n1.
DO n1 TIMES.
rtfline-line = itab-rec.
APPEND rtfline.
SHIFT itab-rec BY 134 PLACES.
ENDDO.
endloop.
HEADER-TDSTYLE = 'S_DOCUS1'.
HEADER-TDFORM = 'S_DOCU_SHOW'.
header-tdspras = 'E'.
CALL FUNCTION 'CONVERT_TEXT'
EXPORTING
CODEPAGE = '0000'
DIRECTION = 'IMPORT'
FORMAT_TYPE = 'RTF'
FORMATWIDTH = 72
HEADER = header
SSHEET = 'WINHELP.DOT'
WITH_TAB = 'X'
WORD_LANGU = SY-LANGU
TABLETYPE = 'ASC'
TAB_SUBSTITUTE = 'X09 '
LF_SUBSTITUTE = ' '
REPLACE_SYMBOLS = 'X'
REPLACE_SAPCHARS = 'X'
MASK_BRACKETS = 'X'
IMPORTING
NEWHEADER = NEWHEADER
WITH_TAB_E =
FORMATWIDTH_E =
TABLES
FOREIGN = RTFLINE
ITF_LINES = ITFLINE.
LINKS_TO_CONVERT =
if sy-subrc <> 0.
endif.
CALL FUNCTION 'PRINT_TEXT_ITF'
EXPORTING
HEADER = newheader
OPTIONS = options
IMPORTING
RESULT =
TABLES
LINES = itfline.
if sy-subrc <> 0.
endif.
Any hints or suggestions to solve this problem will be highly appreciated.
Thanks,
AvraHi Vishwas,
Check out the thread [Efficient way of saving documents uploaded|Re: Efficient way of saving documents uploaded by users; and check the blog by Raja Thangamani.
Also check the thread [Export Images through Function Modules |Export Images through Function Modules;.
Hope it helps you. -
Problem in uploading file from Application Server
Hi everyone,
i got a problem in uplaoding a file from application server.i am having two folder (one folder name is current and another one is processed)in application server. In current folder i am having N no of files.I want to upload all the files names into one internal table and i want to process one by one file.After processing each file the file should be moved to processed folder and the files should not exist in current folder.All these process must be done everyday.Please rectify my problem asap.Ramesh,
Take authorization from basis guy.
Use the below code to get the list of files from require directory
*& Report ZDIRFILES *
REPORT ZDIRFILES .
PARAMETER: p_fdir type pfeflnamel DEFAULT '/usr/sap/tmp'.
data: begin of it_filedir occurs 10.
include structure salfldir.
data: end of it_filedir.
*START-OF-SELECTION
START-OF-SELECTION.
Get Current Directory Listing for OUT Dir
call function 'RZL_READ_DIR_LOCAL'
exporting
name = p_fdir
tables
file_tbl = it_filedir.
Now in internal table "it_filedir" will have all your files.
For moving and deleting
report zrich_0001.
Parameters: d1 type localfile default '/usr/sap/TST/SYS/fld1/Data1.txt',
d2 type localfile default '/usr/sap/TST/SYS/fld2/Data1.txt'.
data: begin of itab occurs 0,
rec(20) type c,
end of itab.
data: wa(20) type c.
start-of-selection.
open dataset d1 for input in text mode.
if sy-subrc = 0.
do.
read dataset d1 into wa.
if sy-subrc <> 0.
exit.
endif.
itab-rec = wa.
append itab.
enddo.
endif.
close dataset d1.
open dataset d2 for output in text mode.
loop at itab.
transfer itab to d2.
endloop.
close dataset d2.
delete dataset d1.
Check below FM if required
To move the file to archive directoryuse FMs 'PFL_COPY_OS_FILE'
To Delete 'EPS_DELETE_FILE'.
Don't forgot to reward if useful -
Calendar & File Upload Components - Threadinar6
Hi All,
This is the sixth in the "Threadinar" series , please see Threadinar5 at
http://swforum.sun.com/jive/thread.jspa?threadID=99473 for details
In this Threadinar we will focus on the
"Calendar" and "File Upload" Components
Let us begin our discussion with the Calendar Component.
Calendar Component
You can drag the Calendar component "calendar component icon" from the Palette's Basic category to a page open in the Visual Designer to create an entry field with an integrated calendar pop-up to help the user pick dates for the field.
You can also drop the calendar on a container component, like a table cell or group box.
After dragging the component to the Visual Designer, you can work with the following useful properties of the Calendar Component:-
General
* id. Type: String
The name of the Calendar component in the page bean and the JSP file.
Appearance
* columns. Type: int
The number of character columns used to render the component. The default value is 20.
* dateFormatPattern. Type: String
The format of the date to be entered by the user. It is not usually necessary to set this property because a pattern is chosen automatically based on the locale.
If you prefer to specify a date format, click the ellipsis button (...) to the right of the property and select a predefined date format from the property editor's list. You can also add your own formats. If you add a format, the values you can enter are limited to some combination of yyyy for the year, MM for the month, and dd for the day separated by separator characters. Typical separator characters are / (slash), . (period), and - (dash). For example, the following date formats are acceptable:
o MM/dd/yyyy
o yyyy.MM.dd
o MM-dd-yyyy
* dateFormatPatternHelp. Type: text
Text that appears below the date entry field and shows the format pattern that the date entry field accepts. If you have not set the dateFormatPattern property, the help text is chosen automatically for you. If you have set the dateFormatPattern property, you should bind the dateFormatPatternHelp property to a localized string that matches the setting for each locale you want to support.
* label. Type: String
A label that appears next to the text entry field, typically describing what the user is supposed to enter.
o Note: The label property is not as flexible as the Label component. You can use the Label component if you want more control over the label's appearance, such as positioning of the label relative to the component.
* labelLevel. Type: int
A number that affects the appearance of the label. 1 (Strong) is larger and bold. 2 (Medium), the default, is smaller and bold. 3 (Weak) is smaller and normal (not bold). This property takes effect only if the label property is set.
* style. Type: String
Cascading Style Sheet rules (CSS level 2) to be applied to the component. For example:
position: absolute; left: 288px; top: 312px
You can enter values directly or click the ellipsis (...) button to use the Style Editor.
o Note: This property overrides any settings in the theme or the project CSS file for this component. If a style specified in this property does not appear to take effect, it is because an area of the component is obscured by a child component that has different style settings.
For a list of CSS2 style attributes, see the web page at
http://www.w3.org/TR/REC-CSS2/propidx.html
* styleClass. Type: String
A space-separated list of CSS2 style classes to be applied when the component is rendered. The style classes must be defined in the project's style sheet or in the theme's CSS file. If you click the ellipsis button (...), you see a list of all styles you can add to this property. For information on adding CSS classes and rules to the project's cascading style sheet, see CSS Editor.
o Note: See the note above under the style property description for an explanation of why a class added to this property might appear to have no effect on the component.
o Note: If you add a CSS style class from the current theme to your project CSS file and you redefine the style class, the change affects all components that use this style class. However, you can add your own style classes to the project CSS file that redefine the default style classes, and then when you add them to this property, the changes affect only this instance of this component.
For the defaulttheme.jar CSS style classes for this component, see Calendar Component CSS Classes.
Data
* maxDate. Type: java.util.Date
The last date that the user can select. The default value is four years from the date set in the minDate property, for a total span of five years.
* minDate. Type: java.util.Date
The earliest date that the user can select. The default value is the value of the selectedDate property, which defaults to the current date if that property is not set.
* required. Type: boolean
If selected, the user must enter a value for the calendar before the page can be submitted. If you add a Message component to the page and link its for property to this component, an error message will be displayed if the user tries to submit the page without entering a value.
* selectedDate. Type: Date
A java.util.Date object representing the calendar date selected by the user. If you right-click the component and choose Bind to Data, you can bind this property to a data provider or object that can process the user entered value on the server.
When the component displays initially, if this property is not set, its value defaults to the current date. If you provide values for minDate and maxDate, you can also provide a value for this property that initially displays a date in that range.
* validator. Type: MethodBinding
Indicates the JavaServer Faces validator that is called when the value is submitted. A validator ensures that the correct value is entered by a user. Choose a validator from the drop-down list. If you choose (null), no validator is called. If you choose a validator, also select the required property to ensure that the validator is used. For descriptions of JavaServer Faces validators, see the list of topics at List of Validators.
o Note: If you define your own validate method, for example, by right-clicking the component and choosing Edit Event Handler > validate, any value you might have set in this property is overridden.
File Upload Component
You can drag the File Upload component "file upload component icon" from the Palette's Basic category to the Visual Designer to create an entry field and a browse button that opens a file chooser dialog on the local system, enabling the user either to select a file or to type a file name into the entry field. When the page is submitted, a copy of the file's contents is sent to the web application.
The component is similar to an HTML <input type="file"> element.
* Note: This component is neither supported by nor available in portlet projects due to security reasons.
* Note: The size of the component in the Visual Designer might not match the size of the component when it is rendered in a web browser, making the component appear to line up correctly in the Visual Designer, but not when the page is rendered in the user's web browser. Also, the rendering of this component can differ depending on the web browser. Be sure to test the component in the web browsers that you expect your users to use. For example, if you add a width setting to the style property that is smaller than the setting in the columns property, Internet Explorer observes only the width setting, while the Mozilla browser ignores it and sets the width according to the number of characters in the columns property.
The File upload component uses a filter, a com.sun.rave.web.ui.util.UploadFilter object that is configured for you in the web application's deployment descriptor. The UploadFilter uses the Apache commons fileupload package. You might need to change these settings in the following two cases:
* The server holds the uploaded file in memory unless it exceeds 4096 bytes; otherwise, the server holds the file contents in a temporary file. You can change this threshold by modifying the sizeThreshold parameter for the UploadFilter filter entry in the web application's web.xml file.
* By default, the File Upload component can handle files up to one megabyte in size. You can change the maximum file size by modifying the maxSize parameter for the UploadFilter filter entry in the application's web.xml file.
o
A negative value for the maxSize parameter indicates that there is no file size limit. Setting the parameter to a negative value is not recommended for security reasons. For example, if you allow unlimited file sizes, a malicious user could mount a denial of service attack on your site by using extremely large files
* To change the settings for the UploadFilter object in the web.xml file:
1. In the Files window, expand project-name > web > WEB-INF.
2. Double-click the web.xml node to open the file in the XML editor.
3. Click the Filters toolbar button.
4. In the UploadFilter section under Initialization Parameters, you can change the values for the maxSize and sizeThreshold parameters.
The contents of the uploaded file, together with some information about it, are stored in an instance of com.sun.rave.web.ui.model.UploadedFile. By using this object, you can get the content of the file as a String or write the contents to disk, as well as get properties such as the name and the size of the file. In the interest of conserving memory, the contents and file data are only available during the HTTP request in which the file was uploaded. To access the contents of the uploaded file, bind the uploadedFile property to a bean property of type com.sun.rave.web.ui.model.UploadedFile. Have the setter or an action method process the file.
The UploadedFile interface has methods for getting the name and size of the file, determining the file's MIME type (such as text/plain or image/jpeg), getting the file's contents as bytes or as a String, and writing the contents to disk. To learn more, in the Java editor, right-click on UploadedFile in a declaration statement and choose Show JavaDoc from the pop-up menu.
* To set the component's properties, select the component and edit its properties in the File Upload Properties Window.
* Right-click the component and choose one of the following pop-up menu items:
o Edit validate Event Handler. Opens the Java Editor with the cursor positioned in the component's validate method so you can insert code to validate the value of the component.
o Set Initial Focus. Gives this component focus when the user opens the page.
o Auto-submit on Change. Causes the form to be automatically submitted if the value of the component changes. Sets the component's JavaScript onclick property to common_timeoutSubmitForm(this.form, 'component-id');. At runtime, this code causes the form to be automatically submitted if the user changes the component value. Once the form is submitted, conversion and validation occur on the server and any value change listener methods execute, and then the page is redisplayed.
A component configured to Auto-submit on Change can use virtual forms to limit the input fields that are processed when the form is submitted. If the auto-submit component is defined to submit a virtual form, only the participants in that virtual form will be processed when the auto-submit occurs.
o Bind to Data. Bind the component's text property to an object or to a data provider. For more information, see Bind to Data Dialog Box.
o Property Bindings. Bind any of the component's properties to an object or data provider, such as the uploadedFile property to a bean property of type com.sun.rave.web.ui.model.UploadedFile.
o Configure Virtual Forms. Enables you to add the component to a virtual form.
For more details on using the "File Upload Component" Please see this tutorial
http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/file_upload.html
Please share your comments, experiences, additional information, questions, feedback, etc. on these components.
------------------------------------------------------------------------------- --------------------Of interest relating to file upload component to users : "Saving Uploaded Files Uploaded by the File Upload Component " Check the blog:
http://blogs.sun.com/roller/page/divas -
Problem in the BDC program to upload the data from a flat file.
Hi,
I am required to write a BDC program to upload the data from a flat file. The conditions are as mentioned below:-
1) Selection Screen will be prompted to user and user needs to provide:- File Path on presentation server (with F4 help for this obligatory parameter) and File Separator e.g. @,#,$,%,... etc(fields in the file will be separated by using this special character) or fields may be separated by tab(tab delimited).
2) Finally after the data is uploaded, following messages need to be displayed:-
a) Total Number of records successfully uploaded.
b) Session Name
c) Number of Sessions created.
Problem is when each record is fetched from flat file, the record needs to be split into individual fields separated by delimiter or in case tab separated, then proceeding in usual manner.
It would be great if you provide me either the logic, pseudocode, or sample code for this BDC program.
Thanks,Here is an example program, if you require the delimitor to be a TAB, then enter TAB on the selection screen, if you require the delimitor to be a comma, slash, pipe, whatever, then simply enter that value. This example is simply the uploading of the file, not the BDC, I assume that you know what to do once you have the data into the internal table.
REPORT zrich_0001.
TYPES: BEGIN OF ttab,
rec TYPE string,
END OF ttab.
TYPES: BEGIN OF tdat,
fld1(10) TYPE c,
fld2(10) TYPE c,
fld3(10) TYPE c,
fld4(10) TYPE c,
END OF tdat.
DATA: itab TYPE TABLE OF ttab.
data: xtab like line of itab.
DATA: idat TYPE TABLE OF tdat.
data: xdat like line of idat.
DATA: file_str TYPE string.
DATA: delimitor TYPE string.
PARAMETERS: p_file TYPE localfile.
PARAMETERS: p_del(5) TYPE c.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
DATA: ifiletab TYPE filetable.
DATA: xfiletab LIKE LINE OF ifiletab.
DATA: rc TYPE i.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
CHANGING
file_table = ifiletab
rc = rc.
READ TABLE ifiletab INTO xfiletab INDEX 1.
IF sy-subrc = 0.
p_file = xfiletab-filename.
ENDIF.
START-OF-SELECTION.
TRANSLATE p_del TO UPPER CASE.
CASE p_del.
WHEN 'TAB'.
delimitor = cl_abap_char_utilities=>horizontal_tab.
WHEN others.
delimitor = p_del.
ENDCASE.
file_str = p_file.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = file_str
CHANGING
data_tab = itab.
LOOP AT itab into xtab.
CLEAR xdat.
SPLIT xtab-rec AT delimitor INTO xdat-fld1
xdat-fld2
xdat-fld3
xdat-fld4.
APPEND xdat to idat.
ENDLOOP.
LOOP AT idat into xdat.
WRITE:/ xdat-fld1, xdat-fld2, xdat-fld3, xdat-fld4.
ENDLOOP.
Regards,
Rich Heilman -
Hi,
Pls fin the error in this program. I am unable to upload.
Regards,
Karthik
Program ID : ZRFC_RUSHORDER
Transaction Code : Z*
Description : RFC For Sales Process using Transaction Method calling
3 Transactions VA01,VL23 & VF06
Change History
Date | Programmer | Corr. # | Description
| | |
| | |
FUNCTION ZRFC_RUSHORDER .
""Local interface:
*" EXPORTING
*" VALUE(SUBRC) LIKE SYST-SUBRC
*" TABLES
*" MESSTAB STRUCTURE BDCMSGCOLL OPTIONAL
*" RO_HEADER STRUCTURE ZSD_HEADER
*" RO_ITEM STRUCTURE ZSD_ITEM
INTERNAL TABLES,STRUCTURES & VARIABLES
*TABLES : ZSO_CREATE_TEXT.
DATA: CTU LIKE APQI-PUTACTIVE,
MODE LIKE APQI-PUTACTIVE,
UPDATE LIKE APQI-PUTACTIVE,
GROUP LIKE APQI-GROUPID,
USER LIKE APQI-USERID,
KEEP LIKE APQI-QERASE,
HOLDDATE LIKE APQI-STARTDATE,
NODATA LIKE APQI-PUTACTIVE.
DATA: T_VBELN LIKE VBFA-VBELN.
data: MESSTAB1 LIKE TABLE OF BDCMSGCOLL WITH HEADER LINE.
DATA: NODATA_CHARACTER VALUE ' '.
DATA : SORDER_FINAL LIKE VBAK-VBELN,
SORDER(15) TYPE C,
V_CODE(2) TYPE C,
V_PLANT LIKE EKPO-WERKS,
YEAR_CONVERSION(1) TYPE C.
DATA : WA_ZRUSH_ORDER LIKE ZRUSH_ORDER.
DATA : V_DATE LIKE SY-DATUM,
V_TIME LIKE SY-UZEIT.
DATA : SESSION_NAM(30) TYPE C.
CTU = ' '.
MODE = 'N'.
USER = SY-UNAME.
CONCATENATE SY-UNAME '_' SY-DATUM '_' SY-UZEIT INTO
SESSION_NAM.
GROUP = 'RUSH_ORDER'.
KEEP = 'X'.
UPDATE = 'L'.
HOLDDATE = ''.
NODATA = '/'.
SUBRC = 0.
*CREATING SESSSION
PERFORM OPEN_GROUP USING GROUP USER KEEP HOLDDATE CTU.
LOOP AT RO_HEADER.
MOVE RO_HEADER-SORDER TO SORDER.
V_PLANT = SORDER+0(4).
SELECT SINGLE CODE INTO V_CODE FROM ZPLANT_NUMER_IBS WHERE PLANT = V_PLANT.
IF SORDER+4(4) = '2005'.
YEAR_CONVERSION = 'E'.
ELSEIF SORDER+4(4) = '2006'.
YEAR_CONVERSION = 'F'.
ELSEIF SORDER+4(4) = '2007'.
YEAR_CONVERSION = 'G'.
ELSEIF SORDER+4(4) = '2008'.
YEAR_CONVERSION = 'H'.
ELSEIF SORDER+4(4) = '2009'.
YEAR_CONVERSION = 'J'.
ELSEIF SORDER+4(4) = '2010'.
YEAR_CONVERSION = 'K'.
ELSEIF SORDER+4(4) = '2011'.
YEAR_CONVERSION = 'L'.
ELSEIF SORDER+4(4) = '2012'.
YEAR_CONVERSION = 'M'.
ELSEIF SORDER+4(4) = '2013'.
YEAR_CONVERSION = 'N'.
ELSEIF SORDER+4(4) = '2014'.
YEAR_CONVERSION = 'P'.
ELSEIF SORDER+4(4) = '2015'.
YEAR_CONVERSION = 'Q'.
ELSEIF SORDER+4(4) = '2016'.
YEAR_CONVERSION = 'R'.
ELSEIF SORDER+4(4) = '2017'.
YEAR_CONVERSION = 'S'.
ELSEIF SORDER+4(4) = '2018'.
YEAR_CONVERSION = 'T'.
ELSEIF SORDER+4(4) = '2019'.
YEAR_CONVERSION = 'U'.
ELSEIF SORDER+4(4) = '2020'.
YEAR_CONVERSION = 'V'.
ELSEIF SORDER+4(4) = '2021'.
YEAR_CONVERSION = 'W'.
ELSEIF SORDER+4(4) = '2022'.
YEAR_CONVERSION = 'X'.
ELSEIF SORDER+4(4) = '2023'.
YEAR_CONVERSION = 'Y'.
ELSEIF SORDER+4(4) = '2024'.
YEAR_CONVERSION = 'Z'.
ELSEIF SORDER+4(4) = '2025'.
YEAR_CONVERSION = 'A'.
ELSEIF SORDER+4(4) = '2026'.
YEAR_CONVERSION = 'B'.
ELSEIF SORDER+4(4) = '2027'.
YEAR_CONVERSION = 'C'.
ENDIF.
CONCATENATE YEAR_CONVERSION V_CODE SORDER+8(7) INTO SORDER_FINAL.
CLEAR YEAR_CONVERSION.
CLEAR V_CODE.
CLEAR V_PLANT.
Text Element Creation for Sales order.
ZSO_CREATE_TEXT-SORDER = SORDER_FINAL.
ZSO_CREATE_TEXT-LR_NUMBER = RO_HEADER-LR_NUMBER.
ZSO_CREATE_TEXT-TRANSPORTER = RO_HEADER-TRANSPORTER.
ZSO_CREATE_TEXT-Z003 = RO_HEADER-Z003.
ZSO_CREATE_TEXT-Z004 = RO_HEADER-Z004.
INSERT ZSO_CREATE_TEXT.
PERFORM BDC_DYNPRO USING 'SAPMV45A' '0101'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'VBAK-SPART'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'VBAK-AUART'
'ZKSO'. "AUART_001.
PERFORM BDC_FIELD USING 'VBAK-VKORG'
RO_HEADER-VKORG. "VKORG_002.
PERFORM BDC_FIELD USING 'VBAK-VTWEG'
RO_HEADER-VTWEG. "VTWEG_003.
PERFORM BDC_FIELD USING 'VBAK-SPART'
RO_HEADER-SPART. "SPART_004.
Sales Order Date insertion.......
PERFORM BDC_DYNPRO USING 'SAPMV45A' '4001'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=KKAU'.
PERFORM BDC_FIELD USING 'VBAK-VBELN'
SORDER_FINAL.
PERFORM BDC_FIELD USING 'KUAGV-KUNNR'
RO_HEADER-SP.
PERFORM BDC_FIELD USING 'KUWEV-KUNNR'
RO_HEADER-SH.
PERFORM BDC_FIELD USING 'VBKD-BSTKD'
RO_HEADER-REF_PO.
PERFORM BDC_FIELD USING 'VBKD-ZTERM'
RO_HEADER-ZTERM.
WRITE RO_HEADER-SODATE TO RO_HEADER-SODATE.
PERFORM BDC_DYNPRO USING 'SAPMV45A' '4002'.
perform bdc_field using 'BDC_OKCODE'
'=T\03'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'VBAK-AUDAT'.
PERFORM BDC_FIELD USING 'VBAK-AUDAT'
RO_HEADER-SODATE. "Document Date
PERFORM BDC_FIELD USING 'VBKD-PRSDT'
RO_HEADER-SODATE. "Pricing Date
Billing Screen ***********************
perform bdc_dynpro using 'SAPMV45A' '4002'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/EBACK'.
perform bdc_field using 'BDC_CURSOR'
'VBKD-FKDAT'.
PERFORM BDC_FIELD USING 'VBKD-FKDAT'
RO_HEADER-SODATE. "Billing date
PERFORM BDC_DYNPRO USING 'SAPMV45A' '4001'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=KKO1'.
PERFORM BDC_FIELD USING 'KUAGV-KUNNR'
RO_HEADER-SP. "KUNNR_006.
PERFORM BDC_FIELD USING 'KUWEV-KUNNR'
RO_HEADER-SH. "KUNNR_007.
PERFORM BDC_FIELD USING 'VBKD-BSTKD'
RO_HEADER-REF_PO. "BSTKD_008.
PERFORM BDC_FIELD USING 'RV45A-KETDAT'
RO_HEADER-SODATE. "Delivery Date.
PERFORM BDC_FIELD USING 'VBKD-ZTERM'
RO_HEADER-ZTERM. "ZTERM_011.
************************Added for test 25-02******************
PERFORM BDC_FIELD USING 'RV45A-KETDAT' " CNGD FROM 'KEDAT' TO 'KETDAT'.
RO_HEADER-SODATE. "REQ DELVY DATE.
PERFORM BDC_FIELD USING 'VBKD-PRSDT' "CNGD FROM 'RV45A' TO 'VBKD'.
RO_HEADER-SODATE. "PRICING DATE.
************************Added for test 25-02******************
*Dont DELETE, For Future Use of Inco terms 1 & 2.
*PERFORM BDC_FIELD USING 'BDC_CURSOR'
'VBKD-INCO2'.
*PERFORM BDC_FIELD USING 'VBKD-INCO1'
RO_HEADER-INCO1. "INCO1_012.
*PERFORM BDC_FIELD USING 'VBKD-INCO2'
RO_HEADER-INCO2. "INCO2_013.
Header condition types......................................
PERFORM BDC_DYNPRO USING 'SAPMV45A' '5002'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=V69A_KOAN'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KOMV-KSCHL(05)'.
IF RO_HEADER-KSCHL1 IS NOT INITIAL.
PERFORM BDC_DYNPRO USING 'SAPMV45A' '5002'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=V69A_KOAN'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KOMV-KSCHL(04)'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KOMV-KBETR(02)'.
PERFORM BDC_FIELD USING 'KOMV-KSCHL(02)' RO_HEADER-KSCHL1.
PERFORM BDC_FIELD USING 'KOMV-KBETR(02)' RO_HEADER-KBETR1.
ENDIF.
IF RO_HEADER-KSCHL2 IS NOT INITIAL.
PERFORM BDC_DYNPRO USING 'SAPMV45A' '5002'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=V69A_KOAN'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KOMV-KSCHL(04)'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KOMV-KBETR(02)'.
PERFORM BDC_FIELD USING 'KOMV-KSCHL(02)' RO_HEADER-KSCHL2.
PERFORM BDC_FIELD USING 'KOMV-KBETR(02)' RO_HEADER-KBETR2.
ENDIF.
IF RO_HEADER-KSCHL3 IS NOT INITIAL.
PERFORM BDC_DYNPRO USING 'SAPMV45A' '5002'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=V69A_KOAN'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KOMV-KSCHL(04)'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KOMV-KBETR(02)'.
PERFORM BDC_FIELD USING 'KOMV-KSCHL(02)' RO_HEADER-KSCHL3.
PERFORM BDC_FIELD USING 'KOMV-KBETR(02)' RO_HEADER-KBETR3.
ENDIF.
*change on 11.04.2006 for adding rounding off condition type.
IF RO_HEADER-KSCHL4 IS NOT INITIAL.
PERFORM BDC_DYNPRO USING 'SAPMV45A' '5002'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=V69A_KOAN'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KOMV-KSCHL(04)'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KOMV-KBETR(02)'.
PERFORM BDC_FIELD USING 'KOMV-KSCHL(02)' RO_HEADER-KSCHL4.
PERFORM BDC_FIELD USING 'KOMV-KBETR(02)' RO_HEADER-KBETR4.
ENDIF.
PERFORM BDC_DYNPRO USING 'SAPMV45A' '5002'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/EBACK'.
Dont DELETE, For Future Use of : Sales Person Data.................
*PERFORM BDC_DYNPRO USING 'SAPMV45A' '4001'.
*PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=HEAD'.
*perform bdc_dynpro using 'SAPMV45A' '4002'.
*perform bdc_field using 'BDC_OKCODE'
'=T\08'.
*perform bdc_dynpro using 'SAPMV45A' '4002'.
*perform bdc_field using 'BDC_OKCODE'
'=PAAN'.
*perform bdc_field using 'BDC_CURSOR'
'GVS_TC_DATA-REC-PARTNER(09)'.
*perform bdc_field using 'GV_FILTER'
'PARALL'. "GV_FILTER_024.
*perform bdc_field using 'GVS_TC_DATA-REC-PARVW(09)'
'VE'."REC-PARVW_09_025.
*perform bdc_field using 'GVS_TC_DATA-REC-PARTNER(09)'
'0'. "REC-PARTNER_09_026.
*perform bdc_dynpro using 'SAPMV45A' '4002'.
*perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
*perform bdc_field using 'BDC_CURSOR'
'GVS_TC_DATA-REC-PARTNER(09)'.
*perform bdc_field using 'GV_FILTER'
'PARALL'. "GV_FILTER_027.
PERFORM BDC_DYNPRO USING 'SAPMV45A' '4001'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=POAN'.
PERFORM BDC_FIELD USING 'KUAGV-KUNNR'
RO_HEADER-SP. "KUNNR_006.
PERFORM BDC_FIELD USING 'KUWEV-KUNNR'
RO_HEADER-SH. "KUNNR_007.
PERFORM BDC_FIELD USING 'VBKD-BSTKD'
RO_HEADER-REF_PO. "BSTKD_008.
*FETCHING LINE ITEM DATA.
LOOP AT RO_ITEM WHERE SORDER = RO_HEADER-SORDER.
PERFORM BDC_DYNPRO USING 'SAPMV45A' '4001'.
PERFORM BDC_FIELD USING 'BDC_OKCODE' '=POAN'.
PERFORM BDC_FIELD USING 'RV45A-MABNR(02)' RO_ITEM-MATNR.
PERFORM BDC_FIELD USING 'RV45A-KWMENG(02)' RO_ITEM-QTY.
PERFORM BDC_FIELD USING 'VBAP-VRKME(02)' RO_ITEM-UOM. " For Future Use
PERFORM BDC_FIELD USING 'VBAP-WERKS(02)' RO_ITEM-PLANT.
PERFORM BDC_FIELD USING 'VBAP-LGORT(02)' RO_ITEM-SLOC.
PERFORM BDC_FIELD USING 'VBAP-CHARG(02)' RO_ITEM-BATCH.
*FREE DELIVERY CHECK CHANGING OF ITEMCATEGORY : TANN.
IF RO_ITEM-KBETR1 IS INITIAL AND RO_ITEM-KBETR2 IS INITIAL.
PERFORM BDC_FIELD USING 'VBAP-PSTYV(02)'
'ZANN'.
ELSE.
PERFORM BDC_DYNPRO USING 'SAPMV45A' '4001'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
Condition Types For The Items
PERFORM BDC_DYNPRO USING 'SAPMV45A' '4001'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=PKO1'.
PERFORM BDC_FIELD USING 'RV45A-VBAP_SELKZ(01)' 'X'.
PERFORM BDC_DYNPRO USING 'SAPMV45A' '5003'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=V69A_KOAN'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KOMV-KSCHL(02)'.
Condition Type 1...........
PERFORM BDC_DYNPRO USING 'SAPMV45A' '5003'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'KOMV-KSCHL(02)' RO_ITEM-KSCHL1.
PERFORM BDC_FIELD USING 'KOMV-KBETR(02)' RO_ITEM-KBETR1.
Condition Type 2...........
PERFORM BDC_DYNPRO USING 'SAPMV45A' '5003'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=V69A_KOAN'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KOMV-KSCHL(02)'.
PERFORM BDC_DYNPRO USING 'SAPMV45A' '5003'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'KOMV-KSCHL(02)' RO_ITEM-KSCHL2.
PERFORM BDC_FIELD USING 'KOMV-KBETR(02)' RO_ITEM-KBETR2.
Condition Type 3.............
IF RO_ITEM-KSCHL3 IS NOT INITIAL.
PERFORM BDC_DYNPRO USING 'SAPMV45A' '5003'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=V69A_KOAN'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KOMV-KSCHL(02)'.
PERFORM BDC_DYNPRO USING 'SAPMV45A' '5003'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'KOMV-KSCHL(02)' RO_ITEM-KSCHL3.
PERFORM BDC_FIELD USING 'KOMV-KBETR(02)' RO_ITEM-KBETR3.
ENDIF.
Condition Type 4..............
IF RO_ITEM-KSCHL4 IS NOT INITIAL.
PERFORM BDC_DYNPRO USING 'SAPMV45A' '5003'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=V69A_KOAN'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KOMV-KSCHL(02)'.
PERFORM BDC_DYNPRO USING 'SAPMV45A' '5003'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'KOMV-KSCHL(02)' RO_ITEM-KSCHL4.
PERFORM BDC_FIELD USING 'KOMV-KBETR(02)' RO_ITEM-KBETR4.
ENDIF.
Condition Type 5...............
IF RO_ITEM-KSCHL5 IS NOT INITIAL.
PERFORM BDC_DYNPRO USING 'SAPMV45A' '5003'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=V69A_KOAN'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KOMV-KSCHL(02)'.
PERFORM BDC_DYNPRO USING 'SAPMV45A' '5003'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'KOMV-KSCHL(02)' RO_ITEM-KSCHL5.
PERFORM BDC_FIELD USING 'KOMV-KBETR(02)' RO_ITEM-KBETR5.
ENDIF.
Condition Type 6...............
IF RO_ITEM-KSCHL6 IS NOT INITIAL.
PERFORM BDC_DYNPRO USING 'SAPMV45A' '5003'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=V69A_KOAN'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KOMV-KSCHL(02)'.
PERFORM BDC_DYNPRO USING 'SAPMV45A' '5003'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'KOMV-KSCHL(02)' RO_ITEM-KSCHL6.
PERFORM BDC_FIELD USING 'KOMV-KBETR(02)' RO_ITEM-KBETR6.
ENDIF.
PERFORM BDC_DYNPRO USING 'SAPMV45A' '5003'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/EBACK'.
ENDIF.
ENDLOOP.
Saving The Sales Document
PERFORM BDC_DYNPRO USING 'SAPMV45A' '4001'.
PERFORM BDC_FIELD USING 'BDC_OKCODE' '=SICH'.
PERFORM BDC_TRANSACTION TABLES MESSTAB
USING 'VA01'
CTU
MODE
UPDATE.
*CALL TRANSACTION 'VA01' USING BDCDATA1
MODE
MODE 'A'
UPDATE
UPDATE 'A'
MESSAGES INTO MESSTAB.
ENDLOOP.
CALL TRANSACTION 'VA01' USING BDCDATA1
MODE 'A'
UPDATE 'A'
MESSAGES INTO MESSTAB1.
APPEND MESSTAB1.
*SELECT SINGLE VBELN INTO T_VBELN FROM VBFA
WHERE VBELV = RO_HEADER-SORDER." AND VBTYP_N = 'J'.
perform bdc_dynpro using 'SAPMV50A' '4004'.
perform bdc_field using 'BDC_CURSOR' 'LIKP-VBELN'.
perform bdc_field using 'BDC_OKCODE' '/00'.
perform bdc_field using 'LIKP-VBELN' T_VBELN. "'7012000733'.
perform bdc_dynpro using 'SAPMV50A' '1000'.
perform bdc_field using 'BDC_OKCODE' '=WABU_T'. "'=SICH_T'.
**perform bdc_field using 'LIKP-BLDAT' RO_HEADER-SODATE. '27.06.2006'.
perform bdc_field using 'BDC_CURSOR' 'LIKP-WADAT_IST'.
perform bdc_field using 'LIKP-WADAT' RO_HEADER-SODATE. " '26.05.2006'.
**perform bdc_field using 'LIKP-WAUHR' '00:00:00'.
perform bdc_field using 'LIKP-BTGEW' '10'.
perform bdc_field using 'LIKP-GEWEI' 'KG'.
perform bdc_field using 'LIKP-WADAT_IST' RO_HEADER-SODATE." '26.05.2006'.
PERFORM BDC_TRANSACTION TABLES MESSTAB
USING 'VL02N'
CTU
MODE
UPDATE.
ENDLOOP.
IF SY-SUBRC <> 0.
SUBRC = SY-SUBRC.
EXIT.
*else.
update zrush_order set PROCESSED = 'X'.
where sorder = SORDER_FINAL and
sodate = RO_HEADER-SODATE.
ENDIF.
PROCESSING OUT BOUND DELIVERY
*PERFORM BDC_DYNPRO USING 'SAPMSSY0' '0120'.
*PERFORM BDC_FIELD USING 'BDC_CURSOR' '06/09'.
*PERFORM BDC_FIELD USING 'BDC_OKCODE' '=IMED' .
*PERFORM BDC_DYNPRO USING 'SAPMSSY0' '0120'.
*PERFORM BDC_FIELD USING 'BDC_OKCODE' '=BACK'.
PROCESSING INVOICE DELIVERY
*PERFORM BDC_DYNPRO USING 'RV60SBAT' '1000'.
*PERFORM BDC_FIELD USING 'BDC_CURSOR' 'IMMEDI'.
**SELECTION SCREEN PARAMETER FOR VF06
*PERFORM BDC_FIELD USING 'VKOR1' '1000'.
*PERFORM BDC_FIELD USING 'FKDAB' ' '.
*PERFORM BDC_FIELD USING 'ALLEA' 'X'.
*PERFORM BDC_FIELD USING 'ALLEL' 'X'.
*WRITE SY-DATUM TO V_DATE.
*WRITE SY-UZEIT TO V_TIME.
*ADD '03' TO V_TIME+2(02).
*PERFORM BDC_FIELD USING 'EXDATE' V_DATE. "V_DATE.
*PERFORM BDC_FIELD USING 'EXTIME' V_TIME. "V_TIME.
*PERFORM BDC_FIELD USING 'IMMEDI' 'X'.
*PERFORM BDC_FIELD USING 'NUMBJOBS' ' '.
*PERFORM BDC_FIELD USING 'MAX_CUST' ' '.
*PERFORM BDC_FIELD USING 'UTASY' 'X'.
*PERFORM BDC_FIELD USING 'BDC_OKCODE' '=ONLI'.
*PERFORM BDC_DYNPRO USING 'SAPMSSY0' '0120'.
*PERFORM BDC_FIELD USING 'BDC_OKCODE' '=BACK'.
*PERFORM BDC_DYNPRO USING 'RV60SBAT' '1000'.
*PERFORM BDC_FIELD USING 'BDC_OKCODE' '/E'.
*PERFORM BDC_TRANSACTION TABLES MESSTAB
*USING 'VF06'
CTU
MODE
UPDATE.
PERFORM CLOSE_GROUP USING CTU.
wait up to 2 seconds.
submit ZVF06_SCHEDULE and return.
wait up to 2 seconds.
ENDFUNCTION.y u are unable to Upload?
-
Moving of flat file from the application server after upload.
Hi All,
I am uploading data from a flat file placed on the application server by a BDC program.
After the BDC has created the session i want to transfer the flat file from that folder to another folder on the application server by changing the name of the flatfile.
Can any one suggest the best way of doing this particular scenario?
Thanks in advance.
Regards
Satish Nair.Here is a sample program.
report zrich_0001.
data: d1 type localfile value '/usr/sap/TST/SYS/Data1.txt',
d2 type localfile value '/usr/sap/TST/SYS/Data2.txt'.
data: begin of itab occurs 0,
rec(20) type c,
end of itab.
data: wa(20) type c.
start-of-selection.
open dataset d1 for input in text mode.
if sy-subrc = 0.
do.
read dataset d1 into wa.
if sy-subrc <> 0.
exit.
endif.
itab-rec = wa.
append itab.
enddo.
endif.
close dataset d1.
open dataset d2 for output in text mode.
loop at itab.
transfer itab to d2.
endloop.
close dataset d2.
delete dataset d1.
Regards,
Rich Heilman -
Hi all,
I am new to ABAP Development. I need to upload a .DAT file (the file doesn#t have any proper structure-- Please find the .DAT file in the attachment). After uploading the DATA (.DAT) fiel I need to split in into different columns. Refering the attached .DAT fiel the fields in bracets like:
[Arbeitstag], [Pecunia], [Mita], [Kunde], [Auftrag] and [Position] are different fields that need to be arranged in columns in an internal table. this .DAT fiel which I want to upload and then SPLIT it into various fields will will treated as MASTER DATA table for further programming. The program that I had written is as below. Also please refer the attached .DAT table.
Please if any one could help me. i searched a lot in different forums but couldn't find me a solution. Also note that the attached fiel is in text (.txt) format here but in real situation the same fiel is in DATA (.DAT) format.
*& Report ZDEMO_ZEITERFASSUNG9
REPORT ZDEMO_ZEITERFASSUNG9.
Types: Begin of ttab,
Rec(1000) type c,
End of ttab.
DATA: itab type table of ttab.
DATA: wa_tab type ttab.
DATA: file_str type string.
Parameters: p_file type localfile.
At selection-screen on value-request for p_file.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
* PROGRAM_NAME = SYST-REPID
* DYNPRO_NUMBER = SYST-DYNNR
* FIELD_NAME = ' '
STATIC = 'X'
* MASK = ' '
CHANGING
file_name = p_file.
* EXCEPTIONS
* MASK_TOO_LONG = 1
* OTHERS = 2
Start-of-Selection.
file_str = P_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = '\\10.10.1.92\Volume_1\_projekte\Zeiterfassung-SAP\BUP_ZEIT.DAT' " This the file source address
FILETYPE = 'DAT'
HAS_FIELD_SEPARATOR = ';'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* CHECK_BOM = ' '
* VIRUS_SCAN_PROFILE =
* NO_AUTH_CHECK = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
tables
data_tab = itab
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.
LOOP at itab into wa_tab.
WRITE: / wa_tab.
ENDLOOP.
I will be grateful to all you experts for ur inputs
regards
Chandan SinghFor every Auftrag, there are multiple Position entries.
Rest of the blocks don't seems to have any relation.
So you can check this code to see how internal table lt_str is built whose first 3 fields have data contained in Auftrag, and next 3 fields have Position data. The structure is flat, assuming that every Position record is related to preceding Auftrag.
Try out this snippet.
DATA lt_data TYPE TABLE OF string.
DATA lv_data TYPE string.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = 'C:\temp\test.txt'
CHANGING
data_tab = lt_data
EXCEPTIONS
OTHERS = 19.
CHECK sy-subrc EQ 0.
TYPES:
BEGIN OF ty_str,
a1 TYPE string,
a2 TYPE string,
a3 TYPE string,
p1 TYPE string,
p2 TYPE string,
p3 TYPE string,
END OF ty_str.
DATA: lt_str TYPE TABLE OF ty_str,
ls_str TYPE ty_str,
lv_block TYPE string,
lv_flag TYPE boolean.
LOOP AT lt_data INTO lv_data.
CASE lv_data.
WHEN '[Version]' OR '[StdSatz]' OR '[Arbeitstag]' OR '[Pecunia]'
OR '[Mita]' OR '[Kunde]' OR '[Auftrag]' OR '[Position]'.
lv_block = lv_data.
lv_flag = abap_false.
WHEN OTHERS.
lv_flag = abap_true.
ENDCASE.
CHECK lv_flag EQ abap_true.
CASE lv_block.
WHEN '[Auftrag]'.
SPLIT lv_data AT ';' INTO ls_str-a1 ls_str-a2 ls_str-a3.
WHEN '[Position]'.
SPLIT lv_data AT ';' INTO ls_str-p1 ls_str-p2 ls_str-p3.
APPEND ls_str TO lt_str.
ENDCASE.
ENDLOOP. -
How do I upload my DV videos to my macbook pro if iMovie doesn't recognize a Sony DCR-TRV20?
I purchased a firewire 800 9-pin to 4-pin cable and then found out my macbook pro nor imovie '11 even recognize my cameras existence. I have precious videos on mini DV tapes that I need to upload. Any suggestions?
Hi
My long notes on this
NO CAMERA or A/D-box
Cable
• Are You sure that You are using the FireWire Cable - USB-Cable will not work for miniDV tape Cameras
FireWire - Sure not using the accompany USB-Cable but bought a 4-pin to 6-pin (or 9-pin) FW one ?
• Test another FW-Cable very often the problem maker.
Camera
• Test Your Camera on another Mac so that DV-in still works OK
• Toggle in iMovie pref. Play-back via Camera (on <-> off some times)
• Some Cameras has a Menu where You must select DV-out to get it to work
• Camera connected to "charger" (mains adaptor) - not just on battery
• Camera set in Playback mode - NOT Recording mode
Does Your Camera work on another Mac ?
Sorry to say it is to easy to turn the 6-pin end of the FW-cable 180 deg wrong.
This is lethal to the A/D-chip in the Camera = needs an expensive repair.
(Hard to find out - else than import/export to another Mac ceased to work
everything else is OK e.g. recording and playback to TV)
A/D-box
• Is the dip-switches set right ?
• Set to same standard as recorded/editing e.g. NTSC 29.97fps or PAL 25fps
• Try resetting it
Connections
• Daisy Chaining most often doesn’t work (some unique cases - it’s the only way that work (some Canon Cameras ?))
Try to avoid connecting Camera <--> external HD <--> Mac but import directly to the Mac then move
the Movie project to dedicated external hard disk.
• FireWire-port - Can be re-setted by - Turn off Mac and disconnecting Mac from Mains/Power for 20-30 minutes
External device’s (hard disk’s)
• Should be FireWire as USB/USB2 performs badly and so does Airport or Net-work connected ones too.
• MUST BE - Mac OS Extended formatted - UNIX/DOS/FAT32/Mac OS Exchange - DO NOT WORK for video due to 4Gb barrier.
Mac
• Free space on internal (start-up) hard disk ? Please specify the amount of free space.
(Other hard disks don't count)
I go for a minimum of 25Gb free space for 4x3 SD Video - and my guess is 5 times more for 16x9 HD ones
after material is imported and edited. No Camera or A/D-box
• GarageBands fix - Close iMovie, Open GarageBand, Play some notes, Close GB and iMove can now be OK
• Does Your Mac have a FireWire Port
• White MacBooks - don't
• MacBook-Air - don't
if not then a few Mac’s has a PCM-CIA slot and there are FW-Cards that makes a FW-port this way
else - NO SOLUTION
Only option as I get it is either
• Use another Mac to Capture material (to an external USB2 - Mac OS Extended formatted hard disk - or -
• Change to another Camera that can be used with Your Mac (no there are no miniDV tape Cameras that can)
• If Your Mac-Book has a PCM-CIA Card place - then there are FW-port-Cards and then
You can import via this - but I've not seen this on more modern Macs. My PowerBook G4
has one and this FW-Card-port works greatly.
SoftWare
• Delete iMovie pref. file may help sometimes. I rather start a new account, log into this and have a re-try.
• Any strange Plug-ins into QuickTime as Perian etc ? Remove and try again.
• FileVault is off ? (hopefully)
• Screen Saver - OFF
• Energy Saver - OFF
Using WHAT versions ? .
• Mac OS - X.5.4 ?
• QuickTime version ? (This is the heart in both iMovie and FinalCut)
• iMovie’08 (7.1.?), 09 or 11 ?
• iMovie HD 6 (6.0.4/3) ?
Other ways to import Your miniDV tape
• Use another Camera. There where tape play-back stations from SONY
but they costed about 2-4 times a normal miniDV Camera.
• If Your Camera works on another Mac. Make an iMovie movie project here and move it
over to Your Mac via an external hard disk.
(HAS TO BE Mac OS Extended formatted - USB/DOS/FAT32/Mac OS Exchange WILL NOT DO)
(Should be a FireWire one - USB/USB2 performs badly)
from LKN 1935.
Hi Bengt W, I tried it all, but nothing worked. Your answer has been helpful insofar as all the different trials led to the conclusion that there was something wrong with my iMovie software. I therefore threw everything away and reinstalled iMovie from the HD. After that the exportation of DV videos (there has not been any problem with HDV videos) to my Sony camcorders worked properly as it did before. Thank you. LKN 1935
from Karsten.
in addition to Bengt's excellent '9 yards of advice' ..
camera set to 'Play' , not rec/computer/etc.?
camera not on battery, but power-line?
did your Mac 'recognize' this camera before...?
a technical check.
connect camera, on, playback, fw-connected...
click on the Blue Apple, upper left of your screen ..
choose 'About . . / More . .
under Firewire.. what do you read . . ?
More
• FileVault - Secure that it’s turned off
• Network storage - DOESN’T WORK
• Where did You store/capture/import Your project ?
External USB hard disk = Bad Choice / FireWire = Good
If so it has to be Mac OS Extended formatted
----> UNIX/DOS/FAT32/Mac OS Exchange is NOT Working for VIDEO !
mbolander
Thanks for all your suggestions. What I learned is that I had a software problem. I had something called "Nikon Transfer" on my Mac that was recognizing my Canon camcorder as a still camera and was preventing iMovie from working properly. After un-installing Nikon Transfer and doing a reboot, everything worked great.
I never liked the Nikon Transfer software anyway--I guess I'll get a cheap card reader and use that to transfer photos in the future.
No Camera or bad import
• USB hard disk
• Network storage
• File Vault is on
jiggaman15dg wrote
if you have adobe cs3 or 4 and have the adobe bridge on close that
or no firewire will work
see if that helps
DJ1249 wrote
The problem was the external backup hard drive that is connected, you need to disconnect the external drive before the mac can see the video camera.
MaryBoog wrote
Maybe your problems is solved in the meantime, but for all others this might help as I had the same problem, also have the Sony HDR-HC7, but the 7e (Europe, PAL). I found this link today and it works perfectly
//support.sony-europe.com/tutorials/dime/videotransfer/vtransfer.aspx site=odw_en_GB&sec=DVH&m=HDR-HC7E
What I exactly did.- put camera in play mode - open guide - choose connection guide - choose comp./printer (where to transfer movie to) - select connection.- i-link (on my camera) but equal to firewire - OK - choose HDV - choose NO for conversion of i.link.
Settings are shown then (VCR HDV/DV.- HDV and i.link-conv..- OFF), press OK, OK, END.
Switch camera off. Connect firewire cable to camera & Mac. Switch camera on, in play/edit mode.
Open i-movie, choose import from camera. On screen below the camera connection is shown.- DV (HDV). Now you can import, automatically or manually.
This worked perfectly for me. Took me 2 days to find out. Could not find any clear thread explaining what I had to do on the camera and the manual was not clear either.
Yours Bengt W -
Profit Center not getting uploaded through BAPI for MM01. Pls help
Hello all,
I am getting an errror while uploading a file through BAPI for MM01 , The error says
Error:
Profit center 1000/sslcommon does not exist
for material: AC2
*& Report ZBAPI_DUMMY
REPORT ZBAPI_MM01.
*& Report ZBAPI2
TABLES
FLAGS *
DATA: F_STOP. " Flag used to stop processing
DATA DECLARATIONS *
DATA : V_EMPTY TYPE I, " No. of empty records
V_TOTAL TYPE I. " Total no. of records.
STRUCTURES & INTERNAL TABLES
*--- BAPI structures
DATA: BAPI_HEAD LIKE BAPIMATHEAD, " Header Segment with Control
BAPI_MAKT LIKE BAPI_MAKT, " Material Description
BAPI_MARA1 LIKE BAPI_MARA, " Client Data
BAPI_MARAX LIKE BAPI_MARAX, " Checkbox Structure for BAPI_MARA
BAPI_MARC1 LIKE BAPI_MARC, " Plant View
BAPI_MARCX LIKE BAPI_MARCX, " Checkbox Structure for BAPI_MARC
BAPI_MBEW1 LIKE BAPI_MBEW, " Accounting View
BAPI_MBEWX LIKE BAPI_MBEWX, " Checkbox Structure for BAPI_MBEW
BAPI_RETURN LIKE BAPIRET2, " Return Parameter
BAPI_MARDL LIKE BAPI_MARD,
BAPI_MARDX LIKE BAPI_MARDX.
*--- Internal table to hold excel file data
DATA: IT_INTERN TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
*--- Internal table to hold Matetrial descriptions
DATA: BEGIN OF IT_MAKT OCCURS 100.
INCLUDE STRUCTURE BAPI_MAKT.
DATA: END OF IT_MAKT.
*--- Internal to hold the records in the text file
DATA : BEGIN OF IT_DATA OCCURS 100,
WERKS(4), " Plant
MTART(4), " Material type
MATNR(18), " Material number
MATKL(9) , " Material group
MBRSH(1), " Industry sector
MEINS(3), " Base unit of measure
SPART(2), " Division
EKGRP(3), " Purchasing group
PRCTR(10), " Profit Center
VPRSV(1), " Price control indicator
BKLAS(4), "Valuation Class
*stprs(12), " Standard price
PEINH(3), " Price unit
SPRAS(2), " Language key
MAKTX(40), " Material description
LGORT(4) , " storage location
DISMM(2) , "MRP TYPE
VERPR(23), " Moving Average Price
MTVFP(2) , " Availability Check
DISLS(2) , "Lot Size
DISPO(3) , "MRP Controller
BESKZ(1) , "Procurment Type
FHORI(3) , "SCHEDMARGIN KEY
PERKZ(1) , "Period Indicator
END OF IT_DATA.
SELECTION SCREEN. *
SELECTION-SCREEN BEGIN OF BLOCK SCR1 WITH FRAME TITLE TEXT-111.
PARAMETER : P_FILE TYPE RLGRAP-FILENAME OBLIGATORY " Input File
PARAMETER : P_MAX(4) OBLIGATORY DEFAULT '100'. " no.of recs in a session
PARAMETERS: P_HEADER TYPE I DEFAULT 0. " Header Lines
PARAMETERS: P_BEGCOL TYPE I DEFAULT 1 NO-DISPLAY,
P_BEGROW TYPE I DEFAULT 2 NO-DISPLAY,
P_ENDCOL TYPE I DEFAULT 100 NO-DISPLAY,
P_ENDROW TYPE I DEFAULT 32000 NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK SCR1.
AT SELECTION-SCREEN *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
*--- Validating file
PERFORM VALIDATE_FILE USING P_FILE.
START-OF-SELECTION
START-OF-SELECTION.
*--- Perform to convert the Excel data into an internal table
PERFORM CONVERT_XLS_ITAB.
IF NOT IT_DATA[] IS INITIAL.
*--- Perform to delete Header lines
PERFORM DELETE_HEADER_EMPTY_RECS.
ENDIF.
END OF SELECTION. *
END-OF-SELECTION.
*--- Perform to upload Material Master data
PERFORM UPLOAD_MATMAS.
Form : validate_input_file
Description : To provide F4 help for file if read from PC
FORM VALIDATE_FILE USING F_FILE TYPE RLGRAP-FILENAME.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
CHANGING
FILE_NAME = F_FILE
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE S010(ZLKPL_MSGCLASS). " 'Error in getting filename'.
ENDIF.
ENDFORM. " validate_input_file
*& Form CONVER_XLS_ITAB
text
FORM CONVERT_XLS_ITAB.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_FILE
I_BEGIN_COL = P_BEGCOL
I_BEGIN_ROW = P_BEGROW
I_END_COL = P_ENDCOL
I_END_ROW = P_ENDROW
TABLES
INTERN = IT_INTERN.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*--- Perform to move the data into an internal data
PERFORM MOVE_DATA.
ENDFORM. " CONVERT_XLS_ITAB
*& Form MOVE_DATA
text
FORM MOVE_DATA.
DATA : LV_INDEX TYPE I.
FIELD-SYMBOLS <FS> .
*--- Sorting the internal table
SORT IT_INTERN BY ROW COL.
CLEAR IT_INTERN.
LOOP AT IT_INTERN.
MOVE IT_INTERN-COL TO LV_INDEX.
*--- Assigning the each record to an internal table row
ASSIGN COMPONENT LV_INDEX OF STRUCTURE IT_DATA TO <FS> .
*--- Asigning the field value to a field symbol
MOVE IT_INTERN-VALUE TO <FS> .
AT END OF ROW.
APPEND IT_DATA.
CLEAR IT_DATA.
ENDAT.
ENDLOOP.
ENDFORM. " MOVE_DATA
*& Form DELETE_HEADER_EMPTY_RECS
To delete the Header and empty records
FORM DELETE_HEADER_EMPTY_RECS.
DATA: LV_TABIX LIKE SY-TABIX.
IF NOT P_HEADER IS INITIAL.
LOOP AT IT_DATA.
IF P_HEADER > 0 AND NOT IT_DATA IS INITIAL.
DELETE IT_DATA FROM 1 TO P_HEADER.
P_HEADER = 0.
EXIT.
ENDIF.
ENDLOOP.
ENDIF.
CLEAR IT_DATA.
*--- To delete the empty lines from internal table
LOOP AT IT_DATA.
LV_TABIX = SY-TABIX.
IF IT_DATA IS INITIAL.
V_EMPTY = V_EMPTY + 1.
DELETE IT_DATA INDEX LV_TABIX..
ENDIF.
ENDLOOP.
CLEAR IT_DATA.
*--- Total no of recs in file
DESCRIBE TABLE IT_DATA LINES V_TOTAL.
IF V_TOTAL = 0.
MESSAGE I013(ZLKPL_MSGCLASS). " No records in the file
F_STOP = 'X'.
STOP.
ENDIF.
ENDFORM. " DELETE_HEADER_EMPTY_RECS
*& Form UPLOAD_MATMAS
to upload Material Master data
FORM UPLOAD_MATMAS .
LOOP AT IT_DATA.
Header
BAPI_HEAD-MATERIAL = IT_DATA-MATNR.
BAPI_HEAD-IND_SECTOR = IT_DATA-MBRSH.
BAPI_HEAD-MATL_TYPE = IT_DATA-MTART.
BAPI_HEAD-BASIC_VIEW = 'X'.
BAPI_HEAD-PURCHASE_VIEW = 'X'.
BAPI_HEAD-ACCOUNT_VIEW = 'X'.
BAPI_HEAD-storage_view ='X'.
bapi_head-mrp_view = 'X'.
bapi_head-COST_view ='X'.
Material Description
REFRESH IT_MAKT.
IT_MAKT-LANGU = IT_DATA-SPRAS.
IT_MAKT-MATL_DESC = IT_DATA-MAKTX.
APPEND IT_MAKT.
Client Data - Basic
BAPI_MARA1-MATL_GROUP = IT_DATA-MATKL.
BAPI_MARA1-BASE_UOM = IT_DATA-MEINS.
bapi_mara1-unit_of_wt = it_data-gewei.
BAPI_MARA1-DIVISION = IT_DATA-SPART.
BAPI_MARAX-MATL_GROUP = 'X'.
BAPI_MARAX-BASE_UOM = 'X'.
BAPI_MARAX-UNIT_OF_WT = 'X'.
BAPI_MARAX-DIVISION = 'X'.
Plant - Purchasing
BAPI_MARC1-PLANT = IT_DATA-WERKS.
BAPI_MARC1-PUR_GROUP = IT_DATA-EKGRP.
BAPI_MARC1-PROFIT_CTR = IT_DATA-PRCTR.
BAPI_MARC1-MRP_TYPE = IT_DATA-DISMM.
BAPI_MARC1-AVAILCHECK = IT_DATA-MTVFP.
BAPI_MARC1-LOTSIZEKEY = IT_DATA-DISLS.
BAPI_MARC1-MRP_CTRLER = IT_DATA-DISPO.
BAPI_MARC1-PROC_TYPE = IT_DATA-BESKZ.
BAPI_MARC1-SM_KEY = IT_DATA-FHORI.
BAPI_MARC1-PERIOD_IND = IT_DATA-PERKZ.
BAPI_MARCX-PLANT = IT_DATA-WERKS.
BAPI_MARCX-PUR_GROUP = 'X'.
BAPI_MARCX-AVAILCHECK = 'X'.
BAPI_MARCX-PROFIT_CTR = 'X'.
BAPI_MARCX-MRP_TYPE = 'X'.
BAPI_MARCX-MRP_CTRLER = 'X'.
BAPI_MARCX-SM_KEY = 'X'.
BAPI_MARCX-LOTSIZEKEY = 'X'.
Storage Location.
BAPI_MARDL-PLANT = IT_DATA-WERKS.
BAPI_MARDL-STGE_LOC = IT_DATA-LGORT.
BAPI_MARDX-PLANT = IT_DATA-WERKS.
BAPI_MARDX-STGE_LOC = IT_DATA-LGORT.
Accounting
BAPI_MBEW1-VAL_AREA = IT_DATA-WERKS.
BAPI_MBEW1-PRICE_CTRL = IT_DATA-VPRSV.
BAPI_MBEW1-VAL_CLASS = IT_DATA-BKLAS.
BAPI_MBEW1-MOVING_PR = IT_DATA-VERPR.
bapi_mbew1-std_price = it_data-stprs.
BAPI_MBEW1-PRICE_UNIT = IT_DATA-PEINH.
BAPI_MBEWX-VAL_AREA = IT_DATA-WERKS.
BAPI_MBEWX-PRICE_CTRL = 'X'.
BAPI_MBEWX-STD_PRICE = 'X'.
BAPI_MBEWX-PRICE_UNIT = 'X'.
BAPI_MBEWX-MOVING_PR = 'X'.
*--- BAPI to create material
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
HEADDATA = BAPI_HEAD
CLIENTDATA = BAPI_MARA1
CLIENTDATAX = BAPI_MARAX
PLANTDATA = BAPI_MARC1
PLANTDATAX = BAPI_MARCX
FORECASTPARAMETERS =
FORECASTPARAMETERSX =
PLANNINGDATA =
PLANNINGDATAX =
STORAGELOCATIONDATA = BAPI_MARDL
STORAGELOCATIONDATAX = BAPI_MARDX
VALUATIONDATA = BAPI_MBEW1
VALUATIONDATAX = BAPI_MBEWX
WAREHOUSENUMBERDATA =
WAREHOUSENUMBERDATAX =
SALESDATA = BAPI_MVKE1
SALESDATAX = BAPI_MVKEX
STORAGETYPEDATA =
STORAGETYPEDATAX =
IMPORTING
RETURN = BAPI_RETURN
TABLES
MATERIALDESCRIPTION = IT_MAKT
UNITSOFMEASURE =
UNITSOFMEASUREX =
INTERNATIONALARTNOS =
MATERIALLONGTEXT =
TAXCLASSIFICATIONS =
RETURNMESSAGES =
PRTDATA =
PRTDATAX =
EXTENSIONIN =
EXTENSIONINX =
IF BAPI_RETURN-TYPE = 'E'.
WRITE:/ 'Error:' ,BAPI_RETURN-MESSAGE ,'for material:' ,
IT_DATA-MATNR.
ELSEIF BAPI_RETURN-TYPE = 'S'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN = BAPI_RETURN
WRITE: 'Successfully created material' ,IT_DATA-MATNR.
ENDIF.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN = BAPI_RETURN
ENDLOOP.
ENDFORM. " UPLOAD_MATMASthe Profit center 1000/sslcommon not created. first create the profit center and then upload your data.check tcode KE52 for created profit centers...
-
Upload Purchase info Records using LSMW
Hi,
Im uploading purchase info records using LSMW - direct method
Object 0060 Purchasing info rec.
Method 0000
Program Name RM06IBI0
i need step by step process for this. any one have done this using this program help me out.
Regards,
VimalHello Jürgen
and thank you!
One additional question: When I import info records using LSMW, one condition record (PB00) is created automatically. Is it possible to change the validity of that condition record using LSMW, too? Or can I only create new condition records?
Thanks again
Alicia -
Need Sample code to upload the data to Application Server
Hi ,
I need to upload the data to application server.
The output should be an XML file.
Can anybody send me sample code for this.
Reward points are assured.
Best Regards
Bhagat.may be this code wil help ,first to downjload the XML fine -
1)
REPORT zhr_test2_tk.
TYPE-POOLS: ixml.
TYPES: BEGIN OF xml_line,
data(256) TYPE x,
END OF xml_line.
DATA: l_ixml TYPE REF TO if_ixml,
l_streamfactory TYPE REF TO if_ixml_stream_factory,
l_ostream TYPE REF TO if_ixml_ostream,
l_renderer TYPE REF TO if_ixml_renderer,
l_document TYPE REF TO if_ixml_document.
DATA: l_element_position TYPE REF TO if_ixml_element,
l_element_title TYPE REF TO if_ixml_element,
l_element_flight TYPE REF TO if_ixml_element,
l_element_from TYPE REF TO if_ixml_element,
l_element_to TYPE REF TO if_ixml_element,
l_element_dummy TYPE REF TO if_ixml_element,
l_value TYPE string.
DATA: l_xml_table TYPE TABLE OF xml_line,
l_xml_size TYPE i,
l_rc TYPE i.
DATA: lt_erec TYPE TABLE OF hrp5126,
l_erec TYPE hrp5126.
DATA: date(10),
time(4),
filepath TYPE string.
CONSTANTS: filedir TYPE string VALUE 'C:\tmp\',
filename TYPE string VALUE 'ZHR_test'.
START-OF-SELECTION.
fill internal table
SELECT * FROM hrp5126 INTO TABLE lt_erec.
Start filling xml DOM object from internal table lt_erec.
LOOP AT lt_erec INTO l_erec.
*Create the root node 'position'
IF sy-tabix EQ 1.
create an ixml factory
l_ixml = cl_ixml=>create( ).
create Document Object Model
l_document = l_ixml->create_document( ).
Fill root node with value 'position'
l_element_position = l_document->create_simple_element(
name = 'position'
parent = l_document ).
ENDIF.
IF sy-tabix GT 1.
create element jobtitle as child of position
l_value = l_erec-jobtitle.
l_element_title = l_document->create_simple_element(
name = 'job_title'
parent = l_element_position
value = l_value ).
l_value = l_erec-empl_start_date.
l_element_dummy = l_document->create_simple_element(
name = 'StartDate'
parent = l_element_title
value = l_value ).
l_value = l_erec-empl_end_date.
l_element_dummy = l_document->create_simple_element(
name = 'EndDate'
parent = l_element_title
value = l_value ).
ENDIF.
ENDLOOP.
IF sy-subrc NE 0.
WRITE: 'No data in table hrp5125'.
ENDIF.
create a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
connect internal XML table to streamfactory
l_ostream = l_streamfactory->create_ostream_itable(
table = l_xml_table ).
render the document
l_renderer = l_ixml->create_renderer( ostream = l_ostream
document = l_document ).
l_rc = l_renderer->render( ).
Get time and date
WRITE sy-uzeit2(2) TO time2(2).
WRITE sy-uzeit0(2) TO time0(2).
WRITE sy-datum4(2) TO date0(2).
WRITE sy-datum6(2) TO date2(2).
WRITE sy-datum0(4) TO date4(4).
*Build filename with date and time reference
CONCATENATE filedir filename date time '.xml' INTO filepath.
<i>* This is the code I hope to modify in order to save the xml structure on the application server, with a specified filepath.</i>
<b> OPEN DATASET filepath FOR OUTPUT IN BINARY MODE.
LOOP AT lt_erec into l_erec.
TRANSFER l_erec TO filepath.
ENDLOOP.
CLOSE DATASET filepath.</b>
save XML document
l_xml_size = l_ostream->get_num_written_raw( ).
*This is the code for download to local computer
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize = l_xml_size
filename = filepath
filetype = 'BIN'
CHANGING
data_tab = l_xml_table
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
2) uploading tht PC XML file to APPliaction server -
DATA rec like QISRS_XML_LINE.
OPEN DATASET filepath FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT l_xml_table into rec.
TRANSFER rec TO filepath.
ENDLOOP.
CLOSE DATASET filepath.
Maybe you are looking for
-
Any recommendations regarding guitar to MacBook Pro audio interface?
I'm ready to plug some electric guitar into my Garage Band. Any advice as to what's a decent piece of equipment or audio cable?
-
Why do u inhabit truecaller from showing non saved contacts as other operating systems
I have a truecaller app but it don't show names for unsaved no. When they calls as I was used in Samsung for example and when I asked the apps co. They told me that apple don't allow them to do..so please could u guys manage this
-
Cannot install sqldeveloper 64 bits on windows 7
I am trying to install SQL Developer on windows 7. I unzipped it under C:\program Files\sqldeveloper ok I run it as administrator it asks for the path to java.exe, so I provided it and I get Cannot Find J2SE SDK installed I searched and found that th
-
What is the correct sequence preset to choose?
Now a days I shoot AVCHD but I have video from years past that is from several different Video cameras, on my hard drive, just waiting until I get around to editing it. How do I determine which of those many presets that are available to choose from,
-
I have had an apple ID for at least 8 years I now have a diffeent deslyop computer and email address from when I opened the account when my email changed I updated my email and continued to download music books apps etc after a recent update I can no