Skip to Content

how to find the checktable assigned to a field dynamically

Hi Members ,

I have a requirement in which numerous validations have to applied before passing the values to a BAPI . i have to find a way to know checktable assigned to a field dynamically . I will explain it more clearly now .

eg . There is a structure KOMK . It has 363 fields in these fields around 200 have a check table assigned to them .

The requirement is to check the value in the excel sheet provided by user to first validated before passing to BAPI .

eg . if it is sales organisation . field : VKORG . The value provided by user should be in table TVKO which is checktable for this field ( displayed in Inputc help/check tab ) . In this way there are numerous other fields whose checks need to be applied . Plz Refer to screenshot below :

i have the names of fields like VKORG , VTWEG , BRSCH stored in character in a internal table in one single column .

i am looking for a dynamic way to find check table so that i can take care of 200+ fields. Maintaing these in Ztable is not an option for me frz .

Is it stored in some table or Link of tables or View or some Function Module .....

How to fulfill this Requirement ?

Would be grateful to your Replies ....

Kindly comment .

Thanks & Rgds ,

Dave

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Posted on Aug 18, 2016 at 06:09 AM

    I don't understand the requirement to do the checks before calling the BAPI. Doesn't the BAPI check the values too?

    Foreign keys are primarily stored in tables DD08L and DD05S (value in field DD03L-CHECKTABLE being redundant with DD08L-CHECKTABLE)

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 18, 2016 at 06:33 AM

    Look at FM DDUT_INPUT_CHECK.

    Regards,

    Raymond

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 18, 2016 at 06:51 AM

    Devendra,

    Can you please let us know what compelled you to take this approach of validating the field names with the respective check table field names ?

    K.Kiran.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 18, 2016 at 01:40 PM

    Devendra,

    You have an ITAB with the fieldnames you want to check, so may I suggest something along these lines:

    Add another field to that ITAB with the poistion in the DB table for each field. Then you can "walk" across each data record field by field and see what needs to be checked.

    In the below example, I used funciton module DDUT_INPUT_CHECK that Raymond suggested in his earlier comment. The FM has fairly good documentation. Error handling can be done with the FAILURE_TAB or with the MSG procedure (which brings back the error text used in the FK check) or with the simple sy-subrc check I used - whatever fits your needs.

    Good luck!

    Loyd

    DATA: wa_spfli TYPE spfli,
    it_spfli TYPE STANDARD TABLE OF spfli.

    DATA: repid TYPE sy-repid.

    DATA: BEGIN OF wa_fields, "ITAB of fields to be checked
    pos TYPE dd03l-position,
    fieldname TYPE dfies-lfieldname, "datatype is important to FM
    END OF wa_fields,
    it_fields LIKE STANDARD TABLE OF wa_fields.

    FIELD-SYMBOLS: <fs_comp> TYPE any. "used to walk across the structure

    INITIALIZATION. "load the ITAB of fields to be checked
    wa_fields-pos = '5'.
    wa_fields-fieldname = 'CITYFROM'.
    APPEND wa_fields TO it_fields.
    wa_fields-pos = '8'.
    wa_fields-fieldname = 'CITYTO'.
    APPEND wa_fields TO it_fields.

    START-OF-SELECTION.
    repid = sy-repid.
    SELECT * FROM spfli INTO TABLE it_spfli. "get the real data
    LOOP AT it_spfli INTO wa_spfli.
    DO.
    ASSIGN COMPONENT sy-index OF STRUCTURE wa_spfli TO <fs_comp>. "walk the struktur
    IF sy-subrc <> 0.
    EXIT.
    ENDIF.
    CLEAR wa_fields.
    READ TABLE it_fields INTO wa_fields WITH KEY pos = sy-index.
    IF sy-subrc = 0. "found a hit on ITAB
    CALL FUNCTION 'DDUT_INPUT_CHECK'
    EXPORTING
    tabname = 'SPFLI'
    fieldname = wa_fields-fieldname
    calling_program = repid
    value = <fs_comp>
    EXCEPTIONS
    no_ddic_field = 1
    illegal_move = 2
    OTHERS = 3.
    IF sy-subrc <> 0.
    WRITE: 'failed check', wa_fields-fieldname, <fs_comp>.
    ENDIF.
    ENDIF.
    ENDDO.
    ENDLOOP.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 18, 2016 at 12:05 AM

    Hi members ,

    Any suggestions on the issue .

    Thanks ,

    Dave

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.