Wednesday, August 1, 2012

Hari Om Tat Sat


Hari Om Tat Sat   ‘Hari Om Tat Sat’ is a very ancient mantra from the Vedas. ‘Hari Om’ is one mantra and ‘Om Tat Sat’ another. I have joined the two in ‘Hari Om Tat Sat’. ‘Hari’ represents the manifest universe and life. ‘Om’ represents the unmanifest and absolute reality. By the word ‘reality’, I mean total existence. You may even use the word God. Reality, existence, God, Brahman, the absolute are all synonymous terms pointing to one being, but they do not really define it.



This reality has two stages. One is the absolute, the other is manifest. This gross universe, the millions of suns, moons and stars, space, that which is beyond it and beyond this little earth, as far as we can go, are all manifestations of that reality, not a creation of reality. There is a difference between the process of creation and manifestation. You take cotton and make yarn from it, and then a shirt. The cotton has become the shirt, it has not created the shirt. The cotton has transformed itself into a shirt. In the same way, there is a great invisible force. Nobody can see it and nobody has seen it, except for a few people who we call avataras.



The manifest reality, this world, is represented by the mantra ‘Hari’. ‘Om’ is the unmanifest reality, the unseen, invisible, uncreated aspect of the absolute. So, ‘Hari Om Tat Sat’ means ‘That is Truth’. That which I see with my eyes and that which is beyond my eyes are both the same, not different. The creator and the creation are not two. The creator has not created creation, but has manifested or transformed himself into creation.



All these truths are represented in the mantra ‘Hari Om Tat Sat’. When I say ‘Hari Om Tat Sat’, it reminds me that the seen and the unseen, are both one.



LOGGING in PO

Debug logging can be enabled at the Document Manager Level to show activities done during processing for deeper analysis. This is done using the following steps;

1. Set the following profile options at the Oracle Purchasing Application level.

Set "PO: Set Debug Workflow ON" to "Yes"

Set "PO: Set Debug Concurrent ON " to "Yes"

2. Set the number of Document Manager processes to 1

3. Clear the debug table by deleting the contents of po_wf_debug table

4. Bounce the Document Manager process.

5. Reproduce the issue.

6. Query the po_wf_debug table so find the log lines written.

7. Revert the profile option settings:

8. Bounce the Document Approval Manager to update the setting changes.

Purchasing approval processing

TROUBLESHOOTING



The following section provides some details on diagnosing some common issues in the Purchasing approval processing

1) Document Approval Logic:

Issue 1

Document remains in Incomplete status after Approval



Cause 1A

The creator of the document is not part of a valid approval hierarchy, and does not have the limits to make the approval. The user needs to be associated to a valid Approval Hierarchy that address the approval limits for the specific document type. If employee / supervisor relation is being used for the document approval routing, then the needed assignments and association for each approval level will need to be done through the Enter Person form for each sequential employee/supervisor. For details on assigning employees, refer to Oracle Purchasing User’s Guide Release 11i (Part No. A82913–06) in 11.5.10 or Oracle Purchasing User's Guide Release 12 (Part No. B28669-01)



Cause 1B

The creator is part of a valid hierarchy, but there is not a level within the hierarchy that covers the elements on the document. The main culprit for this is the Change Account. Verify that for each of the limits under each level, that the number of digits for each segment in the account ranges matches that of the Charge Account. If the segment count appears to be correct, perform a quick test, and move the top of the account for the last level to be ‘Z’ for each digit. (Ex: ZZ.ZZZ.ZZ.ZZZZ.ZZZZ) If the resubmit of the approval now moves through without issue, then it is known that the cause was the Account Range, and new limits just need to be set for the each level.

Issue 2


Document rolls-up to the next approval level, when it should be approved by the owner.



Cause 2A

The assigned approval limits for the owner/creator are not broad or high enough to allow for document approval at the owner level. Review the approval limits and conditions assigned to the owner, and match each against a document that rolled-up to the next level.

Cause 2B

Even though the owner/creator has the correct approval limits for the document approval, the “Owner Can Approve” option under the document type setup has not been set to “Y”. For an owner/creator to be able to approve their own documents, this setting must be defined as “Y”.

Issue 3

Unable to open Requisitions or Purchase Orders from the document summary, for approval.

Cause 3A


The document is in either In Process or Pre-Approved status. A majority of the time, there is an open notification against either the Requisition or Purchase Order. The following query set can be used to determine the current user the notification action is waiting for:

Requisition:


select reqh.segment1 req, wfn.status notify_status, wias.notification_id notify_id,
wfn.to_user name, reqh.org_id org from wf_item_activity_statuses wias, wf_notifications wfn, po_requisition_headers_all reqh
where wias.notification_id is not null and wias.notification_id = wfn.group_id
and wfn.status = 'OPEN' and wias.item_type = 'REQAPPRV'
and wias.item_key = reqh.wf_item_key and reqh.authorization_status = ‘&Req_Number’ order by 5,1,3;

Purchase Order:

select poh.segment1 po, wfn.status notify_status, wias.notification_id notify_id,
wfn.to_user name, poh.org_id org from wf_item_activity_statuses wias,
wf_notifications wfn, po_headers_all poh where wias.notification_id is not null
and wias.notification_id = wfn.group_id and wfn.status = 'OPEN'
and wias.item_type = 'POAPPRV' and wias.item_key = poh.wf_item_key and poh.segment1 = ‘&PO_Number’ order by 4,5,1,3;

Cause 3B


The Purchase Order is in In Process or Pre-Approved status, but does not have any Workflow data. The most common cause for this is that there is an Open Change request against the Purchase Order/Requisition combination. Because the Purge Obsolete Workflow Process may have been run against the document between the last time the Approval took place and the Change Request was raised, the WF data would be missing. The correct action in this case is to have the Buyer, which the Change Request is waiting on, reply to the notification to either except or reject the change. The following query can be used to review the ties between the Purchase Order, Requisition and Change Request.

Purchase Order:


select ref_po_num PO_Num, ref_po_rel_num Rel_Num, document_num Req_Num,
change_request_id CR_Id, change_request_group_id CR_Grp_ID,
last_update_date, document_line_number Doc_Line_Num, action_type,
request_reason, request_status status from po_change_requests where ref_po_header_id =
(select po_header_id from po_headers_all where segment1 = '&PO_NUMBER' and org_id = '&ORG_ID')
and document_type = 'REQ' order by last_update_date

Requisition:

select ref_po_num PO_Num, ref_po_rel_num Rel_Num, document_num Req_Num,
change_request_id CR_Id, change_request_group_id CR_Grp_ID,
last_update_date, document_line_number Doc_Line_Num, action_type,
request_reason, request_status status from po_change_requests where document_header_id =
(select requisition_header_id from po_requisition_headers_all where segment1 = '&Req_NUMBER'
and org_id = '&ORG_ID') and document_type = 'REQ' order by last_update_date

Tuesday, July 31, 2012

How much can you lose in equity?


How much can you lose in equity?
 
 
Posting in Full :
 
People, sometimes, have no rules, limits, and have no clue on how to invest in equities. These people can, should and do lose their shirt, pants and undergarments and full well deserve it.



Let us say you are a well qualified, sensible, boy or girl and wish to invest in equities. Well if you do not want to be an active participant, you could choose a mutual fund. If you do not trust fund managers (I trust only 5 out of the 100 odd that I would have met), choose an index fund – the cheaper (and with lesser tracking error too) the better.
But if you want to be a little more adventurous and wish to invest in direct equities follow these rules so your losses are limited to the minimum.


Let us say you are 35 years and wish to create a portfolio. You are a woman, earning Rs. 8 lakhs, and are not the primary provider of the house. So you can take a little more risk than a man, who is the primary provider.
So let us say you have Rs. 10 lakhs to invest, and influenced by this site, you decide to put Rs. 8 lakhs in equities.



Rule No.1: NOT more than 80% of the SECONDARY earner’s portfolio will be in equities.


Rule No. 2: NOT more than 5% will be invested in ONE Company, as an initial investment. In case the share does well, we will LET it go up to 25% of one’s EQUITY portfolio. Anything in excess will be constantly sold off.
Let us say you are able to add Rs. 20,000 to the equity portfolio every month, and this share is also going up every month, it will take a real long time to breach the upper limit (unless you have picked one diamond and all other duds!).


Rule No. 3: Industry diversification I will learn or copy from a good fund manager’s portfolios, and I will buy only in group A, or B1. I will NOT touch a share in group B2, or T2T….even if someone says these are future blue-chips.


Rule No. 4: I will keep a 25% trailing stop loss. Let me explain. You have bought Rs. 40,000 worth of Carborundum Universal (my examples are obviously from my portfolio, and my cost of this share is Rs. 3.59 per share, thanks to split and bonus, so if you want to copy me, go to 1990, or create your own portfolio). Suddenly the shares value falls to Rs. 30,000. You will do nothing. However on the day it falls below 30,000, you will sell. Knowing how to cut losses is as important as knowing how to let profits run.

Rule No. 5: I will review my portfolio on a quarterly basis. I have no business managing my own portfolio unless I can beat the index. Clearly if you beat the index for the first year, then the second year, then the third year…you are doing well. If you do not beat it for the first four quarters – and are trailing by a huge margin, sell and go to a good fund house.



Now, With all these rules in place how much can you lose?

Rs. 800,000 is the total investment, Rs. 40,000 is the maximum exposure to one stock, 25% is the trailing stop loss- so you can lose about Rs. 10,000.

Considering your liquid net-worth is Rs. 10,00,000 you stand to lose about 1% of your net-worth. Not an amount you need to lose sleep over.

Kartviryarjun defeated Ravan

Ravan was always looking for somebody who could be a match to him in strength. On finding any such person, Ravan challenged him to a duel.


There was a king named Kartviryarjun. He was also named Sasrarjun because he had thousand hands.(The word Sahasra means thousand). He got thousand hands as a boon from Lord Dattatreya(incarnation of Lord Vishnu). In brief he is also called as Arjun. But one must not confuse him with Arjun of Mahabharat.



Ravan heard of Kartviryarjun power and went to challenge him. Before challenging Kartviryarjun, Ravan saw river Narmada. He went to the bank of Narmada and started offering worship to Lord Shiva. He found that water started flowing in opposite direction. Ravan asked his men to find out the reason. They found that at some distance Kartviryarjun was taking bath in Narmada. Some women of his gynaecium were with him. He made water flow in opposite direction with his thousand hands.

Ravan got angry that his puja was interrupted because of Kartviryarjun and wanted to have war with him. Ravan's ministers advised him that Kartviryarjun was relaxing in the water of Narmada at that time and was also in the company of women, therefore it was not appropriate to challenge him at that time. But Ravan did not listen.

Initially there was war between Ravan's soldiers and Kartviryarjun's soldiers. When Kartviryarjun was still inside water, Ravan's soldiers had upper hand and they were destroying the soldiers of Kartviryarjun. Kartviryarjun came out without any worry and defeated the soldiers of Ravan. He challenged Ravan to have single combat. Ravan and Kartviryarjun fought. Kartviryarjun easily won. He took Ravan to his(Kartviryarjun's) jail and imprisoned him.



Ravan's grandfather Pulastya came to know of this. He reached Mahismati(Kartviryarjun's capital) and requested Kartviryarjun to release Ravan. Since Kartviryarjun defeated Ravan, therefore he had the right to take anything from Ravan. If he wanted, he could also take Ravan's kingdom. But, out of respect for the great sage Pulastya, Kartviryarjun did not ask for anything and released Ravan. Not only that, he even accepted Ravan as his friend.

Some stories say that sage Pulastya asked Kartviryarjun to free Ravan and some say that Lord Brahma did that. It is possible that both Lord Brahma and sage Pulastya went to Kartviryarjun.

Friday, July 27, 2012

regexp_substr Handle CSV Data


REGEXP_SUBSTR(source_string, pattern
[, position [, occurrence
[, match_parameter]]])

  1. 'source_string' is a character expression that serves as the search value.
  2. 'pattern' is the regular expression. It is usually a text literal.
  3. 'position' is a positive integer indicating the character of
  4. 'source_string' where Oracle should begin the search. The default position is 1.
  5. 'occurrence' is a positive integer indicating which occurrence of pattern in source_string Oracle should search for. The default is 1.
  6. 'match_parameter' is a text literal that lets you change the default matching behavior of the function.
  7. 'match_parameter' can be a combination of
    1. i: to match case insensitively
    2. c: to match case sensitively
    3. n: to make the dot (.) match new lines as well
    4. m: to make ^ and $ match beginning and end of a line in a multiline string

-- match 'call', 'caller', 'called', or 'calling' in the string

SELECT REGEXP_SUBSTR('You have called me too often, she said.','call((ing) (er) (ed))')
FROM dual;
 
Handle  CSV data
select '...'||LTRIM(regexp_substr('I had a dog, he had white fur, his name was Bob.','[^,]+', 1,level) ), level from dual
 connect by
regexp_substr('I had a dog, he had white fur, his name was Bob.', '[^,]+', 1, level) IS NOT NULL


DECLARE
--
p_csv VARCHAR2(1000):= '688646,688563,807141';
p_csv1 VARCHAR2(1000):='27057931H,18025414H,18025415H,27057934H,27057937H,27061344H,27061345H,18025405H,18025408H';
--
CURSOR c
IS
SELECT serial_number
FROM mtl_serial_numbers
WHERE rownum < 12
AND inventory_item_id IN (
select regexp_substr(p_csv,'[^,]+', 1,level)
from dual
connect by
regexp_substr(p_csv, '[^,]+', 1, level) IS NOT NULL
);

CURSOR c1
IS
SELECT inventory_item_id
FROM mtl_serial_numbers
WHERE 1=1
AND serial_number IN (
select regexp_substr(p_csv1,'[^,]+', 1,level)
from dual
connect by
regexp_substr(p_csv1, '[^,]+', 1, level) IS NOT NULL
);

BEGIN

--
FOR i IN C
LOOP
--
dbms_output.put_line(i.serial_number);
--
END LOOP;
--
FOR i IN C1
LOOP
--
dbms_output.put_line(i.inventory_item_id);
--
END LOOP;
--
END;

Tuesday, July 24, 2012

MTL_RESERVATIONS


On 11.5.10.2 in Production:
Find that when Customer creates Org Level Reservations for Internal  Sales
Orders. If  partial quantity  gets Pick  released and Shipped,  the Org
Level Reservation  for the remaining Back ordered qty  gets relieved.

EXPECTED BEHAVIOR
-----------------------
Expect the reservation should split , and the new line should carry the Org
Level reservation of the remaining qty.

STEPS
-----------------------
The issue can be reproduced at will with the following steps:

Item Number : XXXXXX
OHQ Picture:
Sub: Secondary LPN1 : 100 qty
Sub: Secondary LPN2 : 100 qty
Sub: Primary Loose : 25 (Not packed)

1) Internal  requisition / Internal Sales Order created for 150 qty
2) Org   Level reservation is created for 150  qty

3) Pick  Release  WITH  PRIOR RESERVATION
4) Based on the WMS Rule (Allocate Full LPN)  system can allocate only  125
(Lpn1 100qty + 25 loose)
5) At this point  the STF shows the following
Released to  Warehouse : 125 , Back  Ordered : 25
6) At  this Point, the mtl_reservations shows
reservation_quantity = 150   and  detailed_quantity = 125
7) After  the Pick  Confirmation , in the mtl_reservations , the
reservation_quantity  changes to
125 , with  Staged_flag = Y
8) Expect the reservation should split , and the new line should carry the
Org Level reservation of the remaining 25 qty.

BUSINESS IMPACT
-----------------------
The issue has the following business impact:
Due to this issue, the  Business Rules which  were set up  for reservations
now have no meaning because of the problem, and it is causing considerable
loss of Business of the organization.