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

Table maintenance generation problem

former_member384574
Active Participant
0 Likes
2,043

Hello Experts,

I'm having a problem with a table maintenance view and how to check the whole table. I try to explain the problem. We are on 4.6C.

When a new entry is created, I need to check that there isn't any other line with the same values for all fields except for location one.

This example will be wrong cause there's a blank entry which is generic and the location is the same in both lines.

Ord.material Component Location

mat1 mat2 YYYY

blank mat2 YYYY

I can not create the table key with Ord. Material, Component and Location cause I can insert the same line with orden material or without it.

So I think the only possible solution will be to create a validation and check when we have this kind of situations.

I've tried with event 01 and check the whole table when the new entries are saved, but I'm having several problems to read the tables.... Could you please help me to identify which table is the complete table (I think is TOTAL) and which table or structure contain the new entry to be inserted? Also, could you please help me how this validation could be done?

I hope you can understand my problem...

Thanks in advance,

Best regards,

Rebeca

8 REPLIES 8
Read only

former_member228164
Participant
0 Likes
1,768

please give the screenshots what you are trying to tell....

Read only

former_member384574
Active Participant
0 Likes
1,768

Hello Abid Ali,

First of all, thanks for your answer. I'm sorry but I do not have screenshots, I will try again...

This is a good table example. As you can see, depending on the material order and the component (as key table) I can choose a different storage location. So, if my production order has material order AAAA and has component1 the storage location will be LLL, if my production order has material order BBBB and has component1 the storage location will be QQQQ and if my production order has any other value (CCCC, DDDD...whatever), the table will read the empty column and will set Storage location ZZZZ.

Material Order Component material Storage Location AAAA Comp1 LLLL BBBB Comp1 QQQQ empty Comp1 ZZZZ

What we want to avoid is that the user can insert a row like this:

Material Order Component material Storage Location CCC Comp1 ZZZZ

Because as you can see on table 1, this situation will be included on the third row of table one (the empty one) which will be the generic, so this entry wil be a redundancy in the table values.

I've think about changing the table key, but I have always the same problem...so finally I thought it will be better to do it using an event and a validation. I've tried with event 01, but the problem I've here is that, first, I'm on 4.6C version non-unicode, so the field-symbols are diffferent than on 6.0 and also, I do not know how to use tables TOTAL and EXTRACT.

I've checked this link, and I've seen that my pointers are a long character field with all the data together, so I want to avoid to use offsets to get the values of the fields, but I'm thinking I do not have other way,....

http://help.sap.com/erp2005_ehp_04/helpdata/en/33/96613cb44b6c4de10000000a11405a/content.htm

Also my problem is that in this version, I can't identify which table is the whole table (in my example table 1) and which table/structure has the new values the user is inserting....

Do you understand now better my problem? Could you please help me with this strange behaviour?

Thanks in advance for your support.

BEst regards,

Rebeca

Read only

former_member384574
Active Participant
0 Likes
1,768

Sorry I've seen the tables are not correct uploaded. I send you some screenshots on word.

This is table 1

This is new row will be redundancy with the empty value of table 1

Thanks again,

Regards,

Rebeca

Read only

Sandra_Rossi
Active Contributor
1,768

TOTAL is both an internal table containing all lines of the table, and a structure initialized by LOOP AT TOTAL, for which the field symbol <ACTION> defines whether the line is unchanged (space), new (N), modified (U), compared to what is in database.

You may easily code your event 01 using table field names using ASSIGN CASTING, as follows:

field-symbols <yourtable> type name_of_your_table.
LOOP AT total.
CASE <action>.
WHEN NEUER_EINTRAG OR AENDERN. " new or modified
assign total to <yourtable> casting.

<yourtable>-matnr ...
Read only

0 Likes
1,768

Hello Sandra and Bruce and thanks for your answer.

@Sandra I tried your solution, and it works, the problem is that the table TOTAL doesn't have structure, is a string, so i can not read of there's redundancy... I mean, if I'm inserting a new row I have to read the table TOTAL and check if there's an entry with Material order empty .. but how can I do that? the key is a string and I neef to check without the field Material Order.... do u understand what I mean

@Bruce, but then, should I also need to have an internal table which contains the new rows added before the saving is done? Sorry I do not understand your help...

Thanks both of u for your support.

Regards,

Rebeca

Read only

0 Likes
1,768

With the code I have provided, and with ABAP debugging, you'll see that the TOTAL "string" is mapped to the field symbol <yourtable> (right after ASSIGN ... CASTING), which contains fields. You can then easily test each field.

Read only

Former Member
0 Likes
1,768

Rebeca,

One thing to keep in mind, the table TOTAL contains only the records from the database table that were returned from the select. Your validation may need to take into account the records from the database table that were not returned from the select as well as everything populated on the screen.

Bruce

Read only

former_member384574
Active Participant
0 Likes
1,768

Solved with event 01.