FM BAPI_PO_CHANGE how to add item? - abap

I try to add items to existing PO.
And I use BAPI_PO_CHANGE.
Maybe somebody have WORKING example how to ADD item to PO?
I ALREADY CAN UPDATE EXISTING items in PO.
I need to add some NEW.
And yes, we talking about AFS system. :(((
Thanks in advance, Alexander.

Pass the relevent filed ON in the Xstrucuture for all the required fields.
E.g.
PO_ITEM-PO_ITEM = new_item
APPEND..
PO_ITEMx-PO_ITEM = new_item
PO_ITEMx-PO_ITEMX = 'X'.
APPEND ...

Try BAPI_PO_CREATE1 it will handle the AFS data needs as well. You should be able to open an existing PO and add a NEW item to that existing PO. PO_CHANGE will only allow changes to existing items. I have not used these in some time, but you can get a better idea of how SAP uses BAPI's by tracing some of the logic within as you develop your programming.

Related

Update MKPF text during save in MB1A tcode

I am working on a requirement to update MKPF-BKTXT during save in MB1A tcode. I found MB_DOCUMENT_BADI, but the methods of the BADI only allows importing parameters and does not allow changing MKPF.
Has anyone in the community worked on similar? How to do this?
You can use BTE event 00001120 to do that and substitute BKTXT. Here is the detailed guide:
https://wiki.scn.sap.com/wiki/display/ERPFI/Example+for+BTE+00001120
Just create Product, register your custom FM as process module and code your substitution.

How can we make an Item in socialengine?

I know how to get an item of the particular table. Like for user we can have
$userItem = Engine_Api::_()->getItem("user", $userId);
or for a custom table
$customItem = Engine_Api::_()->getItem("custom", $customeId);
I want to know the code or method how can I make my $customItem to work the same way as $userItem works for users table. So that I can get data or manipulate the data of custom table
Thanks for your help. :-)
You can achieve that by creating a model. Check how it's done in /application/modules/User/Model. There is User.php file that declares User_Model_User and methods available for User such as getTitle, get Href etc.
You may use similar approach for your custom item. You will also need to create a file similar to /application/modules/User/Model/DbTable/User.php to declare table for your custom items.

Maximo - Adding elements to a CustomMboSet using scripting

Is it possible to add to a CustomMboSet in Maximo using scripting? I am writing a custom application using a custom object called TIMESHEET. As part of the application I am writing a (Jython) script that needs to dynamically build up an MboSet (a set of TIMESHEETs). The code retrieves an existing CustomMboSet and attempts to add elements to it. It works when using an out of box MboSet, but when I try to run the same code on a custom MboSet it does not seem to work. No error is thrown, but code below the offending line is not run.
In other words, this works (LABTRANS is an out of box MBO):
myMboSet = mbo.getMboSet("LABTRANS")
newMbo = myMboSet.add()
# Set attributes on newMbo, everything is happy
But this does not (TIMESHEET is a custom MBO):
myMboSet = mbo.getMboSet("TIMESHEET")
newMbo = myMboSet.add()
# Code does not execute after the above line
Anyone have any insight as to why I am seeing this behavior? Does the Maximo scripting framework simply not support the dynamic building up of CustomMboSets? Any help is appreciated. Thanks.
You need to make sure that the relationship exists between the Current MBO and the Custom MBO in the database configuration otherwise it will not work.
Alternatively you can use the following code to create an new mboSet on the fly:
timeSheetMboSet = mxServer.getMboSet("TIMESHEET", userInfo)
mbo.getMboSet(RELATIONSHIPNAME).
LABTRANS and TIMESHEET must be the relationship names to the object in auto script.
If you want to get/add records in any object, use
mxServer.getMboSet(OBJECTNAME, userInfo)
A bit more explanation. You can create your own custom relationship from within your automation script. The trick is to make sure it's not already existing. That's why I use a dollar sign for mine.
variable = mbo.getMboSet(tempRelationshipName,Object,where clause)
previousPhaseSet = mbo.getMboSet("$wophasetranstemp1", "exitdate is null")

How to update Name field contents into Title field

I want to update title field from Name column immediately after file attachment in document library. Is it possible ?
You should use workflow.
I don't know any way in which you can update any column immediately. Attach a workflow the the item creation event.
Wouldnt' it be easier to have the content provider/owner ensure that Title is the same as filename? Sometimes developing is not the only answer ... collaborate (isn't that what SP is allabout?)

Drupal Views - Custom / Modded SQL

I am having an issue with the "Profile Checkboxes" module which stores custom profile fields comma separated.
The issue is if I create a view to filter by a value. The SQL result ends up being something like this:
...AND (profile_values_profile_interests.value in ('Business and Investment'))...
Which will not return any data since the value is stored like this:
"Business and Investment, Case Law, Labor Law, Tax Law"
I just need to adjust the SQL so that it is making sure the field contains the selected value
Is there anything I can do to adjust this?
For a 'quick hack' solution, you could try implementing hook_views_query_alter(&$view, &$query) in a custom module, check $view->name (and eventually also $view->current_display) to ensure you are dealing with the right view/display, and then manipulate $query as needed.
EDIT: Looks like the underlying problem has been addressed by the module maintainer in the meantime - see John's answer ...
I'm the creator and maintainer of Profile Checkboxes and thought you might be interested to know that the new version of the module now stores the values as serialized and includes Views support. The feature is available in the current release version.
Check out the Views modify query module.