Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Make default Date to Custom Field

Former Member
0 Kudos

Hi ,

Is it possible to populate the default value of a date variable that I am using in IW38 under enhancement , Whenever the user executes the tcode , the default value should be displayed as current date which should be allowed to be changed by the user if necessary.

I have used ZXWOCU07 include. Please referred the screen shot, i need to set default date in new target date.



Jiya

1 ACCEPTED SOLUTION

jogeswararao_kavala
Active Contributor

Jiya,

I found the easy way of doing it. You have used screen-exit (IWO10018) for the custom fields. In the PBO module of the screen-exit, just put your default value syntax such as AUFK-ZZTRGTDT = SY-DATUM. I have assumed the field name of Target Date field is ZZTRGTDT and you requirement is to default Current Date. Please note that AUFK-ZZTRGTDT is the field name in the screen layout you have created in the screen-exit.

See how I tested and the result.

I put this line to default in my custom field ZZCUSTFLD1.

Note that I put this line in the PBO module of the screen-exit (IWO10018). The include here is ZXWOCO01.


See the result.

So you can customize this as per your requirement. The solution area has been now clear. So for this requirement you can forget about exit IWO10009.



Regards

KJogeswaraRao

11 REPLIES 11

jogeswararao_kavala
Active Contributor
0 Kudos

Jiya,

  1. You reference to tcode IW38 (List of Orders) is incorrect. Though you are coming to the screen you posted through IW38, you should be aware that you are talking about tcode IW32 (Change Order).
  2. As I mentioned in my referred document, to my knowledge no enhancement has been provided for defaulting the field values in Order, like those available in Notifications.
  3. Only possible option seems to explore Implicit enhancement point in the program SAPLCOIH.
  4. Also I did not understand from your picture 'why the fields in the Enhancement tab are in non-editable mode.

shadab_maldar
Active Participant
0 Kudos

Hi Jiya,

You can achieve this without doing enhancement also by screen variants.

Regards,

Shadab.

Former Member
0 Kudos

Hi,

You will have to set the default date in the same exit where you have applied the screen enhancement.

there you can use two FM which can set and get data to manipulate screen field data.

Hope this helps.

0 Kudos

Hello Gaurav,

Defaulting a value means you should be able to see the value before you Save. You said use the same Exit. Means IWO10009. This performs at the SAVE event of the Order. Means you'll not be able to view and edit the value here before you Save. Then how we will be able to achieve the defaulting values? This is not possible with this exit and as I said I'm not aware of any BAdi can perform this. Please tell us if you have some worked-out method.

0 Kudos

Hi,

May the confusion is which exit was used for Screen enhancement. I was guessing IWO10018 was used for the screen enhancement where we could have been able to set the default Values. The mention of the include  ZXWOCU07 confused me .

I don't have any applied method which I have used in the past, I would have given it a try and used IWO10018 exit to set the default value.

Sorry for the confusion.

Hope this helps.

0 Kudos

Ok, I understood. In fact she was updating the custom field by the desired value using exit IWO10009. I too did not recall the the screen-exit IWO10018 through which these custom fields have been created.

So we can say that if the Default feid value requirement is for custom fields then we can achieve through screen exit itself, by some syntax in PBO module. This is the case her. If the requirement is for standard Order header fields then the story restarts.

Thank you

raymond_giuseppi
Active Contributor
0 Kudos

Did you check the BAdI available in package COBADI, I know the WORKORDER_UPDATE BAdI has a default providing method at creaton IF_EX_WORKORDER_UPDATE->INITIALIZE, but I don't think that SAP provided a mehod for a "changed by default" value field ?

For a standard field

As already wrote, you could look for some implicit enhancement spot after read of data from database .

For a customer field in the customer dynpro

That should be much more easy, just change the value during the first call of the dynpro SAPLXWOC/0900 in the PBO exitr IWO10018 / EXIT_SAPLCOIH_018 store in exit function group global data some order number field to memorize you already changed the value, if not yet changed, change it once. (of course insure you are in update mode) You could/should also use SMOD IWO10009 / EXIT_SAPLCOIH_009 in case user doesn't display the customer dynpro if you want to force update in this case.

Regards,

Raymond

jogeswararao_kavala
Active Contributor

Jiya,

I found the easy way of doing it. You have used screen-exit (IWO10018) for the custom fields. In the PBO module of the screen-exit, just put your default value syntax such as AUFK-ZZTRGTDT = SY-DATUM. I have assumed the field name of Target Date field is ZZTRGTDT and you requirement is to default Current Date. Please note that AUFK-ZZTRGTDT is the field name in the screen layout you have created in the screen-exit.

See how I tested and the result.

I put this line to default in my custom field ZZCUSTFLD1.

Note that I put this line in the PBO module of the screen-exit (IWO10018). The include here is ZXWOCO01.


See the result.

So you can customize this as per your requirement. The solution area has been now clear. So for this requirement you can forget about exit IWO10009.



Regards

KJogeswaraRao

0 Kudos

Yes,

I was trying to convey this only. here she can customise the code for the actual requirement.

Thanks for the elaborate example.

Regards,

Gaurav Dubey

jogeswararao_kavala
Active Contributor

Jiya,

Even better option is here:

The PBO route discussed earlier will have issues if the defaulting values depend upon some logic. If they are fixed values there is no issue. If it is the case of retrieving from some other fields then the following method is suitable.

You have two exits in the screen-exit namely EXIT_SAPLCOIH_018 and EXIT_SAPLCOIH_019.

For your requirement of value defaulting in custom fields, you use the first one. (include ZXWOCU15 ).

Suppose you want to default the custom field ZZTRGTDT with the Basic Finish date then put this line in this include:


aufk-zztrgtdt = sap_caufvd_imp-gltrp.

See this how I tested.

So you have all possible ways for your requirement. This is working fine. And this defaults at run-time.

Good luck

KJogeswaraRao

Former Member
0 Kudos

Hi,

Thanks everyone for your reply, i have assigned the variable = sy-datum, and its working.

Jiya