{"id":10106,"date":"2016-02-15T18:22:09","date_gmt":"2016-02-15T17:22:09","guid":{"rendered":"http:\/\/orabr.com\/?p=10106"},"modified":"2016-02-15T15:24:32","modified_gmt":"2016-02-15T17:24:32","slug":"AME-ATTRIBUTE-RECUPERANDO-O-VALOR-DA-LINHA-DA-PO-3","status":"publish","type":"post","link":"https:\/\/orabr.virttus.com\/?p=10106","title":{"rendered":"AME &#8211; ATTRIBUTE RECUPERANDO O VALOR DA LINHA DA PO"},"content":{"rendered":"<p><HTML><HTML>Oi Helder,  Muito obrigado pelo retorno  Eu n&atilde;o encontrei o attribute core, por isso estou criando um.  N&atilde;o posso colocar o SUM, pois o cliente quer que o valor da linha seja levado em considera&ccedil;&atilde;o.  Ex. PO1 Linha1 Se (pol.unit_price * pol.quantity) = 1000 and Centro de custo = 300 and ame_approval_id = 123 ent&atilde;o Aprovador = Paulo  Linha2 Se (pol.unit_price * pol.quantity) = 5000 and Centro de custo = 300 and ame_approval_id = 123 ent&atilde;o Aprovador = Claudio  Ou seja, tem que disparar duas solicita&ccedil;&otilde;es de aprova&ccedil;&atilde;o para uma mesma PO  Abs,  Anderson Marques  2016-02-15 15:05 GMT-02:00 Helder Amaral <a href=\"mailto:helderamaral@yahoo.com.br\">helderamaral@yahoo.com.br<\/a>  &lt;<a href=\"mailto:&#038;gt\">&#038;gt<\/a>;:  &gt; &gt; &gt; Anderson, &gt; &gt; Eu j&aacute; constru&iacute; esse processo na m&atilde;o antes dele existir no core. Mas a &gt; respeito do core eu n&atilde;o conhe&ccedil;o. &gt; &gt; Mas independente disso, pelo que vejo, o problema est&aacute; na query. A sua &gt; query est&aacute; tantando pegar os valores de todas as linhas. &gt; &gt; Se for isso mesmo que voc&ecirc; quer, voc&ecirc; precisa incluir um SUM,  da seguinte &gt; forma :   SUM((pol.unit_price * pol.quantity)) AS price &gt; Mas se voc&ecirc; quer pegar o valor de uma linha espec&iacute;fica, voc&ecirc; precisa &gt; restringir essa linha na query. &gt; &gt; Algo do tipo: &gt; &gt; AND poll.line_num = &amp;LINE_NUM &gt; &gt; &gt; Espero ter ajudado, &gt; &gt; Atenciosamente, &gt; Helder Costa Amaral &gt; &gt; &gt; &gt; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &gt; *De:* &quot;Anderson Marques <a href=\"mailto:amlopesc@gmail.com\">amlopesc@gmail.com<\/a> &quot; &lt; &gt; <a href=\"mailto:&#038;gt\">&#038;gt<\/a>; &gt; *Para:*  &lt;<a href=\"mailto:&#038;gt\">&#038;gt<\/a>; &gt; *Enviadas:* Segunda-feira, 15 de Fevereiro de 2016 14:07 &gt; *Assunto:*  AME &#8211; Attribute recuperando o valor da linha da PO &gt; &gt; &gt; Boa tarde! &gt; &gt; Algu&eacute;m j&aacute; criou algum atribute no AME (Transaction Type: Purchase Order &gt; Approval) que fosse utilizado para recuperar o valor da linha da PO? &gt; &gt; Eu criei um com a seguinte query &gt; &gt; SELECT DECODE(type_lookup_code, &#8216;STANDARD&#8217;, (SELECT (pol.unit_price * &gt; pol.quantity) AS PRICE FROM po_distributions_all pod, po_lines_all pol, &gt; po_headers_all poh, po_line_locations_all poll WHERE pol.po_header_id = &gt; poh.po_header_id AND poh.ame_approval_id = :transactionId AND &gt; pol.po_line_id = pod.po_line_id AND pol.po_line_id = poll.po_line_id AND &gt; poll.line_location_id = pod.line_location_id AND NVL(poll.cancel_flag,&#8217;N&#8217;) &gt; = &#8216;N&#8217; )), poh.currency_code, NVL(poh.rate_type, psp.default_rate_type) FROM &gt; po_headers_all poh, po_system_parameters_all psp WHERE poh.AME_APPROVAL_ID &gt; = :transactionId AND psp.org_id = poh.org_id &gt; &gt; Quando executo a query &eacute; retornado o valor correto, mas quando executo o *Test &gt; Workbench no AME* de uma PO com duas ou mais linhas &eacute; apresentado o &gt; seguinte erro: &gt; &gt; &ldquo;Error: An error occurred while fetching the attributes for given &gt; transaction id. Ensure that the given transaction id is correct and the &gt; dynamic queries for attributes and item classes are correct. &ldquo; &gt; &gt; Algu&eacute;m poderia me ajudar? &gt; &gt; Obrigado, &gt; &gt; Anderson Marques &gt; &gt; &#8212; &gt; ____________________________________ &gt; Anderson Marques &gt; Oracle Functional Consultant &gt; +55(21)8204-1899 &gt; Skype: amlopesc &gt; MSN: <a href=\"mailto:amlopesc@hotmail.com\">amlopesc@hotmail.com<\/a> &gt; &gt; &gt;  &gt;    <\/HTML><\/HTML><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Oi Helder, Muito obrigado pelo retorno Eu n&atilde;o encontrei o attribute core, por isso estou criando um. N&atilde;o posso colocar o SUM, pois o cliente&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29],"tags":[],"class_list":["post-10106","post","type-post","status-publish","format-standard","hentry","category-base-de-conhecimentos"],"_links":{"self":[{"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=\/wp\/v2\/posts\/10106","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10106"}],"version-history":[{"count":0,"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=\/wp\/v2\/posts\/10106\/revisions"}],"wp:attachment":[{"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10106"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}