Adding new records in output based on extracted data
Hi Experts,
Good day!
I'm still having a problem with my material hitorical data project. I have a requirements in our historical data of material price which adding data that are not existing based on data extracted from standard tables such as A004 and KONP.
Now, i need to use the VALIDFROM (DATAB) as well as VALIDTO(DATBI) value as basis for the latest price.
To make it more clear, see the example below:
Extracted data:
Material Number Valid From Valid to Price
100101 01/01/2008 02/01/2008 100.00
100101 02/02/2008 04/02/2008 100.00
100101 04/03/2008 08/01/2008 200.00
100101 08/02/2008 01/31/2009 300.00
100102 05/02/2008 07/01/2008 10.00
100102 07/02/2008 10/31/2008 15.00
100102 11/01/2008 01/31/2009 20.00
Output:
Material Number Calmonth Price
100101 01/2008 100.00
100101 02/2008 100.00
100101 03/2008 100.00
100101 04/2008 200.00
100101 05/2008 200.00
100101 06/2008 200.00
100101 07/2008 200.00
100101 08/2008 300.00
100101 09/2008 300.00
100101 10/2008 300.00
100101 11/2008 300.00
100101 12/2008 300.00
100101 01/2009 300.00
100102 05/2008 10.00
100102 06/2008 10.00
100102 07/2008 15.00
100102 08/2008 15.00
100102 09/2008 15.00
100102 10/2008 15.00
100102 11/2008 20.00
100102 12/2008 20.00
100102 01/2009 20.00
Text that are in bold are the added data. What is the best code to do with this?
How can i come up with this output? Help me please guys....
Thanks and Godbless,
nips
Edited by: Nips on Jan 18, 2009 4:23 AM
hi,
I havenot created such program before but i think the logic shud work.
I have refined the logic take a look at it.
DATA: d1 like sy-datum VALUE '11012008', "dates in internal format
d2 LIKE sy-datum VALUE '01012008', "dates in internal format
mon TYPE i,
v_mon TYPE i,
v_year TYPE char4
v_date type char6.
CALL FUNCTION 'MONTHS_BETWEEN_TWO_DATES'
EXPORTING
i_datum_bis = d1
i_datum_von = d2
I_KZ_INCL_BIS = ' '
IMPORTING
E_MONATE = mon
IF mon > 0.
v_mon = wa1-validfrom+0(2).
v_year = wa1-validfrom+4(4).
ENDIF.
do mon times.
CONCATENATE v_mon '/' v_year INTO v_date.
wa2-matnr = wa1-matnr.
wa2-calmonth = v_date.
wa2-price = wa1-price.
append wa2 to itab2.
v_mon = v_mon + 1.
enddo.
endloop.
кu03B1ятu03B9к
Similar Messages
-
Hi i am new to labview
I want to extract data from a text file and display it on the front panel.
How do i proceed??
I have attached a file for your brief idea...
Attachments:
extract.jpg 3797 KBRoopeshV wrote:
Hi,
The below code shows how to read from txt file and display in the perticular fields.
Why have you used waveform?
Regards,
Roopesh
There are so many things wrong with this VI, I'm not even sure where to start.
Hard-coding paths that point to your user folder on the block diagram. What if somebody else tries to run it? They'll get an error. What if somebody tries to run this on Windows 7? They'll get an error. What if somebody tries to run this on a Mac or Linux? They'll get an error.
Not using Read From Spreadsheet File.
Use of local variables to populate an array.
Cannot insert values into an empty array.
What if there's a line missing from the text file? Now your data will not line up. Your case structure does handle this.
Also, how does this answer the poster's question? -
Master detail refresh when adding new record
Guys,
Can't believe I need to ask this question ....but here we go
when adding new master record --> I want to refresh the detail record..... in my case old detail records stays as it is until i click the save button
for detail panelformlayout-->partial trigger--> i set the ids of master panelformlayout and newMasterrecord button..... but still it doesn't refresh the child record when new master record is being created.....
any thought will be greatly appreciatedIn application module it works fine......
Even on the page when i click next/previous button on masters it refreshes details information.
but when i click the button "create" it doesn't refreshes details...... (but when i save the information, i certainly see the updated details)
seems like there is some settings or binding i need to check but can't able to find one.....
any help is greatly appreciated -
Adding new record in user table via DI API
Dear all,
I created in SAP B1 two user tables (Master data and master data rows)
I need to add a new header record in my master data user table by DI code.
This is my source code...
Dim sboDestTable As SAPbobsCOM.UserTable = oCompany.UserTables.Item("MY_HEAD_TABLE")
sboDestTable.Code = newCode
sboDestTable.ArchiveDate = Now
sboDestTable.UserFields.Fields.Item("u_userfield1").Value = "new value 1"
Dim ErrCode As Integer = sboDestTable.Add()
but I have an exception error message on the Add() command: "SAP B1 Cannot add rows to a MasterData type UserTable"
Can someone help me, please?
How can I add a new record in a user master data table?
Best regards
EmanueleHi,
Try this :
SAPbobsCOM.GeneralService oGeneralService;
SAPbobsCOM.GeneralData oGeneralData;
SAPbobsCOM.GeneralData oChild;
SAPbobsCOM.GeneralDataCollection oChildren;
SAPbobsCOM.GeneralDataParams oGeneralParams;
oCompService = SBO_Company.GetCompanyService();
SBO_Company.StartTransaction();
oGeneralService = oCompService.GetGeneralService("UDOCODE");
oGeneralData = (SAPbobsCOM.GeneralData)oGeneralService.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData);
//Setting Data to Master Data Table Fields
oGeneralData.SetProperty("Code", CodeHeader);
oGeneralData.SetProperty("U_ProjectC", ProjectCodeHeader);
oGeneralData.SetProperty("U_ProjectN", ProjectNameHeader);
oGeneralData.SetProperty("U_StartDate", StartDateHeader);
oGeneralData.SetProperty("U_EndDate", EndDateHeader);
//Setting Data to Child Table Fields
oChildren = oGeneralData.Child("DETAILTABLENAMEWITHOUT@");
oChild = oChildren.Add();
oChild.SetProperty("U_Code", ActivityCodeRow);
oChild.SetProperty("U_Name", NameRow);
oChild.SetProperty("U_DESC", DescriptionRow);
oChild.SetProperty("U_Building", NumberOfBuildings);
oChild.SetProperty("U_STDT1", StartDateRow);
oChild.SetProperty("U_ENDT1", EndDateRow);
oChild.SetProperty("U_ESTMTDY1", DaysFinal);
//Attempt to Add the Record
oGeneralService.Add(oGeneralData);
if (SBO_Company.InTransaction)
{ SBO_Company.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_Commit);
Hope it helps.
Thanks & Regards
Ankit Chauhan -
Error adding new records in an user table
Hi
I'm trying to add a new record in an user table, and after calling the add method I get the next error message:
"Generating this document requieres numbering to be determined for the document".
I've defined my user table as Master Data, and the source code is as follows:
dim m_UserTable as SAPbobsCOM.UserTable
m_UserTable = SboCompany.UserTables.Item(UserTable)
m_usertable.Code = NewValue
m_usertable.UserFields.Fields.Item("U_FIELD1").Value = NewValue
if m_userTable.add() <> 0 then
SboCompany.GetLastError(lngError, strerror)
SboApplication.MessageBox(strerror)
end if
Thanks and Best Regards
DaniHi Dani,
when you create a user Table as "Master Data", this table becomes a part of a UDO (User Data Object) that you have to create too.
In the version 2004A, you don't have the possibility to enter information in these kind of table using the DI. You can only do it thru the application.
You can look at a post called "Access to UDO via DI" posted 16th December 2004
Sebastien -
Any BAPI/Function Module for adding new record with dates in PA0027
Hi all,
I am tryig to find is there any BAPI/Function module for updating new record with Start Date and End date for specified Personal Number in PA0027 Table.
In PA0027 table i will be passing start date and end date for selected personal number, it needs to add new record with this details in the table checking the condition that this start date and end dates should not be between any of of start date and end dates for the specified personal number.
thanks for ur time.
MuraliHi Raj/Suresh thanks for ur answers.
but i am having a problem,i gave this values.
INFTY -
0027
NUMBER -
00000010
SUBTYPE -
010
OBJECTID
LOCKINDICATOR
VALIDITYEND -
03/12/2006
VALIDITYBEGIN -
03/01/2006
RECORDNUMBER -
000
RECORD -
P0027
OPERATION -
CHK
TCLAS -
A
DIALOG_MODE -
0
NOCOMMIT -
Y
VIEW_IDENTIFIER
SECONDARY_RECORD
i am getting short dump saying that
The source field is too short.
The current program, "SAPLHRMM", tried to assign a field to a field symbo
However, the field is shorter than the type of the field symbol, which
is not allowed.
The statement in question is in the form ASSIGN f TO <fs> CASTING or
ASSIGN f TO <fs> with a field symbol that was created using the
STRUCTURE addition.
I tried operation - Chage,Create (same thing for all inputs)
is this correct funtion moduel for my requirment?
what ever i am passing the start and end dates this should check in the table records with this personal number and if this start date and end dates are not between of any start and end dates then it should add new record with this dates.
Thanks for ur time.
Murali. -
Adding new records from time dependent master data
Hi,
i need to keep track of asset movements between costcenters. currently we using costcenter hierarchy, which is not time dependent. But i can see asset movement from one cost center to another in asset master data. if i access costcenter from asset master data report is giving wrong values, because its reading last value of the costcenter. i am using 0FIAA_C11 AND 0FIAA_C12, I need to populate extra record for that asset when it moves one cost center to another cost center, if it moved in 2nd period of current fiscal year, i need to populate two records for that specific fiscal year.
any suggestion or solution.
regards
rajaIf you make cost center a time dependent attribute of 0ASSET you will be able to track the changes undergone by an asset. Anytime a costcenter changes for the asset there will be a new record that will be created and the old one will be delimited.
-
I have imported all objects from an old access db (.adp file) into a new db (.accdb). All of my data lives in sql server so I have added all the tables and views to the .accdb as linked tables. My forms all connect to data, but I am having issues
with a sub form. The sub form does not allow for creation of children records tied to the parent record the way the old db did/does.
Correct - old format .adp file (notice the empty second record in sub-form with the defaulted date of today's date):
Incorrect - new .accdb file (notice the lack of empty second record in sub-form like above):
If I click the create new record icon in the bottom of the subform, it creates a completely blank record not tied to the parent record (fields blacked out in screen shots above). When using this button all parent record fields are blank.
I have also verified the child table used in the sub-form has a valid Fky relationship to parent table used in the parent form.
Have you checked each forms 'Filter' property (in Design view) to make sure they are blank and that each forms 'Filter On Load' property to make sure it is set to 'No'? Also, you might try inserting the following commands in each forms On
Open event:
DoCmd.RunCommand acCmdRemoveAllFilters
DoCmd.ShowAllRecords
If you can open each forms Record Source and they are showing that new records are able to be entered (the new record * is showing at the bottom of the recordset), then check each forms On Load and On Open events to make sure there is no filtering.
In addition, check any macro or VBA commands behind the button that opens the main form to make sure there is no SQL filtering in the DoCmd.OpenForm command.
If one of the forms Record Source does NOT allow new records, then you will need to change that Record Source so the new record * indicator shows.
Out of ideas at this point. -
Af:table gets cleared when adding new record in it
Dear All,
I am having a af:table on my page, which has an dropdown. When the value of dd is changed then a record(blank) should be inserted in the same af:table.
Now i have following problem.
When i set row Selection to single, then every thing works fine,
When i set it to none then when i add a row to table(on change of dropdown) then table gets cleared, means only newely added values gets cleared and not the one which are fetched from database.
The reason behind setting row selection to none is that on single selection when ever the user tries to change the value of from other row then it hits server, sometimes it becomes slow also.So for the workaround i need to set autoSubmit="true" to all fields in table but then also whenever user changes the value it hits server.
Please guys can any one give me proper solution...except rowSelection
Thanks,
Santosh
jdeveloper 11.1.1.5.0Hi Frank,
Thanks for the reply. I can get the correct input component to display on a given row in the table.
The real issue is when a new row is added (via a createInsert operation on a button). The creation of a new row PPRs the table and the input Components are all set the same on any existing rows, irrespective of which component was used to input data.
I'm assuming here that it should be possible to have one row show one component under the column, while another row shows a different input component under the same column..?
Do I need to iterate through the af:table (if possible) when a new row is created to reset the correct input component??
Thanks. -
I have created an user defined table for storing city details.When I add record in it,it returns -4002 and the record is not saved.The code is as follows ,
Private Sub AddCity()
Dim objCity As SAPbobsCOM.UserTable
Dim intCode As Integer
Dim txtCity As SAPbouiCOM.EditText
Dim lngStatus As Long
Dim btnSave As SAPbouiCOM.Button
Try
objCity = objCompany.UserTables.Item("U_City")
intCode = GetPK("[@U_City]", "New")
txtCity = objForm.Items.Item("txtCity").Specific
objCity.Code = intCode
objCity.Name = intCode
objCity.UserFields.Fields.Item("U_City_Code").Value = intCode
objCity.UserFields.Fields.Item("U_City_Name").Value = txtCity.Value.Trim
objCity.UserFields.Fields.Item("U_Active").Value = "Y"
lngStatus = objCity.Add()
If lngStatus = 0 Then
SBO_Application.StatusBar.SetText("Operation Completed Successfully", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success)
btnSave = SBO_Application.Forms.ActiveForm.Items.Item("btnSave").Specific
btnSave.Caption = "OK"
End If
Catch ex As Exception
SBO_Application.MessageBox("Tour Reporter:AddCity()=" & ex.Message)
End Try
End Sub
The function GetPK returns primary key of the table.Hello
It it is an UDO, not a UDT, you may use GeneralService to insert record into the table, ot build and UDO type form to get binded automatically.
You may use a similar code to save an data to UDO table
Dim oGeneralService As SAPbobsCOM.GeneralService
Dim oGeneralData As SAPbobsCOM.GeneralData
Dim oGeneralParams As SAPbobsCOM.GeneralDataParams
Dim sCmp As SAPbobsCOM.CompanyService = oCompany.GetCompanyService
oGeneralService = sCmp.GetGeneralService("U_City")
oGeneralData = oGeneralService.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData)
SQL = "select AutoKey from ONNM where ObjectCode = 'U_City'"
oRs.DoQuery(SQL)
oGeneralData.SetProperty("Code", oRs.Fields.Item(0).Value.ToString())
oGeneralData.SetProperty("U_COL1", COL1Data)
oGeneralService.Add(oGeneralData)
Return True
This code inserts records into UDO master Data type object, called U_City
You may clone the rows oGeneralData.SetProperty("U_COL1", COL1Data) and replace "U_COL1" with the UDF name inside, and "COL1Data" with the data of the field
Edited by: János Nagy on Jun 23, 2011 12:16 PM - removed the matrix elements, -
Adding new field in output layout in transaction ME2N
I would like to know if it is possible to add new fields in the output layout of transaction ME2N. For example field EKPO-AFNAM (Requisitioner) that in the standard layout is not used.
Thanks a lot
MelihDear Melih,
We can do.add some functions.In this way SAP provided some dynamic search strategeis.you can use other wise create through variant cofiguration.
press SHIFT+F4 will apper dynamic selection tab there you can select some search strategeis.
Hope this can helps you
Prem. -
Adding New Records Using BPC Data Manager
Hi All,
Thanks for reading my post.
I have a requirement in which file format is as given below
Account|Category|Time|RptCurrency|Amount|Quantity
I am able to upload Amount into my application, I need to update Quantity into another account. I have tried options using *NEWCOL(A) with combinations of with and without Header file format. In case of without header my Transformation is as following:
============================================================
*OPTIONS
FORMAT = DELIMITED
HEADER = NO
DELIMITER =
SKIP = 0
SKIPIF =
CREDITNEGATIVE=NO
VALIDATE_RECORDS=YES
*MAPPING
ACCOUNT = *COL(1)
CATEGORY = *COL(2)
DATASRC = *COL(3)
ENTITY = *COL(4)
RPTCURRENCY = *COL(5)
Time=*COL(6)
AMOUNT=*COL(7)
*CONVERSION
============================================================
I need to add another Mapping to read the Quantity coming in the file but moment I do that, BPC Transformation reports error that Account dimension is already mapped and in second case when I have two columns in the file with Header, Data manager reports error "DUPLICATE SIGNEDDATA"
I may end up having another dimension to store quantity, will appreciate your comments which can be give me some hints to fix this issue.
Regards,
UmeshUmesh,
What you are trying to achieve is not standard possible. You have in fact two columns with measure data in it, this is not possible with some workarounds.
One possibilitie is that you create a ssis package that in fact loads in the file twice, each go with each own transformation/conversion files, the first go will then load in the amounts, the second the quantity. You have to make sure that the second go is a merge instead of a clear and replace.
Another possibilitie is that you create a ssis that first load in the delivered file in a staging table, combine the amount and quantity table, dump the records to a tempfile and than load in this file using one transformation/conversion file.
I have an example package that does the second possibilitie (never looked/used this package myself, just got it in my library), please drop me an email if you want this example.
Alwin -
Rollback while adding new record - current form cancels action
Hi, I'm using a create record form, if the user wants to cancel the creation of the record, they have to first fill it out before they can rollback and cancel it's creation.
How can I avoid this?Do you mean that the Rollback button is greyed out until they have submitted the information? If that's the case check out the following:
http://www.groundside.com/blog/content/DuncanMills/J2EE+Development/?permalink=47E3819366FE66199FDDBBF3F8610A52.txt -
Inserting new line in output based on character count +sapscript
Dear All,
I want to print amount in words on cheque. Condition is if on the first line the character
count reaches 40 the rest words should be printed in next line. Also amount in word
should be printed on the same line.
I have the internal table values itab-amtwords(amount in words and ) itab-rbetr(amount in number)
I want to print them something like this -
Sixty seven crore eighty five lakh twelve thousand
fourty five 678512045.00
the amount in word should come in second line only. The amount in word if reaches certain point
the rest word should print in second line.
How to write the logic in script editor
Regards,
Sandeep
Moderator message - Cross post locked
Edited by: Rob Burbank on Apr 17, 2009 10:46 AMthe amount in number should print in the second .
2163126312.00
Regards,
Sandeep -
Display output based on oldest date
I am developing picking list report. I have fetched the data into final internal table consisting of the fields material number, batchno, shelf life expr date, pick qty, actual qty and bin number based on some conditions from different tables. Now, my requirement is to display the data based on following condition
Using the Material Code, locate the Material master record on SAP. Determine if the material is stored by shelf life. If it is, find the batch with the oldest shelf life with available stock for the material and get the bin number in which it is stored. Write the bin number, shelf life, batch and quantity picked details to the record and write the record. If there is insufficient stock in the batch to satisfy the requirement in full, find the next batch with the next oldest shelf life and write those details to a second record and so on until the requirement is met in full.
Can anyone pls help me to write the logic ?
Geetahi,
tell me first that japanese data is coming from table in japanese text ?
or u just needed to hardcode japanese text ?
if so u can write a format trigger .
Take taht particular column in a seperate frame and on that frame write a format trigger based on the user input for language selection.
try with this.
is it ok?r give me ur requirement clearly once.
--Basava.S
Maybe you are looking for
-
File Name and Path special field
Post Author: puser01 CA Forum: .NET I have a report created in CR 9 with the File Name and Path special field on the report displayed correctly. when i try to run it on CR XI environment i get this: C:\WINDOWS\TEMP\{4D86438D-54F5-4EEF-A0AB-05D5EB2BFF
-
Solution Manager 4.0/When accessing services as ex. showing graphic in Proj
Hi, We have just upgraded from Solution Manager 3.1 to 4.0. When accessing services as ex. showing graphic in Projects, tab graphics shows: " Service cannot be reached. What has happened? URL http://dnismpa.danisco.com:1080/sap/bc/solman/defaultUser/
-
Set default value to UTC DateTime?
Hi; Is there a way to set a default value to be the current UTC date & time? And if so, how do I put that in a SQL script? (I have given up on using the Migration Workbench and am hand writing my sql script. I looked at all the forums and this seems
-
How to check file exist in applet?
I would like to check the existance of a file from an applet. How can I achieve that? I'd tried many attempts but still fail to get an answer. Please kindly help. Below are my file structures:- folder/applet/myApplet.java folder/appletView.jsp folder
-
Hi I am trying to configure the settings on a shared linksys router. Unfortunately I do not have a wired connection which I am hoping I do not need. The router is a WRT54G with no version number, so I assume 1.0. I have an internet connection wirele