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: 

A Tricky Table Maintenace Problem

Former Member
0 Kudos

Howdy,

Could you help with the following please?

I have created the following Z-table:

<b>Field | Field Type| Data Type| Length| Check table|Short Text</b>

MANDT| MANDT | CLNT | 3 | T000 | Client

VKORG| VKORG | CHAR | 4 | TVKO | Sales organization

VKBUR | VKBUR | CHAR | 4 | TVBUR | Sales office

VKGRP | VKGRP | CHAR | 3 | TVKGR | Sales group

SECTOR| ZSECTOR| CHAR | 6 | | Sector Codes

I have then set-up one step table maintenace and the user can now go in and add delete entries to the table via SM30 - great so far

But oh no! The user now realises what they would really like

They've said:

<b>Please can you make the sales grp dependant on the sales office and the sales office dependant on the sales org - so that only relevant entries are displayed - this is how it is in the customer master - see sales data view and orders screen.</b>

Now is sounds like that they want me to vlaidate the entries that they enter for the Sales Area, but how would I do that? Does anyone have any ideas? Please help if you can and let me know if you need any more information from me...

Thanks!

P.S> If I wanted to transport the contents of theis table would I need to change the attributes->delivery class to 'A'? It is currently set to 'C'.

1 ACCEPTED SOLUTION

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

In SE11 for that table , Go to->Table Maintenance->and then generate Table Maintenance.While generating it you need to give a function group for that.In that,go to that main program.Then uncomment the PBO option.Then write your own validations there.

Hope this is clear.

If not,get back to me.

12 REPLIES 12

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

In SE11 for that table , Go to->Table Maintenance->and then generate Table Maintenance.While generating it you need to give a function group for that.In that,go to that main program.Then uncomment the PBO option.Then write your own validations there.

Hope this is clear.

If not,get back to me.

0 Kudos

Do remember whenever you regenerate the table maintenance screen, your changes will be gone too. Creating your own module pool with validation etc won't take a day IMO.

0 Kudos

I must agree with Misnan in that creating a separate transaction is a better idea. It should take you no more than an hour.

0 Kudos

Hello all,

but you can include all your coding -

so that you've only to insert your includes to the module

pool, if you've to regenerate it.

regards Andreas

0 Kudos

Have look in to Cardinality of a relationship, with respective check tables.

Might help you.

Manohar

0 Kudos

Howdy Jayanthi,

Thanks for the tip.

Unfortunately I've done what you siad and I've ut in a breakpoint and the code won't stop there?

Additionally I wrote an error message that should be displayed and again this this is not displayed?

Also when uncommenting the PBO in the function module I had to add '00' onto the end of the name or the program would not compile.

Is there something that I am missing?

0 Kudos

Hi Steve,

Uncomment the PBO and PAI like this.

INCLUDE LZCSI_CAPIPRO<b>01</b>.   " PBO-Modules
INCLUDE LZCSI_CAPIPRI<b>01</b>.   " PAI-Modules

Then in the PAI of the screen(While creating Table Maintenance), write like this.

 MODULE detail_set_pfstatus.
  CHAIN.
    FIELD zcs_exp_ipr_fact-bukrs .
 ....

    MODULE set_update_flag ON CHAIN-REQUEST.
* Start of insert   
    <b>MODULE zcs_exp_ipr_fact_valid.</b>
* End of insert     
  ENDCHAIN.

Then in the PAI which we uncommented earlier ,

write the required as below.

MODULE zcs_exp_ipr_fact_valid INPUT.

  IF zcs_exp_ipr_fact-bukrs IS INITIAL.
    <b>SET CURSOR FIELD 'ZCS_EXP_IPR_FACT-BUKRS'.</b>
    break username.
    MESSAGE e091(zcs_p2p_001)."Enter Company code
  ENDIF.
 ENDMODULE.        " zcs_exp_ipr_fact_valid  INPUT

Hope this is clear.If not,get back to me.

Rgds,

J.Jayanthi

christian_wohlfahrt
Active Contributor
0 Kudos

Hi Steve,

coming back to the question of value checks:

use table TVKBZ as check table for VKBUR and table

TVBVK as check table for VKGRP. Maybe your Z-table needs distribution channel and division in addition, maybe you can maintain default values in check table definition - depends on your enterprise structure.

Any additional coding for SM30 isn't needed (IMHO).

Regards,

Christian

0 Kudos

Howdy CHristian,

I've already added value check tables if you have a closer look at my original post you may see the tables I have used.

The problem is that the user's want a more thorough check like the one in VA01 where all corresponding sales office/Group/org combinations can be assigned to each other.

Would your check tables take account of this? If so you've solved my problem!

0 Kudos

Yes! Just need to find the right check table for the scenario, there are a few more tables available, look at the tables VBAK, LIKP, LIPS, VBRP, VBRK foir the check tables used there and you should find your solution.

I also suggest awarding Christian some points.

Rishi

0 Kudos

Hi Steve,

Changing the check tables as suggested by Christian should solve your problem, even though it will give you a message "Foreign Key cannot be specified in full", but you can ignore it or use constant values as suggested by Christian.

Change your table as follows


Field | Field Type| Data Type| Length| Check table|Short Text
MANDT | MANDT     | CLNT | 3 | T000  | Client
VKORG | VKORG     | CHAR | 4 | TVKBZ | Sales organization
VKBUR | VKBUR     | CHAR | 4 | TVKBZ | Sales office
VKGRP | VKGRP     | CHAR | 3 | TVBVK | Sales group
SECTOR| ZSECTOR   | CHAR | 6 |       | Sector Codes

This should take care of it. If not, you can use events to have your own validations. Go to SE54, enter your table name and choose the menu option 'Environment-->Events'. In the next screen, create new entries and choose event 01 and give a name for the routine. Using the Editor button for that row, you can insert your validation logic there.

Hope this helps,

Srinivas

0 Kudos

Hi Steve,

I took the tables out of customizing (SPRO):

Enterprise Structure->Assignment->Sales and Distribution->Assign sales office to sales area

Enterprise Structure->Assignment->Sales and Distribution->Assign sales group to sales office

I can't imagine, which connection could be more specific / sophisticated - that's exactly the way of SAP's definition.

So this should be alright for your customer.

Regards,

Christian