Hi guys,
I have a unique requirement in the CRM conversions.
In table CABN there is a field "ATNAM' which is Attribute/Charactristic Name and for every characteristic their will be a check table which is the field 'ATPRT'.
My requirement is to first fetch the Check table name of an characteristic and then get the primary field of this check table and then validate the characteristic value available with the primary field.
I have already written the code to get the check table name and then using FM COM_GET_KEY_FIELDS_FOR_TABLE have fetch the primary field names in an field symbol table as i am not sure how many fields will the primary field of the check table have for different characteristic's.
Can any one suggest me how can i write a dynamic select statement to capture the required field name of the check table.
SAMPLE CODE:
READ TABLE it_atson into wa_atson WITH KEY atnam = wa_partner-atname .
IF sy-subrc EQ 0.
lv_atprt = wa_atson-atprt.
Get key field from the database table
FIELD-SYMBOLS: <Fs_atprt> TYPE ANY TABLE.
CALL FUNCTION 'COM_GET_KEY_FIELDS_FROM_TABLE'
EXPORTING
iv_table_name = lv_atprt
IV_CLIENT_NEEDED = ' '
IMPORTING
ET_KEY_FIELDS = <Fs_atprt>
EXCEPTIONS
NO_INPUT = 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.
if lv_atprt IS NOT INITIAL.
SELECT *
from (lv_atprt)
INTO table lt_atvalue
where field = <fs_atprt>.