cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Foreign Key check in an editable ALV

Former Member
0 Kudos

Hi,

I've implemented an editable ALV.

The underlying context node is referenced to a structure and within the structure the foreign keys are defined.

In my example, I have two editable columns with different foreign key checks.

My problem is, the foreign key check works only for one column.

So if I enter in both columns incorret values, only a message for the first column is thrown,

but not for the second column!

Only if I enter two errors in one(!) column (in two rows), than I get two error messages.

Examples:

does not work:

COL1 | COL2

err1 | err2 -> only one error message is displayed (for err1)

It works in this case:

COL1 | COL2

err1 | ok

err2 | ok

=> two messages for err1 and err2

and in this case

COL1 | COL2

err1 | ok

ok | err2

=> two messages for err1 and err2

I've found nothing in OSS. My system is a 7.00 with SP18, so OSS 1153492 is already implemented.

Do I somenthing wrong or is this an error in SAP?

Thanks,

Andreas

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

can you provide some example...i will try to replicate it...

Regards,

Lekha.

Former Member
0 Kudos

Hi Lekha,

thank you very much for your support!

I try to give you an example.

In general, you need an editable ALV with at least two columns.

The node for the ALV table in the component controller has to be assigned to a dictionary structure!

That is very important, otherwise the foreign key check will not work!

And the two fields in this dictionary structure have to be assigned to a "check table".

Prerequisition: NW70 SP16 or higher! See oss note 1153492.

Maybe an easy way to reproduce it is using the WD component WDT_FLIGHTLIST_EDIT.

So copy this component to a Z-component.

Than create a dictionary structure for the node "NODE_FLIGHTTAB" with the same 10 fields as the node attributes.

In your new dictionary structure, assign to the fields CARRID and CONNID the check tables SCARR and SPFLI. (see table SFLIGHT).

Than make both columens (CARRID and CONNID) editable.

This has to be done in the "RESULTVIEW" in the method "INIT".

You can user the following code:


  lr_column = lr_column_settings->get_column( 'CARRID' ).

  create object lr_input_field
    exporting
      value_fieldname = 'CARRID'.
  lr_column->set_cell_editor( lr_input_field ).  
  
  lr_column = lr_column_settings->get_column( 'CONNID' ).

  create object lr_input_field
    exporting
      value_fieldname = 'CONNID'.
  lr_column->set_cell_editor( lr_input_field ). 

Copy this code below this code:

 
  lr_column_settings ?= l_value.
  lr_column = lr_column_settings->get_column( 'PRICE' ).

  create object lr_input_field
    exporting
      value_fieldname = 'PRICE'.
  lr_column->set_cell_editor( lr_input_field ).

Than just activate all, create a Web Dynpro Application and your are ready to test it.

To test it, do the following:

Append/Insert an empty row.

Enter a CARRID and CONNID that does not exist and press ENTER.

My result: only one error message is displayed for the wrong CARRID, but no error message for CONNID!

Insert a new row.

Enter in the first row, column CARRID an invalid value and in the second(!) row in column CONNNID.

Than you get two(!) error messages. That's the behavior I expect.

So thank you very much in advance for your help!

Regards,

Andreas