Application Development and Automation 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: 
Read only

CO01 - Set default values on creating

Former Member
0 Likes
3,422

Hi all,

Transaction CO01

We need, after set the fields of the first screen (for example: Material, Production Plant and Order Type), to have some fields of the following screens setted with some values (detemined from custom tables). In particular these fields are:

In 'Maintain Settlement Rule: Overview" screen:

         

          - Cat (COBRB-KONTY)

          - Settlement Receiver (DKOBR-EMPGE)

In "Goods receipt" tab:

          - Stor. Location (AFPOD-LGORT)

          - Goods Receipt (AFPOD-WEPOS)

In "Component Overview" screen:

          - Some field of the item rows (these fields can be valorized at saving event)

Note:

We found the exits

CCOWB001

COIB0001

COZF0001...COZF0002

PPCO0001...PPCO0023

STATTEXT

but no one seems to be useful.

We found BAdI WORKORDER_UPDATE (in particular we've noted the methods INITIALIZE-AT_SAVE-IN_UPDATE-BEFORE_UPDATE) but the methods seem not having the necessary parameters.

Any idea? Thanks in advance for all suggestions.

12 REPLIES 12
Read only

Sijin_Chandran
Active Contributor
0 Likes
2,567

I guess you can do it by designing a screen variant for CO01 using SHD0.

So give a try to tcode SHD0 to get your solution.

Read only

Sijin_Chandran
Active Contributor
Read only

0 Likes
2,567

First of all, thank you for the suggestion; in effect I don't know SHD0 transaction so much, but I have the suspect that it does not permit to set a field with a default value in a parametric way (for example put a value 'XXXX' extracted from a Z... table into the Stor. Location field of Goods receipt tab).

Does it?

Read only

0 Likes
2,567

Okay then u need to stick on with the BADI itself.

Read only

0 Likes
2,567

Yes...I also think so, but looking at the parameters of its methods I can't find those ones I need to change. So I'm wondering, and asking here ,  how I can bypass this limit.

Read only

0 Likes
2,567

I think you can use method IF_EX_WORKORDER_UPDATE~INITIALIZE for you purpose in the same BADI , WORKORDER_UPDATE.

And Parameter IS_CAUFVDB will contain the data entered during the runtime.

and you can use the following method inside that

CALL METHOD IS_CAUFVDB->SET_DATA(Work Area) to set the default data

Read only

0 Likes
2,567

Perfect and I agree: as written in the question text, this one is the first method I checked.

Of course it has the parameters I need to access the Z... table (in detail: IS_CAUFVDB-WERKS and IS_CAUFVDB-AUART) but how about those ones I need to modify with the values extracted from Z... table?

"....

In 'Maintain Settlement Rule: Overview" screen:

         

          - Cat (COBRB-KONTY)

          - Settlement Receiver (DKOBR-EMPGE)

In "Goods receipt" tab:

          - Stor. Location (AFPOD-LGORT)

          - Goods Receipt (AFPOD-WEPOS)

...."

In other words, when I create the SELECT at Z.... table, how I can modify the fields with the default values extracted?

SELECT SINGLE x k y z INTO (?, ?, ?, ?)

   FROM Z....

WHERE wekrs   EQ is_caufvdb-werks

     AND auart     EQ is_caufvdb-auart.

Thanks again.

Read only

0 Likes
2,567

Declare a work area as type CAUFVDB say work area WA_CAUFVDB.

First select the data from the ZTABLE and you can modify data by calling

CALL METHOD IS_CAUFVDB->SET_DATA(WA_CAUFVDB)

Read only

0 Likes
2,567

Sorry, my mistake: I have not well explained the concept.

Of course I know the usage of work areas and I understood the suggestion to use SET_DATA method but what I meant is that the structure CAUFVDB hasn't the fields I need to change (refer to previous reply) but only the fields useful to create the where condition of the select. How I can change the content of a field if I haven't that field on line? (...and that's the limit I'm trying to bypass)

Read only

0 Likes
2,567

Hello Umberto ,

CO01 is not used in our system , that why I was not able to go through your query properly and try it in my system.

Now I understood your problem.

Try with the method IF_EX_WORKORDER_UPDATE~IN_UPDATE

I guess it contains all data regarding a Work Order.

Read only

Former Member
0 Likes
2,567

I solved using both Enhancement points and BAPI BAPI_ALM_ORDER_MAINTAIN (using in particular IT_COMPONENT and IT_SRULE tables): it's the only way.

Read only

0 Likes
2,567

I solved using BAPI BAPI_ALM_ORDER_MAINTAIN (IT_SRULE tables only).

- Cost Center

it_srule-objnr = OR000005655300

it_srule-costcenter = P56310G

it_srule-extnr = 001

it_srule_up-costcenter = X

it_srule_up-orderid = X

it_srule_up-extnr = X

- Order

it_srule-objnr = OR000005655300

it_srule-orderid = R56310G

it_srule-extnr = 001

it_srule_up-costcenter = X

it_srule_up-orderid = X

it_srule_up-extnr = X