ALV grid texte

Getting started ... Alles für einen gelungenen Start.
7 Beiträge • Seite 1 von 1
7 Beiträge Seite 1 von 1

ALV grid texte

Beitrag von kostonstyle (Specialist / 247 / 0 / 0 ) »
hallo abapfreaks
ich habe eine frage zu alvgrid, und zwar wie kann ich den titeltext(siehe bild ist rot umrahmt) nach belieben verändern.
Zum Beispiel Materialkurztext zu Materialtext.
vielen dank im Vorrraus kostonstyle

gesponsert
Stellenangebote auf ABAPforum.com schalten
kostenfrei für Ausbildungsberufe und Werksstudenten


Beitrag von an4kh4 (ForumUser / 94 / 0 / 0 ) »
Hallo Kostonstyle,

ja kannst du,
du musst beim aufruf der methode "set_table_for_first_disblay" einen feldkatalog mitgeben:

Code: Alles auswählen.

  CALL METHOD my_alv->set_table_for_first_display
    EXPORTING
      i_structure_name     = my_struct_name
(...)
    CHANGING
      it_outtab            = my_tab
      it_fieldcatalog      = my_fieldcatalog.
Der Feldkatalog muss vom Type lvc_t_fcat sein, also:

Code: Alles auswählen.

DATA: my_fieldcatalog    TYPE lvc_t_fcat
und da gibts ein feld mit dem Namen "coltext"...

also jetzt mal 'n ganz Triviales Beispiel:

Code: Alles auswählen.

DATA: my_fieldcatalog     TYPE lvc_t_fcat,
      l_field             like line of my_fieldcatalog.

  l_field-fieldname     = 'MATNR'. "Feldname in deiner struktur
  l_field-coltext       = 'MatNr'. "ALV-Control: Spaltenüberschrift
  APPEND l_field TO my_fieldcatalog.

  CALL METHOD my_alv->set_table_for_first_display
    EXPORTING
      i_structure_name     = my_struct_name
(...)
    CHANGING
      it_outtab            = my_tab
      it_fieldcatalog      = my_fieldcatalog.
ich hoffe das ist so einigermaßen verständlich

Gruß Lars

Beitrag von kostonstyle (Specialist / 247 / 0 / 0 ) »
hier ist noch der code

Code: Alles auswählen.

REPORT zliefervolu MESSAGE-ID sapdocu.

*Tabelledefinition
TABLES: mara, marm, makt.

*Typendefinition
TYPES: BEGIN OF alv_out_table_t,
         matnr LIKE mara-matnr,
         lvorm LIKE mara-lvorm,
         maktx LIKE makt-maktx,
         meins LIKE mara-meins,
         umrez LIKE marm-umrez,
         meinh LIKE marm-meinh,
         hoehe LIKE marm-hoehe,
         umren LIKE marm-umren,
         meabm LIKE marm-meabm,
         spras LIKE makt-spras,
       END OF alv_out_table_t.

*Variablendefinition
DATA: ctl_alv_scarr  TYPE REF TO cl_gui_alv_grid,
      ctl_cccontainer TYPE REF TO cl_gui_custom_container,
      fct_ma_mm_mk TYPE lvc_t_fcat,
      t_alv_out_table TYPE TABLE OF alv_out_table_t,
      ok_code LIKE sy-ucomm.

*Selektionsoption
SELECT-OPTIONS: s_matnr FOR marm-matnr, "Materialnummer
                s_matkl FOR mara-matkl. "Warengruppe


***************************************************
* Programmstart                                   *
***************************************************
START-OF-SELECTION.

* ----------------------------------------------------------
* Datenbankdaten mit Selekt JOIN zusammenknüpfen           *
* ----------------------------------------------------------
  PERFORM fill_alv_table CHANGING t_alv_out_table.

* ----------------------------------------------------------
* Datenbanktabellen lesen                                  *
* ----------------------------------------------------------
  PERFORM read_database CHANGING fct_ma_mm_mk.

* ----------------------------------------------------------
* Feldleiste, die nicht ausgeblendet wird, ein Flag setzen *
* ----------------------------------------------------------
  PERFORM turn_off_cols CHANGING fct_ma_mm_mk.

* --------------------------------------------------
* Feldname mit Tabellenfeldern füllen              *
* --------------------------------------------------
  PERFORM set_fct_fieldname CHANGING fct_ma_mm_mk.

* Dynpro anzeigen
  CALL SCREEN 100.

END-OF-SELECTION.

***************************************************
* Programmsende                                   *
***************************************************


* --------------------------------------------------
* Feldname mit Tabellenfeldern füllen              *
* --------------------------------------------------

FORM set_fct_fieldname
  CHANGING i_fct_ma_mm_mk TYPE lvc_t_fcat.

  PERFORM customize_fieldcatalog
    USING 'MATNR' 'COL_POS' 1 CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MATNR' 'TECH' space CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MAKTX' 'COL_POS' 2 CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MAKTX' 'TECH' space CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MEINS' 'COL_POS' 6 CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MEINS' 'TECH' space CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'UMREZ' 'COL_POS' 5 CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'UMREZ' 'TECH' space CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MEINH' 'COL_POS' 4 CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MEINH' 'TECH' space CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'UMREN' 'COL_POS' 3 CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'UMREN' 'TECH' space CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'HOEHE' 'COL_POS' 7 CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'HOEHE' 'TECH' space CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MEABM' 'COL_POS' 8 CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MEABM' 'TECH' space CHANGING fct_ma_mm_mk.


ENDFORM.                    "set_FCT_MA_MM_MK

* ----------------------------------------------------------
* Feldleiste, die nicht ausgeblendet wird, ein Flag setzen *
* ----------------------------------------------------------

FORM turn_off_cols
  CHANGING i_fieldcat TYPE lvc_t_fcat.

  DATA: wa_fieldcat TYPE lvc_s_fcat.

  LOOP AT i_fieldcat INTO wa_fieldcat.
    wa_fieldcat-tech = 'X'.
    MODIFY i_fieldcat FROM wa_fieldcat INDEX sy-tabix.
  ENDLOOP.
ENDFORM.                    "turn_off_cols

* ----------------------------------------------------------
* Datenbanktabellen lesen                                  *
* ----------------------------------------------------------

FORM read_database
  CHANGING fct_ma_mm_mk TYPE lvc_t_fcat.

  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
      i_structure_name       = 'MAKT'
      i_client_never_display = 'X'
    CHANGING
      ct_fieldcat            = fct_ma_mm_mk.

  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
      i_structure_name       = 'MARM'
      i_client_never_display = 'X'
    CHANGING
      ct_fieldcat            = fct_ma_mm_mk.

  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
      i_structure_name       = 'MARA'
      i_client_never_display = 'X'
    CHANGING
      ct_fieldcat            = fct_ma_mm_mk.

ENDFORM.                    "create_FCT_MA_MM_MK


* ----------------------------------------------------------
* Datenbankdaten mit Selekt JOIN zuknüpfen                 *
* ----------------------------------------------------------

FORM fill_alv_table
  CHANGING t_alv_out_table TYPE ANY TABLE.

  CLEAR: marm, makt, mara.

  SELECT sp~matnr
         sp~lvorm
         sm~maktx
         sm~spras
         sp~meins
         sc~umrez
         sc~meinh
         sc~meabm
         sc~hoehe
         sc~umren
  FROM ( mara AS sp INNER JOIN marm AS sc
                       ON sp~matnr = sc~matnr
                       INNER JOIN makt AS sm
                       ON sp~matnr = sm~matnr AND sm~spras = sy-langu
       )
  INTO CORRESPONDING FIELDS OF TABLE t_alv_out_table
                               WHERE sc~matnr IN s_matnr
                               AND sp~matkl IN s_matkl
                               AND sp~lvorm <> 'x'
                               ORDER BY sp~matnr sc~umrez .

  IF sy-subrc NE 0.
    MESSAGE text-002 TYPE 'e'.
    EXIT.
  ENDIF.

ENDFORM.                    "fill_alv_table

* ----------------------------------------------------------
* Feldleiste zusammenfügen                                 *
* ----------------------------------------------------------

FORM customize_fieldcatalog
  USING value(i_colname) TYPE lvc_fname
        value(i_modfield) TYPE c
        value(i_modvalue) TYPE any
  CHANGING i_fieldcat TYPE lvc_t_fcat.

  DATA: wa_fieldcat TYPE lvc_s_fcat.

  FIELD-SYMBOLS: <fs_modfield> TYPE ANY.

  ASSIGN: COMPONENT i_modfield OF STRUCTURE
             wa_fieldcat TO <fs_modfield>.

  READ TABLE i_fieldcat WITH KEY fieldname = i_colname
    INTO wa_fieldcat.

  <fs_modfield> = i_modvalue.

  MODIFY i_fieldcat FROM wa_fieldcat INDEX sy-tabix.

ENDFORM.                    "customize_fieldcatalog

* ----------------------------------------------------------
* MODULES
* ----------------------------------------------------------

MODULE init_controls OUTPUT.
  IF ctl_cccontainer IS INITIAL.
    CREATE OBJECT ctl_cccontainer
       EXPORTING  container_name = 'CCCONTAINER'.

    CREATE OBJECT ctl_alv_scarr
       EXPORTING i_parent = ctl_cccontainer.

    ctl_alv_scarr->set_table_for_first_display(
        CHANGING it_outtab = t_alv_out_table
                 it_fieldcatalog = fct_ma_mm_mk ).
  ENDIF.
ENDMODULE.                    "init_controls OUTPUT

*----------------------------------------------------------------------*
*  MODULE status_0100 OUTPUT
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'MAIN100'.
  SET TITLEBAR 'TITEL'.
ENDMODULE.                    "status_0100 OUTPUT

*----------------------------------------------------------------------*
*  MODULE handle_input INPUT
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
MODULE handle_input INPUT.
  IF ok_code = 'EXIT'.
    LEAVE PROGRAM.
  ENDIF.
  CLEAR ok_code.
ENDMODULE.
hier wird der name des titelfeldes zugewiesen

Code: Alles auswählen.

FORM set_fct_fieldname
  CHANGING i_fct_ma_mm_mk TYPE lvc_t_fcat.

  PERFORM customize_fieldcatalog
    USING 'MATNR' 'COL_POS' 1 CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MATNR' 'TECH' space CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MAKTX' 'COL_POS' 2 CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MAKTX' 'TECH' space CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MEINS' 'COL_POS' 6 CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MEINS' 'TECH' space CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'UMREZ' 'COL_POS' 5 CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'UMREZ' 'TECH' space CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MEINH' 'COL_POS' 4 CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MEINH' 'TECH' space CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'UMREN' 'COL_POS' 3 CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'UMREN' 'TECH' space CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'HOEHE' 'COL_POS' 7 CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'HOEHE' 'TECH' space CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MEABM' 'COL_POS' 8 CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MEABM' 'TECH' space CHANGING fct_ma_mm_mk.


ENDFORM.                    "set_FCT_MA_MM_MK

Beitrag von kostonstyle (Specialist / 247 / 0 / 0 ) »
könnte mir jemand sagen, was daran falsch ist?

Code: Alles auswählen.

REPORT zliefervolu MESSAGE-ID sapdocu.

*Tabelledefinition
TABLES: marm, likp, lips.

*Typendefinition
TYPES: BEGIN OF alv_out_table_t,
          vbeln TYPE vbeln,
          wadat TYPE wadat,
          kunnr TYPE kunnr,
          lfimg TYPE lfimg,
          v_volumen TYPE i,
          v_totvol TYPE i,
       END OF alv_out_table_t.

*Variablendefinition
DATA: ctl_alv_scarr  TYPE REF TO cl_gui_alv_grid,
      ctl_cccontainer TYPE REF TO cl_gui_custom_container,
      fct_ma_mm_mk TYPE lvc_t_fcat,
      t_alv_out_table TYPE TABLE OF alv_out_table_t,
      dt_alv_out_table TYPE TABLE OF alv_out_table_t WITH HEADER LINE INITIAL SIZE 0,
      ok_code LIKE sy-ucomm.

*Selektionsoption
SELECT-OPTIONS: s_kunnr FOR likp-kunnr,
                s_wadat FOR likp-wadat,
                s_vbeln FOR likp-vbeln.


***************************************************
* Programmstart                                   *
***************************************************
START-OF-SELECTION.

* ----------------------------------------------------------
* Datenbankdaten mit Selekt JOIN zusammenknüpfen           *
* ----------------------------------------------------------
  PERFORM fill_alv_table CHANGING t_alv_out_table.

* ----------------------------------------------------------
* Datenbanktabellen lesen                                  *
* ----------------------------------------------------------
  PERFORM read_database CHANGING fct_ma_mm_mk.

* ----------------------------------------------------------
* Feldleiste, die nicht ausgeblendet wird, ein Flag setzen *
* ----------------------------------------------------------
  PERFORM turn_off_cols CHANGING fct_ma_mm_mk.

* --------------------------------------------------
* Feldname mit Tabellenfeldern füllen              *
* --------------------------------------------------
  PERFORM set_fct_fieldname CHANGING fct_ma_mm_mk.

* Dynpro anzeigen
  CALL SCREEN 100.

END-OF-SELECTION.

***************************************************
* Programmsende                                   *
***************************************************


* --------------------------------------------------
* Feldname mit Tabellenfeldern füllen              *
* --------------------------------------------------

FORM set_fct_fieldname
  CHANGING i_fct_ma_mm_mk TYPE lvc_t_fcat.

  PERFORM customize_fieldcatalog
    USING 'MATNR' 'COL_POS' 1 CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MATNR' 'TECH' space CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MAKTX' 'COL_POS' 2 CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MAKTX' 'TECH' space CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MEINS' 'COL_POS' 6 CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MEINS' 'TECH' space CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'UMREZ' 'COL_POS' 5 CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'UMREZ' 'TECH' space CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MEINH' 'COL_POS' 4 CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MEINH' 'TECH' space CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'UMREN' 'COL_POS' 3 CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'UMREN' 'TECH' space CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'HOEHE' 'COL_POS' 7 CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'HOEHE' 'TECH' space CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MEABM' 'COL_POS' 8 CHANGING fct_ma_mm_mk.

  PERFORM customize_fieldcatalog
    USING 'MEABM' 'TECH' space CHANGING fct_ma_mm_mk.


ENDFORM.                    "set_FCT_MA_MM_MK

* ----------------------------------------------------------
* Feldleiste, die nicht ausgeblendet wird, ein Flag setzen *
* ----------------------------------------------------------

FORM turn_off_cols
  CHANGING i_fieldcat TYPE lvc_t_fcat.

  DATA: wa_fieldcat TYPE lvc_s_fcat.

  LOOP AT i_fieldcat INTO wa_fieldcat.
    wa_fieldcat-tech = 'X'.
    MODIFY i_fieldcat FROM wa_fieldcat INDEX sy-tabix.
  ENDLOOP.
ENDFORM.                    "turn_off_cols

* ----------------------------------------------------------
* Datenbanktabellen lesen                                  *
* ----------------------------------------------------------

FORM read_database
  CHANGING fct_ma_mm_mk TYPE lvc_t_fcat.

  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
      i_structure_name       = 'MAKT'
      i_client_never_display = 'X'
    CHANGING
      ct_fieldcat            = fct_ma_mm_mk.

  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
      i_structure_name       = 'MARM'
      i_client_never_display = 'X'
    CHANGING
      ct_fieldcat            = fct_ma_mm_mk.

  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
      i_structure_name       = 'MARA'
      i_client_never_display = 'X'
    CHANGING
      ct_fieldcat            = fct_ma_mm_mk.

ENDFORM.                    "create_FCT_MA_MM_MK


* ----------------------------------------------------------
* Datenbankdaten mit Selekt JOIN zuknüpfen                 *
* ----------------------------------------------------------

FORM fill_alv_table CHANGING t_alv_out_table TYPE ANY TABLE.

  CLEAR: likp.

  SELECT * FROM likp WHERE kunnr IN s_kunnr
                     AND wadat IN s_wadat
                     AND vbeln IN s_vbeln.

    MOVE likp-vbeln TO dt_alv_out_table-vbeln.
    MOVE likp-wadat TO dt_alv_out_table-wadat.
    MOVE likp-kunnr TO dt_alv_out_table-kunnr.

    CLEAR: lips.
    SELECT * FROM lips WHERE vbeln EQ likp-vbeln.

      CLEAR: marm.
      SELECT SINGLE * FROM marm WHERE matnr EQ lips-matnr
                                AND meinh EQ lips-vrkme.

      dt_alv_out_table-v_volumen = lips-lfimg * marm-hoehe.
      dt_alv_out_table-v_totvol = dt_alv_out_table-v_totvol + dt_alv_out_table-v_volumen.
      dt_alv_out_table-lfimg = dt_alv_out_table-lfimg + lips-lfimg.

    ENDSELECT.

    APPEND dt_alv_out_table TO t_alv_out_table.

  ENDSELECT.

  break user912.

*  CLEAR: marm, makt, mara.
*
*  SELECT sp~matnr
*         sp~lvorm
*         sm~maktx
*         sm~spras
*         sp~meins
*         sc~umrez
*         sc~meinh
*         sc~meabm
*         sc~hoehe
*         sc~umren
*  FROM ( mara AS sp INNER JOIN marm AS sc
*                       ON sp~matnr = sc~matnr
*                       INNER JOIN makt AS sm
*                       ON sp~matnr = sm~matnr AND sm~spras = sy-langu
*       )
*  INTO CORRESPONDING FIELDS OF TABLE t_alv_out_table
*                               WHERE sc~matnr IN s_matnr
*                               AND sp~matkl IN s_matkl
*                               AND sp~lvorm <> 'x'
*                               ORDER BY sp~matnr sc~umrez .

  IF sy-subrc NE 0.
    MESSAGE text-002 TYPE 'e'.
    EXIT.
  ENDIF.

ENDFORM.                    "fill_alv_table

* ----------------------------------------------------------
* Feldleiste zusammenfügen                                 *
* ----------------------------------------------------------

FORM customize_fieldcatalog
  USING value(i_colname) TYPE lvc_fname
        value(i_modfield) TYPE c
        value(i_modvalue) TYPE any
  CHANGING i_fieldcat TYPE lvc_t_fcat.

  DATA: wa_fieldcat TYPE lvc_s_fcat.

  FIELD-SYMBOLS: <fs_modfield> TYPE ANY.

  ASSIGN: COMPONENT i_modfield OF STRUCTURE
             wa_fieldcat TO <fs_modfield>.

  READ TABLE i_fieldcat WITH KEY fieldname = i_colname
    INTO wa_fieldcat.

  <fs_modfield> = i_modvalue.

  MODIFY i_fieldcat FROM wa_fieldcat INDEX sy-tabix.

ENDFORM.                    "customize_fieldcatalog

* ----------------------------------------------------------
* MODULES
* ----------------------------------------------------------

MODULE init_controls OUTPUT.
  IF ctl_cccontainer IS INITIAL.
    CREATE OBJECT ctl_cccontainer
       EXPORTING  container_name = 'CCCONTAINER'.

    CREATE OBJECT ctl_alv_scarr
       EXPORTING i_parent = ctl_cccontainer.

    ctl_alv_scarr->set_table_for_first_display(
        CHANGING it_outtab = t_alv_out_table
                 it_fieldcatalog = fct_ma_mm_mk ).
  ENDIF.
ENDMODULE.                    "init_controls OUTPUT

*----------------------------------------------------------------------*
*  MODULE status_0100 OUTPUT
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'MAIN100'.
  SET TITLEBAR 'TITEL'.
ENDMODULE.                    "status_0100 OUTPUT

*----------------------------------------------------------------------*
*  MODULE handle_input INPUT
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
MODULE handle_input INPUT.
  IF ok_code = 'EXIT'.
    LEAVE PROGRAM.
  ENDIF.
  CLEAR ok_code.
ENDMODULE.                    "handle_input INPUT
fehlermeldung
siehe bild

Beitrag von kostonstyle (Specialist / 247 / 0 / 0 ) »
hallo miteinader
ich habe mal neues versucht

Code: Alles auswählen.

CALL METHOD grid1->set_table_for_first_display
      EXPORTING
        i_structure_name = 'mara'
      CHANGING
        it_outtab        = v_mara."gt_sflight.
diese alv grid nimmt struktur von mara, wie kann ich eigene struktur definieren?

gruss kostonstyle

Beitrag von cut1 (Specialist / 121 / 0 / 0 ) »
In dem du im Dictionary eine eigene Struktur anlegest und diese dann
anstatt 'MARA' angibst.

Beitrag von kostonstyle (Specialist / 247 / 0 / 0 ) »
so abap leutz
habe das programm nun fertig programmiert, vielen dank für eure mühe, dass ihr mich geholfen habt

Code: Alles auswählen.

PROGRAM zliefervolu.

*---------------------------------------------------------------------*
* Definition                                                          *
*---------------------------------------------------------------------*

TABLES: likp, "Vertriebsbeleg: Lieferung: Kopfdaten
        lips, "Vertriebsbeleg: Lieferung: Positionsdaten
        kna1, "Kundenstamm (allgemeiner Teil)
        marm. "Mengeneinheiten zum Material

DATA: ok_code LIKE sy-ucomm, "Bildschirmbilder, Funktionscode, der PAI ausgelöst hat
      i_volintern TYPE TABLE OF zvolumen WITH HEADER LINE INITIAL SIZE 0, "Interne Tabelle nur für Kurzspeicher
      i_volextern TYPE TABLE OF zvolumen, "Interne Tabelle für Datenspeicher
      v_volurech TYPE p DECIMALS 2, "Volumenberechnung
      v_lifmeng TYPE p DECIMALS 3, "Lieferungsmenge Total
      name_catolog TYPE lvc_t_fcat, "Ändern von Spaltenname
      l_field LIKE LINE OF name_catolog, "Kurzspeicher für Spaltenname
      g_container TYPE scrfname VALUE 'BCALV_GRID_CONTROL',
      grid1  TYPE REF TO cl_gui_alv_grid, "ALV Grid Definition
      g_custom_container TYPE REF TO cl_gui_custom_container.

SELECT-OPTIONS: s_vbeln FOR likp-vbeln OBLIGATORY, "Lieferung
                s_wadat FOR likp-wadat, "Geplantes Datum der Warenbewegung
                s_kunnr FOR likp-kunnr. "Warenempfänger
*---------------------------------------------------------------------*
* Main Program                                                        *
*---------------------------------------------------------------------*
START-OF-SELECTION.

  CLEAR: likp.
* Selektion Vertriebsbeleg: Lieferung: Kopfdaten
  SELECT * FROM likp WHERE kunnr IN s_kunnr
                     AND wadat IN s_wadat
                     AND vbeln IN s_vbeln
                     ORDER BY vbeln.

*   Vertriebsbeleg: Lieferung: Kopfdaten in interne Tabelle speichern
    MOVE-CORRESPONDING likp TO i_volintern.

    CLEAR: kna1.
*   Selektion Kundenstamm (allgemeiner Teil)
    SELECT SINGLE * FROM kna1 WHERE kunnr EQ likp-kunnr.

*   Selektion Kundenstamm (allgemeiner Teil) in interne Tabelle speichern
    MOVE-CORRESPONDING kna1 TO i_volintern.

    CLEAR: lips.
*   Selektion Vertriebsbeleg: Lieferung: Positionsdaten
    SELECT * FROM lips WHERE vbeln EQ likp-vbeln.

      CLEAR: marm.
*     Selektion Mengeneinheiten zum Material
      SELECT SINGLE * FROM marm WHERE matnr EQ lips-matnr
                                AND meinh EQ lips-vrkme.

      CLEAR: v_volurech.
*     Volumen = Zähler für die Umrechnung in Basismengeneinheiten * Tatsächlich gelieferte Menge in VME * Höhe
      v_volurech = lips-lfimg * marm-hoehe.
*     Volumentotal
      i_volintern-volutot = i_volintern-volutot + v_volurech.
*     Gesamte Liefermenge
      i_volintern-gelimf = i_volintern-gelimf + lips-lfimg.
    ENDSELECT.

    APPEND i_volintern TO i_volextern.

  ENDSELECT.
  CALL SCREEN 100.


END-OF-SELECTION.
*---------------------------------------------------------------------*
*       MODULE PBO OUTPUT                                             *
*---------------------------------------------------------------------*
MODULE pbo OUTPUT.
  SET PF-STATUS 'MAIN100'.

* Definition von Feldkatalog
  l_field-fieldname = 'GELIMF'.
  l_field-coltext = 'Gesamte Liefermenge'.
  APPEND l_field TO name_catolog.

  l_field-fieldname = 'VOLUTOT'.
  l_field-coltext = 'Volumen'.
  APPEND l_field TO name_catolog.

  IF g_custom_container IS INITIAL.
    CREATE OBJECT g_custom_container
           EXPORTING container_name = g_container.
    CREATE OBJECT grid1
           EXPORTING i_parent = g_custom_container.

*   ALV Methode aufruf für Ausgabe
    CALL METHOD grid1->set_table_for_first_display
      EXPORTING
        i_structure_name = 'ZVOLUMEN'
      CHANGING
        it_outtab        = i_volextern
        it_fieldcatalog  = name_catolog.
  ENDIF.
ENDMODULE.                    "PBO OUTPUT
*---------------------------------------------------------------------*
*       MODULE PAI INPUT                                              *
*---------------------------------------------------------------------*
MODULE pai INPUT.
*   to react on oi_custom_events:
  CALL METHOD cl_gui_cfw=>dispatch.
  CASE ok_code.
    WHEN 'EXIT'.
      PERFORM exit_program.
    WHEN OTHERS.
*     do nothing
  ENDCASE.
  CLEAR ok_code.
ENDMODULE.                    "PAI INPUT
*---------------------------------------------------------------------*
*       FORM EXIT_PROGRAM                                             *
*---------------------------------------------------------------------*
FORM exit_program.
*  CALL METHOD G_CUSTOM_CONTAINER->FREE.
*  CALL METHOD CL_GUI_CFW=>FLUSH.
  LEAVE PROGRAM.
ENDFORM.                    "EXIT_PROGRAM
gruss kostonstyle

Seite 1 von 1

Vergleichbare Themen

17
Antw.
13419
Views
SAPMV45A USEREXIT Itab Pos.Texte / Head Texte
von Luigi91 » 31.01.2014 09:31 • Verfasst in ABAP® für Anfänger
4
Antw.
5062
Views
ALV Grid Sortierung aktualisieren im grid 1 und grid 2
von c oco » 06.02.2012 10:09 • Verfasst in ABAP Objects®
1
Antw.
1957
Views
PS-Texte exportieren
von Orlando80 » 06.09.2006 17:59 • Verfasst in Financials
17
Antw.
10288
Views
Texte übertragen
von bohne » 12.05.2006 13:25 • Verfasst in ABAP® für Anfänger
4
Antw.
4492
Views
Texte aus Materialstamm
von Fredi » 02.05.2005 16:22 • Verfasst in ABAP® Core

Über diesen Beitrag


Unterstütze die Community und teile den Beitrag für mehr Leser und Austausch

Newsletter Anmeldung

Keine Beiträge verpassen! Wöchentlich versenden wir lesenwerte Beiträge aus unserer Community.
Die letzte Ausgabe findest du hier.
Details zum Versandverfahren und zu Ihren Widerrufsmöglichkeiten findest du in unserer Datenschutzerklärung.

Unbeantwortete Forenbeiträge

aRFC im OO-Kontext
vor 4 Wochen von ralf.wenzel 1 / 1540
Hilfe bei SWEC/SWE2
letzen Monat von retsch 1 / 8151