Skip to main content

I want to have a generic sales part number e.g. “J” that users can add to a customer order line. Then have a custom event that runs before the line is saved that recognises the part number is “J”,  determines the max value + 1 of part numbers beginning with J e.g. “J20010” and then substitutes 

&NEW:PART_NO = ‘J20010’,

so i can then run a script to auto create “J20010” as a Sales Part number, but i get the error “PLS-00201: identifier 'J' must be declared.

Is changing the part number on a customer order line before saving the record possible?

TIA Chris. (APPS9)

 

Hi @chrisplant,

Could you share the PL/SQL block you have written as well? According to the error message, it looks like you have not declared a variable in your PL/SQL block.


Interesting topic as we have this exact same requirement.


It’s roughly along the lines of this (still in rough format currently)

DECLARE

attr_        varchar2(1000);
info_        varchar2(1000);
objid_       varchar2(1000);
objversion_  varcahr2(1000);

BEGIN

attr_       := NULL;
&NEW:PART_NO := 'J40001';  -- Hard coded value for testing
-- Crashes on this line.


CLIENT_SYS.Clear_Attr(attr_);
CLIENT_SYS.Add_To_Attr(CONTRACT'','01 ', attr_);
CLIENT_SYS.Add_To_Attr('ACTIVEIND_DB', ' 1', attr_);
CLIENT_SYS.Add_To_Attr('PART_NO', ' &NEW:PART_NO', attr_);
-- Additional attributes still to add

sales_part_api.New__(info_, objid_, objversion_, attr_, 'DO');
  
end;


 


 


I was not under the impression you could change a “new” field value and have it be used throughout the event and subsequent “base” calls in IFS? I guess I should play with that…

Is it valid to place a “new” field on the left-hand side of an assignment? Does it filter through to the actual “New__” method? I am curious as to how this is accomplished.

 

Thanks,

Joe Kaufman


OK, I played around with this some, and I better understand what you are trying to do… I wrote a simple event on CustomerInfo that would force the Name to always be the same. It looks like this:

DECLARE

attr_ varchar2(1000);
info_ varchar2(1000);
objid_ varchar2(1000);
objversion_ varchar2(1000);

BEGIN

--&NEW:NAME := 'New Customer Will Always Have This Name!';
CLIENT_SYS.Clear_Attr(attr_);
CLIENT_SYS.Add_To_Attr('NAME', '&NEW:Name', attr_);

END;

I have the line that directly sets the “Name” field commented out because it causes an error. Specifically, the colon on the left-hand side of the assignment operator is most unappreciated by the compiler. I know it is the colon because I moved the line around and the error thrown always mentions the row and column where the colon hits. So, I am not sure how your code gets beyond that line and error.

The next problem as I see it is that the attr_ you are manipulating in this event is a local variable. It is not the same attr_ that will pass through to the New__ method once the event is completed. Calling a completely different method should work with whatever you assemble as the attr_ string, but I don’t see how you can change what gets passed to the underlying event you are sitting atop?

When I use the action above. it fires without error, but even though I am clearing attr_ out, the Customer record saves fine and the Name field is left as it was typed into the screen.

 

Thanks,

Joe Kaufman