Split the records of interanl table and upload it to fields
Hi All,
I have a internal table filled with records in following format.
XXXXXXXX~~Export the invoice
2~19980501~19980531
// The first invoice:
0~00130698114000010004119980512059611000276233.350.1711076.66????321000789010005???????????????????130601000000000??????????18? 3352051????532611-3357211???~~~
0~????????176233.350.1711076.6676233.350~1510
// The second invoice:
0~00130698114000010007219980512059611000440482.000.175882.00????110108078901007?????????61? 68744479?????????????462088-07?????130601000000000??????????18? 3352051????532611-3357211???????????~~~
0~????????139780.000.175780.0039780.000~1510
0~????3.5"10702.000.17102.0070.20~1510
I want to sort this out field by field and fill it to the respective fields.
If i try to do so with work area
read table itgt_frmgto into waitgt_frmgto index 4.
i have a out put of one line that is 4th.Butbbecause these are random records,i cannot count on lines .So i have to go by fields.
Could anybody tell me how to do this with multiple lines coming in without using
index concept.
Thank you,
Priya
hi,
loop the table and inside the loop split each line into other variables if the line has a fix structure or split into an another itab if not.
SPLIT <line> AT '~~' INTO <f1> ... <fn>.
or
SPLIT <line> AT '~~' INTO <itab>.
you might want to take a look at the syntax of SPLI statement.
br
Similar Messages
-
Delete records in a table and at the same time print out for reference
I am working on a req to delete some records from a table and at the same time, record/print the deleted records in the outstream (DBMS_OUTPUT.PUT_LINE)
DECLARE
v_rec_po hst_po%ROWTYPE;
BEGIN
DELETE FROM hst_po po
WHERE abbrpoid = '&opportunity_code'
AND updatedby = (SELECT employeeid
FROM tes_employee
WHERE name = &emp_name)
AND audittimestamp BETWEEN TO_DATE ('&start_timestamp',
'DD-MON-YYYY HH24:MI'
AND TO_DATE ('&end_timestamp',
'DD-MON-YYYY HH24:MI'
END;
I was thinking of using returning into and then using DBMS_output to pull out the delted records, but there will be multiple rows deleted fro this statements. I am stuck here..Can anyone helpHow about:
SQL> create table t
2 (x int)
3 /
Table created.
SQL> insert into t
2 select rownum
3 from all_objects
4 where rownum <= 10
5 /
10 rows created.
SQL> declare
2 cnt pls_integer;
3 begin
4 delete from t;
5 cnt := sql%rowcount;
6 dbms_output.put_line ('Removed: '||to_Char (cnt));
7 end;
8 /
Removed: 10
PL/SQL procedure successfully completed.Edited by: Alex Nuijten on Jun 4, 2009 8:58 AM -
Stay on the edit page once saved and see the record as a table
I like to click on the edit of an interactive report to go to the edit page.
Once in the edit page, I like to see not only the form to edit the record but also
the record as a table to see what the record looks like once the save button is clicked below the edit form.
Thanks.Look at the page branches. There will be one or more which goes to the first page. Change it to go to the current page instead of the first page.
-
Regarding how to delete the record in internal table
Hi experts ,
how to delete the record in intarnal table after validating the data,
if record contains invalid fields?
i am giving my code see this and give me the answer?
loop at it_data into wa_data .
Validate Cost Center
READ TABLE it_kostl INTO wa_kostl WITH KEY kostl = wa_data-kostl BINARY SEARCH.
IF sy-subrc NE 0.
PERFORM update_error_log USING wa_data
text-004.
ENDIF.
Validate source file material ( material number )
loop at it_mara into wa_mara .
read table it_ausp into wa_ausp with key atwrt = wa_data-i_matnr .
if sy-subrc NE 0 .
PERFORM update_error_log USING wa_data
text-002.
delete it_data-objek .
else.
read table it_mara into wa_mara with key matnr = wa_ausp-objek .
if sy-subrc EQ 0 .
wa_data-objek = wa_mara-matnr.
wa_data-matkl = wa_mara-matkl.
ENDIF.
Modify it_data from wa_data .
endif.
*endloop.
Validate unit of measure (unit)
READ TABLE it_t006 INTO wa_t006 WITH KEY msehi = wa_data-unit .
IF sy-subrc NE 0.
PERFORM update_error_log USING wa_data
text-003.
endif.
Validate delivery location ( storage location )
READ TABLE it_lgort INTO wa_lgort WITH KEY del_loc = wa_data-del_loc.
IF sy-subrc NE 0.
PERFORM update_error_log USING wa_data
text-001.
if wa_data-flag ='x' .
delete it_data from wa_data .
endif.
ENDIF.
endloop.Hi Naren,
First get the index number of the IT_data table and store it in one variable whose declaration like this.
data: tabix type sy-tabix.
while reading the internal table it_data set the tabix variable.
tabix = sy-tabix.
Instead of the above use below one.
Delete it_data-objek
Use the Below statement it will delete the row from the internal table.
Delete it_data-objek index tabix
Thanks,
Chidanand -
Sending email after deleting the records in a table
Hi
I am deleting the records in a table. After deleting the records,
i want to send an email to another person. I am planning to follow this steps.
1. Create a trigger on the table(AFTER DELETE ON table FOR EACH ROW)
to copy the deleted records to temporary table.
2. Read the temporary table and send an email.
Is there any other way we can do with out creating temporary table ?.
GovindI don't know what you plan to use to send the mail but here's a solution that would work.
-- Create a send mail procedure
create or replace procedure send_mail (
sender IN VARCHAR2,
recipient IN VARCHAR2,
message IN VARCHAR2)
IS
mailhost VARCHAR2(30) := 'localhost';
mail_conn utl_smtp.connection;
BEGIN
mail_conn := utl_smtp.open_connection(mailhost, 25);
utl_smtp.helo(mail_conn, mailhost);
utl_smtp.mail(mail_conn, sender);
utl_smtp.rcpt(mail_conn, recipient);
utl_smtp.data(mail_conn, message);
utl_smtp.quit(mail_conn);
END;
/-- Create the trigger to email deleted rows
create or replace trigger email_del_rows
after delete on <table>
for each row
declare
msg varchar2(2000);
begin
msg := 'COL1 COL2 COMPANY NAME DATE'||chr(10);
msg := msg||:old.col1||' '||:old.col2||' '||:old.company_name||' '||:old_date|| chr(10);
msg := msg||'END OF FILE';
send_mail('SENDER','[email protected]',msg);
end;
/You can make it look pretty but you get the basic idea. -
Iterate through all the records in a table using Java API
Hi All,
What is the easiest way to iterate through all the records in a given table using Java API? I cannot find any methods that will return all records in a table and the only way I can use is to perform a free form search with a condition that is always true. The code works but is pretty ugly. Is there an alternative to this approach?
Thanks!
KennyHi Kenny,
You can construct a new Search object with your table's code name, a new ResultSetDefinition object for your table and just execute this search using the GetResultSet method of CatalogData.
Please look at the following code:
Search search = new Search(<code name of your table>);
ResultSetDefinition rsd = new ResultSetDefinition(<code name of your table>);
rsd.AddField<code name of a field>);
rsd.AddField(<code name of a field>);
String sortField = <code name of your sort field>;
boolean sortAscending = true;
int page = 0; //page number
A2iResultSet rs = <your CatalogData object>.GetResultSet(search, rsd, sortField, sortAscending, page);
for (int i = 0; i < rs.GetRecordCount(); i++)
Value fieldValue = rs.GetValueAt(i, <code name of a field>);
Hope this helps,
Nir
PS - I really recommend you to start using the new API, as it is much more efficient and straight-forward. -
How to count records from 2 tables and show in RDLC Report
hi all,
its being a one day searching for the solution but No Luck.
I have two SQL tables tblstudetail and tblfeereceiptdetail.
i just want to count records from both tables and show in RDLC report.
I tried SQl Query Like This:
select a.session, a.course,
Count(CASE a.ADstatus WHEN 'OK' THEN 1 ELSE 0 END ) AS Admission,
Count(CASE s .I_receiptstatus WHEN 'OK' THEN 1 ELSE 0 END) AS Feeprint
from
tblstudetail a
FULL join
tblfeereceiptdetail s on s.studentID = a.studentID
where a.session = '2015' AND s.Fsession = '2015' AND a.adcat = 'Regular'
GROUP BY a.session,a.course
ORDER by a.course
The result Show the Same Value in Both columns
Session Course Admission FeeDetail
2015 B.A. I 275 275
2015 B.A. II 307 307
2015 B.A. III 255 255
2015 B.Sc. I 110 110
2015 B.Sc. II 105 105
2015 B.Sc. III 64 64
Actully I want to Count How many ADMISSION have been Taken(FROM tblstudetail) and How many FEE RECEIPT have been Print (From tblfeereceiptdetail).
please guide me for this as soon as possible.
thanks in advance...I am counting 'OK' in both the table columns I.e 'ADstatus' in tblstudetail and 'feereceiptstatus' in tblfeereceiptdetail
please suggest me -
Triggers to insert the record in a table
I have two table 1. Holiday 2. Attendance.
When I insert the record in holiday table for his
advance holiday with empid, the same time I want to insert it attendance table
automatically for the same date using a trigger
Insert into attendance (empid,date,holiday) values (20078,07/10/2014,1). If holiday column value 1 represent holiday marked,
0 represent holiday not marked. The same thing can happen vice versa
If employee mark his current attendance as holiday through attendance,
it should be inserted into holiday table
automatically using triggers.
Insert into Holiday (empid,date,holiday) values (20078,06/08/2014,1). If holiday column value 1 represent holiday marked,
0 represent holiday not marked. The same thing can happen vice versa
Please I am looking for your help , how I can make it using triggers
to insert both table in two different ways of options.
Regards
Pol
polachanHi polachan,
According to your description, if you want to synchronize the data between the holiday table and the attendance table while inserting records into holiday table, you need to create a trigger on the holiday table, please try the following syntax.
use <databasename>
go
create trigger Tr_holiday
on holiday
for insert
as
declare @empid varchar(20),
@date datetime,
@holiday int
select @empid = empid, @date=date, @holiday=holiday from inserted
declare @qty int
select @qty =count(*) from attendance where empid=@empid and date=@date and holiday=@holiday
if @qty<1
begin
insert into attendance
select i.empid,
i.date,
i.holiday
from inserted i
end
Meanwhile, if you want to insert the record into the holiday table when holiday is updated to 1 in the attendance table, you need to create another trigger on the attendance table, please try the following syntax.
use <databasename>
go
create trigger Tr_attendance
on attendance
for update
as
declare @holiday int
if update (holiday)
begin
select @holiday=holiday from inserted
if @holiday=1
begin
insert into dbo.holiday
select empid,
date,
holiday
from inserted
end
end
For more details about creating triggers in SQL Server, please review this article:
CREATE TRIGGER (Transact-SQL).
Thanks,
Lydia Zhang -
Create a table and upload data in MS ACCESS from SAP ABAP programming?
Hi All,
How to create a table in MS ACCESS database and Upload SAP database table data into MS ACCESS table using ABAP programming?
Explain: My client requirement is " If he/she runs a ABAP Program, that will create a table and upload data into MS ACCESS Database table in background. "
Could you please give the solution or code? I know the program RIACCESS and I went through the SAP Note 583698.
Is this only solution for this? Or Any other possibilities?
Please give me solution.
Thanks in advance.Hi,
It is not possible to create tables in a non SAP schema from inside SAP.
The SAP-Oracle license also does not allow you to create the table (see note 581312):
the following actions, among other things, are therefore forbidden at database level:
Creating database users
Creating database segments
Querying/changing/creating data in the database
Using ODBC or other SAP external access methods
Please refer following link,
[Ckick Here|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes.do]
You can also do it by LSMW,
If you are using Access 97, you can download directly into an access
database from SAP. See program RIACCESS for details. You have to establish
an RFC destination PS_ACCESS_1 and 2.
There are then a couple of function modules. Go to SE37 and put in
msaccess and hit PF4.
The following is from the readme file: sapgui/ps/readme.sap
For the MS-Access interface SAP delivers 4 files:
WDPSASTR.EXE This is an RFC server program that is called by SAP R/3
(PS module). This program creates a MS Access database. The structure
information of the tables is transferred from R/3. In addition to
these tables a table named DDIC is created. This table contains the
structure information and should in no case be modified or deleted.
WDPSATAB.EXE This is an RFC server program that is called by SAP R/3
after WDPSASTR. This program filles the tables of the database with data.
There must not be made any changes of the structure of
the tables between the calls of WDPSASTR and WDPSATAB.
WDPSAZET.EXE This is an RFC client program that triggers work/time
confirmations in the PS module of SAP R/3 (like transaction CN27 Collectiv
confirm).
WDPSAMAT.EXE This is an RFC client program that triggers material
confirmations in the PS module of SAP R/3 (like transaction MB1A - Goods
Please also refer following links,
[Click here|Upload data from MS Access tables, to SAP tables.;
Before using the program "RIACCESS", you need to install the PS utilities, which are part of SAPGUI install CD.
It is available in the "SAPGUIPS directory".
Then do the followings :
1. Select transaction code SALE -> Systems in network-> Define RFC Destination.
2. You will need two RFC destinations (TCP/IP connections for the front-end workstation).
Setup the two RFC destinations PS_ACCESS_1 and PS_ACCESS_2 and you'll have to get them to point to
wdpsastr.exe and wdpsatab.exe respectively.
3. Then execute RIACCESS and choose PS_ACCESS_1 to generate access tables.
The system must also be able to access the RFC-DLL files (librfc2.dll, librfc3.dll, librfc4.dll, librfc5.dll, librfc6.dll, vrfc.dll).
Please note that Access only supports tables with up to 255 fields. -
MDM API to read the Record Key Mapping table
Hi,
Does anybody know what class/method I can use to read the Record Key Mapping table?
For the Business Partner table the Key Mapping table has this columns:
<u>Default / MDM Partner ID / Remote System / Key</u>
I have everything but the Key. How can I read it?
Thanks in advance,
Diego.GetKey Mapping is one of the available Web Services as of SP4.
Else you could use the Java API to get the Key Mapping.
<b>CatalogData class</b> has the following method
<b>GetKeyMapping</b>
public java.lang.String[][] GetKeyMapping(java.lang.String agency,
java.lang.String table,
int[] recordIDs,
boolean isDefaultKeyOnly)
throws StringExceptionRetrieves the key mapping for each record.
Parameters:
agency - the agency name.
table - the table name.
recordIDs - the list of records.
isDefaultKeyOnly - True to retrieve only the default value, False to all key values.
Returns: the key values for each record. -
ABAP Program to split the records
Hi Experts,
As i am new to ABAP please update me with the required ABAP Code or atlease with the skeleton Code
Source & target fields
Emp_ID ZEMP_ID (CHAR)
Start Date: ZESTA_DT (DATS)
End Date : ZEEND_DT (DATS)
My requirment is to write a start routine that split the record in to 2
Emp_ID-Start_Date-Termination Date
0001----01/01/2005---01/01/2008
0002----01/01/2007---
(Termination date will be blank if emp is still working)
As per my requirment i would like to see data in DSO as
Emp_ID-Start_Date-Termination Date
0001----01/01/2005---
0001----01/01/2005---01/01/2008
0002----01/01/2007---
I want to split the records of an employee
Please let me know if u need any information
ThanksHi Srinivas,
Thanks for the update....
Please correct me my if i was wrong
Data:
Emp_ID-Start date------Termination Date
0001----01/01/2005---01/01/2008
0002------01/01/2005
Loop at itab.
if itab-ZEEND_DT is initial.
itab1 = itab.
append itab1.
else. " split the records ... based on termination ..
itab1 = itab.
clear itab1-ZEEND_DT
append itab1.
itab1 = itab.
append itab1.
endif.
endloop.
My requirment is for the above example data
For the employee 0001 as Termination date is not initial i need that record to be split in to 2
Emp_ID-Start date------Termination Date
0001------01/01/2005
0001----01/01/2005---01/01/2008
Please update -
How to update and insert the records without using Table_comparison and Map_operation?
Use either join or MERGE see this Inserting, Updating, and Deleting Data by Using MERGE
-
Function module or BAPI that is used to update the records in RBKP table.
Hello All,
Can anybody please give me the name of any Function module or BAPI that is used to update the records in RBKP table.
Please help me
I need to change the fiscal year in RBKP table
Thanks in Advance,
Regards,
LIJOHi,
You can use the BAPIs,
BAPI_ACC_INVOICE_RECEIPT_CHECK Accounting: Check Invoice Receipt (OAG: LOAD PAYABLE)
BAPI_ACC_INVOICE_RECEIPT_POST Accounting: Post Invoice Receipt (OAG: LOAD PAYABLE)
Hope this helps.
Regards,
Renjith Michael. -
About the Names of std Tables and their list of contents
Hi every body ,
can u pls give me Source of finding the list of standard tables and their contents
such that i can refer to those tables to determine what should be the Mandatory data elements .
i need just 2 determine what is required and what not ?
Awaiting for a brighter and good response .....
reply to [email protected]Hi,
Search for SAP Tables in www.sap-img.com. You will find a Zip file, this has most of the tables used in most of the modules. Check those tables and find which are all the primary fields.
Regards
Subramanian -
Split the material cost into labor and overhead costs
Hello Experts,
We get Finished Goods from another plant and that plant is not on SAP. So we load these materials as Finished Goods and enter the price in the costing tab and we do run cost estimates. In the cost estimate we see this price as material cost. How can we split this material cost into material + labor + over head costs? Is there anywhere we can enter the percentages that would split the total price into material and labor and overhead prices? I appreciate your time and response.
Thanks In AdvanceHI Venkat,
You can only split material cost using origin groups and not into material, labour & OH as you may know the cost components are grouping of cost elements (with an option to use origin groups).
If this is too important for you to maintain that cost component split, then I see the only way is to consider maintaining quantity structure in SAP for the finished product, so that cost roll up happens with cost components.
Hope this helps.
Maybe you are looking for
-
WLS 8.1 JAX-RPC stubs and SSL
I am part of an industry effort to assess WS interop. We have created a common WSDL that will be implemented in WAS, .NET and WLS 8.1. As part of this effort, we are also trying to use two-way SSL authentication. However, I have not found a way to co
-
CS6 Extended 3D functions not working... Need help!
This is a copy of the system info from CS6: Adobe Photoshop Version: 13.0.1 (13.0.1.2 20130522.r.24 2013/05/22:21:00:00) x64 Operating System: Windows 7 64-bit Version: 6.1 Service Pack 1 System architecture: AMD CPU Family:15, Model:1, Stepping:0 wi
-
URGENT Problem with Greek Character from an Oracle database
Hello, I am having a serious and urgent problem with the character settings of an oracle database (8.1.7). The database is sitting in a solaris unix server and when we run the env command we have the following in the NLS_LANG parameter: AMERICAN_AMER
-
How to include the simbol % in a flash chart
hello everyone Do you know how to include the simbol % in a flash chart? I am using a 3D flash chart. This simbol obviously would be after that number of percentage. Do I must modify the chart XML adding some after that {VALUE} ? Any help would be ve
-
I followed all the steps in iTunes Home Sharing setup and I am still unable to view sharing in iTunes. Using MacBook Pro and iPhone 4.