Konvertierung Spalten- in Zeilenformat: Unterschied zwischen den Versionen

Aus SAP Wiki ツ
(Die Seite wurde neu angelegt: „Kategorie:Codeschnipsel Beispiel 1: LOOP AT columns ASSIGNING FIELD-SYMBOL(<columns_fieldsymb>). ASSIGN COMPONENT sy-tabix OF STRUCTURE…“)
 
 
Zeile 2: Zeile 2:


Beispiel 1:
Beispiel 1:
 
<syntaxhighlight lang="abap" line start="1">
       LOOP AT columns ASSIGNING FIELD-SYMBOL(<columns_fieldsymb>).
       LOOP AT columns ASSIGNING FIELD-SYMBOL(<columns_fieldsymb>).
         ASSIGN COMPONENT sy-tabix OF STRUCTURE struc_from_itab TO FIELD-SYMBOL(<struc_fieldsymb>).
         ASSIGN COMPONENT sy-tabix OF STRUCTURE struc_from_itab TO FIELD-SYMBOL(<struc_fieldsymb>).
Zeile 10: Zeile 10:
       ENDLOOP.
       ENDLOOP.
       APPEND struc_from_itab TO itab_data.
       APPEND struc_from_itab TO itab_data.
 
</syntaxhighlight>
Beispiel 2:
Beispiel 2:
 
<syntaxhighlight lang="abap" line start="1">
  LOOP AT it_splitted_data_colums ASSIGNING FIELD-SYMBOL(<splitted_data>).
  LOOP AT it_splitted_data_colums ASSIGNING FIELD-SYMBOL(<splitted_data>).
     ASSIGN COMPONENT sy-tabix OF STRUCTURE <structure> TO FIELD-SYMBOL(<field>).
     ASSIGN COMPONENT sy-tabix OF STRUCTURE <structure> TO FIELD-SYMBOL(<field>).
Zeile 23: Zeile 23:
     ENDIF.
     ENDIF.
   ENDLOOP.
   ENDLOOP.
</syntaxhighlight>

Aktuelle Version vom 12. August 2021, 08:03 Uhr


Beispiel 1:

      LOOP AT columns ASSIGNING FIELD-SYMBOL(<columns_fieldsymb>).
        ASSIGN COMPONENT sy-tabix OF STRUCTURE struc_from_itab TO FIELD-SYMBOL(<struc_fieldsymb>).
        IF sy-subrc = 0.
          <struc_fieldsymb> = <columns_fieldsymb>-name.
        ENDIF.
      ENDLOOP.
      APPEND struc_from_itab TO itab_data.

Beispiel 2:

 LOOP AT it_splitted_data_colums ASSIGNING FIELD-SYMBOL(<splitted_data>).
    ASSIGN COMPONENT sy-tabix OF STRUCTURE <structure> TO FIELD-SYMBOL(<field>).
    IF sy-subrc = 0.
      <field> = <splitted_data>.
    ELSE.
      error_occurs = abap_true.
      MESSAGE e018(zbc_if_idoc) WITH sy-tabix str_name iv_filename iv_row_in_file INTO DATA(msg).
      zcl_bc_application_log=>add_sy_msg_to_bal_msg_tab( CHANGING xt_bal_msg = xt_log ).
    ENDIF.
  ENDLOOP.