Need Function module to upload an excel file to SAP
Need Function module to upload more than 100 characters of excel file data into SAP internal table.
Currently i have two function module
1. ALSM_EXCEL_TO_INTERNAL_TABLE --32 characters max
2. KCD_EXCEL_OLE_TO_INT_CONVERT --50 characters max
Please let me know some pointers.
Thanks in Advance,
A.Karthikeyan.
hi,
use the FM GUI_UPLOAD
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = W_FILENAME
FILETYPE = W_FILETYPE
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = 'X'
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = wp_it_upload
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.
Similar Messages
-
Can anybody help how to upload an excel file into sap-crm urgent
hi guys,
i need the right function module to upload the excel file from the presentation server in to sap-crm.
1) I know we use the function module 'ALSM_EXCEL_TO_INT_TABLE' in sap-r/3 but this function module is not exist in sap-crm.
2) i tried with the function moduel 'GUI_UPLOAD' but its not uploading correctly i am gettting hases(#).
Please can any one provide the right function module to upload the excel into sap-crm with an sample code.
thanks
viswa gunthaHi Visma,
Please check this link for sample custom FM.
Re: function mudule for MS excel file to sap crm
Hope this will help.
Regards,
Ferry Lianto
Please reward points if helpful as away to say thanks. -
Need help in uploading an excel file into SAP
Hi All,
I got a requirement to upload an excel file to SAP.
But When i tried with the FM "ALSM_EXCEL_TO_INTERNAL_TABLE" , file not getting uploaded to internal table.
Getting expection 2, UPLOAD_OLE...
I think the problem is with the file... the following the sample text of the file...
Technical IdentNo. Line No. Text Location
BS-PZ-180 1 035-05 EXZENTER-SCHNECKENPUMPE 0026
BS-PZ-180 2 LIEFERANT : SOCSIL-INTER SA ECUBLENS 0026
BS-PZ-180 3 HERSTELLER : MONO PUMPS LIMITED MANCH 0026
BS-PZ-180 4 MODELL/TYP : SH 60 0026
But when I tried with only one Column..its getting successfully uploaded...
Pls suggest me how to upload the file? ( May be with sample code)
Also pls let me know hw to handle the file..which contains 5 differnt sheets of texts.. ( May be with sample code)
Your suggestion will be highly appreciated...
Thanks,
PriyaHi,
Use the FM: TEXT_CONVERT_XLS_TO_SAP. It will work perfectly. I used this function module and uploaded data from xls to sap. check the following code:
TYPE-POOLS: truxs.
PARAMETERS: p_file TYPE rlgrap-filename.
TYPES: BEGIN OF t_datatab,
PROP_NAME like SDOKPROP-PROP_NAME,
PROP_CHECK like SDOKPROP-PROP_CHECK,
TABNAME like SDOKPROP-TABNAME,
FIELDNAME like SDOKPROP-FIELDNAME,
DESCRIPT(30) type c,
END OF t_datatab.
DATA: it_datatab type standard table of t_datatab,
itab TYPE STANDARD TABLE OF t_datatab,
wa_itab TYPE t_datatab,
wa_datatab type t_datatab.
DATA: it_raw TYPE truxs_t_text_data.
At selection screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
field_name = 'P_FILE'
IMPORTING
file_name = p_file.
*START-OF-SELECTION.
START-OF-SELECTION.
SELECT * FROM sdokprop INTO CORRESPONDING FIELDS OF TABLE itab
WHERE PROP_NAME LIKE 'DMS%'.
WRITE / 'Before Modification'.
LOOP AT itab INTO wa_itab.
WRITE:/1 wa_itab-PROP_NAME, 27 wa_itab-PROP_CHECK, 31 wa_itab-TABNAME, 65 wa_itab-FIELDNAME, 96 wa_itab-DESCRIPT.
CLEAR wa_itab.
ENDLOOP.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
i_line_header = 'X'
i_tab_raw_data = it_raw " WORK TABLE
i_filename = p_file
TABLES
i_tab_converted_data = it_datatab[] "ACTUAL DATA
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
END-OF-SELECTION.
END-OF-SELECTION.
WRITE / 'After Modification'.
MODIFY sdokprop FROM TABLE it_datatab.
LOOP AT it_datatab INTO wa_datatab.
WRITE:/1 wa_datatab-PROP_NAME, 27 wa_datatab-PROP_CHECK, 31 wa_datatab-TABNAME, 65 wa_datatab-FIELDNAME, 96 wa_datatab-DESCRIPT.
CLEAR wa_datatab.
ENDLOOP.
IF sy-subrc = 0.
MESSAGE 'successfull' TYPE 'S'.
ELSE.
MESSAGE 'failed' TYPE 'E'.
ENDIF.
Regards,
Bhaskar -
BDC : Function Module to Upload Unicode text file
Hi Friends,
Can anyone tell me how to upload data to internal table by taking it from unicode text file ?
at present i'm using FM - GUI_UPLOAD which do not support Unicode text file.
SonalHi,
U Have to use CodePage Parameter to upload the data.
Check the Description
Character Representation for Output
Description
Use parameter CODEPAGE to specify the desired source codepage. If this parameter is not set, the codepage of the SAP GUI is used as the source codepage.
Value range
4-digit number of the SAP codepage. The function module SCP_CODEPAGE_BY_EXTERNAL_NAME provides the SAP codepage number for an external character set name, for example, "iso-8859-1". The function module NLS_GET_FRONTEND_CP provides the respective non-Unicode frontend codepage for a language.
The desired codepage can be determined interactively, if the parameter with_encoding of method file_open_dialog is set by cl_gui_frontend_services.
If the specified codepage is not suited for the Byte Order Mark of the file, an exception is triggered.
SPACE: Codepage of the frontend operating system
Default
SPACE -
Upload excel file in SAP BI-7.0
Hi ,
i need to upload an excel file in SAP BI 7.0 where the standard r/3 fm are not available.
Currently we uploading a file in CSV format but now we want to upload using XLS also.
ia way to upload excel file in SAP BI 7.0
Best Regards,
Sharad
Edited by: sharad narayan on Jan 7, 2011 10:58 AM
while searching the forum i found the fm MS_EXCEL_OLE_STANDARD_DAT .
but while using this FM i am getting the exception file not exist.
Kindlu suggest what to do
i even tried the FM TMP_GUI_GET_FILE_EXIST' to check the existence of the file.
even then same problem.
Please suggest
Edited by: sharad narayan on Jan 10, 2011 2:51 PMHi,
Scheduled jobs are the jobs for which we have scheduled for a time, may be daily so that each day the scheduled jobs will trigger at the time given.So that every time u need not to trigger the job manully urself as the schedule time will hit the job will trigger itself.
Released job means the job which is in between Sheduled state and active state.say For eg: 10 jobs are Scheduled in a queue Job no 1 is released from the queue that means any moment it will be in active state.So it is the state between Schedule and Active state of a job.
Thanks
Varun -
Function module to upload excel to internal table in SAP 7.0 version system
<<Question has been asked and answered many times - please search before asking for function modules for common tasks>>
currently i am using SAP Netweaver7.0 version, i need a Funtion Module to upload an Excel sheet data to an internal table.
please let me know this ASAP.
thanks,
Edited by: Matt on Aug 24, 2009 7:25 AMhi,
the FM you have suggested does not exist in the *version 7.0*
added the FM "ALSM_....",also does not exist
pls suggest a FM for SAP7.0 version -
Function module to upload Excel in version 3.1
Hi,
Please can anybody tell me what is the function module to upload Excel sheet in SAP version 3.1.its urgent
And also the user-command in radio buttons is not working in version 3.1. Please suggest me the right code for radio buttons in 3.1 version.
please find the following code for radio buttons
SELECTION-SCREEN BEGIN OF BLOCK blck WITH FRAME TITLE text-001.
PARAMETERS: r_local radiobutton group g1 user-command ucomm,
r_app radiobutton group g1,
p_filename LIKE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK blck.
Thanks in Advance....
Regards,
Swapna
Edited by: Alvaro Tejada Galindo on Feb 29, 2008 10:22 AMHi,
Use Ws_upload function module.
Regards,
Sunil -
Need to upload the excel file having extension .XLSX
Hello,
I am not able to upload the excel file having extension .XLSX But i can upload the excel file having extension .XLS .
Please Guide me what are the changes i need to do... for uploading the excel file".XLSX".
Thanks.Hi,
What issue you are facing? Refer this document: Upload/Read .xlsx file in SAP Web Dynpro . You need to on Netweaver 712 to use the classes mentioned in this document.
Regards,
Kiran -
Hi,
I am getting an error while trying to upload a excel file. I am using the function HR_KR_XSTRING_TO_STRING for conversion. The error message is "Unable to interpret as a number"First of all, are you sure you know what you are working with here. If this is standard Excel file in the Microsoft binary/propriatery format there is not function module or class in ABAP that can magically just transform this to a character string. You should search the forums as this has been discussed extensively. On that topic, please also do not post duplicate threads. I have already locked your other thread with the same basic question.
Instead of the binary/propriatery format of Excel, the file should be saved on the client as a text based format - like XML or Text Tab Delimited. You can then use several different options on the server to convert the XSTRING to STRING and process the content (becuase it was text based to begin with). You could use CL_BCS_CONVERT, the function modules in the function group SCMS_CONV, or the class CL_ABAP_CONV_IN_CE. -
Problem in uploading an excel file in wd abap
I am trying to upload an excel file in wd abap but on uploading it shows me the data in the form of some codes but when i try to do the same thing using text file it works well.Plese refer the code .
METHOD onactionon_upload .
TYPES : BEGIN OF itab_str1,
name(10) TYPE c,
age(10) TYPE c,
END OF itab_str1.
DATA : t_table1 TYPE STANDARD TABLE OF itab_str1,
i_data TYPE STANDARD TABLE OF string,
lo_nd_sflight TYPE REF TO if_wd_context_node,
lo_el_sflight TYPE REF TO if_wd_context_element,
l_string TYPE string,
fs_table TYPE itab_str1,
l_xstring TYPE xstring,
fields TYPE string_table,
lv_field TYPE string.
DATA : t_table TYPE if_main=>elements_data_tab,
data_table TYPE if_main=>elements_data_tab.
wd_context->get_attribute(
EXPORTING
name = 'DATASOURCE'
IMPORTING
value = l_xstring
CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
EXPORTING
in_xstring = l_xstring
IMPORTING
out_string = l_string.
SPLIT l_string AT cl_abap_char_utilities=>newline INTO TABLE i_data.
LOOP AT i_data INTO l_string.
SPLIT l_string AT cl_abap_char_utilities=>horizontal_tab INTO TABLE fields.
READ TABLE fields INTO lv_field index 1.
fs_table-name = lv_field.
READ TABLE fields INTO lv_field index 2.
fs_table-age = lv_field.
APPEND fs_table TO t_table1.
ENDLOOP.
lo_nd_sflight = wd_context->get_child_node( 'DATA_TAB').
lo_nd_sflight->bind_table( t_table1 ).
ENDMETHOD.Problem is not with the file format nor Upload element.
problem is with conversion function module, still now for conversion of xcel data to string format we dont have perfect function module.
CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
EXPORTING
in_xstring = l_xstring
IMPORTING
out_string = l_string.
That's a bug with xcel conversion As of now I dont find any fm which converts xcel data to string without any problem.
Regards
Srinvivas
Edited by: sanasrinivas on Dec 23, 2011 7:02 AM -
Hi Friends,
Iam trying to Upload Excel file into SAP using the FM
ALSM_EXCEL_TO_INTERNAL_TABLE. But it is going to dump n the error is
The call to the function module "ALSM_EXCEL_TO_INTERNAL_TABLE" is incorrect:
In the function module interface, you can specify only
fields of a specific type and length under "INTERN".
Although the currently specified field
"ITAB" is the correct type, its length is incorrect.
I have attached the code also.
Please let me know where iam getting the error.
Code :
Tables : mara,
ztable.
parameters : p_infile like rlgrap-filename.
data : begin of itab occurs 0,
matnr like mara-matnr,
mbrsh like mara-mbrsh,
matkl like mara-matkl,
end of itab.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = p_infile
I_BEGIN_COL = 1
I_BEGIN_ROW = 1
I_END_COL = 100
I_END_ROW = 100
TABLES
INTERN = itab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
sort itab by matnr.
loop at itab.
write:/ itab.
*modify ztable from table itab.
endloop.hi check this code:
DATA : BEGIN OF TYP_INPUT ,
MATNR LIKE MARA-MATNR,
WERKS LIKE MARC-WERKS,
LGORT LIKE MARD-LGORT,
LGNUM LIKE MLGN-LGNUM,
LGTYP LIKE MLGT-LGTYP,
LTKZA LIKE MLGN-LTKZA,
LTKZE LIKE MLGN-LTKZE,
LGBKZ LIKE MLGN-LGBKZ,
LGPLA LIKE MLGT-LGPLA,
END OF TYP_INPUT.
*Input File Data
DATA : IT_FILE LIKE TYP_INPUT OCCURS 0 WITH HEADER LINE.
*"INTERNAL TAB TO TAKE EXCEL SHEET.
DATA : IT_EXCEL LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_PFILE
I_BEGIN_COL = 1
I_BEGIN_ROW = 2
I_END_COL = 9
I_END_ROW = 6000
TABLES
INTERN = IT_EXCEL
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
* IT_EXCEL CONTAINS DATA IN THE FORM OF ROW, COL, VALUE *
* CONVERTING THAT INTERNAL TABLE TO FORMAT THAT OF EXCEL SHEET *
IF NOT IT_EXCEL[] IS INITIAL.
SORT IT_EXCEL BY ROW COL.
LOOP AT IT_EXCEL.
CASE IT_EXCEL-COL.
WHEN 1.
IT_FILE-MATNR = IT_EXCEL-VALUE.
WHEN 2.
IT_FILE-WERKS = IT_EXCEL-VALUE.
WHEN 3.
IT_FILE-LGORT = IT_EXCEL-VALUE.
WHEN 4.
IT_FILE-LGNUM = IT_EXCEL-VALUE.
WHEN 5.
IT_FILE-LGTYP = IT_EXCEL-VALUE.
WHEN 6.
IT_FILE-LTKZA = IT_EXCEL-VALUE.
WHEN 7.
IT_FILE-LTKZE = IT_EXCEL-VALUE.
WHEN 8.
IT_FILE-LGBKZ = IT_EXCEL-VALUE.
WHEN 9.
IT_FILE-LGPLA = IT_EXCEL-VALUE.
ENDCASE.
AT END OF ROW.
APPEND IT_FILE.
CLEAR IT_FILE.
ENDAT.
ENDLOOP.
ELSE.
MESSAGE I000 WITH 'The input file is empty'.
STOP.
ENDIF. -
Uploading an excel file in an internal table.
hi experts,
I m trying to upload a excel file comprising of 16,000 records using the function module 'ALSM_EXCEL_TO_INTERNAL_TABLE' as follws
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_input
i_begin_col = 1
i_begin_row = 1
i_end_col = 30
i_end_row = 65000
TABLES
intern = g_t_excel
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
My problem is I am unable to upload record number 10001 else all the records are uploaded successfully
can anyone help me in solving this problemFORM upload_itab .
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = p_file
FILETYPE = 'ASC'
HEADLEN = ' '
LINE_EXIT = ' '
TRUNCLEN = ' '
USER_FORM = ' '
USER_PROG = ' '
DAT_D_FORMAT = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = itab
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
NO_AUTHORITY = 10
OTHERS = 11
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 of excel file in to purchase order
hi guys,
i want to upload a excel file to the internal table and then to create the purchase order.
i know the name of function module and bapi.
but how to make use of them in implementation!!!
fun module : ALSM_EXCEL_TO_INTERNAL_TABLE
bapi : BAPI_PO_CREATE1.
arun and vishnu from
infotech solutions*CREATION OF A TEMPORARY STRUCTURE FOR INSERTING FIELDS OF EXCEL TO INTERNAL TABLE.
TYPES : BEGIN OF STR_FINAL,
COMP_CODE TYPE BAPIMEPOHEADER-COMP_CODE, " STRUCTURE : BAPIMEPOHEADER
ITEM_INTVL TYPE BAPIMEPOHEADER-ITEM_INTVL,
VENDOR TYPE BAPIMEPOHEADER-VENDOR,
PMNTTRMS TYPE BAPIMEPOHEADER-PMNTTRMS,
PURCH_ORG TYPE BAPIMEPOHEADER-PURCH_ORG,
PUR_GROUP TYPE BAPIMEPOHEADER-PUR_GROUP,
CURRENCY TYPE BAPIMEPOHEADER-CURRENCY,
PO_ITEM TYPE BAPIMEPOITEM-PO_ITEM, " STRUCTURE : BAPIMEPOITEM
MATERIAL TYPE BAPIMEPOITEM-MATERIAL,
PLANT TYPE BAPIMEPOITEM-PLANT,
STGE_LOC TYPE BAPIMEPOITEM-STGE_LOC,
QUANTITY TYPE BAPIMEPOITEM-QUANTITY,
TAX_CODE TYPE BAPIMEPOITEM-TAX_CODE,
ITEM_CAT TYPE BAPIMEPOITEM-ITEM_CAT,
ACCTASSCAT TYPE BAPIMEPOITEM-ACCTASSCAT,
SCHED_LINE TYPE BAPIMEPOSCHEDULE-SCHED_LINE, " STRUCTURE : BAPIMEPOSCHEDULE
DELIVERY_DATE TYPE BAPIMEPOSCHEDULE-DELIVERY_DATE,
SERIAL_NO TYPE BAPIMEPOACCOUNT-SERIAL_NO, " STRUCTURE : BAPIMEPOACCOUNT
GL_ACCOUNT TYPE BAPIMEPOACCOUNT-GL_ACCOUNT,
COSTCENTER TYPE BAPIMEPOACCOUNT-COSTCENTER,
CO_AREA TYPE BAPIMEPOACCOUNT-CO_AREA,
END OF STR_FINAL.
DATA : IT_FINAL TYPE TABLE OF STR_FINAL,
WA_FINAL TYPE STR_FINAL.
DATA: ST_BAPIMEPOHEADER TYPE BAPIMEPOHEADER,
ST_BAPIMEPOHEADERX TYPE BAPIMEPOHEADERX.
*it is for item data
DATA: WA_POITEM TYPE BAPIMEPOITEM,
IT_POITEM TYPE TABLE OF BAPIMEPOITEM,
WA_POITEMX TYPE BAPIMEPOITEMX,
IT_POITEMX TYPE TABLE OF BAPIMEPOITEMX,
WA_POSCHEDULE TYPE BAPIMEPOSCHEDULE,
IT_POSCHEDULE TYPE TABLE OF BAPIMEPOSCHEDULE,
WA_POSCHEDULEX TYPE BAPIMEPOSCHEDULX,
IT_POSCHEDULEX TYPE TABLE OF BAPIMEPOSCHEDULX,
WA_POACCOUNT TYPE BAPIMEPOACCOUNT,
IT_POACCOUNT TYPE TABLE OF BAPIMEPOACCOUNT,
WA_POACCOUNTX TYPE BAPIMEPOACCOUNTX,
IT_POACCOUNTX TYPE TABLE OF BAPIMEPOACCOUNTX,
WA_RETURN TYPE BAPIRET2,
IT_RETURN TYPE TABLE OF BAPIRET2.
selection-screen skip 1.
parameters: p_file type localfile default 'D:\VISHNU\DEMO.XLS'.
*selection-screen skip 1.
at selection-screen on value-request for p_file.
call function 'KD_GET_FILENAME_ON_F4'
exporting
static = 'X'
changing
file_name = p_file.
start-of-selection.
clear IT_FINAL.
refresh IT_FINAL.
perform upload_data.
loop at IT_FINAL INTO WA_FINAL.
write:/ WA_FINAL-COMP_CODE,
/ WA_FINAL-ITEM_INTVL,
/ WA_FINAL-VENDOR,
/ WA_FINAL-PMNTTRMS,
/ WA_FINAL-PURCH_ORG,
/ WA_FINAL-PUR_GROUP,
/ WA_FINAL-CURRENCY,
/ WA_FINAL-PO_ITEM,
/ WA_FINAL-MATERIAL,
/ WA_FINAL-PLANT,
/ WA_FINAL-STGE_LOC,
/ WA_FINAL-QUANTITY,
/ WA_FINAL-TAX_CODE,
/ WA_FINAL-ITEM_CAT,
/ WA_FINAL-ACCTASSCAT,
/ WA_FINAL-SCHED_LINE,
/ WA_FINAL-DELIVERY_DATE,
/ WA_FINAL-SERIAL_NO,
/ WA_FINAL-GL_ACCOUNT,
/ WA_FINAL-COSTCENTER,
/ WA_FINAL-CO_AREA.
endloop.
LOOP AT IT_FINAL INTO WA_FINAL.
ST_BAPIMEPOHEADER-COMP_CODE = WA_FINAL-COMP_CODE.
ST_BAPIMEPOHEADER-DOC_TYPE = 'NB'.
ST_BAPIMEPOHEADER-ITEM_INTVL = WA_FINAL-ITEM_INTVL.
ST_BAPIMEPOHEADER-VENDOR = WA_FINAL-VENDOR.
ST_BAPIMEPOHEADER-LANGU = SY-LANGU.
ST_BAPIMEPOHEADER-PMNTTRMS = WA_FINAL-PMNTTRMS.
ST_BAPIMEPOHEADER-PURCH_ORG = WA_FINAL-PURCH_ORG.
ST_BAPIMEPOHEADER-PUR_GROUP = WA_FINAL-PUR_GROUP.
ST_BAPIMEPOHEADER-CURRENCY = WA_FINAL-CURRENCY.
*insert ST_BAPIMEPOHEADERX values
ST_BAPIMEPOHEADERX-COMP_CODE = 'X'.
ST_BAPIMEPOHEADERX-DOC_TYPE = 'X'.
ST_BAPIMEPOHEADERX-ITEM_INTVL = 'X'.
ST_BAPIMEPOHEADERX-VENDOR = 'X'.
ST_BAPIMEPOHEADERX-LANGU = 'X'.
ST_BAPIMEPOHEADERX-PMNTTRMS = 'X'.
ST_BAPIMEPOHEADERX-PURCH_ORG = 'X'.
ST_BAPIMEPOHEADERX-PUR_GROUP = 'X'.
ST_BAPIMEPOHEADERX-CURRENCY = 'X'.
*insert IT_POITEM values
WA_POITEM-PO_ITEM = WA_FINAL-PO_ITEM.
WA_POITEM-MATERIAL = WA_FINAL-MATERIAL.
WA_POITEM-PLANT = WA_FINAL-PLANT.
WA_POITEM-STGE_LOC = WA_FINAL-STGE_LOC.
WA_POITEM-QUANTITY = WA_FINAL-QUANTITY.
WA_POITEM-TAX_CODE = WA_FINAL-TAX_CODE.
WA_POITEM-ITEM_CAT = WA_FINAL-ITEM_CAT.
WA_POITEM-ACCTASSCAT = WA_FINAL-ACCTASSCAT.
APPEND WA_POITEM TO IT_POITEM.
CLEAR WA_POITEM.
*insert IT_POITEMX values
WA_POITEMX-PO_ITEM = WA_FINAL-PO_ITEM.
WA_POITEMX-PO_ITEMX = 'X'.
WA_POITEMX-MATERIAL = 'X'.
WA_POITEMX-PLANT = 'X'.
WA_POITEMX-STGE_LOC = 'X'.
WA_POITEMX-QUANTITY = 'X'.
WA_POITEMX-TAX_CODE = 'X'.
WA_POITEMX-ITEM_CAT = 'X'.
WA_POITEMX-ACCTASSCAT = 'X'.
APPEND WA_POITEMX TO IT_POITEMX.
CLEAR WA_POITEMX.
*insert IT_POSCHEDULE values
WA_POSCHEDULE-PO_ITEM = WA_FINAL-PO_ITEM.
WA_POSCHEDULE-SCHED_LINE = WA_FINAL-SCHED_LINE.
WA_POSCHEDULE-DELIVERY_DATE = WA_FINAL-DELIVERY_DATE .
WA_POSCHEDULE-QUANTITY = WA_FINAL-QUANTITY.
APPEND WA_POSCHEDULE TO IT_POSCHEDULE.
CLEAR WA_POSCHEDULE.
*insert IT_POSCHEDULEX values
WA_POSCHEDULEX-PO_ITEM = WA_FINAL-PO_ITEM.
WA_POSCHEDULEX-SCHED_LINE = WA_FINAL-SCHED_LINE.
WA_POSCHEDULEX-PO_ITEMX = 'X' .
WA_POSCHEDULEX-SCHED_LINEX = 'X' .
WA_POSCHEDULEX-DELIVERY_DATE = 'X' .
WA_POSCHEDULEX-QUANTITY = 'X' .
WA_POSCHEDULEX-PO_ITEM = WA_FINAL-PO_ITEM .
WA_POSCHEDULEX-SCHED_LINE = WA_FINAL-SCHED_LINE.
WA_POSCHEDULEX-PO_ITEMX = 'X'.
WA_POSCHEDULEX-SCHED_LINEX = 'X' .
WA_POSCHEDULEX-DELIVERY_DATE = 'X' .
WA_POSCHEDULEX-QUANTITY = 'X'.
WA_POSCHEDULEX-PO_ITEM = WA_FINAL-PO_ITEM.
WA_POSCHEDULEX-SCHED_LINE = WA_FINAL-SCHED_LINE.
WA_POSCHEDULEX-PO_ITEMX = 'X'.
WA_POSCHEDULEX-SCHED_LINEX = 'X'.
WA_POSCHEDULEX-DELIVERY_DATE = 'X' .
WA_POSCHEDULEX-QUANTITY = 'X'.
APPEND WA_POSCHEDULEX TO IT_POSCHEDULEX.
CLEAR WA_POSCHEDULEX.
*insert IT_POACCOUNT values
WA_POACCOUNT-PO_ITEM = WA_FINAL-PO_ITEM.
WA_POACCOUNT-SERIAL_NO = WA_FINAL-SERIAL_NO.
WA_POACCOUNT-QUANTITY = WA_FINAL-QUANTITY .
WA_POACCOUNT-GL_ACCOUNT = WA_FINAL-GL_ACCOUNT.
WA_POACCOUNT-COSTCENTER = WA_FINAL-COSTCENTER.
WA_POACCOUNT-CO_AREA = WA_FINAL-CO_AREA.
APPEND WA_POACCOUNT TO IT_POACCOUNT.
CLEAR WA_POACCOUNT.
*insert IT_POACCOUNTX values
WA_POACCOUNTX-PO_ITEM = 00001.
WA_POACCOUNTX-SERIAL_NO = 01.
WA_POACCOUNTX-QUANTITY = 'X'.
WA_POACCOUNTX-GL_ACCOUNT = 'X'.
WA_POACCOUNTX-COSTCENTER = 'X' .
WA_POACCOUNTX-CO_AREA = 'X'.
APPEND WA_POACCOUNTX TO IT_POACCOUNTX.
CLEAR WA_POACCOUNTX.
ENDLOOP.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
POHEADER = ST_BAPIMEPOHEADER
POHEADERX = ST_BAPIMEPOHEADERX
POADDRVENDOR =
TESTRUN =
MEMORY_UNCOMPLETE =
MEMORY_COMPLETE =
POEXPIMPHEADER =
POEXPIMPHEADERX =
VERSIONS =
IMPORTING
EXPPURCHASEORDER =
EXPHEADER =
EXPPOEXPIMPHEADER =
TABLES
RETURN = IT_RETURN
POITEM = IT_POITEM
POITEMX = IT_POITEMX
POADDRDELIVERY =
POSCHEDULE = IT_POSCHEDULE
POSCHEDULEX = IT_POSCHEDULEX
POACCOUNT = IT_POACCOUNT
POACCOUNTPROFITSEGMENT =
POACCOUNTX = IT_POACCOUNTX
POCONDHEADER =
POCONDHEADERX =
POCOND =
POCONDX =
POLIMITS =
POCONTRACTLIMITS =
POSERVICES =
POSRVACCESSVALUES =
POSERVICESTEXT =
EXTENSIONIN =
EXTENSIONOUT =
POEXPIMPITEM =
POEXPIMPITEMX =
POTEXTHEADER =
POTEXTITEM =
ALLVERSIONS =
POPARTNER =
*this is for save the porder number
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
*dispaly the results
LOOP AT IT_RETURN INTO WA_RETURN.
WRITE:/ WA_RETURN-MESSAGE,
ST_BAPIMEPOHEADER-PO_NUMBER.
ENDLOOP.
form upload_data.
data: file type rlgrap-filename.
data: IT_XCEL type table of alsmex_tabline,
WA_XCEL TYPE ALSMEX_TABLINE.
file = p_file.
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = file
i_begin_col = '1'
i_begin_row = '1'
i_end_col = '21'
i_end_row = '1'
tables
intern = IT_xcel
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
loop at IT_xcel INTO WA_XCEL.
case
WA_XCEL-COL.
when '0001'.
WA_FINAL-COMP_CODE = WA_xcel-value.
WHEN '0002'.
WA_FINAL-ITEM_INTVL = WA_XCEL-VALUE.
WHEN '0003'.
WA_FINAL-VENDOR = WA_XCEL-VALUE.
WHEN '0004'.
WA_FINAL-PMNTTRMS = WA_XCEL-VALUE.
WHEN '0005'.
WA_FINAL-PURCH_ORG = WA_XCEL-VALUE.
WHEN '0006'.
WA_FINAL-PUR_GROUP = WA_XCEL-VALUE.
WHEN '0007'.
WA_FINAL-CURRENCY = WA_XCEL-VALUE.
WHEN '0008'.
WA_FINAL-PO_ITEM = WA_XCEL-VALUE.
WHEN '0009'.
WA_FINAL-MATERIAL = WA_XCEL-VALUE.
WHEN '00010'.
WA_FINAL-PLANT = WA_XCEL-VALUE.
WHEN '00011'.
WA_FINAL-STGE_LOC = WA_XCEL-VALUE.
WHEN '00012'.
WA_FINAL-QUANTITY = WA_XCEL-VALUE.
WHEN '00013'.
WA_FINAL-TAX_CODE = WA_XCEL-VALUE.
WHEN '00014'.
WA_FINAL-ITEM_CAT = WA_XCEL-VALUE.
WHEN '00015'.
WA_FINAL-ACCTASSCAT = WA_XCEL-VALUE.
WHEN '00016'.
WA_FINAL-SCHED_LINE = WA_XCEL-VALUE.
WHEN '00017'.
WA_FINAL-DELIVERY_DATE = WA_XCEL-VALUE.
WHEN '00018'.
WA_FINAL-SERIAL_NO = WA_XCEL-VALUE.
WHEN '00019'.
WA_FINAL-GL_ACCOUNT = WA_XCEL-VALUE.
WHEN '00020'.
WA_FINAL-COSTCENTER = WA_XCEL-VALUE.
WHEN '00021'.
WA_FINAL-CO_AREA = WA_XCEL-VALUE.
ENDCASE.
at end of row.
append WA_FINAL TO IT_FINAL.
clear WA_FINAL.
endat.
ENDLOOP.
ENDFORM. -
How to upload a excel file in webdynpro? Please help!
Hi Experts,
I have a requirement where I need to upload a excel file in my webdynpro for ABAP report.
I have used the fileupload UI element in my view and a upload button.
However when I test the application I found that it is getting file data as some junk value like below:
###ࡱ#################>########################################################################################################################################################################################################################################
Why is that so?
Is there any limitation with fileuplaod reading excel file?
Do i have to use any encoding option?
What is the alternative option to read excel file in ABAP webdynpro?
Thanks
GopalHi,
Check this.. Write this code in Upload button 's method
********** Reading data from flat file ****************
DATA lo_el_context TYPE REF TO if_wd_context_element.
DATA ls_context TYPE wd_this->element_context.
DATA lv_datasource type xstring.
* get element via lead selection
lo_el_context = wd_context->get_element( ).
* get single attribute
lo_el_context->get_attribute(
EXPORTING
name = `DATASOURCE`
IMPORTING
value = lv_datasource ).
CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
EXPORTING
* FROM_CODEPAGE = '8500'
IN_XSTRING = LV_DATASOURCE
* OUT_LEN = '1'
IMPORTING
OUT_STRING = LV_STRING.
SPLIT LV_STRING AT CL_ABAP_CHAR_UTILITIES=>NEWLINE INTO TABLE IT_STR.
LOOP AT IT_STR INTO LV_STRING.
SPLIT LV_STRING AT CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB INTO TABLE FIELDS.
READ TABLE FIELDS INTO LV_FIELD INDEX 1. " Reading 1st field
ls_header-STATU = LV_FIELD.
clear LV_FIELD.
READ TABLE FIELDS INTO LV_FIELD INDEX 2. " Reading 2st field
ls_header-LIFNR = LV_FIELD.
clear LV_FIELD.
READ TABLE FIELDS INTO LV_FIELD INDEX 3.
ls_header-BSART = LV_FIELD.
clear LV_FIELD.
READ TABLE FIELDS INTO LV_FIELD INDEX 4.
ls_header-EKORG = LV_FIELD.
clear LV_FIELD.
READ TABLE FIELDS INTO LV_FIELD INDEX 5.
ls_header-EKGRP = LV_FIELD.
clear LV_FIELD.
READ TABLE FIELDS INTO LV_FIELD INDEX 6.
ls_header-BUKRS = LV_FIELD.
clear LV_FIELD.
APPEND wa to it.
append ls_header to lt_header.
clear: ls_header,wa.
endloop.
lo_nd_header->BIND_TABLE( lt_header ).
Thanks,
Ramesh
Edited by: Rameshkumar Raamasamy on Dec 20, 2010 11:16 AM -
Urgent : Uploading an excel file to an internal table
Hi All
M problem is simple ..i have to upload an excel file from my PC which is containing 2 cols to an internal table which is having two fields .. I am using GUI_UPLOAD function module for this and using FILELD_SEPARATOR as 'X" .. But i am not able to upload anything .it gives some junk content to my internal tble .
please help me out
Regards
rohanHi Rohan,
Use the following code.
DATA: IT_MAIN LIKE STANDARD TABLE OF ALSMEX_TABLINE WITH HEADER LINE.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = 'c:\test.xls'
i_begin_col = 1
i_begin_row = 1
i_end_col = 4
i_end_row = 4
tables
intern = IT_MAIN
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
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 IT_MAIN.
WRITE:/ IT_MAIN-ROW, ' ',
IT_MAIN-COL, ' ',
IT_MAIN-VALUE, ' '.
ENDLOOP.
The field VALUE of internal table IT_MAIN will contain the data. The first row will contain data from the first column, second for the second column and so on... In your case, the third row will contain 2nd row data from the first column of your excel sheet and so on.
Hopw this helps,
Cheers,
Madhur
Maybe you are looking for
-
How can I subscribe to different podcasts on different computers?
Up until recenlty, I could susbcribe to different casts on two different computers. I sync my iPod with my iMac at home, and use this for most of my podcast listening. At work, I had a different set of podcasts I listened to at my desk. Now, I get b
-
Quick help: Taking MBP in for repair, need to lock folders?
hey guys, I'm supposed to drop my MBP off at an Apple Reseller today to replace the disc drive. They want me to drop it off today, but the replacement drive won't be here until tomorrow. They asked that I provide my user password so they can login an
-
App download error, always error for download ,can't clean temp
right now, I'm Using Mountain lion as OS At App Store, I was try to download imovie , but it fail to completed the program and install its show error ("small") red word before install botton no matter how i did, just can't completed the program I did
-
Best connection with U-verse Gateway and AirPort Extreme
These past couple of weeks I've been having problems where my AirPort Extreme (connected to my U-verse Gateway) has been randomly rebooting. I had Apple exchange the entire unit along with power cables and AT&T has already switched out the Gateway an
-
ME9F - Prints only one message
Hi all, I'm having a problem when printing more than one purchase order message in ME9F. When I select all messages to be printed, only one is going to printer, and the other ones stay in spool list with status "-" (not yet sent to the host system).