hi, i want to fill a fieldcatalog(ALV) with a field that's not in my itab, i mean for example i want to add a field that shows me some value like '123', please help!!
I do not really understand your question but can give you some advice about creating fieldcatalogs anyway.
Assuming that you have build your fieldcatalog (LVC_T_FCAT) according to a given DDIC structure I would look for another DDIC structure which contains a field you are looking for. Then you append this DDIC field to your fieldcatalog like this:
DATA: ls_fcat TYPE lvc_s_fcat, lt_fcat TYPE lvc_t_fcat. " NOTE: gt_fcat contains the fieldcatalog for your itab except for the missing field/column CALL FUNCTION 'LVC_FIELDCATALOG_MERGE' EXPORTING * I_BUFFER_ACTIVE = i_structure_name = '<name of 2nd DDIC structure' * I_CLIENT_NEVER_DISPLAY = 'X' I_BYPASSING_BUFFER = 'X' " important here !!! * I_INTERNAL_TABNAME = CHANGING ct_fieldcat = lt_fcat EXCEPTIONS inconsistent_interface = 1 program_error = 2 OTHERS = 3. IF sy-subrc <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. LOOP AT lt_fcat INTO ls_fcat WHERE ( fieldname = '<missing field>' ). ls_fcat-fieldname = '<new name of additional column>'. ls_fcat-scrtext_s = '<new short text>'. ls_fcat-scrtext_m = '<new medium text>'. ls_fcat-scrtext_l = '<new long text>'. APPEND ls_fcat TO gt_fcat. " add new column to fieldcatalog ENDLOOP. " Finally renumbering of column LOOP AT gt_fcat INTO ls_fcat. ls_fcat-col_pos = syst-tabix. MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix. ENDLOOP.