Code: Alles auswählen.
*&---------------------------------------------------------------------*
*& Form feldkatalog_aufbauen
*&---------------------------------------------------------------------*
* Feldkatalog aufbauen
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM FELDKATALOG_AUFBAUEN.
DATA: I TYPE I,
SAV_JAHR(4) TYPE C,
SAV_MONAT(2) TYPE C.
*Aufbau eines Feldkataloges aus der internen Tabelle
*Feldkatalog-gerüst aufbauen
G_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = G_REPID
I_INTERNAL_TABNAME = 'ITAB'
I_INCLNAME = G_REPID
CHANGING
CT_FIELDCAT = FIELDCAT[]
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 FIELDCAT INTO WRK_FIELDCAT_ALV.
CASE WRK_FIELDCAT_ALV-FIELDNAME.
WHEN 'ANZPS'.
WRK_FIELDCAT_ALV-SELTEXT_S = 'Pers.max/Tag'.
WRK_FIELDCAT_ALV-SELTEXT_M = 'Personen maximal/Tag'.
WRK_FIELDCAT_ALV-SELTEXT_L = 'Personen maximal/Tag'.
WRK_FIELDCAT_ALV-REPTEXT_DDIC = 'Personen maximal/Tag'.
WHEN 'BED01' OR 'BED02' OR 'BED03' OR 'BED04' OR 'BED05' OR
'BED06' OR 'BED07' OR 'BED08' OR 'BED09' OR 'BED10' OR 'BED11'
OR 'BED12'.
SAV_JAHR = AKTJAHR.
SAV_MONAT = AKTMONAT.
SAV_MONAT = SAV_MONAT + WRK_FIELDCAT_ALV-FIELDNAME+3(2) - 1.
IF SAV_MONAT > 12.
SAV_MONAT = SAV_MONAT - 12.
SAV_JAHR = SAV_JAHR + 1.
ENDIF.
CONCATENATE SAV_MONAT '_' SAV_JAHR
INTO WRK_FIELDCAT_ALV-SELTEXT_S.
CONCATENATE 'Bed. Std: ' SAV_MONAT '_' SAV_JAHR
INTO WRK_FIELDCAT_ALV-SELTEXT_M.
CONCATENATE 'Bedarf Std: ' SAV_MONAT '_' SAV_JAHR
INTO WRK_FIELDCAT_ALV-SELTEXT_L.
CONCATENATE 'Bedarf (Std): ' SAV_MONAT '_' SAV_JAHR
INTO WRK_FIELDCAT_ALV-REPTEXT_DDIC.
WHEN 'GRUPPE'.
WRK_FIELDCAT_ALV-SELTEXT_S = 'Gruppe'.
WRK_FIELDCAT_ALV-SELTEXT_M = 'Gruppe'.
WRK_FIELDCAT_ALV-SELTEXT_L = 'Gruppe'.
WRK_FIELDCAT_ALV-REPTEXT_DDIC = 'Gruppe'.
WHEN 'TGBED'.
WRK_FIELDCAT_ALV-SELTEXT_S = 'Kap.Bed.'.
WRK_FIELDCAT_ALV-SELTEXT_M = 'Kapazitätsbedarf'.
WRK_FIELDCAT_ALV-SELTEXT_L = 'Kapazitätsbedarf'.
WRK_FIELDCAT_ALV-REPTEXT_DDIC = 'Kapazitätsbedarf (Std.)'.
WHEN OTHERS.
WRK_FIELDCAT_ALV-KEY = ''.
ENDCASE.
MODIFY FIELDCAT FROM WRK_FIELDCAT_ALV.
ENDLOOP.
ENDFORM.