cancel
Showing results for 
Search instead for 
Did you mean: 

To add new field on Create Expense application

bhakti2
Active Participant
0 Kudos

Hello,

My requirement is add a new field on the create expense application screen in ESS

This is requried so that user keys in a particular reference travel request number. (advance approval functionality)

This value should be stored against the trip number , possibly in PTREQ_HEADER table (willput zfield in  append structure)

Also there is whole set of validations to be applied to this field which should happen on Save button on last screen as the validations have to be done against the receipt data entered.

I am refering the thread http://scn.sap.com/message/13660041  and other linked threads to this.

I have been able to make the new field appear on the screen, but the saving and validation needs to be implemented

Please could you give me hints how to approach.

thanks

bhakti

Accepted Solutions (0)

Answers (2)

Answers (2)

bhakti2
Active Participant
0 Kudos

Hello Lukas,

Thanks a ton for sharing the very much valuable details. thanks for your time and efforts.

I will need time to implement this, ill let you know

I appreciate your help

kind regards,

bhakti

Lukas_Weigelt
Active Contributor
0 Kudos

Glad to be of assistance ; I'll be curious how your implementation turns out and what ultimate approach you will use

Cheers, Lukas

bhakti2
Active Participant
0 Kudos

hello Lukas,

Our requirement has been met by tweaking the design from functional perspective rather than technical.

we have finally applied below design fyi.

requirement : expense workflow is already in place but for one of the countries , a pre-approval of expense amount is required, against which the actual expense would be checked for necesarry re-approval.

initial design : a new expense type for preapproval, user creates preapproval expense using this expense type before the trip. Create new field on the create expense screen, user enters the preapproved expense number in the actual post-trip expense.

current design : while we were realising that adding new field was not quite fitting into our timelines, the functional consultant found that another form travel request gets converted into expense post-approval. so there was no need to use two different documents for pre and post-trip expenses and then link them explicitly. we could continue with the same document. we have built it with required workflow changes and have not faced any hurdle so far.

my proposal of adding custom field, almost failed, so its a lesson learnt for me. As I have worked majorly in SRM UI, I thought adding new field on the screen should not be considered impossible.

I will certainly apply your details on test purpose in our system. it is to know the fundamentals of the UI design in latest ESS MSS webdynpro abap based designs.

thank you ,

bhakti

Former Member
0 Kudos

Hi Bhakti,

For the validation there is a BADI TRIP_WEB_CHECK available. Please check the methods

USER_CHECK_RECEIPTS and USER_CHECK_LINE_OF_RECEIPTS for your needs. I have implemented checks there.

There is lots of data available there to validate against but you will probably have to retrieve data for your new field yourself unless included in existing structure. You can also do simple field validation by implementing post exist in your view that has the field but I guess you are aware of how to do that?

Regarding saving your new field I would suggest you have a look at the save methods in the assistance class as shown below to see how you best get it included in save.

Br Jan

bhakti2
Active Participant
0 Kudos

Hello Jan,

thanks a lot for your answer.

I will check the methods you have given to store the new field.

regarding validation : I will explore the BADI now immediately.

I can manage to implement post exit but cannot use post exit in the first view because I need to check what expense types the user has entered in the next screen (Wdcomp FITE_VC_RECEIPTS) in order to determine the validity of the new field contents....... and then issue the error message.

so ill see if I can use post exit in the view of the receipts screen but I need to have all the data requried to validate it, apart from expense types I need several other things like start date, cost assignment, etc.

So all this data along with the content of the new field should be available either in the BADI TRIP_WEB_CHECK or the post exit of the second step.

thank you,

bhakti

Former Member
0 Kudos

I think the BADI is your best option. Good Luck!

Jan

bhakti2
Active Participant
0 Kudos

hello Jan,

I am still trying to save the contents of my custom field

I have bound it to a new attribute i created in context

but I am not able to get the value

I saw a method INIT_FROM_URL_PARAMETERS in the assistance class which seems to be the origin of the attribute GS_GENERAL_DATA which is actualy getting passed on as the general data context values. but this method doesnt stop at debug and why would they get the values from URL instead of context ?

thanks

bhakti

Former Member
0 Kudos

I agree - the values should be retrieved from context in a normal scenario.

Have you checked and debugged the assistance method GET_GENERAL_DATA?

I would guess that is the one that retrieves the data and maybe needs to be enhanced to retrieve your new field as well.

Regarding saving your new value - can you show where and how you have added it in the context if you still have problem saving it?

bhakti2
Active Participant
0 Kudos

hi Jan,

thank you for your much requried reply

yes the method GET_GEENRAL_DATA is the one that gets general data that is used further on, but instead of reading the context it is getting from the assistance class attribute gs_general_data

to see how this attribute is getting populated (where the context is being read) I am trying but I think there are function modules like PTRA_WEB_GENERAL_DATA_GET

because I was asked to update a structure PTP02 used in one of stadard programs when I appended the structure PTRV_HEAD

your inputs are highly useful and realy required at this point.

thank you

bhakti

Former Member
0 Kudos

- have you added new fields to travel application from scratch? In that case maybe you have some hints for Bhakti that I'm missing.

bhakti2
Active Participant
0 Kudos

Hello Jan,

I 'll try if i can get inputs from Lukas Weigelt.

not having found way to get the custom field contents from the screen in feasible timeline, is it ok to take up below appraoch

- bind the custom input field to independently new context node

- find a point in view controller of receipts screen where all required data (receipts, amounts, cost objects, general data etc) are available, read the new z-context ourselves and validate against the trip data and issue required message

- store this z-input field against the trip document in separate z-table and not in PTREQ_HEAD , as it doesnt seem feasible. but this will need to be done after the new trip number has got generated.

thanks

bhakti

Former Member
0 Kudos

Hi Bhakti,

I've only been able to give you guidelines as I have not implemented a new field in this specific application my self and at the minute I don't have time to dig into the code to guide you the rest of the way - sorry

If I get some time I will have a look. If not I hope you can find a way around to get it implemented possibly the way you mention above - I think it is fine to keep it in Z (if you can get it to work) as you then make sure it doesn't interfere with rest of application but I can't say for sure this is the correct approach  by the book.

Br Jan

Lukas_Weigelt
Active Contributor
0 Kudos

Hi Bhakti, Hi Jan,

I have indeed added about 70 custom fields from scratch and implemented them into the entire standard process (and it even solidly works out the way I intended it, good gracious! ). Here's the approach I used:

SAP provides the Standard Structure "PTK99" which has been implemented in many (not all, but it's getting better the more rant-OSS-messages I raise) portions of the entire FI-TV process. Here's where it is (by now) applied and in my opinion genuinely working:

  • The Cluster PCL1-TE
  • the Interfaces between FMs, form routines, etc. etc. for the PDF-Adobe Forms
  • PR05

There are other portions where PTK99 is also 'propagated' but doesn't really work like TP01 and other old Dynpro-Technology stuff like that. Just to clear out misunderstandings, this is SAP standard, I didn't invent this myself so you do have a huge advantage up to this point. So what I did first was make a DDIC-enhancement to PTK99 and add all the fields I required (approach suggested by SAP in IMG documentation).

Here's the big downer to it though: PTK99 is not applied in the WDA scenarios in standard and the subsequent business logic, this is what I built myself, here's a short overview:

  • I enhanced several WDA Applications and added my own UI-Elements and Context, I used the common UI-manipulation methods with post and overwrite exits etc and did the plausibility checks respectively, partly with BADI TRIP_WEB_CHECK. After all this, I'm kind of "clean" frontend-wise, this is where your conceptional problem starts if I interpreted the thread correctly.
  • After the plausibility is OK, I take all of my custom fields in one itab type PTK99 and write them into the ABAP-Memory with a certain ID. I do this, because PTK99 is lateron again used in standard but there are about a dozen call stack levels where it is not available between the distinct interfaces and there can be intertwined checks and program branches which then multiply the spots that would have to be modified (which I didn't want because this is beyond reason). So, the custom data I want to be stored is now in the ABAP memory and "waits" there to be fetched.
  • Next step: The use case is: plausibility checks are OK and the user wants to have the data saved to the database (doesn't matter if it's draft or for approval). I implemented the 'old' Enhancement spot FITR0003 via SMOD for a customer include. Within this FM, all the data passes through before it is saved to the database and you are theoretically able to manipulate absolutely everything. This is the point of time I read my itab PTK99 back from memory (we are still in the same runtime so this is possible) and give it to the standard interface. With this trick, my custom data is saved in my enhanced fields in PTK99 in the standard Cluster in a clean way.
  • Data retrieval: vice versa, of course I want my saved custom data also to be read and put back to the frontend WDAs. For this I use HRTRV_IF_GET_TRIP (which I also enhanced a bit to make it work, because the interface is crippled in standard), i.e. to get my PTK99 back to runtime which I then bind back to the context and ta-daaaa! (note: this FM is not released for customers and has no support).

Here's a little screen I made with my overly elite ms-paint skills for a better understanding

I already had the plan to share this experience within a blog but I never blogged before and didn't have the time to put effort into it, maybe in the future I'll do so 😜

best regards + Cheers

Lukas