Foreign Key check in ALV Grid

Hi all.
I'm trying to have data automatically validated using Foreign Keys in an (editable) ALV Grid.  I managed to get the proper values in a dropdown on F4, but i want the manual entries validated without coding every field individually.
The field in question is LFA1-REGIO.  This field has a Foreign Key in T005S.  I'm using F.M. DDIF_TABL_GET to populate my Field Catalog.  This gives me all Foreign Key fields for my fields.
If the user enters 'ZZ' as a Region(LFA1-REGIO), the auto-validation of CL_GUI_ALV_GRID does not recognize that this value is invalid.
I've debugged the class methods that handle the validation, but it seems the problem is in the way i'm setting up my Foreign Key info.
Could someone tell me how to set this up properly?  i also have access to the dependant field LAND1, and would like to integrate it in the Validation, but this is a second priority.  Thanks in advance.

Hi Jester,
  In your ALV Grid Field Catalog (LVC_S_LAYO), for REGIO check whether field <b>checktable</b> has value T005S and <b>ref_field</b> has REGIO and <b>ref_table</b> has LFA1.
  If the above entries are fine and still the validation does not occur then try changing the ref_table to T005S and see..
  Hope this helps..
Sri

Similar Messages

  • Editable ALV & Foreign Key Check

    I am working on an Editable ALV. Here if I try to enter some value into a field which doesnt exist in the corresponding Check table of the field, ALV throws me an error. This scenario is working fine.
    But in some scenarios I populate the ALV table from a Z table (Z table has the same strucutre as the ALV table) and then show this to the user as an editable ALV but in this scenarios if some erroneous values exist in my Z table for a particular fieId I am not getting the Foreign Key check I mentioned earlier.  Here I was hoping to get error message after SET_TABLE_FOR_FIRST_DISPLAY !
    I am using CL_GUI_ALV_GRID, has anyone found a workaround for this
    Antony

    Hi Antony,
    you can INHERIT a class from CL_GUI_ALV_GRID and then redefine SET_TABLE_FOR_FIRST_DISPLAY adding the raising EVENT data_changed for all cells.
    Regards,
    Clemens

  • Problem with Foreign Key check in an editable ALV

    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

    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

  • Use of foreign key check in ABAP reports

    Hi,
    I'm trying to understand if it's possible to use a foreign key integrity check in an ABAP reports. I have understood that this kind of check is deactivated for performance reasons, is it right?
    In this case I'd like to know if it is possible to activate the foreign key check "on demand", or just for a particular table.
    As an example, I'd like to use the foreign key defined on attribute AKONT of table KNB1, that points on the related attribute of table SKB1.
    Thanks,
    Gabriele

    Welcome on SCN!
    I'm trying to understand if it's possible to use a foreign key integrity check in an ABAP reports. I have understood that this kind of check is deactivated for performance reasons, is it right?
    Most likely yes. Integrity is turned OFF for Open SQL statements but is turned ON for screen fields.
    If you just create screen parameter like
    parameters pa_akont type knb1-akont.
    ...then input help for that field will be automatically provided. This means that you will not be able to pick or enter value different that this allowed from SKB1 table (foreign key relationship will be checked).
    You can explicitly assign different input help or search help for certain screen field independently of type it is refering i.e by means of fm F4IF_FIELD_VALUE_REQUEST .
    This however still relates only to screen fields, not fields used directly in ABAP statement.
    Regards
    Marcin

  • Handling Enter Key in Editable ALV Grid using REUSE_ALV_GRID_DISPLAY

    Hello All,
    I have seen a number of threads on captioned issue and everyone of them say to create FCODE for Enter in the Screen's PF Status and then handle the event.
    But the catch is when you hit Enter key in ALV Grid, it will not trigger any FCODE at all because the FCODE Enter you have created is for the screen and not for the GRID. Can anyone please let me know if SAP has given any standard utility in REUSE_ALV_GRID_DISPLAY FM for handling the Enter key event.
    Thanks and regards,
    Mahesh

    Hi,
    Set the PF-status for OK key and use the FCODE or u can usethe dynamic ok_code generated .
    Also try 'ENTE' .
    Hope thishelps.

  • How to control edit checks on alv grid fields

    I have set up an alv grid that allows for user input. 
    The fields are defined from the data dictionary. 
    Edit checks are happening on all fields, but I would like to turn that off for some fields. 
    How is that controlled?
    Regards!

    u need to define ur own field catalog for this purpose, for the fields for which u want to set check box, add property like this
      X_FIELDCAT-FIELDNAME = 'LIFNR'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-SELTEXT_L  = 'VENDOR'.
      X_FIELDCAT-NO_ZERO    = 'X'.
      X_FIELDCAT-OUTPUTLEN  = 10.
      X_FIELDCAT-COL_POS    = 1.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      X_FIELDCAT-FIELDNAME = 'BUKRS'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-CHECKBOX = 'X'.
      X_FIELDCAT-SELTEXT_L  = 'COMPANY'.
      X_FIELDCAT-NO_ZERO    = 'X'.
      X_FIELDCAT-OUTPUTLEN  = 4.
      X_FIELDCAT-COL_POS    = 2.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
        CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
          EXPORTING
            I_PROGRAM_NAME         = SY-REPID
            I_INTERNAL_TABNAME     = 'IT_FINAL'
            I_INCLNAME             = SY-REPID
          CHANGING
            CT_FIELDCAT            = IT_FIELDCAT
          EXCEPTIONS
            INCONSISTENT_INTERFACE = 1
            PROGRAM_ERROR          = 2
            OTHERS                 = 3.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            I_CALLBACK_PROGRAM = SY-REPID
            IS_LAYOUT          = L_LAYOUT
            IT_FIELDCAT        = IT_FIELDCAT
          TABLES
            T_OUTTAB           = IT_FINAL
          EXCEPTIONS
            PROGRAM_ERROR      = 1
            OTHERS             = 2.
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    u can even check program BCALV_EDIT_05, award points if found helpful

  • Catching "RETURN" Key on a ALV Grid

    Good Morning,
    I have a ALV grid which can be updated with values. I need to trigger code after i update one field in the ALV. How can i do that?
    Should i use function REUSE_ALV_EVENTS_GET?
    Regards,
    Pedro Gaspar

    Hi
    1. Things won't work if we do normal things.
    2. The important things are :
    a) New PF-STATUS is required , say 'ABCD'.
    b) Handle user_commmand
    3. First of all, from Function group SALV,
    copy the STANDARD gui status to your program,
    from SE80, by right clicking.
    4. come to your program.
    start-of-selection.
    SET PF-STATUS 'ABCD'.
    5. Double click ABCD and activate the gui status.
    6. In gui status,
    in those green buttons and yellow buton,
    write BACK1 in both.
    ie. buttons with fcode BACK1.
    Save and activate.
    6. AT USER-COMMAND.
    IF sy-ucomm = 'BACK1'.
    DATA : answer TYPE c.
    CALL FUNCTION 'POPUP_TO_CONFIRM'
    EXPORTING
    titlebar = 'Do You Want To Exit ?'
    text_question = 'Do You Want To Exit ?'
    IMPORTING
    answer = answer
    EXCEPTIONS
    text_not_found = 1
    OTHERS = 2.
    IF answer = '1'.
    SET USER-COMMAND 'BACK'.
    ENDIF.
    ENDIF.
    This will solve your problem.
    I tried at my end, it works fantastic.
    <b>Reward if usefull</b>

  • Display listbox key value in ALV GRID method

    Hi All,
    I have a program in which columns are generted dynamically based on number of fields. The column name is dynamic as it depends on its text while The value in Column's can be 1, 2, 3, 4, 5.
    I am trying to display this in a list box along with the text which are maintained as fixed values at domain level.
    space Walking
    1       Archery   
    2       Boxing
    3       Cycling
    4       Rowing
    Also I am displaying by using 'DD_DOMVALUEs_GET, looping through all the fixed values and concatenate
    domvalue_l   ddtext separated by cl_abap_char_utilities=>horizontal_tab. No tab space is coming between key and value.
    Also for the 1st value which is space it is not coming properly as space is condensed.
    The point is that after I am putting values in the grid. The system event data changed is called where the value selected is  1 Archery and it is going to bad cells, error protocol display . I want only the 1st character. How to modify the content in the grid before the system event gets called.
    Regards,
    DPM

    Hi,
    try follow code to setup fieldcat of that DROP DOWN field.
    FCAT-DOMNAME = ' '.
    FCAT-CHECKTABLE= '!'.

  • Foreign key dependency checking

    Dear all:
    I have a question about foreign key checking.
    Let's say I have two Z table, one is master table and one is transaction table.
    The master table contains a primary key named CustNo.
    The transaction table have two primary keys named CustNo and OrderNo.
    The CustNo has foreign key (mandt + CustNo) point to master table, with setting
    "Key fields/candidates  1:N"
    I expected that, delete record in master table should check if there is any dependency in the transaction table,
    but I am wrong.  I am able to delete anything in master table even there are records in transaction table using the same CustNo.
    My question is, how can I make the dependency check?
    Thanks in advance.
    Edited by: Hung Kai, Michael Cheng on Nov 3, 2008 5:29 AM

    Hello,
        For this u need to change the cardinality.
    Below are the list of cardinalities and their functionality.Chack it and use the proper one.
    The left side (n) of the cardinality is defined as follows:
    n=1: There is exactly one record assigned to the check table for each record of the foreign key table.
    n=C: The foreign key table may contain records which do not correspond to any record of the check table because the foreign key field is empty. This can occur for example if the field of the foreign key table is optional, in which case it does not have to be filled.
    The right side (m) of the cardinality is defined as follows:
    m=1: There is exactly one dependent record for each record of the check table.
    m=C: There is at most one dependent record for each record of the check table.
    m=N: There is at least one dependent record for each record of the check table.
    m=CN: There may be any number of dependent records for each record of the check table.
    Shafi

  • Maintenance View for custom table with foreign key relationship

    Hi Folks,
         I have created a custom table with foreign key relationship with other check tables. I want to create a maintenance view / tablemaintenance generator. What all things I need to take care for the foreign keys related fields while creating the maintenance view / tablemaintenance generator.
    Regards,
      santosh

    Hi,
    You do not have to do anything explicitely for the foreign key relationships in the table maintainance generator.
    Create the table maintainance generator via SE11 and it will take care of all teh foreign key checks by itself.
    Regards,
    Ankur Parab

  • ALV grid display-my columns are multiplying.

    I have been searching for the solution for my small problem..So I hope this question hasn`t been asked before.
    I have an ALV grid in a pop up display using 'REUSE_ALV_GRID_DISPLAY'.
    I have an input field on my screen that helps me display only certain keys on my alv grid.
    When I input for example key 2 it shows all the correct products for that key 2.
    When I try to enter another key....it shows the correct products but each column is duplicated. So each time I input something and hit 'Show' each column in that table is duplicated again.
    Tried REFRESH, CLEAR my internal table....but I haven`t been able to make it work.
    Did this happen to anybody ?
    Newbie Ilinca
    my input module for that screen:
    when 'SHOW'.
           select col1 col2....
               into corresponding fields of table it_display
               from ztable
              where col1 = ztable2-col1.
    CLEAR ls_fieldcatlog.
      ls_fieldcatlog-row_pos   = '1'.
      ls_fieldcatlog-col_pos   = '1'.
      ls_fieldcatlog-fieldname = 'COL1'.
      ls_fieldcatlog-tabname   = 'IT_DISPLAY'.
      ls_fieldcatlog-seltext_m = 'Infotype'.
      APPEND ls_fieldcatlog TO lt_fieldcatlog.
      CLEAR ls_fieldcatlog.
      ls_fieldcatlog-row_pos   = '1'.
      ls_fieldcatlog-col_pos   = '2'.
      ls_fieldcatlog-fieldname = 'COL2'.
      ls_fieldcatlog-tabname   = 'IT_DISPLAY'.
      ls_fieldcatlog-seltext_m = 'Infotype'.
      APPEND ls_fieldcatlog TO lt_fieldcatlog.
    noloyo-zebra = 'X'.
    noloyo-colwidth_optimize = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program    = sy-repid
          i_grid_title          = 'INFOTYPE DETAILS'
          is_layout             = noloyo
          it_fieldcat           = lt_fieldcatlog
          i_screen_start_column = 10
          i_screen_start_line   = 20
          i_screen_end_column   = 100
          i_screen_end_line     = 40
        TABLES
          t_outtab              = it_display
        EXCEPTIONS
          program_error         = 1
          OTHERS                = 2.
    AND MY DECL:
    TYPES: BEGIN OF type_com,
          col1TYPE ztable-col1,
          col2TYPE ztable-col2,
           END OF type_com.
    DATA : it_display TYPE STANDARD TABLE OF type_com.

    Hi ilinktrinel;
    Please try to below code
    first way;
    refresh lt_fieldcatlog. "add only this row
    CLEAR ls_fieldcatlog.
    ls_fieldcatlog-row_pos = '1'.
    ls_fieldcatlog-col_pos = '1'.
    ls_fieldcatlog-fieldname = 'COL1'.
    ls_fieldcatlog-tabname = 'IT_DISPLAY'.
    ls_fieldcatlog-seltext_m = 'Infotype'.
    APPEND ls_fieldcatlog TO lt_fieldcatlog.
    CLEAR ls_fieldcatlog.
    ls_fieldcatlog-row_pos = '1'.
    ls_fieldcatlog-col_pos = '2'.
    ls_fieldcatlog-fieldname = 'COL2'.
    ls_fieldcatlog-tabname = 'IT_DISPLAY'.
    ls_fieldcatlog-seltext_m = 'Infotype'.
    second way;
    if lt_fieldcatlog is initial. "add this row
    CLEAR ls_fieldcatlog.
    ls_fieldcatlog-row_pos = '1'.
    ls_fieldcatlog-col_pos = '1'.
    ls_fieldcatlog-fieldname = 'COL1'.
    ls_fieldcatlog-tabname = 'IT_DISPLAY'.
    ls_fieldcatlog-seltext_m = 'Infotype'.
    APPEND ls_fieldcatlog TO lt_fieldcatlog.
    CLEAR ls_fieldcatlog.
    ls_fieldcatlog-row_pos = '1'.
    ls_fieldcatlog-col_pos = '2'.
    ls_fieldcatlog-fieldname = 'COL2'.
    ls_fieldcatlog-tabname = 'IT_DISPLAY'.
    ls_fieldcatlog-seltext_m = 'Infotype'.
    endif. "add this row
    Best regards.

  • Break-point in ALV-GRID OO if standard-button &PRINT_BACK is pressed.

    Hi,
    is it possible to set a break-point in Button '&PRINT_BACK'?
    I will use it to test if i can use:
        CALL METHOD I_ALV_GRID->GET_FRONTEND_PRINT
          IMPORTING
            ES_PRINT = GS_PRNT.
    and
        CALL METHOD I_ALV_GRID->SET_FRONTEND_PRINT
          EXPORTING
            IS_PRINT = GS_PRNT.
    Regards, Dieter

    Hi,
    Please check links,
    ALV Grid Control - Dropwdown / Checkbox
    Question about triggering event for ALV dropdown
    Regards,
    Hema.
    Reward points if it is useful.

  • Dropdown in ALV Grid (OO)

    Hi All,
    I am populating a dropdown in the ALV grid, Now I have a requirement to fill this dropdown when I press enter button after selecting a value in the grid for a previous column ,I have written the code for this but the values are not getting filled into the dropdown , I tried debug the program and found out that the internal table I am using to fill the dropdown is getting filled with correct values but when I am calling the function
    CALL METHOD g_grid->set_drop_down_table
        EXPORTING
          it_drop_down_alias = lt_dropdown.
    the values are not getting passed to that field in the grid.
    Please help.
    I am posting the code also.
    DATA : lt_ct1_mat TYPE STANDARD TABLE OF eina .
      DATA:  ls_dropdown TYPE lvc_s_dral.
      DATA : wa like line of lt_ct1_mat.
      SELECT * FROM eina INTO TABLE lt_ct1_mat
               WHERE matnr = l_partno.
      IF NOT lt_ct1_mat[] IS INITIAL.
      clear lt_dropdown[].
        LOOP AT lt_ct1_mat into wa.
          ls_dropdown-handle = '1'.
          ls_dropdown-value = wa-lifnr.
          APPEND ls_dropdown TO lt_dropdown.
          CLEAR ls_dropdown.
        ENDLOOP.
      ENDIF.
      CALL METHOD g_grid->set_drop_down_table
        EXPORTING
          it_drop_down_alias = lt_dropdown.
    Thanks

    Hi,
    Please check links,
    ALV Grid Control - Dropwdown / Checkbox
    Question about triggering event for ALV dropdown
    Regards,
    Hema.
    Reward points if it is useful.

  • Selected lines in ALV grid

    Hi,
    I provided one check in ALV grid as one field.If I  select the check boxes for some rows and click on user command(created by me), I need to pass the selected rows only into another sub routine for further processing. How to achive this functionality?
    thanks
    kumar

    hi,
    Did you try using the method Get_selected_row o this class????
    before using plz set the sel_mode of layout as 'A', 'C' or 'D'....
    Call this method as follows:
    data: gi_itab type lvc_t_row.
    call method <ref variable of cl_gui_alv_grid>->get_selected_row
    importing
    et_index_rows = gi_itab.
    this table will have the indexes of the selected rows.
    hope this solves your problem...
    regards,
    ags.

  • EMIGALL : problem of foreign key

    Hi everybody
    I m working on a EMIGALL migration and i met one problem with foreign key…
    My field VKONT is defined (in specific table ZR006SAT) like a foreign key with check table FKKVK (Contract Account Header). It means that an entry can be inserted in ZR006SAT , only if VKONT value exists in FKKVK table.
    But, during the migration of my migration object ZR006SAT (same name as the table), I have no error when I put any value for my VKONT field in the input file. EMIGALL does not control the foreign key constraint and I don’t understand why (???).
    However,
    1.     when i try to insert manually (by SE11) an entry in ZR006SAT, SAP forces me to input correct value (existing in FKKVK table) for VKONT field.
    2.     for standards migration objects, there is no problem… foreign key check is working well
    3 days I ve been on this problem.
    Please help me

    Hai
    You can find detailed documentation of EMIGALL in SAP itself. Use Transaction EQ81 to display it. It provides all the concepts and procedures to work with EMIGALL. I will also prepare a document and send it to u later. Meanwhile just for ur info here are some points about EMIGALL :
    1. It Migrates data Business Object wise
    2. It uses Direct Input Technique
    3. It has more than 100 objects of IS-U
    and the steps for implementation goes like this:
    1)You have to create a user specially for migration which will have all the authorizations related to migration workbench, BASIS and IS-U
    2)You have to create your own company in EMIGALL. There is a default company called SAP.
    3)Company SAP contains all the Business Objects
    4)You have to figure out what business objects u need and then u have to copy those business objects to ur company from Standard Company SAP
    5)Each objects contains more than one structure and each structure can contain more than one fields. The relation goes like this
    Object ---> Structure ---> Field
    6)You have to define field rules for each required field of the object. You have to mark "Not required" for fields u don't need
    7)After field rules for a given object is set u have to generate load report i.e. actual Direct Input Program which will migrate data. This program is generated on basis of field rules set by u.
    8)After the load report is generated u have to prepare an input file (import File) for migration. The import file should be according to structure provided by SAP and must be in binary format. SAP Provides the structure of file according to your configurations. You have to write ur own Data conversion program(in any language) for this task.
    9)You take import file as input and migrate the data using generated load program
    10)Finally u can check the Migration Statistics and Error Log
    Regards
    Sreeni

Maybe you are looking for

  • Are there any examples of queres or reports for the Access DB TS can generate?

    I am currently useing the default TestStand SPC database storage routine to store the results of all runs. Are there any tools, queries, reports, etc. to help me post process this database? I thought I would check here before making something myself.

  • Purchase Tax - Field BSEG- WMWST not getting filled on Invoice documents

    Hi, I am posting a Invoice document using FB60. Along with other details, I enter Tax code and check the Calculate Tax check box and SAP calculates & generated extra line for Tax amount. Document is posted successfully. Howver this purchase tax calcu

  • 3 Condition types to be added

    Hello, We have 3 custom condition types defined in pricing procedure. We need to add the values of all these 3 conditions and add into the last (i.e.  3rd condition). Basically we want to collect the sum of all 3 conditions into the third condition v

  • Restrict PR Unrelease Before PO Unrelease

    Hi, We want that PR should not be Unreleased before PO Unreleased... In my system, currently user is able to Unreleased the PR, before PO Unreleased... Even MIGO / MIRO has been Done...then user is doing PR Unreleased. How can we Stop this??? Please

  • Help about PDF Templates

    Hi all, I am new to xmlp and i have experience only with the RTF Templates. Now my user wants the templates in PDF for some new reports. I dont know how to use PDF Templates. If any one had good experience with PDF Templates please give any forums or