Reading records from excel
hi all,
i am using Forms [32 Bit] Version 6.0.8.24.1 (Production).
i am uploading data from excel to form(record wise)and saving.
now i am reading the data from 2nd row by assuming that 1st row followed with columns titles.But, my question is we cannot predict the excel that the record always starts from 2nd row. how check for the starting for the actual data
is its something like if column1 is null and col2 is null and col3 is null
then increment the row and repeat the process.. but, upto which record i should continue this process..
anybody is having better solution than this..
Thanks..
Hi,
The nice option would be keep the upload (start from and end) manually, What i mean is in the uploading screen put two more fields like Start Row and End Row and let the user fill these fields before starting the upload process. So, if any error will happen during upload then let the user handle.
-Ammad
Similar Messages
-
Read data from excel sheet and then perform the required operations.
Hi all
I need to write a procedure which can read data from excel sheet.I have excel sheet in which i have to options one is modification and other is addition.so if it reads modification then i need to read the concerned table name then check its availability in pl-sql datbase.If table exists then reading the realated column in that row to fire the querry. The excel sheet is saved in local disk c.
can anybody help me with this.How i need to start specialy to read the data from excel sheet saved in local disk c.
Edited by: user13334062 on Jun 30, 2010 3:45 AMHi
If you can convert the excel to a csv format, then it can be simply query from DB Creating Oracle External Tables. Best part is that you may still change the CSV using EXCEL.
Following action Points can be adopt;
*1. Convert Excel File to a csv. File Save as CSV*
*2. Create Oracle Directory* ( This has to be the location of your excel file )
SQL> Create directory mydir as 'C:\testdb'; --- "testdb" is the location folder in win for your excel sheet.
*3. Create the External Table*
SQL> create table my_ext_tab (
Field1 Datatype,
Field2 Datatype,
Field3 Datatype,
Field4 Datatype,
Field5 Datatype
Organization external
(type oracle_loader default directory mydir
access parameters (records delimited by newline fields terminated by ',')
location ('my_ext_tab.csv'))
reject limit 100;
*4. Now you can query the table "my_ext_tab"*
Select * from "my_ext_tab";
Please avoid the reformat the data column inside the spreadsheet (CSV). -
How to read records from Relationship table using ABAP API's
Hi All,
I need to retrieve the records from Relationship table. In Java API's I came to know there is an option to retrieve this. I could not find anything in ABAP API's. Is there any option in ABAP API's to do this.
Please Suggest.
Thank You,
Gajendra.Hi Gajendra,
You can mainly read records from MDM (in a DDIC structure) using ABAP API's using the following function modules/methods:
1. RETRIEVE: This is used to generically retrieve records from tables. Attributes and Values can also be retrieved.
2. RETRIEVE SIMPLE: Retrieve records from MDM in a simple way.( simple data types).
3. RETRIEVE CHECKOUT: Retrieves all checked out ID's.
4. RETRIEVE ATTRIBUTES: Retrieves attribute(s) from a Taxanomy table.
You will find all these methods in the following interface
Interface : IF_MDM_CORE_SERVICES
Hope it helps.
*Please reward points if found useful.
Thanks and Regards
Nitin Jain -
Using ResultSet to read records from multiple tables
Im using a ResultSet object to read records from tables.
I have a database with 5 tables. Initially, I got it to work fine with one of those tables. What Im exactly trying to do is check if there is a record in a table which matches a given string, and if it does, display some text on some JTextFields. I got that to work fine with one table.
Problem is, how do I get it to work with all 5 tables at the same time?
i.e. instead of searching through one table, I want it to look through all 5 tables and look for the matches.
Any help greatly appreciated.
ThanksAfter the first interaction with the first table, I
used a stmt.getMoreResults() followed by instructions
to get data from the second table, and so on.
Worked fine.Sounds remarkably inefficient. (Potential for lots of network traffic.)
is this another way of doing it?Sounds more like a document search type of thing than a database query. What about Lucene? Could it help here?
% -
Read data from Excel file and diaplay in Webdynpro
Hi all,
I need some help. I have a Excel file with set of name, phonenumbers . I want to know how to display the data using Webdynpro. Could some one help me. help is appreciated and I promise to award points for right answer.
Thank you
Maruti<b>Hi
i can explain you to read data from Excel file
First You have to download the jxl.jar file. You can get this file from the Below site
</b><a href="http://www.andykhan.com/jexcelapi/download.html">jexcelapi jar</a>
It will be in Compressed Fromat So Unzip it to get the Contents
After Unzipping The File You will get a Folder (jexcelapi/jxl.jar)
Now in NWDS open web dynpro explorer, Right Click Your Project, a popup menu will appear and in that click Properties
You will get window displaying your Project Properties
On Left Side of the window You Will Find "Java Build Path"
Click That "Java Build Path" and you will get 4 Tabs Showing ( Source,Projects,Libraries,Order and Export)
Click Libraries Tab
You will find options many options buttons
In that click the Button "Add External Jars"
You will get Window in order to fecth the jxl.jar file from the location you had stored
After selecting the jxl.jar i will get displayed and click ok
Now Open Navigator
Open Your Project
You will find Lib folder
Copy the jxl.jar to that lib folder
Note : You cannot Read the Content from the excel file directly
First You Have to copy that file to the Server,
And from the Server you can get the file absolute path
With the absolute path you can read the contents of the Excel file
You have to save the Excel file as .xls Format and Not as xlsx format i will not accept that...
You have Upload the Excel file from the Server Using the File Upload UI Element
This Coding will extract 3 columns from the Xls File
Coding
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import com.sap.fileupload.wdp.IPrivateFileUpload_View;
import com.sap.tc.webdynpro.services.sal.datatransport.api.IWDResource;
public void onActionUpload_File(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionUpload_File(ServerEvent)
IPrivateFileUpload_View.IContextElement element1 = wdContext.currentContextElement();
IWDResource resource = element1.getFileResource();
element1.setFileName(resource.getResourceName());
element1.setFileExtension(resource.getResourceType().getFileExtension());
//@@end
public void onActionUpload_File_in_Server(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionUpload_File_in_Server(ServerEvent)
InputStream text=null;
int temp=0;
try
File file = new File(wdContext.currentContextElement().getFileResource().getResourceName().toString());
FileOutputStream op = new FileOutputStream(file);
if(wdContext.currentContextElement().getFileResource()!=null)
text=wdContext.currentContextElement().getFileResource().read(false);
while((temp=text.read())!=-1)
op.write(temp);
op.flush();
op.close();
path = file.getAbsolutePath();
wdComponentAPI.getMessageManager().reportSuccess(path);
catch(Exception e)
e.printStackTrace();
//@@end
public void onActionUpload_Data_into_Table(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionUpload_Data_into_Table(ServerEvent)
try
Workbook wb =Workbook.getWorkbook(new File(path));
Sheet sh = wb.getSheet(0);
//wdComponentAPI.getMessageManager().reportSuccess("Columns = "+sh.getColumns());
//wdComponentAPI.getMessageManager().reportSuccess("Rows = "+sh.getRows());
int columns = sh.getColumns();
int rows = sh.getRows();
int i=0;
for(int j=1;j<=rows;j++)
ele=wdContext.nodeTable_Data().createTable_DataElement();
Cell c1 = sh.getCell(i,j);
ele.setTab_Name(c1.getContents());
Cell c2 = sh.getCell(i+1,j);
ele.setTab_Degree(c2.getContents());
Cell c3 = sh.getCell(i+2,j);
ele.setTab_Percentage(c3.getContents());
wdContext.nodeTable_Data().addElement(ele);
catch(Exception ex)
wdComponentAPI.getMessageManager().reportSuccess(ex.toString());
//@@end
* The following code section can be used for any Java code that is
* not to be visible to other controllers/views or that contains constructs
* currently not supported directly by Web Dynpro (such as inner classes or
* member variables etc.). </p>
* Note: The content of this section is in no way managed/controlled
* by the Web Dynpro Designtime or the Web Dynpro Runtime.
//@@begin others
String path;
IPrivateFileUpload_View.ITable_DataElement ele;
//@@end
Regards
Chandran S -
Read data from Excel and write into oracle database
Hi
I want to know how can i read data from excel and write into oracle database using java.Kindly help me out to find a solution.
Thanks and Regards
NeetaHai,
I am suggesting the solution.
I will try out and let u know soon.
Make a coma separated file from your excel file.
Assuming that your requirement allows to make a csv file.
This file may be passed as an file object to be read by java.Using JDBC you must be able to populate the data base.You can also use String Tokenizer if needed.
You do not want to go via sql Loader?
For reading the excel file itself do you want java? -
Read records from VALUES OBJECT using the INTERATOR
Hi
I'm trying to read records from my value object with interator these way:
ValidaUsu usuVO = new ValidaUsu();
for (Iterator it = usuVO it.hasNext(); ) {
System.out.println(" User from VO: " + usuVO.getUsuario());
But i don't know what i`m doing wrong ?
Could help me?
ThanksHi Gajendra,
You can mainly read records from MDM (in a DDIC structure) using ABAP API's using the following function modules/methods:
1. RETRIEVE: This is used to generically retrieve records from tables. Attributes and Values can also be retrieved.
2. RETRIEVE SIMPLE: Retrieve records from MDM in a simple way.( simple data types).
3. RETRIEVE CHECKOUT: Retrieves all checked out ID's.
4. RETRIEVE ATTRIBUTES: Retrieves attribute(s) from a Taxanomy table.
You will find all these methods in the following interface
Interface : IF_MDM_CORE_SERVICES
Hope it helps.
*Please reward points if found useful.
Thanks and Regards
Nitin Jain -
Problem in reading data from Excel sheet to 2D string array (ActiveX & LabView).
I am trying to read data from Excel sheet to 2D string array (ActiveX & LabView). Error -2147352571 is generated (type mismatch) if cell value is "#NULL!", "#N/A" etc. What should I do?
Hello �
Is the error happening when the cell value is #NULL or #NA only?
Sometimes these errors occur because of an ActiveX object mismatch. The version of the ActiveX object might have changed or been updated since the VI was created. The VI tries to use an earlier, incompatible version of the ActiveX object.
To solve the problem, you need to link automation refnum terminal to the correct ActiveX object. To do so, right-click an automation refnum terminal and choose Select ActiveX Class»Browse from the shortcut menu. From the Type Library pull-down menu, select the latest version of the library you want to use, such as Microsoft Excel Object Library. In the Objects list, select an ActiveX object, and click the OK button. Link ea
ch automation refnum terminal in the VI and its subVIs until the run arrow is not broken. Also, you might have to replace some or all of the Invoke Nodes and Property Nodes for the ActiveX objects.
Also, I came across this Knowledgebase. The error number is slightly different but it is always good to check it out and make sure it is not your case.
Hope this helps.
S Vences
Applications Engineer
National Instruments -
Hello,
I have a table which is linked (using FK) with a number of other tables which are linked with other tables, etc. (like a tree). Using ADO.NET EF provider within ODAC 11.2.0.3 Release 5 I am trying to get a record from the root table. I coded a test using MSTest and when I do "myContext.MyTable.Where(...).FirstOrDefault();" VS2010 stops the debugging process after a while - no exception is caught in code but I get an error in Test results window: "The test adapter 'UnitTestAdapter' threw an exception while running test '<my test>'. Exception has been thrown by the target of an invocation.
Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
In the Debug window/view I get this:
A first chance exception of type 'System.AccessViolationException' occurred in Oracle.DataAccess.dll
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter.dll
Step into: Stepping over method without symbols 'Microsoft.VisualStudio.TestTools.Agent.AgentExecution.CallAdapterRunMethod'
W, 7380, 13, 2012/11/09, 23:33:29.803, QTAgent32.exe, AgentExecution: Exception while calling TestAdapter.Run: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Oracle.DataAccess.Client.OpsDac.Read(IntPtr opsConCtx, IntPtr opsErrCtx, IntPtr opsSqlCtx, IntPtr& opsDacCtx, OpoSqlValCtx* pOpoSqlValCtx, OpoMetValCtx* pOpoMetValCtx, OpoDacValCtx* pOpoDacValCtx)
at Oracle.DataAccess.Client.OracleDataReader.Read()
at System.Data.Common.Internal.Materialization.Shaper`1.StoreRead()
at System.Data.Common.Internal.Materialization.Shaper`1.SimpleEnumerator.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
at System.Data.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__1[TResult](IEnumerable`1 sequence)
at System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot)
at System.Data.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[S](Expression expression)
at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source)
at <my code stack>
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.DefaultTestMethodInvoke(Object[] args)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.DefaultTestMethodDecorator.Invoke(Object[] args)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.RunTestMethod()
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.ExecuteTest()
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.Execute(UnitTestResult result)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestRunner.ExecuteSingleTest(UnitTestExecuter executer, UnitTestElement test, ITestContext testContext, UnitTestAdapterContext userContext, Boolean isLoadTest)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestRunner.Run(UnitTestElement test, ITestContext testContext, Boolean isLoadTest, Boolean useMultipleCpus)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestRunner.Run(UnitTestElement test, ITestContext testContext, Boolean isLoadTest, Boolean useMultipleCpus)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter.Run(ITestElement testElement, ITestContext testContext, Boolean isLoadTest)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter.Run(ITestElement testElement, ITestContext testContext)
at Microsoft.VisualStudio.TestTools.Agent.AgentExecution.CallAdapterRunMethod(Object obj)
The thread 'Agent: adapter run thread for test '<my test>' with id '0779674e-2258-44d4-adfe-65302abbe50f'' (0x13e0) has exited with code 0 (0x0).
W, 7380, 30, 2012/11/09, 23:33:29.869, QTAgent32.exe, Performance warning: m_test should be null when TestResult is serialized. Please find the offending code and correct it.
E, 7380, 30, 2012/11/09, 23:33:29.879, QTAgent32.exe, AgentExecution: Received adapter message during test shutdown: run id {94200779-4759-4b4a-819c-61c55d39acbc}, test '<my test>' with id 0779674e-2258-44d4-adfe-65302abbe50f: MessageKind: Result, Outcome: Error
The thread 'ExecutionUtilities.InvokeWithTimeout helper thread 'Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter.AbortTestRun'' (0x1f98) has exited with code 0 (0x0).
The thread 'Agent: state execution thread for test '<my test>' with id '0779674e-2258-44d4-adfe-65302abbe50f'' (0x2688) has exited with code 0 (0x0).
The thread 'Agent: test queue thread' (0x1c58) has exited with code 0 (0x0).
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in Oracle.DataAccess.dll
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll
The thread '<No Name>' (0x24c0) has exited with code 0 (0x0).
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in System.Data.Entity.dll
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll
The thread '<No Name>' (0x2410) has exited with code 0 (0x0).
The thread '<No Name>' (0x2520) has exited with code 0 (0x0).
E, 7380, 6, 2012/11/09, 23:35:17.912, QTAgent32.exe, AgentObject: Cleanup: Timeout reached in cleaning up the agent.
E, 7380, 6, 2012/11/09, 23:35:22.918, QTAgent32.exe, AgentObject: Cleanup: Timeout reached in cleaning up the agent.
The program '[7380] QTAgent32.exe: Managed (v4.0.30319)' has exited with code 0 (0x0).
Any idea is appreciated!
Thanks
Edited by: 917334 on Nov 10, 2012 12:17 AM
The equivalent where statement works well in classic ADO.NET.Hello
Use the below function module
RV_ORDER_FLOW_INFORMATION pass the type as C and pass the number.You will get all the flow.
SELECT VBELN KNUMV BUKRS KUNRG REGIO NETWR FKSTO FKDAT FKART INTO CORRESPONDING FIELDS OF TABLE T_VBRK FROM VBRK WHERE BUKRS IN P_BUKRS AND FKDAT IN P_FKDAT AND VKORG IN P_VKORG AND REGIO = '07'
ORDER BY VBELN KNUMV.
SORT T_VBRK BY vbeln.
LOOP AT T_VBRK.
IF T_VBRK-FKART = 'F2' OR T_VBRK-FKART = 'YF2' OR T_VBRK-FKART = 'ZF2' OR
T_VBRK-FKART = 'ZG2' OR T_VBRK-FKART = 'ZL2' OR T_VBRK-FKART = 'YG2' OR T_VBRK-FKART = 'YL2' .
IF T_VBRK-FKSTO IS INITIAL.
i_vbco6-vbeln = t_vbrk-vbeln.
CALL FUNCTION 'RV_ORDER_FLOW_INFORMATION'
EXPORTING
AUFBEREITUNG = '2'
BELEGTYP = ' '
COMWA = i_vbco6
NACHFOLGER = 'X'
N_STUFEN = '50'
VORGAENGER = 'X'
V_STUFEN = '50'
IMPORTING
BELEGTYP_BACK =
TABLES
VBFA_TAB = t_vbfa
EXCEPTIONS
NO_VBFA = 1
NO_VBUK_FOUND = 2
OTHERS = 3
endif.
ENDIF.
endloop.
loop at t_vbfa.
if t_vbfa-vbtyp_V = 'C' OR t_vbfa-vbtyp_V = 'K' OR t_vbfa-vbtyp_V = 'L' OR t_vbfa-vbtyp_V = 'E' .
*clear t_vbfa.
SELECT VBELN BSTNK BSTDK FROM VBAK INTO CORRESPONDING FIELDS OF TABLE T_VBAK FOR ALL ENTRIES IN T_VBFA WHERE VBELN = T_VBFA-VBELV .
endif.
ENDLOOP.
In case of any more help is required do let me know
Regards,
Nabheet Madan -
How to Read data From Excel File in Labview 8.5?
We can read it from xls file, but it is encrypted..... we need exact data...
i have attached that excel file...i want to extract the full data from that file..how i can read it...when i read by using "Read from spreadsheet file" function, data was in encrypted form....so please send me the correct way...
Attachments:
stn_auto.xls 40 KB -
Removing adobe reader icon from excell and outlook
How can I permanently remove the adobe reader V9 icon from Excel and Outlook? I used toolbar customize to delete the icons but they come back when I restart the programs.
Sorry, your question is not clear. Can you give us the exact wording (or a screenshot) of that notification?
What is your operating system? -
How to Read records from structure to internal table
HI,
Can any body know how to read the records from structure to internal table at runtime.
please give me sample program if possible.
thanks in advance
KPif your internal table is having the same structure as the structure you are reading the values from then you can directly assign like..
internatable table work area or header line = structure.
or else if they are different assign field by field like
internal table-field1 = structure-field1.
internal table-field2 = structure-field2.
award points if it helps. -
FM HR_READ_INFOTYPE to read records from 3 infotypes
Hi all,
I am writing a report using PNP as my LDB. So there is a selection screen which can takes in the pernr and the dates as begda and endda. Based on this scenario, how do you normally use this FM 'HR_READ_INFOTYPE' to all the records from let say 2 fields from infotype p0000, 2 fields from p0001 and 3 fields from infotype p9999?Hi,
Since your are using PNP logical data base, I recomended extract the information via begda and endda limits for each infotype, ie.
GET PERNR. " fill all infotypes
rp_provide_from_last p0001 space pn-begda pn-endda. "extracts the records that meet the criteria
IF pnp-sw-found = '1'. "If found records DO ... whatever you want
write:/ 'Infotipo P001: ', p0001.
ELSE.
REJECT. "If not fount records ... next record.
ENDIF.
This example with infotype 0001, tha same method to infotype 0000, infotype 0002, to infotype 9999.
Regards
José Luis.
Edited by: Aguirre Eguiluz Jose Luis on Dec 9, 2010 10:32 AM
Edited by: Aguirre Eguiluz Jose Luis on Dec 9, 2010 10:33 AM
Edited by: Aguirre Eguiluz Jose Luis on Dec 9, 2010 10:34 AM -
BDC for Transaction IA01 including recording from excel (sample Code)
Dear Experts,
Can anyone give me a sample BDC code for transaction IA01 from excel
Thanks in advance
Regards
SayandeepHi,
Try This Code
report Y_P_GB01
no standard page heading line-size 255.
R O H M A N D H A A S C O M P A N Y *
======================================================================
Development ID : mqhpkl *
Creation Date : 24-11-2008 *
Developer Name : Paramesh Kalluri *
Program Title : Upload the Special Ledger data from Excel to SAP *
Description : *
Constants *
CONSTANTS: c_begcol TYPE i VALUE 1,
c_begrow TYPE i VALUE 1,
c_endcol TYPE i VALUE 10,
c_endrow TYPE i VALUE 10.
Types Declaration *
TYPES : begin of d_itab,
data element: BUKRS
BUKRS_001(004),
data element: DOCTY
DOCTY_002(002),
data element: RVERS
RVERS_003(003),
data element: BUDAT
DATE_004(010),
data element: RTCUR
RTCUR_005(005),
data element: GCURR_A
GCURR_006(005),
data element:
GD_USE_TARGET_LEDGER_007(001),
data element:
TARGET_LEDGER_008(002),
data element: UTAB_D
UTAB_009(030),
data element: VTCUR12
TSL_010(019),
end of d_itab.
Data Declarations *
DATA: it_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE,
it_bdcmsgcoll LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE,
XL_itab type alsmex_tabline occurs 0 with header line,
msg_disp TYPE string.
data : it_itab type standard table of d_itab,
wa_itab type d_itab.
Selection Screen *
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_file LIKE rlgrap-filename.
SELECTION-SCREEN: END OF BLOCK b1.
At Selection Screen for File *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
perform f4_filename.
Start-of-selection *
start-of-selection.
*Uploading the data from excel to internal table
perform excel_upload.
*Uploading to SAP
perform chek_data.
if sy-subrc ne 0.
perform format_message.
endif.
end-of-selection.
*& Form F4_FILENAME
Find the file
--> p1 text
<-- p2 text
FORM F4_FILENAME .
CALL FUNCTION 'F4_FILENAME'
IMPORTING
FILE_NAME = p_file.
ENDFORM. " F4_FILENAME
*& Form CHEK_DATA
text
--> p1 text
<-- p2 text
FORM CHEK_DATA .
loop at it_itab into wa_itab.
perform bdc_dynpro using 'SAPMGBUK' '0102'.
perform bdc_field using 'BDC_CURSOR'
'GLU1-BUKRS'.
perform bdc_field using 'BDC_OKCODE'
'=ERF'.
perform bdc_field using 'GLU1-BUKRS'
wa_itab-bukrs_001.
perform bdc_field using 'GLU1-DOCTY'
wa_itab-docty_002.
perform bdc_field using 'GLU1-RVERS'
wa_itab-RVERS_003.
perform bdc_field using 'RGBUK-DATE'
wa_itab-DATE_004.
perform bdc_field using 'GLU1-RTCUR'
wa_itab-RTCUR_005.
perform bdc_field using 'RGBUK-GCURR'
wa_itab-GCURR_006.
perform bdc_field using 'GD_USE_TARGET_LEDGER'
wa_itab-GD_USE_TARGET_LEDGER_007.
perform bdc_field using 'TARGET_LEDGER'
wa_itab-TARGET_LEDGER_008.
perform bdc_field using 'T883S-UTAB'
wa_itab-UTAB_009.
perform bdc_dynpro using 'SAPMGBUK' '0110'.
perform bdc_field using 'BDC_CURSOR'
'GLU1-TSL'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'GLU1-TSL'
wa_itab-TSL_010.
perform bdc_dynpro using 'SAPMGBUK' '0110'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
perform bdc_field using 'BDC_CURSOR'
'GLU1-TSL'.
perform bdc_dynpro using 'SAPLSPO1' '0200'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_dynpro using 'SAPMGBUK' '0102'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
perform bdc_field using 'BDC_CURSOR'
'GLU1-BUKRS'.
CALL TRANSACTION 'GB01' USING IT_BDCDATA MODE 'A' UPDATE 'A' MESSAGES
INTO IT_BDCMSGCOLL.
CLEAR WA_ITAB.
refresh it_bdcdata.
ENDLOOP.
ENDFORM. " CHEK_DATA
*& Form EXCEL_UPLOAD
text
--> p1 text
<-- p2 text
FORM EXCEL_UPLOAD .
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = p_file
I_BEGIN_COL = c_begcol
I_BEGIN_ROW = c_begrow
I_END_COL = c_endcol
I_END_ROW = c_endrow
TABLES
INTERN = xl_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.
loop at xl_itab.
case xl_itab-col.
when '1'.
wa_itab-bukrs_001 = xl_itab-value.
when '2'.
wa_itab-docty_002 = xl_itab-value.
when '3'.
wa_itab-RVERS_003 = xl_itab-value.
when '4'.
wa_itab-DATE_004 = xl_itab-value.
when '5'.
wa_itab-RTCUR_005 = xl_itab-value.
when '6'.
wa_itab-GCURR_006 = xl_itab-value.
when '7'.
wa_itab-GD_USE_TARGET_LEDGER_007 = xl_itab-value.
when '8'.
wa_itab-TARGET_LEDGER_008 = xl_itab-value.
when '9'.
wa_itab-UTAB_009 = xl_itab-value.
when '10'.
wa_itab-TSL_010 = xl_itab-value.
*at end of row.
append wa_itab to it_itab.
*endat.
endcase.
at end of row.
append wa_itab to it_itab.
endat.
endloop.
ENDFORM. " EXCEL_UPLOAD
*& Form BDC_DYNPRO
text
-->P_0169 text
-->P_0170 text
FORM BDC_DYNPRO USING A B.
clear it_bdcdata.
it_bdcdata-PROGRAM = A.
it_bdcdata-DYNPRO = B.
it_bdcdata-DYNBEGIN = 'X'.
APPEND it_bdcdata.
ENDFORM. " BDC_DYNPRO
*& Form BDC_FIELD
text
-->P_0174 text
-->P_0175 text
FORM BDC_FIELD USING C D.
clear
it_bdcdata.
it_bdcdata-FNAM = C.
it_bdcdata-FVAL = D.
APPEND it_bdcdata.
ENDFORM. " BDC_FIELD
*& Form FORMAT_MESSAGE
text
--> p1 text
<-- p2 text
FORM FORMAT_MESSAGE .
LOOP AT IT_BDCMSGCOLL.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = IT_BDCMSGCOLL-MSGID
LANG = '-D'
NO = it_bdcmsgcoll-msgnr
V1 = IT_BDCMSGCOLL-MSGV1
V2 = IT_BDCMSGCOLL-MSGV2
V3 = IT_BDCMSGCOLL-MSGV3
V4 = IT_BDCMSGCOLL-MSGV4
IMPORTING
MSG = MSG_DISP
EXCEPTIONS
NOT_FOUND = 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.
WRITE:/ MSG_DISP.
ENDLOOP.
ENDFORM. " FORMAT_MESSAGE
******************End of the Program**********
All the best -
Getting error when importing BP records from Excel
Hi,
I am familiar with importing from Excel into SAP using Admin>Data Import/Export, so I very puzzled by an error message.
Row Number 1: Default payment method should be included with the BP's payment methods [Business Partner - Payment Method Code]
This error appears for every row. I do not see the field in the Import From Excel Field pull-down menu that I can add or assign to a column in my excel sheet that will fix this problem.
Thanks!Jennifer,
If you are so confident about the settings in B1 then it is probably something to do with the import engine.
The other option would be to import this through DTW. Unless there is a compleling why you only want to use the Import utility I would not wait to do this using DTW as it is equally easier given that it is only BP Master and everything is in excel already.
Thanks
Suda
Maybe you are looking for
-
Appreciate if any one help me out to solve this problem ?
-
Programming a c application which is calling a *.so built by LabVIEW.
Hello all, This question probably has been asked, but I can't find the answer. So here's my question: I have built a LabVIEW *.so in Linux and I want to call it from a "c" application. The LabVIEW *.so is returning a cluster of strings and I want t
-
How can I define global variable in user exit whic I can use anywhere.
Hi all, How can I define global variable( Table ) which I can use when it come back to same user exit where I defined and stored some data. What I mean is I want to define 1 global table. In user exit when it comes I store some information. and again
-
Very urgent : Problem with field attributes in Datasource
Hi I am getting a problem with field attributes in the datasource. The issue came up after i modified the extract structure-i modified one field and added one field to the structure.Now those two fields are not visible in BW. When i checked with tran
-
Hello, DST: the SQL Cluster did not change the time by itself.. Where should I look for the issue. The time was changed manually to continue processing.... Thanks, Dom System Center Operations Manager 2007 / System Center Configuration Manager 2007 R