Ordering and Reordering rows in a Matrix
Hi,
I am using a DBDataSource (User Defined) to populate a Matrix.
I use Conditions to filter this matrix.
I have a field called Seq in the Matrix and want to be able to order the matrix by Seq.
Can this be done without using a SQL Query in the datasource.
Also I have up and down buttons next to the Matrix - is there a way to move rows up and down (or reorder the rows) in the matrix without changing a code and requerying the Datasource ?
Thanks
Nick
Pages: 1
Hi Dragos,
Hope this can help.
In my form I have 2 matrix's that need reordering, and I have 2 buttons next to each up1/dn1 and up2/dn2
Here is the event code :
Private Sub FLBOM_ItemPress(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByVal oform As SAPbouiCOM.Form)
Dim s As Integer = 0
'Dim oform2 As SAPbouiCOM.Form
'oform2 = SBO_Application.Forms.Item("FLBOM")
Try
If pVal.Before_Action = True Then
Select Case pVal.ItemUID
Case "up1"
FLBOM_MoveRow(pVal, oform, "matBOM", Direction.Up)
Case "dn1"
FLBOM_MoveRow(pVal, oform, "matBOM", Direction.Down)
Case "up2"
FLBOM_MoveRow(pVal, oform, "matSubBOM", Direction.Up)
Case "dn2"
FLBOM_MoveRow(pVal, oform, "matSubBOM", Direction.Down)
End Select
End If
Catch ex As Exception
MessageBox.Show("s=" & s.ToString & ":" & ex.Message)
End Try
End Sub
I also pin this to the itempress event on the matrix itself - if the user selects the top row of the matrix
it disables the up button, bottom of the matrix disables down button
If pVal.FormMode = 1 Then
Dim m As SAPbouiCOM.Matrix = oform.Items.Item("matBOM").Specific
Dim r As Integer = pVal.Row
Dim rc As Integer = m.RowCount
Select Case r
Case 1
FLBOM_ItemEnable(oform, "up1", True)
FLBOM_ItemEnable(oform, "dn1", False)
FLBOM_ItemEnable(oform, "btnBOMDel", False)
Case rc
FLBOM_ItemEnable(oform, "up1", False)
FLBOM_ItemEnable(oform, "dn1", True)
FLBOM_ItemEnable(oform, "btnBOMDel", False)
Case Else
FLBOM_ItemEnable(oform, "up1", False)
FLBOM_ItemEnable(oform, "dn1", False)
FLBOM_ItemEnable(oform, "btnBOMDel", False)
End Select
ItemEnable looks like this
Private Sub FLBOM_ItemEnable(ByVal oform As SAPbouiCOM.Form, ByVal Itm As String, ByVal Off As Boolean)
Dim e As SAPbouiCOM.Item
e = oform.Items.Item(Itm)
If Off Then
e.Enabled = False
Else
e.Enabled = True
End If
End Sub
Then I have code to handle the moving of the rows - it is fairly generic - you feed it the form, matrix name and the direction and the code does the rest.
You need to change the SQL to update the right UDT
The matrix name(s) - remember I have 2 on the same form that I reorder so this code could easily be simplified.
Private Sub FLBOM_MoveRow(ByVal pval As SAPbouiCOM.ItemEvent, ByVal oform As SAPbouiCOM.Form, ByVal Mat As String, ByVal dir As Direction)
If pval.FormMode = 1 Then
Dim oMatrix As SAPbouiCOM.Matrix = oform.Items.Item(Mat).Specific
Dim irow As Integer
Try
irow = oMatrix.GetNextSelectedRow(0, SAPbouiCOM.BoOrderType.ot_SelectionOrder)
If irow = 1 And dir = Direction.Up Then
SBO_Application.StatusBar.SetText("Cannot Go Up ", SAPbouiCOM.BoMessageTime.bmt_Medium, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
Exit Sub
End If
Catch
SBO_Application.StatusBar.SetText("Must Select a Line in First", SAPbouiCOM.BoMessageTime.bmt_Medium, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
Exit Sub
End Try
If irow < 0 Then
SBO_Application.StatusBar.SetText("Must Select a Line First", SAPbouiCOM.BoMessageTime.bmt_Medium, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
Exit Sub
End If
' CODE HERE
Dim oTbl As SAPbouiCOM.DataTable
Dim sSql As String
Dim Seq1 As Integer
Dim Seq2 As Integer
Dim code1 As String
Dim code2 As String
Dim oe As SAPbouiCOM.EditText
oe = oMatrix.Columns.Item("colSeq").Cells.Item(irow).Specific
Seq1 = oe.Value
oe = oMatrix.Columns.Item("#").Cells.Item(irow).Specific
code1 = oe.Value
Select Case dir
Case Direction.Up
code2 = oMatrix.Columns.Item("#").Cells.Item(irow - 1).Specific.value
Seq2 = oMatrix.Columns.Item("colSeq").Cells.Item(irow - 1).Specific.value
Case Direction.Down
code2 = oMatrix.Columns.Item("#").Cells.Item(irow + 1).Specific.value
Seq2 = oMatrix.Columns.Item("colSeq").Cells.Item(irow + 1).Specific.value
End Select
oTbl = oform.DataSources.DataTables.Item("TEMPTable1")
sSql = "UPDATE [@LYNXS_SP] SET U_Seq=" & Seq2 & " WHERE Code = '" & code1 & "'"
oTbl.ExecuteQuery(sSql)
sSql = "UPDATE [@LYNXS_SP] SET U_Seq=" & Seq1 & " WHERE Code = '" & code2 & "'"
oTbl.ExecuteQuery(sSql)
If Mat = "matBOM" Then
FLBOM_After_CFLBP(oform)
Else
Dim om1 As SAPbouiCOM.Matrix = oform.Items.Item("matBOM").Specific
Dim e As SAPbouiCOM.EditText = om1.Columns.Item("#").Cells.Item(irow).Specific
LoadSubBom(e.Value, oform)
End If
Select Case dir
Case Direction.Up
irow = irow - 1
Case Direction.Down
irow = irow + 1
End Select
oMatrix.SelectRow(irow, True, False)
Dim rc As Integer = oMatrix.RowCount
Select Case irow
Case 1
FLBOM_ItemEnable(oform, "up1", True)
FLBOM_ItemEnable(oform, "dn1", False)
Case rc
FLBOM_ItemEnable(oform, "up1", False)
FLBOM_ItemEnable(oform, "dn1", True)
Case Else
FLBOM_ItemEnable(oform, "up1", False)
FLBOM_ItemEnable(oform, "dn1", False)
End Select
Try
If Mat = "matBOM" Then
Dim e As SAPbouiCOM.EditText = oMatrix.Columns.Item("#").Cells.Item(irow).Specific
LoadSubBom(e.Value, oform)
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
Else
SBO_Application.StatusBar.SetText("Must Update Form First", SAPbouiCOM.BoMessageTime.bmt_Medium, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
End If
End Sub
So Finally - here are the 2 routines that load the matrix - notice I use the same routines to initially load the matrix as I do after the above updates when the row is moved.
Private Sub FLBOM_After_CFLBP(ByVal oform As SAPbouiCOM.Form)
Dim oMatrix As SAPbouiCOM.Matrix
Dim oMatrix2 As SAPbouiCOM.Matrix
oMatrix = oform.Items.Item("matBOM").Specific
Dim oe As SAPbouiCOM.EditText = oform.Items.Item("3").Specific
Dim oc As SAPbouiCOM.ComboBox = oform.Items.Item("cbArea").Specific
Dim SQLSTR As String = "SELECT * FROM [@LYNXS_SP] WHERE U_PARENTCODE IS NULL AND U_CARDCODE = '" & oe.Value & "' AND U_AREAID = '" & oc.Selected.Value & "' ORDER BY U_AREAID, U_SEQ"
oform.DataSources.DataTables.Item("TEMP").ExecuteQuery(SQLSTR)
oMatrix.LoadFromDataSource()
oMatrix2 = oform.Items.Item("matSubBOM").Specific
oMatrix2.Clear()
End Sub
and
Private Sub LoadSubBom(ByVal ParentID As Integer, ByVal oform As SAPbouiCOM.Form)
Dim m As SAPbouiCOM.Matrix = oform.Items.Item("matSubBOM").Specific
m.Clear()
Dim SQLSTR As String = "SELECT * FROM [@LYNXS_SP] WHERE U_PARENTCODE = '" & ParentID & "' ORDER BY U_SEQ"
oform.DataSources.DataTables.Item("TEMP").ExecuteQuery(SQLSTR)
m.LoadFromDataSource()
End Sub
one last bit of code that is missing from the above
Public Enum Direction
Up
Down
End Enum
Let me know how this goes for you.
Regards,
Nick
Similar Messages
-
Setting Evaluation order and Reordering dimension
hi i was going through the hp admin pdf and i have a few doubts
what do you mean by setting the evaluation option in planning means and why is it reccomended to select only one dimension(setting evaluation order)
in "About Reordering Dimensions" topic it was mentioned about the ordering of aggregating sparse dimensions before non aggregatin ones , what are these two types and also it was said to arrange the sparse dimensions in the order of more sparse members to less sparse members but isnt it the opposite way around i mean as per the hour glass model the order should be from least sparse to most sparse dimension and attribute dimension in the end
what exactly is the diffrence in Setting Evaluation Order and Reordering dimensions ?Reording the dimensions sets the order of the dimensions in essbase, reordering the dimensions can be part of optimizing the database.
Setting the evaluation order is more to do with how the dimensions are evaluated in forms, so if account is set to be first then the properties of the account members data type will be used first, for instance if the account member is set to Percentage then member will be displayed as a percentage.
Cheers
John
http://john-goodwin.blogspot.com/ -
UDO: Add and Remove rows to/from Matrix.
Hi all,
Yes, I know there are lots of topics about adding and removing rows but I was having trouble with these and I need some expert's opinion.
I'm working with a Document type UDO, with 1 header table (ADAT_ONR) and 1 child table (ADAT_NR1 - MatrixUID = "mtx_NR").
I add the first row when the user chooses the business partner.
If oMatrix.RowCount = 0 Then
oMatrix.AddRow()
oMatrix.AutoResizeColumns()
oMatrix.Columns.Item("V_LineId").Cells.Item(1).Specific.Value = 1
End If
Then, the user has to press the AddRow button to add new rows, and the user can only add 1 new blank row. Later I'll change the row adding behavior to mimic B1s.
If pVal.BeforeAction = False Then
Select Case pVal.ItemUID
Case "AddRow"
'ItemHandler_Click = AddRow(oCompany, oApplication, oForm, oForm.Items.Item("mtx_NR").Specific.RowCount())
oMatrix = oForm.Items.Item("mtx_NR").Specific
If oMatrix.RowCount > 0 Then
If Trim(oMatrix.Columns.Item("V_PltCode").Cells.Item(oMatrix.RowCount).Specific.Value) = "" Then
oApplication.StatusBar.SetText(TranslateStr(oApplication, MustChoosePallet), BoMessageTime.bmt_Short)
Exit Function
End If
End If
ItemHandler_Click = NewLine(oCompany, oApplication, oForm)
Exit Function
Private Function NewLine(ByRef oCompany As SAPbobsCOM.Company, ByRef oApplication As SAPbouiCOM.Application, _
ByRef oForm As SAPbouiCOM.Form) As Boolean
NewLine = False
Try
oMatrix = oForm.Items.Item("mtx_NR").Specific
Dim Index As Integer = oMatrix.RowCount
With oForm.DataSources.DBDataSources.Item("@ADAT_NR1")
.Clear()
End With
oMatrix.AddRow()
oMatrix.Columns.Item("V_LineId").Cells.Item(Index + 1).Specific.Value = (Index + 1).ToString
oMatrix.FlushToDataSource()
oMatrix.LoadFromDataSource()
oForm.Refresh()
NewLine = True
Catch ex As Exception
oApplication.MessageBox("NewLine(): " & oCompany.GetLastErrorCode.ToString & ", " & ex.Message)
End Try
End Function
When I Add or Update the data, I clear the last blank row, if it exists.
'// In the Click Event
If pVal.BeforeAction = True Then
Select Case pVal.ItemUID
Case "1"
If oForm.Mode <> BoFormMode.fm_FIND_MODE Then
oMatrix = oForm.Items.Item("mtx_NR").Specific
oMatrix.FlushToDataSource()
oMatrix.LoadFromDataSource()
If Trim(oMatrix.Columns.Item("V_PltCode").Cells.Item(oMatrix.RowCount).Specific.Value) = "" Then
oForm.DataSources.DBDataSources.Item("@ADAT_NR1").RemoveRecord(oMatrix.RowCount - 1)
oMatrix.DeleteRow(oMatrix.RowCount)
'oMatrix.FlushToDataSource()
End If
End If
End Select
My question is, Is there an easier way to Add and Delete Rows??
BTW, I still have a problem so solve. With this code, when the user deletes a row the row numbering is incorrect. Example: if I have to rows in a matrix and I delete row nº1, row nº2 will hold the same number...
Any Ideas?
Thanks in advanced,
Vítor VieiraHi Victor,
there is a Form Data event which you ca use in that try to write the code for adding a row after updating and delete a row while inserting and add a row while traversing.
sample code.
Sub FormDataEvent(ByRef BusinessObjectInfo As SAPbouiCOM.BusinessObjectInfo, ByRef BubbleEvent As Boolean)
Try
Select Case BusinessObjectInfo.EventType
Case SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD, SAPbouiCOM.BoEventTypes.et_FORM_DATA_UPDATE
If BusinessObjectInfo.BeforeAction = True Then
objForm = objMain.objApplication.Forms.Item(BusinessObjectInfo.FormUID)
oDBs_Head = objForm.DataSources.DBDataSources.Item("@Header")
oDBs_Detail= objForm.DataSources.DBDataSources.Item("@Line")
objMatrix = objForm.Items.Item("83").Specific
If objMatrix.VisualRowCount <> 0 Then
objMatrix.DeleteRow(objMatrix.VisualRowCount)
objMatrix.FlushToDataSource()
End If
If BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD Then
End If
ElseIf BusinessObjectInfo.ActionSuccess = True Then
objForm = objMain.objApplication.Forms.Item(BusinessObjectInfo.FormUID)
If BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_UPDATE Then
objMatrix = objForm.Items.Item("83").Specific
objMatrix.AddRow()
SetNewLineCharge(objForm.UniqueID, objMatrix.VisualRowCount)
objMatrix.FlushToDataSource()
End If
End If
Case SAPbouiCOM.BoEventTypes.et_FORM_DATA_LOAD
If BusinessObjectInfo.ActionSuccess = True Then
oDBs_Head = objForm.DataSources.DBDataSources.Item("@Header")
oDBs_Detail = objForm.DataSources.DBDataSources.Item("@Line")
objMatrix = objForm.Items.Item("83").Specific
objMatrix.AddRow()
SetNewLineCharge(objForm.UniqueID, objMatrix.VisualRowCount)
objMatrix.FlushToDataSource()
End If
End Select
End Sub
Hope this helps,
OM Prakash -
Matrix Add Row and Duplicate Row
Hi All,
Can anybody suggest me how to work on Add row and duplicate row in any document table.
Lets take one example
Sales order document
In this doc we have table format where we specify item no, item description etc. In this table when we right click on particluar row we have option for add, delete, duplicate rows..etc.
wht i would like to know is that when we click add row .....one row is added and number is incremented under # column. Hw to perform and display this auto increment/ decrement of number for these rows under this # column
thanks
harishHi,
I tried following both code, but in that i am geting value. Means i am getting .Value Why i not getting value.
matrix.Columns.Item("V_-1").Cells.Item(pVal.Row).Specific.value = matrix.RowCount
and i also tried for "AddRow",
If pVal.BeforeAction = False Then
Select Case pVal.ItemUID
Case "AddRow"
matrix = form.Items.Item("mtr").Specific
If matrix.RowCount > 0 Then
If Trim(matrix.Columns.Item("V_-1").Cells.Item(matrix.RowCount).Specific.value) = "" Then
End If
End If
End Select
End If
In both example i not getting .Value.
Plz tell y ?
Thanks -
how to show employee names in descending order but 3rd row is fixed and always top on the table ?
for example employee names is A,B,C, D, E
and output is C,E,D,B,ASince you are posting in the design forum, the short answer is - you don't. Rows in a table have no inherent order that you can rely on and the "position" of rows is a visual characteristic that should be implemented by the application that displays
this information or by the query that is used to generate the resultset.
So the next question is how one accomplishes this particular order within a select statement. That is a tsql question which, for future reference, is best posted to the tsql forum. In addition, many of the questions or issues that you will face
have been discussed in the forums - often many, many times. The first thing you should do when faced with an issue is to simply search the forums and leverage the the knowledge that has already been discussed. In doing so you are quite likely to
see suggestions or related issues that you should consider in your search for a solution.
Now, to answer the question - you need to formulate a order by clause that forces the rows to be sorted in the manner you desire. Effectively you have 2 levels of sorting. The first level divides your rows into 2 groups. Group 1 consists
of rows where name = E and Group 2 is everything else. Following that you then need to sort the rows in each group by name in descending order. Something like:
order by case name when E then 1 else 2 end, name desc -
How can i add a new row in System Matrix passing itemcode and quantaty
Hi All,
I have to add new lines in the matrix system only through the itemcode and item quantity. I tried several ways without success. Maybe the following code help to explain what I'm trying to do.
Someone already inserted rows in the matrix system? Can someone show me how I can do. This example is in C# but if someone has in VB I will apreciate.
FormUID = SBO_Application.Forms.ActiveForm.UniqueID;
f = SBO_Application.Forms.Item(FormUID);
try
SAPbobsCOM.Recordset oRS;
oRS = ((SAPbobsCOM.Recordset)oCompany.GetBusinessObje
SAPbobsCOM.BoObjectTypes.BoRecordset));
oItem = f.Items.Item("38");
oMatrix = ((SAPbouiCOM.Matrix)(oItem.Specific));
oEditText = ((SAPbouiCOM.EditText)oMatrix.Columns.Item(3).Cells.Item(oMatrix.RowCount - 1).Specific);
string Codigo = oEditText.Value; //Select the item number to use in strQuery
strQuery = "SELECT U_ART_COM FROM [@SB1EVOL_COMPOSTOS] where
U_ART_PRI='" + Codigo.ToString();
oRS.DoQuery(strQuery);
if (oRS.RecordCount > 0)
oRS.MoveFirst();
numart = oRS.RecordCount;
f.Freeze(true);
for (j = 1; j <= numart; j++)
try
ItemCodeTXT = oRS.Fields.Item(0).Value.ToString();
oEditText = ((SAPbouiCOM.EditText)(oMatrix.Columns.Item(3).Cells.Item(oMatrix.RowCount).Specific));
oEditText.Value = ItemCodeTXT.ToString();
f.Update();
oRS.MoveNext();
catch (Exception oEx)
f.Freeze(false);
f.Update();
MessageBox.Show(oEx.Message + " j = " + System.Convert.ToString(j));
j = 0;
f.Freeze(false);
f.Update();
In this example i try to add rows in Invoice matrix.
Thanks in advance.
Edited by: Luís Filipe Duarte on Jun 26, 2009 4:14 PM
Edited by: Luís Filipe Duarte on Jun 26, 2009 4:17 PMViva Vitor,
Antes de mais obrigado pela resposta.
È esse mesmo o meu objectivo. Passo a explicar qual é o objectivo deste desenvolvimento. O que se pretende é que quando um utilizador escreva o código de um artigo numa linha da matrix de um documento de venda o add-on vai ler esse artigo e de seguida consultar uma tabela de utilizador que ja esta criada para validar se esse artigo tem outros artigos associados, e se tiver, entao o addon tem que os escrever nas linhas imediatamente a seguir. Eu queria mesmo, era escrever qual era o artigo e qual a respectiva quantidade. Eu consigo encontrar qual o artigo que o utlizador escreve e qual os artigos associados. O meu problema acontece quando tendo adicionar as novas linhas.
Com o codigo que se segue podes ver que estou a atribuir a uma EditText o codigo do artigo a escrever. O problema é se correr em modo debug consigo ver que a aplicação chega a essa linha
oEditText.Value = ItemCodeTXT.ToString();
e volta para trás, ou seja entra num loop e nao sai daqui.
if (oRS.RecordCount > 0)
oRS.MoveFirst();
numart = oRS.RecordCount;
f.Freeze(true);
for (j = 1; j <= numart; j++)
try
ItemCodeTXT = oRS.Fields.Item(0).Value.ToString();
oEditText = ((SAPbouiCOM.EditText)(oMatrix.Columns.Item(3).Cells.Item(oMatrix.RowCount).Specific));
oEditText.Value = ItemCodeTXT.ToString();
f.Update();
oRS.MoveNext();
catch (Exception oEx)
f.Freeze(false);
f.Update();
MessageBox.Show(oEx.Message + " j = " + System.Convert.ToString(j));
Eu para adicionar uma nova linha o que tenho de fazer? não vasta passar a informação do item code?
Este desenvolvimento é para implementar ecoreee no sap. Nao sei já tiveste alguma coisa dessas entre mãos.
Obrigado mais uma vez pela atenção. Espero também um dia poder ajudar.
Com os melhores cumprimentos.
Luis duarte -
Oracle 8i vs Oracle 9/10: Group by and order of returned rows
Hello people,
I've searched the forum for threads on this topic: the order of returned rows in queries which have a GROUP BY clause, and found out that Oracle states that GROUP BY clause does not guarantee that the order of returned rows will be the same every time nor the rows will be ordered someway. I've confirmed this information in the Oracle documentation for the GROUP BY clause for Oracle 9 and 10. But I couldn't find the same in the Oracle 8 documentation (SQL Reference), in which the GROUP BY clause section does not mention anything about the order of returned rows in queries which have a GROUP BY (except for something about using a GROUP BY and a HAVING clause together, which is not helpful in this situation).
Besides, I have an Oracle training book: "Introduction to Oracle: SQL and PL/SQL" for Oracle 8, where the GROUP BY clause is said to perform a default ordering, here is the text:
"By default, rows are sorted by ascending order of the columns included in the GROUP BY list. You can override this by using the ORDER BY clause".
So, I need to find out if Oracle 8 GROUP BY clause did some kind of sorting over the returned rows as it is said in the training book and if this behavior changed in Oracle 9. And more important: where to look for to find documentation about this change.
Thank you, guys, I really hope someone could help me with this.
Fer.And this statement from Tom (taken from the link above) says more about why the sort (even when done because of group by) should not be relied upon:
<quote from="asktom link above">
and even when it does sort as a by product of its processing, the sort is a
BINARY SORT, not your sort (with your language and character set)
</quote> -
How to disable a Entire row in a Matrix in Find Mode (User Form)
Hi,
How to disable a Entire row in a Matrix in Find Mode (User Form)
Regards
JambuHi,
Iam using Bubble event = false in click event but the matrix row
is allow to edit but we cant save the document in Find Mode That is fine.
What is my actual requirement is In find mode matrix Row not allow to enter the data .
For examble In ADD mode i enter the data in Three rows (Item Section - Matrix) and
save the document. Whwn i open the document in find mode the three row is not allow
to editable like the same functionality of PO, sales Order, etc ..
Regards
Jambu -
How to change the forecolor of a single row of a matrix
In a matrix which is displaying list of items like the Sales Order Form, I am trying to change the forecolor to red for only those items where the item's required quantity is lesser than the item's avialable quantity.
The Code Snippet is as follows:
ReqQty = oMatrix.Columns.Item("ReqQty").Cells.Item(pval.row).Specific.value
AvaQty = oMatrix.Columns.Item("AvaQty").Cells.Item(pval.row).Specific.value
If ReqQty > AvaQty Then
Dim txtField As SAPbouiCOM.EditText
oMatrix = oform.Items.Item("cMatrix").Specific
txtField = oMatrix.Columns.Item("ItemNo").Cells.Item (pval.row).Specific
txtField.ForeColor = 200
txtField = oMatrix.Columns.Item("ItemDesc").Cells.Item(pval.row).Specific
txtField.ForeColor = 200
oMatrix.Columns.Item("ReqQty").Cells.Item(pval.row).Specific
txtField.ForeColor = 200
oMatrix.Columns.Item("AvaQty").Cells.Item(pval.row).Specific
txtField.ForeColor = 200
End If
But the problem is , if this condition applies to any one of the items in the matrix, then all the rows in the matrix change the forecolor to red.
Has anyone faced this problem and has a solution to it?I haven't tested the problems you have for a matrix.
But I have seen the properties are not exposed for the Cell object...
Regarding the ForeColor and BackColor on the EditText they are deprecated starting from 2004 BUT you have the same properties now exposed at the <b>Item</b> level.
For the Column object the ForeColor and BackColor are not market as deprecated.
Regards
Trinidad. -
E-Rows = NULL and A-Rows=42M? Need help in understanding why.
Hi,
Oracle Standard Edition 11.2.0.3.0 CPU Oct 2012 running on Windows 2008 R2 x64. I am using Oracle 10g syntax for WITH clause as the query will also run on Oracle 10gR2. I do not have a Oracle 10gR2 environment at hand to comment if this behaves the same.
Following query is beyond me. It takes around 2 minutes to return the "computed" result set of 66 rows.
SQL> WITH dat AS
2 (SELECT 723677 vid,
3 243668 fid,
4 TO_DATE ('06.03.2013', 'dd.mm.yyyy') mindt,
5 TO_DATE ('06.03.2013', 'dd.mm.yyyy') maxdt
6 FROM DUAL
7 UNION ALL
8 SELECT 721850,
9 243668,
10 TO_DATE ('06.02.2013', 'dd.mm.yyyy'),
11 TO_DATE (' 22.03.2013', 'dd.mm.yyyy')
12 FROM DUAL
13 UNION ALL
14 SELECT 723738,
15 243668,
16 TO_DATE ('16.03.2013', 'dd.mm.yyyy'),
17 TO_DATE (' 04.04.2013', 'dd.mm.yyyy')
18 FROM DUAL)
19 SELECT /*+ GATHER_PLAN_STATISTICS */ DISTINCT vid, fid, mindt - 1 + LEVEL dtshow
20 FROM dat
21 CONNECT BY LEVEL <= maxdt - mindt + 1
22 order by fid, vid, dtshow;
66 rows selected.
SQL>
SQL> SELECT * FROM TABLE (DBMS_XPLAN.display_cursor (NULL, NULL, 'ALLSTATS LAST'));
PLAN_TABLE_OUTPUT
SQL_ID 9c4vma4mds6zk, child number 0
WITH dat AS (SELECT 723677 vid, 243668 fid,
TO_DATE ('06.03.2013', 'dd.mm.yyyy') mindt,
TO_DATE ('06.03.2013', 'dd.mm.yyyy') maxdt FROM DUAL
UNION ALL SELECT 721850, 243668,
TO_DATE ('06.02.2013', 'dd.mm.yyyy'), TO_DATE ('
22.03.2013', 'dd.mm.yyyy') FROM DUAL UNION ALL
SELECT 723738, 243668, TO_DATE
('16.03.2013', 'dd.mm.yyyy'), TO_DATE (' 04.04.2013',
'dd.mm.yyyy') FROM DUAL) SELECT /*+
GATHER_PLAN_STATISTICS */ DISTINCT vid, fid, mindt - 1 + LEVEL dtshow
FROM dat CONNECT BY LEVEL <= maxdt - mindt + 1 order by fid, vid,
dtshow
Plan hash value: 1865145249
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | OMem | 1Mem | Used-Mem |
| 0 | SELECT STATEMENT | | 1 | | 66 |00:01:54.64 | | | |
| 1 | SORT UNIQUE | | 1 | 3 | 66 |00:01:54.64 | 6144 | 6144 | 6144 (0)|
| 2 | CONNECT BY WITHOUT FILTERING (UNIQUE)| | 1 | | 42M|00:01:04.00 | | | |
| 3 | VIEW | | 1 | 3 | 3 |00:00:00.01 | | | |
| 4 | UNION-ALL | | 1 | | 3 |00:00:00.01 | | | |
| 5 | FAST DUAL | | 1 | 1 | 1 |00:00:00.01 | | | |
| 6 | FAST DUAL | | 1 | 1 | 1 |00:00:00.01 | | | |
| 7 | FAST DUAL | | 1 | 1 | 1 |00:00:00.01 | | | |
--------------------------------------------------------------------------------------------------------------------------If I take out one of the UNION queries, the query returns in under 1 second.
SQL> WITH dat AS
2 (SELECT 723677 vid,
3 243668 fid,
4 TO_DATE ('06.03.2013', 'dd.mm.yyyy') mindt,
5 TO_DATE ('06.03.2013', 'dd.mm.yyyy') maxdt
6 FROM DUAL
7 UNION ALL
8 SELECT 721850,
9 243668,
10 TO_DATE ('06.02.2013', 'dd.mm.yyyy'),
11 TO_DATE (' 22.03.2013', 'dd.mm.yyyy')
12 FROM DUAL)
13 SELECT /*+ GATHER_PLAN_STATISTICS */ DISTINCT vid, fid, mindt - 1 + LEVEL dtshow
14 FROM dat
15 CONNECT BY LEVEL <= maxdt - mindt + 1
16 order by fid, vid, dtshow;
46 rows selected.
SQL>
SQL> SELECT * FROM TABLE (DBMS_XPLAN.display_cursor (NULL, NULL, 'ALLSTATS LAST'));
PLAN_TABLE_OUTPUT
SQL_ID 1d2f62uy0521p, child number 0
WITH dat AS (SELECT 723677 vid, 243668 fid,
TO_DATE ('06.03.2013', 'dd.mm.yyyy') mindt,
TO_DATE ('06.03.2013', 'dd.mm.yyyy') maxdt FROM DUAL
UNION ALL SELECT 721850, 243668,
TO_DATE ('06.02.2013', 'dd.mm.yyyy'), TO_DATE ('
22.03.2013', 'dd.mm.yyyy') FROM DUAL) SELECT /*+
GATHER_PLAN_STATISTICS */ DISTINCT vid, fid, mindt - 1 + LEVEL dtshow
FROM dat CONNECT BY LEVEL <= maxdt - mindt + 1 order by fid, vid,
dtshow
Plan hash value: 2232696677
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | OMem | 1Mem | Used-Mem |
| 0 | SELECT STATEMENT | | 1 | | 46 |00:00:00.01 | | | |
| 1 | SORT UNIQUE | | 1 | 2 | 46 |00:00:00.01 | 4096 | 4096 | 4096 (0)|
| 2 | CONNECT BY WITHOUT FILTERING (UNIQUE)| | 1 | | 90 |00:00:00.01 | | | |
| 3 | VIEW | | 1 | 2 | 2 |00:00:00.01 | | | |
| 4 | UNION-ALL | | 1 | | 2 |00:00:00.01 | | | |
| 5 | FAST DUAL | | 1 | 1 | 1 |00:00:00.01 | | | |
| 6 | FAST DUAL | | 1 | 1 | 1 |00:00:00.01 | | | |
26 rows selected.What I cannot understand is why the E-Rows is NULL for "CONNECT BY WITHOUT FILTERING (UNIQUE)" step and A-Rows shoots up to 42M for first case. The behaviour is the same for any number of UNION queries above two.
Can anyone please help me understand this and aid in tuning this accordingly? Also, I would be happy to know if there are better ways to generate the missing date range.
Regards,
SatishMay be, this?
WITH dat AS
(SELECT 723677 vid,
243668 fid,
TO_DATE ('06.03.2013', 'dd.mm.yyyy') mindt,
TO_DATE ('06.03.2013', 'dd.mm.yyyy') maxdt
FROM DUAL
UNION ALL
SELECT 721850,
243668,
TO_DATE ('06.02.2013', 'dd.mm.yyyy'),
TO_DATE (' 22.03.2013', 'dd.mm.yyyy')
FROM DUAL
UNION ALL
SELECT 723738,
243668,
TO_DATE ('16.03.2013', 'dd.mm.yyyy'),
TO_DATE (' 04.04.2013', 'dd.mm.yyyy')
FROM DUAL)
SELECT vid, fid, mindt - 1 + LEVEL dtshow
FROM dat
CONNECT BY LEVEL <= maxdt - mindt + 1
and prior vid = vid
and prior fid = fid
and prior sys_guid() is not null
order by fid, vid, dtshow;
66 rows selected.
Elapsed: 00:00:00.03 -
Difference between current row and previous row in a table
Hi All,
I am having a problem with the query. Can some of please help me?
I need to get difference between current row and previous row in a table. I have a table, which have data like bellow.
TABLEX
================
Name Date Items
AAA 01-SEP-09 100
BBB 02-SEP-09 101
CCC 03-SEP-09 200
DDD 04-SEP-09 200
EEE 05-SEP-09 400
Now I need to get output like bellow...
Name Date Items Diff-Items
AAA 01-SEP-09 100 0
BBB 02-SEP-09 101 1
CCC 03-SEP-09 200 99
DDD 04-SEP-09 200 0
EEE 05-SEP-09 400 200
Can some one help me to write a query to get above results?
Please let me know if you need more information.
Thanks a lot in advance.
We are using Oracle10G(10.2.0.1.0).
Thanks
Asif, nvl (items - lag (items) over (order by dt), 0)like in
SQL> with test as
2 (
3 select 'AAA' name, to_date('01-SEP-09', 'dd-MON-rr') dt, 100 items from dual union all
4 select 'BBB' name, to_date('02-SEP-09', 'dd-MON-rr') dt, 101 items from dual union all
5 select 'CCC' name, to_date('03-SEP-09', 'dd-MON-rr') dt, 200 items from dual union all
6 select 'DDD' name, to_date('04-SEP-09', 'dd-MON-rr') dt, 200 items from dual union all
7 select 'EEE' name, to_date('05-SEP-09', 'dd-MON-rr') dt, 400 items from dual
8 )
9 select name
10 , dt
11 , items
12 , nvl (items - lag (items) over (order by dt), 0)
13 from test
14 ;
NAM DT ITEMS NVL(ITEMS-LAG(ITEMS)OVER(ORDERBYDT),0)
AAA 01-SEP-09 100 0
BBB 02-SEP-09 101 1
CCC 03-SEP-09 200 99
DDD 04-SEP-09 200 0
EEE 05-SEP-09 400 200
SQL> -
Importing Sales orders and Invoices thru DTW
Hi every one,
I am facing a unique problem when using DTW to import sales orders and invoices through DTW.
I am using the two templates- Documents and Document Lines. But the imported Invoice or the sales order(In both cases) the dicount field in the row is taking a negetive discount value. Let me elaborate....
1. I am taking a BP which has been alloted a Particular pricelistcode in the BP Master.( say it be Purchase price).
2. Now In the Doc_lines Template I have put the value in the price column- (eg. Rs. 500).
3. Now the itemcode used in the template is already having a masters and the prices are also defined in SAP B1. Say the Purchase price defined for the item is Rs.400
4.When I am importing the order/nvoice then the discount field in the row automatically takes a value of -25%, the unit price has the value Rs.400 and the Total Field shows Rs.500.
( this Implies that the price I have suggested to Import i.e. Rs500 is some how not taken by the system. The system takes the price defined for the BP and then adjusts it with the price suggested by the user during import) So a negetive discount is taken.
On the other hand if the same procedure is followed for an item where the prices are not updated in the master data then there is no such problem. the unit price field reflects the price which is given in yhe template.
please suggest a way to get out of this problem.Hi Debraj,
Try the following..
In Admin > System init > Document Settings > General Tab ..Calculate the Row total using Unit price ....... leave this unchecked
Also, at the Document_lines template fill the discount column with 0
Suda -
Joining Sales Orders and Delivery Notes in Query
Hi Experts
Please could someone provide me with the correct SQL syntax for joining tables ORDR, RDR1, ODLN and DLN1 in a query?
I need to show a list of the (rows of all open sales orders) and (closed sales order (which have a delivery note) between certain dates).
Thanks
JonHi Gordon
Thanks for your help. Could you help me a little further? I am writing the query to show me a mixture of (Open Order rows which contain item code 'C&P') and (closed orders between 2 dates which also contain C&P) - both need to have the customer having property 54 set as 'Y'
Working with what you sent me it almost works but for some reason I cannt fathom it won't show the open orders only the closed. I think it may have some do with my last JOIN
This is what I have:
SELECT T0.DocNum 'Delivery No', T0.DocDate 'Delivery Date', T3.Quantity 'Delivery Quantity', T1.DocNum 'S/O No', T1.DocDate 'SO Date', T1.DocStatus, T3.ItemCode, T3.Dscription, T2.Quantity 'SO Quantity', T2.Quantity-T3.Quantity 'Balance Quantity', T2.LineTotal'C&P Price After Discount', T2.DiscPrcnt, T2.Project, T4.QryGroup54'Carriage Deal', t2.freetxt, t1.comments
FROM DBO.DLN1 T3
INNER JOIN DBO.ODLN T0 ON T3.DOCENTRY = T0.DOCENTRY LEFT JOIN DBO.RDR1 T2 ON T3.BaseENTRY = T2.DOCENTRY AND T2.ItemCode = T3.ItemCode LEFT JOIN DBO.ORDR T1 ON T2.DOCENTRY = T1.DOCENTRY INNER JOIN OCRD T4 ON T0.CardCode = T4.CardCode
WHERE (T2.ItemCode LIKE 'C&P%%' AND T1.DocStatus='O' and t4.qrygroup54='Y') or (T2.[ItemCode] LIKE 'C&P%%' AND T1.[DocStatus] = 'C' and T4.QryGroup54='Y' and (T0.DocDate Between '[%0]' and '[%1]'))
Thanks
Jon -
I have a SSRS report which uses a matrix for a crosstab effect.
Each row contains about 10 score values in 10 columns respectively. I need each row to check against the previous row, and i need each score value in each column to be compared to the corresponding column score value in the previous row.
If the current score is greater than the corresponding previous score (in the previous row), then i want to change the background of the cell.
if the current score is smaller than the previous, then it's a different color.
if they are equal, or it's the first row in the matrix table, then leave white.
I have found custom code functions to use in the SSRS expression fields, but every single one of them compares against the previous COLUMN value and not the previous ROW value which is what i need. the "Previous" function would be perfect if i
could use it in a matrix but i can't. (i keep getting error "The use of a Previous aggregate function in a tablix cell is not supported"). looking around it turns out that matrices are arrange in groups and not in rows which is why Previous can't
be used and the only way is with custom code.
Please help. if you have any custom code samples that achieve what i need, please share, or give me advice on how to achieve this.
Thank youI figured it out. Maybe it can help someone else in the future:
Public Shared count as Integer = 0
Public Shared currentRow As Integer = 1
Public Shared MatrixStructures As New System.Collections.Generic.List(Of MatrixStructure)()
Public Shared Function GetCellColor(row as Integer, score as Integer)
If (row > currentRow) Then
count = 0
currentRow = row
End If
count = count + 1
Dim matrixStructure As New MatrixStructure()
matrixStructure.RowIndex = row
matrixStructure.ColumnIndex = count
matrixStructure.ScoreValue = score
MatrixStructures.Add(matrixStructure)
If score = 0 Then
Return "White"
End If
Dim val As MatrixStructure = MatrixStructures.Find(Function(s As MatrixStructure)
Return s.GetRowIndex() = row - 1 AndAlso s.GetColumnIndex() = count
End Function)
If (Not (val Is Nothing)) Then
If val.scoreValue = 0 Then
Return "White"
End If
If score >= val.scoreValue + 2 Then
Return "Green"
ElseIf score <= val.scoreValue - 2 Then
Return "Red"
End If
End If
Return "White"
End Function
Public Class MatrixStructure
Public rowIndex As Integer
Property GetRowIndex() As Integer
Get
Return rowIndex
End Get
Set(ByVal Value As Integer)
rowIndex = Value
End Set
End Property
Public columnIndex As Integer
Property GetColumnIndex() As Integer
Get
Return columnIndex
End Get
Set(ByVal Value As Integer)
columnIndex = Value
End Set
End Property
Public scoreValue As Integer
Property GetScoreValue () As Integer
Get
Return scoreValue
End Get
Set(ByVal Value As Integer)
scoreValue = Value
End Set
End Property
End Class
and to pass the current row number from the expression i use this
Ceiling(RowNumber(NOTHING) / 10)
i divide the row number by 10 because there are ten columns. if you don't know the number of columns, or it's a variable number, then return it from the stored procedure query in the first place. that's what I had to do -
Values in "vendor batch" in the Goods-in-order and Goods-in-plan lists are
Vendor batch No. : Transaction ZJPMPU322
(Background)
There are "vendor batch" and "batch" fields in Goods-in-order and Goods-in-plan lists (transaction ZJPMPU322). Values for these fields are retrieved from inbound delivery document (transaction VL33N). After core 7.0 upgrade, "vendor batch" is not copied from "batch" in inbound delivery document any more so that nothing appears in the vendor batch field in the lists.
(Change request)
Values in "vendor batch" in the Goods-in-order and Goods-in-plan lists are retrieved from "batch" in inbound delivery document ONLY IF "vendor batch" is blank in the inbound delivery document.
(Current design)
Batch is retrieved from LIPS-CHARG
Vendor batch is retrieved from LIPS-LICHN
(If there is no record in LIPS, blank will be printed out for both fields)
(After change)
Batch is retrieved from LIPS-CHARG
Vendor batch is retrieved from LIPS-LICHN only if LIPS-LICHN is not blank.
If LIPS-LICHN is blank, vendor batch is retrieved from LIPS-CHARG.
(If there is no record in LIPS, blank will be printed out for both fields. If both LIPS-CHARG and LIPS-LICHN are blank, blank will be printed out for both fields),
Following is the program:
REPORT zjpmrpu322 MESSAGE-ID zjpm001
NO STANDARD PAGE HEADING
LINE-COUNT 50
LINE-SIZE 255.
*& Development ID: PU_DD_322_LJP *
*& Report : ZJPMRPU322 *
*& The Purpose of this program is to print the Goods-in-order list *
*& and the Goods in plan list for raw materials, materials purchase *
*& etc at the Sasayama plant, Japan. *
*& Change Log: *
*& Init Who Date Text *
*& PV P V R S Varma 07-May-2003 Initial Version *
*& DU D.Usui 2004/02/26 CR No. 1432 *
*& DU D.Usui 2004/03/08 CR No. 1447 *
*& DU D.Usui 2004/05/06 CR No. 1591 *
Constants
CONSTANTS:
c_werks LIKE ekpo-werks VALUE 'JP01', "Plant code - Sasayama plant
c_id LIKE thead-tdid VALUE 'F02', "Text ID for Info record
c_object LIKE thead-tdobject VALUE 'EKPO',"Object of text for info rec
*c_zzjp_r1 LIKE marc-zzjp_re1 VALUE 'GMP', "Goods in plan- Domestic
*c_zzjp_r2 LIKE marc-zzjp_re1 VALUE 'GMPI', "Import sales order document
c_plus TYPE c VALUE '', "Holding '' sign
c_spras LIKE makt-spras VALUE 'J', "Language key Japan
*c_device(7) type c value 'PRINTER', "Device type
c_form(16) TYPE c VALUE 'ZJPMPU305', "Form name
c_ele_gmp(4) TYPE c VALUE 'GMP', "GMP Text element
c_ele_gmpi(4) TYPE c VALUE 'GMPI', "GMPI Text element
add begin CR1432
c_ele_bgmp(4) TYPE c VALUE 'BGMP', "BGMP
c_ele_bgmpi(5) TYPE c VALUE 'BGMPI', "BGMPI
add end CR1432
c_function(3) TYPE c VALUE 'SET', "Function
c_type(4) TYPE c VALUE 'BODY', "Window area in main window
c_win_head(7) TYPE c VALUE 'HEADING', "Heading window
c_win_shead(7) TYPE c VALUE 'SUBHEAD', "sub heading window
c_win_fot1(7) TYPE c VALUE 'FOOTER1', "Footer 1 window
c_win_main(4) TYPE c VALUE 'MAIN', "Main window
c_comd(8) TYPE c VALUE 'NEW-PAGE', "New-page command
c_zar TYPE ekko-bsart VALUE 'ZAR',
c_x TYPE c VALUE 'X', "Indicator for print options
c_f TYPE c VALUE 'F', "Indicator for Purchase Order
add begin CR1591
Deletion indicator in purchasing document
c_loekz(1) TYPE c VALUE 'L',
For ranges tables
c_sign_i(1) TYPE c VALUE 'I', "Sign(include)
c_op_eq(2) TYPE c VALUE 'EQ', "Option(=)
Confirmation category
c_ebtyp_ab(2) TYPE c VALUE 'AB', "Order acknowledgment
add end CR1591
c_la(2) TYPE c VALUE 'LA'. "Indicator for Inbound deliver
Database Tables
Vaiables / Internal tables *
Internal table to store PO information
Not used after CR1591
DATA: BEGIN OF t_purc OCCURS 0,
ebeln LIKE eket-ebeln, "Purchasing Document Number
ebelp LIKE eket-ebelp, "Item Number of Purchasing Document
eindt LIKE eket-eindt, "Item delivery date
menge LIKE eket-menge, "Scheduled quantity
charg LIKE eket-charg, "Batch number
matnr LIKE ekpo-matnr, "Material code
werks LIKE ekpo-werks, "Plant
meins LIKE ekpo-meins, "Unit of measure
lifnr LIKE ekko-lifnr, "Vendor number
END OF t_purc.
Internal table to store material description.
DATA: BEGIN OF t_makt OCCURS 0,
matnr LIKE makt-matnr, "Material code
maktx LIKE makt-maktx, "Material description
END OF t_makt.
Internal table for storage of final EKET data
DATA: BEGIN OF t_eket OCCURS 0,
ebeln LIKE eket-ebeln, "Purchasing Document Number
ebelp LIKE eket-ebelp, "Item Number of Purchasing Document
ebelp_ex(6) TYPE n, "Extended ebelp with length 6
eindt LIKE eket-eindt, "Item delivery date
menge LIKE eket-menge, "Scheduled quantity
dabmg LIKE ekes-dabmg, " Delivered Quantity
charg LIKE eket-charg, "Batch number
matnr LIKE ekpo-matnr, "Material code
werks LIKE ekpo-werks, "Plant
maktx LIKE makt-maktx, "Material Description-- jp check
etens LIKE ekes-etens, "Sequence Number
meins LIKE ekpo-meins, "Unit of measure
lifnr LIKE ekko-lifnr, "Vendor number
vbeln LIKE ekes-vbeln,
vbelp LIKE ekes-vbelp,
vpnam(40) TYPE c, "Vendor product name
END OF t_eket.
Internal table for extraction of data from EKES
Not used after CR1591
DATA: BEGIN OF t_ekes OCCURS 0,
ebeln LIKE ekes-ebeln, "Purchasing Document Number
ebelp LIKE ekes-ebelp, "Item Number of Purchasing Document
etens LIKE ekes-etens, "Sequence No
eindt LIKE ekes-eindt, "Item delivery date
menge LIKE ekes-menge, "Scheduled Quantity
dabmg LIKE ekes-dabmg, " delivered quantity
vbeln LIKE ekes-vbeln,
vbelp LIKE ekes-vbelp,
mark TYPE c,
END OF t_ekes.
Internal table for extraction of data from EKES
Not used after CR1591
DATA: BEGIN OF t_ekes_temp OCCURS 0,
ebeln LIKE ekes-ebeln, "Purchasing Document Number
ebelp LIKE ekes-ebelp, "Item Number of Purchasing Document
etens LIKE ekes-etens, "Sequence No
eindt LIKE ekes-eindt, "Item delivery date
menge LIKE ekes-menge, "Scheduled Quantity
END OF t_ekes_temp.
Internal table for storing data from MLGN table.
DATA: BEGIN OF t_mlgn OCCURS 0,
matnr LIKE mlgn-matnr, "material code
lhmg1 LIKE mlgn-lhmg1, "Standard pallet size
lhme1 LIKE mlgn-lhme1, "Unit of measure
lety1 LIKE mlgn-lety1, "tower
ltkze LIKE mlgn-ltkze, "Storage location
END OF t_mlgn.
Internal table for storing data from MARM table.
DATA: BEGIN OF t_marm OCCURS 0,
matnr LIKE marm-matnr, "material code
umrez LIKE marc-zzjp_cas_size, "Std package unit
meins LIKE ekpo-meins, "alternate unit
END OF t_marm.
Internal table for storing data from MARC table.
DATA: BEGIN OF t_marc OCCURS 0,
matnr LIKE marc-matnr, "Material code
zzjp_nyu_sop LIKE marc-zzjp_nyu_sop, "Product Std number
zzjp_dos_frm LIKE marc-zzjp_dos_frm, "Dosage form
zzjp_aprn LIKE marc-zzjp_aprn, "Apperance
zzjp_re1 LIKE marc-zzjp_re1, "Heading
END OF t_marc.
Internal table for storing data from lfa1 table.
DATA: BEGIN OF t_lfa1 OCCURS 0,
lifnr LIKE lfa1-lifnr, "Vendor code
name1 LIKE lfa1-name1, "Vendor name
END OF t_lfa1.
Internal table for Storing data from LIPS table.
DATA: BEGIN OF t_lips OCCURS 0,
vbeln LIKE lips-vbeln, "Delivery document no
posnr LIKE lips-posnr, "Item number for Delivery document
charg LIKE lips-charg, "Batch number
lichn LIKE lips-lichn, "Vendor Batch number
END OF t_lips.
Internal table for storing the final display data.
DATA: BEGIN OF t_display OCCURS 0,
g_checkbox type c, "check box for selection of records
ebeln LIKE ekes-ebeln, "Purchasing Document Number
ebelp LIKE ekes-ebelp, "Item Number of Purchasing Document
etens LIKE ekes-etens, "Sequence No
eindt LIKE eket-eindt, "Item delivery date
menge LIKE eket-menge, "Scheduled Quantity
vpnam(40) TYPE c, "Vendor product name
lifnr LIKE ekko-lifnr, "Vendor code
name1 LIKE lfa1-name1, "Vendor name
meins LIKE ekpo-meins, "Unit of measure
matnr LIKE ekpo-matnr, "Material Number
maktx LIKE makt-maktx, "Material Description-- jp check
charg LIKE lips-charg, "Batch number
lichn LIKE lips-lichn, "Vendor Batch number
lhmg1 LIKE mlgn-lhmg1, "standard pallet size
lhme1 LIKE mlgn-lhme1, "Unit of standard pallet
lety1 LIKE mlgn-lety1, "tower
ltkze LIKE mlgn-ltkze, "Storage location
umrez LIKE marc-zzjp_cas_size, "Std package unit
meinh LIKE ekpo-meins, "alternate unit
zzjp_nyu_sop LIKE marc-zzjp_nyu_sop, "Product Std number
zzjp_dos_frm LIKE marc-zzjp_dos_frm, "Dosage form
zzjp_aprn LIKE marc-zzjp_aprn, "Apperance
zzjp_re1 LIKE marc-zzjp_re1, "Heading
std_pac_no(13) TYPE n, "Std receipt package no
tot_std_pt(13) TYPE n, "Total no of std pallets
add begin CR1447
Add new field 'Goods-in-order','Item' for goods in plan list
vbeln like ekes-vbeln, "Goods-in-order
vbelp like ekes-vbelp, "Item
add end CR1447
END OF t_display.
Internal table for storing the final display data -Goods in order list
DATA: BEGIN OF t_display1 OCCURS 0,
ebeln LIKE ekes-ebeln, "Purchasing Document Number
ebelp LIKE ekes-ebelp, "Item Number of Purchasing Document
etens LIKE ekes-etens, "Sequence No
eindt LIKE eket-eindt, "Item delivery date
menge LIKE eket-menge, "Scheduled Quantity
vpnam(40) TYPE c, "Vendor product name
lifnr LIKE ekko-lifnr, "Vendor code
name1 LIKE lfa1-name1, "Vendor name
meins LIKE ekpo-meins, "Unit of measure
matnr LIKE ekpo-matnr, "Material Number
maktx LIKE makt-maktx, "Material Description-- jp check
charg LIKE lips-charg, "Batch number
lichn LIKE lips-lichn, "Vendor Batch number
lhmg1 LIKE mlgn-lhmg1, "standard pallet size
lhme1 LIKE mlgn-lhme1, "Unit of standard pallet
lety1 LIKE mlgn-lety1, "tower
ltkze LIKE mlgn-ltkze, "Storage location
umrez LIKE marc-zzjp_cas_size, "Std package unit
meinh LIKE ekpo-meins, "alternate unit
zzjp_nyu_sop LIKE marc-zzjp_nyu_sop, "Product Std number
zzjp_dos_frm LIKE marc-zzjp_dos_frm, "Dosage form
zzjp_aprn LIKE marc-zzjp_aprn, "Apperance
zzjp_re1 LIKE marc-zzjp_re1, "Heading
std_pac_no(13) TYPE n, "Std receipt package no
tot_std_pt(13) TYPE n, "Total no of std pallets
END OF t_display1.
Internal table for storing the final display data - Goods in plan list
DATA: BEGIN OF t_display2 OCCURS 0,
ebeln LIKE ekes-ebeln, "Purchasing Document Number
ebelp LIKE ekes-ebelp, "Item Number of Purchasing Document
etens LIKE ekes-etens, "Sequence No
eindt LIKE eket-eindt, "Item delivery date
menge LIKE eket-menge, "Scheduled Quantity
name1 LIKE lfa1-name1, "Vendor name
meins LIKE ekpo-meins, "Unit of measure
matnr LIKE ekpo-matnr, "Material Number
maktx LIKE makt-maktx, "Material Description-- jp check
charg LIKE lips-charg, "Batch number
lichn LIKE lips-lichn, "Vendor Batch number
lhmg1 LIKE mlgn-lhmg1, "standard pallet size
lety1 LIKE mlgn-lety1, "tower
ltkze LIKE mlgn-ltkze, "Storage location
tot_std_pt(13) TYPE n, "Total no of std pallets
add begin CR1447
Add new field 'Goods-in-order','Item' for goods in plan list
vbeln like ekes-vbeln, "Goods-in-order
vbelp like ekes-vbelp, "Item
add end CR1447
END OF t_display2.
add begin CR1591
RANGES: r_matnr FOR mara-matnr, "for p_matnr
r_ebeln FOR ekpo-ebeln. "for p_ebeln
add end CR1591
DATA: line TYPE i. " line number
DATA: g_checkbox TYPE c. "check box for selection of records
DATA: g_tab LIKE sy-index. "variable to hold index
DATA g_tabix LIKE sy-tabix. "holder for table index
Printing Options.
DATA: lw_pr_options LIKE itcpo.
*lw_pr_options-tddest = 'SA03'. " Print Device Name
lw_pr_options-tdpreview = 'X'. " Print Preview
lw_pr_options-tdnewid = 'X'. " New Request
lw_pr_options-tdlifetime = 2. " Retention in Spool
Selection Screen *
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME.
SELECT-OPTIONS:
s_date FOR sy-datum DEFAULT sy-datum. " Search period.
PARAMETERS:
p_matnr LIKE mara-matnr, " Material code
p_ebeln LIKE ekpo-ebeln. " Purchase Document No
SELECTION-SCREEN END OF BLOCK blk1.
Selection Screen Checks *
AT SELECTION-SCREEN.
IF ( s_date-low IS INITIAL ) AND
( p_matnr IS INITIAL ) AND
( p_ebeln IS INITIAL ).
MESSAGE e000 WITH 'Entry Must in atleast one of the Fields'(t00).
ENDIF.
IF ( NOT p_matnr IS INITIAL ) AND
( s_date IS INITIAL ) AND
( p_ebeln IS INITIAL ).
MESSAGE e000 WITH 'Date should also be Entered'(t01).
ENDIF.
del begin CR1591
This check is not found in original FS
IF ( NOT p_matnr IS INITIAL ) AND
( s_date IS INITIAL ) AND
( NOT p_ebeln IS INITIAL ).
MESSAGE e000 WITH 'Date should also be Entered'(t01).
ENDIF.
del end CR1591
Validations for Data selection *
del begin CR1591
Waste check
IF ( NOT s_date IS INITIAL ) AND
( p_matnr IS INITIAL ) AND
( p_ebeln IS INITIAL ).
PERFORM f_check_date_in_eket.
ENDIF.
IF ( NOT s_date IS INITIAL ) AND
( NOT p_matnr IS INITIAL ) AND
( p_ebeln IS INITIAL ).
PERFORM f_check_matnr_in_plant.
PERFORM f_check_matnr_in_ekpo.
PERFORM f_check_date_in_eket.
PERFORM f_check_matnr_in_plant.
PERFORM f_check_matnr_in_ekpo.
ENDIF.
IF ( NOT s_date IS INITIAL ) AND
( NOT p_matnr IS INITIAL ) AND
( NOT p_ebeln IS INITIAL ).
PERFORM f_check_matnr_in_plant.
PERFORM f_check_matnr_in_ekpo.
PERFORM f_check_date_in_eket.
PERFORM f_check_ebeln_in_ekpo.
PERFORM f_check_werks_in_ekpo.
ENDIF.
IF ( NOT p_ebeln IS INITIAL ) AND
( NOT s_date IS INITIAL ) AND
( p_matnr IS INITIAL ).
PERFORM f_check_date_in_eket.
PERFORM f_check_ebeln_in_ekpo.
PERFORM f_check_werks_in_ekpo.
ENDIF.
IF ( NOT p_ebeln IS INITIAL ) AND
( s_date IS INITIAL ) AND
( p_matnr IS INITIAL ).
PERFORM f_check_ebeln_in_ekpo.
PERFORM f_check_werks_in_ekpo.
ENDIF.
del end CR1591
Data selection from Tables *
START-OF-SELECTION.
SET PF-STATUS 'SELECT'.
add begin CR1591
Set ranges tables
PERFORM set_ranges.
add end CR1591
mod begin CR1591
**Selection of PO data from EKET into internal table t_purc.
PERFORM f_select_eket.
**Selection of corresponding PO data for EKET from EKES into t_ekes.
PERFORM f_select_ekes.
**Selection of material desc from MAKT table into T_makt.
PERFORM f_select_makt.
**Copy the contents of t_purc and t_makt into t_eket table.
PERFORM f_move_eket.
**Replace the corresponding entries of t_eket with t_ekes.
PERFORM f_update_eket.
Selection of PO data from EKET into internal table T_EKET.
PERFORM f_select_eket2.
Selection of corresponding PO data from EKES appending to T_EKET.
PERFORM f_select_ekes2.
Selection of material desc from MAKT table into T_MAKT.
PERFORM f_select_makt2.
mod end CR1591
*Selection of vendor product name.
PERFORM f_select_vpnam.
del begin CR1591
No need
**copy t_eket-ebelp into temporary variable.
PERFORM f_copy_ebelp.
del end CR1591
*selection of data from MLGN table into t_mlgn internal table
PERFORM f_select_mlgn.
*selection of data from marm table into t_marm internal table
PERFORM f_select_marm.
*selection of data from marc table into t_marc internal table
PERFORM f_select_marc.
*selection of data from lfa1 table into t_lfa1 internal table
PERFORM f_select_lfa1.
*Selection of data from LIPS table into t_lips internal table
PERFORM f_select_lips.
del begin CR1591
Don't display list screen when no data exists
*END-OF-SELECTION.
del end CR1591
*lines = sy-linno - 1.
*Collection of data into the final display internal table t_Display
PERFORM f_collect_final.
*Display the contents of t_display as a simple List
PERFORM f_list_display.
AT USER-COMMAND.
PERFORM f_select_layout.
INCLUDE zjpmipu315.
INCLUDE zjpmipu316.
*& Form f_check_MATNR_in_plant
This Routine is to check if the the selected material code is
available in the plant 'JP01'.
FORM f_check_matnr_in_plant.
DATA: l_matnr LIKE mara-matnr.
SELECT matnr UP TO 1 ROWS FROM marc
INTO l_matnr
WHERE
matnr = p_matnr AND
werks = c_werks.
ENDSELECT.
IF l_matnr IS INITIAL.
MESSAGE e000 WITH
'The material is not available in '(t02) c_werks 'plant'(t20).
ENDIF.
ENDFORM. " f_check_MATNR_in_plant
*& Form f_check_EBELN_in_EKPO
This Routine is to check if the Purchase order number selected
is existing or not and if it exists, check if it is related to
the plant 'JP01'.
FORM f_check_ebeln_in_ekpo.
DATA: l_ebeln LIKE ekpo-ebeln.
SELECT ebeln UP TO 1 ROWS FROM ekpo
INTO l_ebeln
WHERE
ebeln = p_ebeln AND
werks = c_werks.
ENDSELECT.
IF l_ebeln IS INITIAL.
MESSAGE e000 WITH
'PO not available or not related to '(t03) c_werks 'plant'(t21).
ENDIF.
ENDFORM. " f_check_EBELN_in_EKPO
*& Form f_check_matnr_in_ekko
This routine is to check if any PO exist for the selected
Material code.
FORM f_check_matnr_in_ekpo.
DATA: l_matnr LIKE ekpo-matnr.
SELECT matnr UP TO 1 ROWS FROM ekpo
INTO l_matnr
WHERE
matnr = p_matnr.
ENDSELECT.
IF l_matnr IS INITIAL.
MESSAGE e000 WITH
'PO does not exist for the material no'(t04) p_matnr.
ENDIF.
ENDFORM. " f_check_matnr_in_ekpo
*& Form f_check_date_in_eket
This routine is to check if any purchase order exists
with the selected
FORM f_check_date_in_eket.
DATA: l_eindt LIKE eket-eindt.
SELECT eindt UP TO 1 ROWS FROM eket
INTO l_eindt
WHERE
eindt IN s_date.
ENDSELECT.
IF l_eindt IS INITIAL.
MESSAGE e000 WITH
'No PO exist with the selected delivery date '(t05).
ENDIF.
ENDFORM. " f_check_date_in_eket
*& Form f_check_werks_in_ekpo
This Routine is to check if the selected purchase order
is associated with the plant JP01
FORM f_check_werks_in_ekpo.
DATA: l_ebeln LIKE ekpo-ebeln.
SELECT ebeln UP TO 1 ROWS FROM ekpo
INTO l_ebeln
WHERE
werks = c_werks.
ENDSELECT.
IF l_ebeln IS INITIAL.
MESSAGE e000 WITH
'The selected P0 is not relevant to '(t06) c_werks 'plant'(t22).
ENDIF.
ENDFORM. " f_check_werks_in_ekpo
*& Form f_select_eket
Routine to collect data from EKET, EKPO, MAKT, EKKO tables
using inner join and store the data into internal table
t_PURC. The data selection is based on the selection screen's
input.
FORM f_select_eket.
IF ( NOT s_date-low IS INITIAL ) AND
( p_matnr IS INITIAL ) AND
( p_ebeln IS INITIAL ).
SELECT
eket~ebeln
eket~ebelp
eket~eindt
eket~menge
eket~charg
ekpo~matnr
ekpo~werks
ekpo~meins
ekko~lifnr
INTO TABLE t_purc
FROM
( ( eket INNER JOIN ekko ON
eketebeln = ekkoebeln ) INNER JOIN ekpo ON
eketebelp = ekpoebelp AND
ekpoebeln = ekkoebeln )
WHERE
eket~eindt IN s_date AND
ekpo~werks = c_werks AND
ekpo~elikz NE c_x AND
ekko~bstyp EQ c_f AND
ekko~bsart NE c_zar.
ELSEIF ( NOT s_date-low IS INITIAL ) AND
( NOT p_matnr IS INITIAL ) AND
( p_ebeln IS INITIAL ).
SELECT
eket~ebeln
eket~ebelp
eket~eindt
eket~menge
eket~charg
ekpo~matnr
ekpo~werks
ekpo~meins
ekko~lifnr
INTO TABLE t_purc
FROM
( ( eket INNER JOIN ekko ON
eketebeln = ekkoebeln ) INNER JOIN ekpo ON
eketebelp = ekpoebelp AND
ekpoebeln = ekkoebeln )
WHERE
eket~eindt IN s_date AND
ekpo~matnr = p_matnr AND
ekpo~werks = c_werks AND
ekpo~elikz NE c_x AND
ekko~bstyp EQ c_f AND
ekko~bsart NE c_zar.
ELSEIF ( NOT s_date-low IS INITIAL ) AND
( NOT p_matnr IS INITIAL ) AND
( NOT p_ebeln IS INITIAL ).
SELECT
eket~ebeln
eket~ebelp
eket~eindt
eket~menge
eket~charg
ekpo~matnr
ekpo~werks
ekpo~meins
ekko~lifnr
INTO TABLE t_purc
FROM
( ( eket INNER JOIN ekko ON
eketebeln = ekkoebeln ) INNER JOIN ekpo ON
eketebelp = ekpoebelp AND
ekpoebeln = ekkoebeln )
WHERE
eket~eindt IN s_date AND
ekpo~matnr = p_matnr AND
ekpo~ebeln = p_ebeln AND
ekpo~werks = c_werks AND
ekpo~elikz NE c_x AND
ekko~bstyp EQ c_f AND
ekko~bsart NE c_zar.
ELSEIF ( s_date-low IS INITIAL ) AND
( p_matnr IS INITIAL ) AND
( NOT p_ebeln IS INITIAL ).
SELECT
eket~ebeln
eket~ebelp
eket~eindt
eket~menge
eket~charg
ekpo~matnr
ekpo~werks
ekpo~meins
ekko~lifnr
INTO TABLE t_purc
FROM
( ( eket INNER JOIN ekko ON
eketebeln = ekkoebeln ) INNER JOIN ekpo ON
eketebelp = ekpoebelp AND
ekpoebeln = ekkoebeln )
WHERE
ekpo~ebeln = p_ebeln AND
ekpo~werks = c_werks AND
ekpo~elikz NE c_x AND
ekko~bstyp EQ c_f AND
ekko~bsart NE c_zar.
ELSEIF ( NOT s_date-low IS INITIAL ) AND
( p_matnr IS INITIAL ) AND
( NOT p_ebeln IS INITIAL ).
SELECT
eket~ebeln
eket~ebelp
eket~eindt
eket~menge
eket~charg
ekpo~matnr
ekpo~werks
ekpo~meins
ekko~lifnr
INTO TABLE t_purc
FROM
( ( eket INNER JOIN ekko ON
eketebeln = ekkoebeln ) INNER JOIN ekpo ON
eketebelp = ekpoebelp AND
ekpoebeln = ekkoebeln )
WHERE
eket~eindt IN s_date AND
ekpo~ebeln = p_ebeln AND
ekpo~werks = c_werks AND
ekpo~elikz NE c_x AND
ekko~bstyp EQ c_f AND
ekko~bsart NE c_zar.
ENDIF.
IF sy-subrc <> 0.
MESSAGE s000 WITH 'Data not found'(t07).
LEAVE LIST-PROCESSING.
ELSE.
SORT t_purc.
ENDIF.
ENDFORM. " f_select_eket
*& Form f_select_makt
Routine to select the material description for all the
materials present in T_purc table
FORM f_select_makt.
DATA: l_t_makt(4) TYPE c VALUE 'MAKT'.
SELECT
matnr
maktx
FROM
makt
INTO TABLE t_makt
FOR ALL ENTRIES IN t_purc
WHERE
matnr = t_purc-matnr AND
spras = c_spras.
IF sy-subrc <> 0.
MESSAGE s000 WITH
'Relevant data not found in'(t09) l_t_makt 'table'(t23).
ELSE.
SORT t_makt.
ENDIF.
ENDFORM. " f_select_makt
*& Form f_move_eket
Routine to join data in T_PURC and T_MAKT tables into
internal table T_MAKT.
FORM f_move_eket.
LOOP AT t_purc.
t_eket-ebeln = t_purc-ebeln.
t_eket-ebelp = t_purc-ebelp.
t_eket-eindt = t_purc-eindt.
t_eket-menge = t_purc-menge.
t_eket-charg = t_purc-charg.
t_eket-matnr = t_purc-matnr.
t_eket-werks = t_purc-werks.
t_eket-meins = t_purc-meins.
t_eket-lifnr = t_purc-lifnr.
READ TABLE t_makt WITH KEY matnr = t_purc-matnr
BINARY SEARCH.
IF sy-subrc = 0.
t_eket-maktx = t_makt-maktx.
ENDIF.
APPEND t_eket.
CLEAR t_eket.
ENDLOOP.
ENDFORM. " f_move_eket
*& Form f_select_ekes
Routine to select EKES data for all corresponding entries
of T_EKET.
FORM f_select_ekes.
DATA: l_tabix TYPE i.
IF NOT s_date IS INITIAL.
SELECT
ebeln
ebelp
etens
eindt
menge
INTO TABLE t_ekes
FROM
ekes
WHERE
eindt IN s_date.
ELSE.
DESCRIBE TABLE t_purc LINES l_tabix.
IF l_tabix GT 0.
SELECT
ebeln
ebelp
etens
eindt
menge
dabmg
vbeln
vbelp
FROM
ekes
INTO TABLE t_ekes
FOR ALL ENTRIES IN t_eket
FOR ALL ENTRIES IN t_purc
WHERE
ebeln = t_purc-ebeln AND
ebelp = t_purc-ebelp AND
eindt IN s_date.
AND ebeln eq p_ebeln.
and matnr in p_matnr.
ENDIF.
CLEAR l_tabix.
IF NOT s_date IS INITIAL AND NOT p_ebeln IS INITIAL.
SELECT
ekes~ebeln
ekes~ebelp
ekes~etens
ekes~eindt
ekes~menge
ekes~dabmg
APPENDING TABLE t_ekes
FROM ekes
WHERE
eindt IN s_date AND
ebeln EQ p_ebeln AND
ebtyp EQ c_la.
ELSEIF NOT s_date IS INITIAL AND p_ebeln IS INITIAL.
SELECT
ekes~ebeln
ekes~ebelp
ekes~etens
ekes~eindt
ekes~menge
ekes~dabmg
APPENDING TABLE t_ekes
FROM ekes
WHERE
eindt IN s_date AND
ebeln EQ p_ebeln AND
ebtyp EQ c_la.
ELSEIF s_date IS INITIAL AND NOT p_ebeln IS INITIAL.
SELECT
ekes~ebeln
ekes~ebelp
ekes~etens
ekes~eindt
ekes~menge
ekes~dabmg
APPENDING TABLE t_ekes
FROM ekes
WHERE
eindt IN s_date AND
ebeln EQ p_ebeln AND
ebtyp EQ c_la.
ENDIF.
IF sy-subrc = 0.
SORT t_ekes.
ENDIF.
IF NOT t_ekes[] IS INITIAL.
t_ekes_temp[] = t_ekes[].
SORT t_ekes_temp BY ebeln ebelp.
DELETE ADJACENT DUPLICATES FROM t_ekes_temp COMPARING ebeln ebelp.
LOOP AT t_ekes_temp.
READ TABLE t_purc WITH KEY ebeln = t_ekes_temp-ebeln
ebelp = t_ekes_temp-ebelp.
IF sy-subrc NE 0.
CLEAR t_purc.
SELECT SINGLE
eket~ebeln
eket~ebelp
eket~eindt
eket~menge
eket~charg
ekpo~matnr
ekpo~werks
ekpo~meins
ekko~lifnr
INTO CORRESPONDING FIELDS OF t_purc
FROM
( ( eket INNER JOIN ekko ON
eketebeln = ekkoebeln ) INNER JOIN ekpo ON
eketebelp = ekpoebelp AND
ekpoebeln = ekkoebeln )
WHERE
eket~ebeln = t_ekes_temp-ebeln
AND eket~ebelp = t_ekes_temp-ebelp
AND ekpo~elikz NE c_x
AND ekko~bstyp EQ c_f
AND ekko~bsart NE c_zar.
IF sy-subrc EQ 0.
APPEND t_purc.
CLEAR t_purc.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
REFRESH: t_ekes_temp, t_ekes.
CLEAR: t_ekes_temp, t_ekes.
Once the header is filled up get the details from EKES
SELECT ebeln ebelp etens eindt menge dabmg vbeln vbelp
INTO TABLE t_ekes
FROM ekes
FOR ALL ENTRIES IN t_purc
WHERE ebeln EQ t_purc-ebeln.
Mark the entries as 'X' which falls in the date range
LOOP AT t_ekes.
IF t_ekes-eindt IN s_date.
t_ekes-mark = 'X'.
MODIFY t_ekes INDEX sy-tabix TRANSPORTING mark.
ENDIF.
ENDLOOP.
SORT t_ekes BY ebeln ebelp ASCENDING mark DESCENDING.
Delete the entries from eket if no entries in EKES falls in the period
LOOP AT t_purc.
l_tabix = sy-tabix.
READ TABLE t_ekes WITH KEY ebeln = t_purc-ebeln
ebelp = t_purc-ebelp.
IF sy-subrc EQ 0.
IF t_ekes-mark NE 'X'.
DELETE t_purc INDEX l_tabix.
ENDIF.
ENDIF.
ENDLOOP.
delete the entries from EKES which do not fall in the specified period
DELETE t_ekes WHERE mark NE 'X'.
ENDFORM. " f_select_ekes
*& Form f_update_eket
Routine to substitute relevant t_eket entries with that of
t_ekes entries.It does not modify the remaining entries for
for which the corresponding values in t_ekes doesnot exist.
FORM f_update_eket.
DATA: BEGIN OF lt_temp_eket OCCURS 0,
ebeln LIKE eket-ebeln, "Purchasing Document Number
ebelp LIKE eket-ebelp, "Item Number of Purchasing Document
eindt LIKE eket-eindt, "Item delivery date
menge LIKE eket-menge, "Scheduled quantity
dabmg LIKE ekes-dabmg, " Delivered quantity
matnr LIKE ekpo-matnr, "Material code
maktx LIKE makt-maktx, "Material Description-- jp check
etens LIKE ekes-etens, "Sequence Number
meins LIKE ekpo-meins, "Unit of measure
lifnr LIKE ekko-lifnr, "Vendor number
charg LIKE eket-charg, " Batch number Added by PD 08/08/03
vbeln LIKE ekes-vbeln,
vbelp LIKE ekes-vbelp,
END OF lt_temp_eket,
l_menge LIKE ekes-menge.
LOOP AT t_eket.
LOOP AT t_ekes WHERE ebeln = t_eket-ebeln
AND ebelp = t_eket-ebelp.
Added by PD 08/08/03
MOVE t_eket-charg TO lt_temp_eket-charg.
addition ends
MOVE t_eket-ebeln TO lt_temp_eket-ebeln.
MOVE t_eket-ebelp TO lt_temp_eket-ebelp.
MOVE t_eket-meins TO lt_temp_eket-meins.
CLEAR l_menge.
l_menge = t_ekes-menge - t_ekes-dabmg.
IF l_menge LE 0.
CONTINUE.
ELSE.
MOVE l_menge TO lt_temp_eket-menge.
ENDIF.
MOVE t_ekes-eindt TO lt_temp_eket-eindt.
MOVE t_ekes-etens TO lt_temp_eket-etens.
MOVE t_eket-lifnr TO lt_temp_eket-lifnr.
MOVE t_eket-maktx TO lt_temp_eket-maktx.
MOVE t_eket-matnr TO lt_temp_eket-matnr.
MOVE t_ekes-vbeln TO lt_temp_eket-vbeln.
MOVE t_ekes-vbelp TO lt_temp_eket-vbelp.
APPEND lt_temp_eket.
CLEAR lt_temp_eket.
CLEAR t_ekes.
ENDLOOP.
IF sy-subrc NE 0.
Added by PD 08/08/03
MOVE t_eket-charg TO lt_temp_eket-charg.
addition ends
MOVE t_eket-ebelnDear
Problem No 1 : we are working in a process industries with three plants each of them have three order type. we have define MRP group in "OPPR" then assign each MRP group to Orde types in "OPPE". Now the problem is whn i convert plan order in process order for any material systme automaticaly pick the order type PIi01.
Answer :
1.Please check the OPPR -Plant and MRP group -Select Order Type Button -Check what Order Type you have assinged here ( PI01( May be the default Process Order Type )
2.If you are maintaing MRP group ( 0001 or 0002) , did you asisng the same in MRP1 view ?? because
3.Did you maintain the similar Order type in OPKP -Define Production Scheduling Profile ? -This has highest priority .
4.Did you maintain correct order type in OPJH-Maintain Order Type ??
Refer the expert comments on the same issue : Strategy group to define production order type
Problem No 2: 2nd Problem is system system is not creating plan order for prrevios dates. say i enter PIR for month of november from first november to 30th november and run MRP on 29th the sytem create plan order on 30th of november with exception message 30.
Answer : You can plan the order in back dated , if you maitain Satrt date in the Past optiuon in OPU3/OPU5-Define Scheduling parameters .Goto OPU3 -Select the Order Type -Double click -Maintain 90-60 days in the Start Date in the past in Scheduling Control and Details scheduling tab .
Hope it helps
regards
JH
Maybe you are looking for
-
Problem logging in to admin account on Apex 3.1
I have just upgraded to Apex 3.1 and I'm getting an error when logging on as admin. After I click log in I get: Line: 35 Char: 1 Error: Object expected Code: 0 Line 35 is : "<td colspan="1" rowspan="1" align="left"><input type="button" value="Login"
-
GR based IV to be checked for free text requirement
Hi All, Is there any option that if we create shopping carts for free text requirement,GR based IV should be checked automatically in purchase order created for that shopping cart.Or will this get replicated depending on vendor master we select.Pleas
-
The best technique to allow user to enter text in a smart form.
I have created a smartform based on a sales order. Now in one section of the form, the user will have to type out a text or include an existing text based on certain parameters like plant (t001w-werks) which may vary for the sales orders. I want to k
-
I have downloaded the service manual for my laptop (DV6 1130SA) and have been looking at the processors. Currently it has an Intel Dual Core T4200 800 FSB but listed are a few of the Core 2 Duo processors. So I have been thinking on getting a new pro
-
Travel Management Employee Grouping for Domestic Travel per diems
Dear All, I have a scenario in Travel management Scenario Client has Domestic Travel, only in India under India they have Class A cities, Class B Cities and Class C, For Class A different Per diems rate with respect to the Employees Grade Eg i have