Translate

Friday, 25 January 2013

Dosave V/S Dosave now

Dosave() : Use the DoSave function to save the current page. DoSave defers processing to the end of the current
PeopleCode program event, as distinct from DoSaveNow, which causes save processing (including SaveEdit,
SavePreChange, SavePostChange, and Workflow PeopleCode) to be executed immediately.


DoSave can be used only in FieldEdit, FieldChange, or MenuItemSelected PeopleCode.

The following example sets up a key list with AddKeyListItem, saves the current page, and then transfers the
user to a page named PAGE_2.
ClearKeyListItem( );
AddKeyListItem(OPRID, OPRID);
AddKeyListItem(REQUEST_ID, REQUEST_ID);
SetNextPage("PAGE_2");
DoSave( );
TransferPage( );

Dosavenow():DoSaveNow causes the current page to be saved immediately. Save processing (including SaveEdit,SavePreChange, SavePostChange, and Workflow PeopleCode) is executed before continuing execution of the program where DoSaveNow is called. DoSaveNow differs from the DoSave function in that DoSave defers saving the component until after any running PeopleCode is completed.

DoSaveNow can only be called from a FieldEdit or FieldChange event

The following example calls DoSaveNow to save the component prior to running a remote process in the
remote_depletion declared function:
Declare Function remote_depletion PeopleCode FUNCLIB_ININTFC.RUN_DEPLETION Field⇒
Formula;
/*
Express Issue Page - run Depletion job through RemoteCall()
*/
If %Component = COMPONENT.EXPRESS_ISSUE_INV Then
DoSaveNow();
&BUSINESS_UNIT = FetchValue(SHIP_HDR_INV.BUSINESS_UNIT, 1);
&SHIP_OPTION = "S";
&SHIP_ID = FetchValue(SHIP_HDR_INV.SHIP_ID, 1);
remote_depletion(&BUSINESS_UNIT, &SHIP_OPTION, &SHIP_ID, &PROGRAM_STATUS);
End-If

No comments:

Post a Comment