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

Input check with foreign key not work

Former Member
0 Likes
2,745

Hi, I have created foreign keys to the fields "fesc" and "aplic" of the table "zfk_table". The foreign key for the field "aplic" consists of the fields "mandt" and "aplic." On the other hand the foreign key for the field "fesc" is formed by the fields "mandt", "aplic" and "fesc".

The check table for the field "aplic" is "ZCHTABLE_APLIC" whose primary key is "mandt" and "aplic". For the field "fesc" the check table is "ZCHTABLE_FESC" whose primary key is "mandt", "aplic" and "fesc".

Now, when I use the fields "fesc" and "aplic" of the table "zfk_table" as input fields in a screen (dynpro), input checks work correctly, but when these fields are used in a selection screen in a executable program (Type 1), input check for the "fesc" send a error message, but the data exist in the check table "ZCHTABLE_FESC".

This is the source code in the selection screen.:

SELECTION-SCREEN BEGIN OF BLOCK bl01 WITH FRAME TITLE text-t01.
PARAMETERS: pa_apli LIKE zfk_table-aplic OBLIGATORY VALUE CHECK.
PARAMETERS: pa_fesc LIKE zfk_table-fesc OBLIGATORY VALUE CHECK.
SELECTION-SCREEN END OF BLOCK bl01.

What could be happening?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,830

Hi Marcel,

You should explicitly validate under the AT SELECTION_SCREEN ON event & check from its check table.

Just refer the below code snippet.

'

  IF parm_cur IS NOT INITIAL.

    SELECT COUNT(*) FROM tcurc UP TO 1 ROWS WHERE waers = parm_cur.

    IF sy-subrc NE 0.

      MESSAGE e012(e2) WITH parm_cur.

    ENDIF.

  ENDIF.

Here TCURC is the check table.

PARM_CUR is the Parameter on Selection screen.

Hope this helps.

Regards

Abhii

Hi, I have created foreign keys to the fields "fesc" and "aplic" of the table "zfk_table". The foreign key for the field "aplic" consists of the fields "mandt" and "aplic." On the other hand the foreign key for the field "fesc" is formed by the fields "mandt", "aplic" and "fesc".

The check table for the field "aplic" is "ZCHTABLE_APLIC" whose primary key is "mandt" and "aplic". For the field "fesc" the check table is "ZCHTABLE_FESC" whose primary key is "mandt", "aplic" and "fesc".

Now, when I use the fields "fesc" and "aplic" of the table "zfk_table" as input fields in a screen (dynpro), input checks work correctly, but when these fields are used in a selection screen in a executable program (Type 1), input check for the "fesc" send a error message, but the data exist in the check table "ZCHTABLE_FESC".

This is the source code in the selection screen.:

SELECTION-SCREEN BEGIN OF BLOCK bl01 WITH FRAME TITLE text-t01.
PARAMETERS: pa_apli LIKE zfk_table-aplic OBLIGATORY VALUE CHECK.
PARAMETERS: pa_fesc LIKE zfk_table-fesc OBLIGATORY VALUE CHECK.
SELECTION-SCREEN END OF BLOCK bl01.

What could be happening?

8 REPLIES 8
Read only

Former Member
0 Likes
1,831

Hi Marcel,

You should explicitly validate under the AT SELECTION_SCREEN ON event & check from its check table.

Just refer the below code snippet.

'

  IF parm_cur IS NOT INITIAL.

    SELECT COUNT(*) FROM tcurc UP TO 1 ROWS WHERE waers = parm_cur.

    IF sy-subrc NE 0.

      MESSAGE e012(e2) WITH parm_cur.

    ENDIF.

  ENDIF.

Here TCURC is the check table.

PARM_CUR is the Parameter on Selection screen.

Hope this helps.

Regards

Abhii

Read only

Former Member
0 Likes
1,830

Hi Abhii, thanks for your answer.

I know that i can use AT SELECTION-SCREEN ON pa_xxx, but i would like know why don't work correctly the input check with foreign key for the field "fesc" in this case.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,830

In dynpro, it doesnot work by default.

You have to mark the check box "screen check required" both while creating the foreign key and in the screen field attributes.

I dont think so you can do it in selection screen, because its dynamically generated.

Read only

Former Member
0 Likes
1,830

Hi Marcel,

I have noticed a scenario which could be useful.

For table /BEV1/BO_LEDGER field HKONT, the check table is SKA1. In the foreign key relation ship, I see that for field KTOPL Instead of defining the foreign key table and field, generic is being defined.

I hope if you define your foreign key for the table field FESC in the similar manner, the value check should work fine.

Hope it helps.

Sujay

Read only

Former Member
0 Likes
1,830

Hi Sujay.

I need to check all foreing key fileds in this case, because both fields "fesc" and "aplic" are dependent each other.

I found a solution (besides AT SELETION-SCREEN ON) but i don't know how convenient it. I modified the flow logic of the report screen "1000". I modified the FIELD statement for this fields.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,830

No, definitely not suggested. You shouldn't be modifying the selection-screen logic.

You should rather look at the foreign key tables & how the entries are maintained. I tried this code & works for me:

PARAMETERS: pa_buk TYPE bkpf-bukrs OBLIGATORY VALUE CHECK.

BR,

Suhas

Read only

Former Member
0 Likes
1,830

Hi Suhas, thanks for your answer.

Me too tried with same code:

SELECTION-SCREEN BEGIN OF BLOCK bl01 WITH FRAME TITLE text-t01.
  PARAMETERS: pa_apli LIKE zfk_table-aplic OBLIGATORY VALUE CHECK.
  PARAMETERS: pa_fesc LIKE zfk_table-fesc OBLIGATORY VALUE CHECK.
SELECTION-SCREEN END OF BLOCK bl01.

For the "pa_apli" work correctly, but the "pa_fesc" not work, i.e, input check for the "pa_fesc" send a error message, but the data exist in the check table "ZCHTABLE_FESC".

Look at above the primary key fields of "ZCHTABLE_FESC" and "ZCHTABLE_APLIC" tables.

Read only

0 Likes
1,830

Hi Marcel,

Did you find any solution? I have the same problem in a Dialog program :S.

Regards

Obed