ABAP Select data from SAP table VBAK into internal table



Get Example source ABAP code based on a different SAP table
  

Below is a number of ABAP code snippets to demonstrate how to select data from SAP VBAK table and store it within an internal table, including using the newer @DATA inline declaration methods. It also shows you various ways to process this data using ABAP work area, inline declaration or field symbols including executing all the relevant CONVERSION_EXIT routines specific to VBAK. See here for more generic Select statement tips.

Sometimes data within SAP is stored within the database table in a different format to what it is displayed to the user. These input/output conversation FM routines are what translates the data between the two formats.

There is also a full declaration of the VBAK table where each field has a char/string type for you to simply copy and paste. This allows you to use processing that is only available to these field types such as the CONCATENATE statement.

DATA: IT_VBAK TYPE STANDARD TABLE OF VBAK,
      WA_VBAK TYPE VBAK,
      GD_STR TYPE STRING.

DATA: lo_typedescr type REF TO cl_abap_typedescr.
DATA: lv_fieldname type fieldname.

FIELD-SYMBOLS: <FIELD> TYPE any.
FIELD-SYMBOLS: <VBAK> TYPE VBAK.

*Process all fields in table header/work area as string values
  PERFORM process_as_string_field_values CHANGING wa_VBAK.

SELECT *
*restrict ABAP select to first 10 rows
 UP TO 10 ROWS      
  FROM VBAK
  INTO TABLE IT_VBAK.

*Select data and declare internal table using in-line method @DATA
*SELECT *
*  FROM VBAK
*  INTO TABLE @DATA(IT_VBAK2).
*--Further methods of using ABAP code to  select data from SAP database tables

*You can also declare the header/work area using the in-line DATA declaration method
READ TABLE IT_VBAK INDEX 1 INTO DATA(WA_VBAK2).


*Demonstrate how to loop at an internal table and update values using a FIELD-SYMBOL
LOOP AT IT_VBAK ASSIGNING <VBAK>.
*To update a field value using a field symbol simply change the value via the field symbol pointer
<VBAK>-MANDT = 1.
<VBAK>-VBELN = 1.
<VBAK>-ERDAT = 1.
<VBAK>-ERZET = 1.
<VBAK>-ERNAM = 1.
ENDLOOP.

LOOP AT IT_VBAK INTO WA_VBAK.
*Write horizonal line to screen report.
  WRITE:/ sy-uline.

*Write selected data to screen/report before conversion.
  WRITE:/ sy-vline,   WA_VBAK-ANGDT, sy-vline,
WA_VBAK-BNDDT, sy-vline,
WA_VBAK-AUDAT, sy-vline,
WA_VBAK-VBTYP, sy-vline,
WA_VBAK-TRVOG, sy-vline,
WA_VBAK-AUART, sy-vline.
ENDLOOP. *Add any further fields from structure WA_VBAK you want to display... WRITE:/ sy-uline. * Aternatively use generic code to Write field values (and NAME) to screen report DO. ASSIGN COMPONENT sy-index OF STRUCTURE wa_VBAK TO <field>. IF sy-subrc <> 0. EXIT. ENDIF. WRITE:/ 'Field Value', <field>, sy-vline. gd_str = <field> . lo_typedescr ?= CL_ABAP_DATADESCR=>DESCRIBE_BY_DATA( <field> ). lv_fieldname = lo_typedescr->GET_RELATIVE_NAME( ). WRITE:/ 'Field Name', lv_fieldname. ENDDO. *Redo loop but convert all fields from internal to out value LOOP AT IT_VBAK INTO WA_VBAK. *Write horizonal line to screen report. WRITE:/ sy-uline. *Convert all fields to display/output versions using conversion routines PERFORM convert_all_field_values CHANGING wa_EKKO. ENDLOOP. *&---------------------------------------------------------------------* *& Form convert_all_field_values *&---------------------------------------------------------------------* FORM convert_all_field_values CHANGING p_EKKO LIKE wa_EKKO. DATA: ld_input(1000) TYPE c, ld_output(1000) TYPE C.

*Conversion exit ALPHA, internal->external for field VBELN CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT' EXPORTING input = WA_VBAK-VBELN IMPORTING output = ld_input.
WRITE:/ 'Org Value:', WA_VBAK-VBELN.
WRITE:/ 'New Value:', ld_input.

*Conversion exit AUART, internal->external for field AUART CALL FUNCTION 'CONVERSION_EXIT_AUART_OUTPUT' EXPORTING input = WA_VBAK-AUART IMPORTING output = ld_input.
WRITE:/ 'Org Value:', WA_VBAK-AUART.
WRITE:/ 'New Value:', ld_input.

*Conversion exit ALPHA, internal->external for field KUNNR CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT' EXPORTING input = WA_VBAK-KUNNR IMPORTING output = ld_input.
WRITE:/ 'Org Value:', WA_VBAK-KUNNR.
WRITE:/ 'New Value:', ld_input.

*Conversion exit ALPHA, internal->external for field KOSTL CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT' EXPORTING input = WA_VBAK-KOSTL IMPORTING output = ld_input.
WRITE:/ 'Org Value:', WA_VBAK-KOSTL.
WRITE:/ 'New Value:', ld_input.

*Conversion exit ALPHA, internal->external for field STAFO CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT' EXPORTING input = WA_VBAK-STAFO IMPORTING output = ld_input.
WRITE:/ 'Org Value:', WA_VBAK-STAFO.
WRITE:/ 'New Value:', ld_input.

*Conversion exit ALPHA, internal->external for field KNUMA CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT' EXPORTING input = WA_VBAK-KNUMA IMPORTING output = ld_input.
WRITE:/ 'Org Value:', WA_VBAK-KNUMA.
WRITE:/ 'New Value:', ld_input.

*Conversion exit KONPR, internal->external for field PS_PSP_PNR CALL FUNCTION 'CONVERSION_EXIT_KONPR_OUTPUT' EXPORTING input = WA_VBAK-PS_PSP_PNR IMPORTING output = ld_input.
WRITE:/ 'Org Value:', WA_VBAK-PS_PSP_PNR.
WRITE:/ 'New Value:', ld_input.

*Conversion exit ALPHA, internal->external for field KNKLI CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT' EXPORTING input = WA_VBAK-KNKLI IMPORTING output = ld_input.
WRITE:/ 'Org Value:', WA_VBAK-KNKLI.
WRITE:/ 'New Value:', ld_input.

*Conversion exit ALPHA, internal->external for field VGBEL CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT' EXPORTING input = WA_VBAK-VGBEL IMPORTING output = ld_input.
WRITE:/ 'Org Value:', WA_VBAK-VGBEL.
WRITE:/ 'New Value:', ld_input.

*Conversion exit ALPHA, internal->external for field AUFNR CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT' EXPORTING input = WA_VBAK-AUFNR IMPORTING output = ld_input.
WRITE:/ 'Org Value:', WA_VBAK-AUFNR.
WRITE:/ 'New Value:', ld_input.

*Conversion exit ALPHA, internal->external for field QMNUM CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT' EXPORTING input = WA_VBAK-QMNUM IMPORTING output = ld_input.
WRITE:/ 'Org Value:', WA_VBAK-QMNUM.
WRITE:/ 'New Value:', ld_input.

*Conversion exit ALPHA, internal->external for field VBELN_GRP CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT' EXPORTING input = WA_VBAK-VBELN_GRP IMPORTING output = ld_input.
WRITE:/ 'Org Value:', WA_VBAK-VBELN_GRP.
WRITE:/ 'New Value:', ld_input.

*Conversion exit ALPHA, internal->external for field MSR_ID CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT' EXPORTING input = WA_VBAK-MSR_ID IMPORTING output = ld_input.
WRITE:/ 'Org Value:', WA_VBAK-MSR_ID.
WRITE:/ 'New Value:', ld_input.

*Conversion exit ALPHA, internal->external for field HANDOVERLOC CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT' EXPORTING input = WA_VBAK-HANDOVERLOC IMPORTING output = ld_input.
WRITE:/ 'Org Value:', WA_VBAK-HANDOVERLOC.
WRITE:/ 'New Value:', ld_input.

*Conversion exit ALPHA, internal->external for field AD01BASDOC CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT' EXPORTING input = WA_VBAK-AD01BASDOC IMPORTING output = ld_input.
WRITE:/ 'Org Value:', WA_VBAK-AD01BASDOC.
WRITE:/ 'New Value:', ld_input.

*Conversion exit SWENR, internal->external for field SWENR CALL FUNCTION 'CONVERSION_EXIT_SWENR_OUTPUT' EXPORTING input = WA_VBAK-SWENR IMPORTING output = ld_input.
WRITE:/ 'Org Value:', WA_VBAK-SWENR.
WRITE:/ 'New Value:', ld_input.

*Conversion exit SMENR, internal->external for field SMENR CALL FUNCTION 'CONVERSION_EXIT_SMENR_OUTPUT' EXPORTING input = WA_VBAK-SMENR IMPORTING output = ld_input.
WRITE:/ 'Org Value:', WA_VBAK-SMENR.
WRITE:/ 'New Value:', ld_input.

*Conversion exit ALPHA, internal->external for field BPN CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT' EXPORTING input = WA_VBAK-BPN IMPORTING output = ld_input.
WRITE:/ 'Org Value:', WA_VBAK-BPN.
WRITE:/ 'New Value:', ld_input.

*Conversion exit ALPHA, internal->external for field LOGSYSB CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT' EXPORTING input = WA_VBAK-LOGSYSB IMPORTING output = ld_input.
WRITE:/ 'Org Value:', WA_VBAK-LOGSYSB.
WRITE:/ 'New Value:', ld_input.
ENDFORM. *&---------------------------------------------------------------------* *& Form process_as_string_field_values *&---------------------------------------------------------------------* FORM process_as_string_field_values CHANGING p_EKKO LIKE wa_EKKO. TYPES: BEGIN OF T_VBAK_STR,
MANDT TYPE STRING,
VBELN TYPE STRING,
ERDAT TYPE STRING,
ERZET TYPE STRING,
ERNAM TYPE STRING,
ANGDT TYPE STRING,
BNDDT TYPE STRING,
AUDAT TYPE STRING,
VBTYP TYPE STRING,
TRVOG TYPE STRING,
AUART TYPE STRING,
AUGRU TYPE STRING,
GWLDT TYPE STRING,
SUBMI TYPE STRING,
LIFSK TYPE STRING,
FAKSK TYPE STRING,
NETWR TYPE STRING,
WAERK TYPE STRING,
VKORG TYPE STRING,
VTWEG TYPE STRING,
SPART TYPE STRING,
VKGRP TYPE STRING,
VKBUR TYPE STRING,
GSBER TYPE STRING,
GSKST TYPE STRING,
GUEBG TYPE STRING,
GUEEN TYPE STRING,
KNUMV TYPE STRING,
VDATU TYPE STRING,
VPRGR TYPE STRING,
AUTLF TYPE STRING,
VBKLA TYPE STRING,
VBKLT TYPE STRING,
KALSM TYPE STRING,
VSBED TYPE STRING,
FKARA TYPE STRING,
AWAHR TYPE STRING,
KTEXT TYPE STRING,
BSTNK TYPE STRING,
BSARK TYPE STRING,
BSTDK TYPE STRING,
BSTZD TYPE STRING,
IHREZ TYPE STRING,
BNAME TYPE STRING,
TELF1 TYPE STRING,
MAHZA TYPE STRING,
MAHDT TYPE STRING,
KUNNR TYPE STRING,
KOSTL TYPE STRING,
STAFO TYPE STRING,
STWAE TYPE STRING,
AEDAT TYPE STRING,
KVGR1 TYPE STRING,
KVGR2 TYPE STRING,
KVGR3 TYPE STRING,
KVGR4 TYPE STRING,
KVGR5 TYPE STRING,
KNUMA TYPE STRING,
KOKRS TYPE STRING,
PS_PSP_PNR TYPE STRING,
KURST TYPE STRING,
KKBER TYPE STRING,
KNKLI TYPE STRING,
GRUPP TYPE STRING,
SBGRP TYPE STRING,
CTLPC TYPE STRING,
CMWAE TYPE STRING,
CMFRE TYPE STRING,
CMNUP TYPE STRING,
CMNGV TYPE STRING,
AMTBL TYPE STRING,
HITYP_PR TYPE STRING,
ABRVW TYPE STRING,
ABDIS TYPE STRING,
VGBEL TYPE STRING,
OBJNR TYPE STRING,
BUKRS_VF TYPE STRING,
TAXK1 TYPE STRING,
TAXK2 TYPE STRING,
TAXK3 TYPE STRING,
TAXK4 TYPE STRING,
TAXK5 TYPE STRING,
TAXK6 TYPE STRING,
TAXK7 TYPE STRING,
TAXK8 TYPE STRING,
TAXK9 TYPE STRING,
XBLNR TYPE STRING,
VGTYP TYPE STRING,
KALSM_CH TYPE STRING,
AGRZR TYPE STRING,
AUFNR TYPE STRING,
QMNUM TYPE STRING,
VBELN_GRP TYPE STRING,
SCHEME_GRP TYPE STRING,
ABRUF_PART TYPE STRING,
ABHOD TYPE STRING,
ABHOV TYPE STRING,
ABHOB TYPE STRING,
RPLNR TYPE STRING,
VZEIT TYPE STRING,
STCEG_L TYPE STRING,
LANDTX TYPE STRING,
XEGDR TYPE STRING,
ENQUEUE_GRP TYPE STRING,
DAT_FZAU TYPE STRING,
FMBDAT TYPE STRING,
VSNMR_V TYPE STRING,
HANDLE TYPE STRING,
PROLI TYPE STRING,
CONT_DG TYPE STRING,
CRM_GUID TYPE STRING,
UPD_TMSTMP TYPE STRING,
MSR_ID TYPE STRING,
TM_CTRL_KEY TYPE STRING,
HANDOVERLOC TYPE STRING,
FPART TYPE STRING,
VCLASSIFIC TYPE STRING,
/XLSO/SO_VALD_FM TYPE STRING,
/XLSO/SO_VALD_TO TYPE STRING,
/XLSO/PAYMENT_OP TYPE STRING,
/XLSO/TRANS_CTXT TYPE STRING,
/XLSO/CATALOG_ID TYPE STRING,
/XLSO/VARIANT_ID TYPE STRING,
AD01FAREG TYPE STRING,
AD01BASDOC TYPE STRING,
LASTVCHR TYPE STRING,
PLC TYPE STRING,
SMB TYPE STRING,
ECC TYPE STRING,
IPP TYPE STRING,
CUR TYPE STRING,
ECO TYPE STRING,
PCO TYPE STRING,
DPT TYPE STRING,
TOP TYPE STRING,
SUS TYPE STRING,
PCN TYPE STRING,
TRU TYPE STRING,
PCY TYPE STRING,
PCD TYPE STRING,
PBN TYPE STRING,
AMN TYPE STRING,
DNO TYPE STRING,
PSM_BUDAT TYPE STRING,
SWENR TYPE STRING,
SMENR TYPE STRING,
PHASE TYPE STRING,
MTLAUR TYPE STRING,
STAGE TYPE STRING,
HB_CONT_REASON TYPE STRING,
HB_EXPDATE TYPE STRING,
HB_RESDATE TYPE STRING,
J_3GKBAUL TYPE STRING,
MILL_APPL_ID TYPE STRING,
TAS TYPE STRING,
BETC TYPE STRING,
MOD_ALLOW TYPE STRING,
CANCEL_ALLOW TYPE STRING,
PAY_METHOD TYPE STRING,
BPN TYPE STRING,
REP_FREQ TYPE STRING,
LOGSYSB TYPE STRING,
KALCD TYPE STRING,
MULTI TYPE STRING,
SPPAYM TYPE STRING,
WTYSC_CLM_HDR TYPE STRING,END OF T_EKKO_STR. DATA: WA_VBAK_STR type T_EKKO_STR. DATA: ld_text TYPE string. LOOP AT IT_EKKO INTO WA_EKKO. MOVE-CORRESPONDING wa_EKKO TO WA_EKKO_STR. CONCATENATE: sy-vline
WA_VBAK_STR-MANDT sy-vline
WA_VBAK_STR-VBELN sy-vline
WA_VBAK_STR-ERDAT sy-vline
WA_VBAK_STR-ERZET sy-vline
WA_VBAK_STR-ERNAM sy-vline
WA_VBAK_STR-ANGDT sy-vline
WA_VBAK_STR-BNDDT sy-vline
WA_VBAK_STR-AUDAT sy-vline
WA_VBAK_STR-VBTYP sy-vline
WA_VBAK_STR-TRVOG sy-vline
WA_VBAK_STR-AUART sy-vline
WA_VBAK_STR-AUGRU sy-vline
WA_VBAK_STR-GWLDT sy-vline
WA_VBAK_STR-SUBMI sy-vline
WA_VBAK_STR-LIFSK sy-vline
WA_VBAK_STR-FAKSK sy-vline
WA_VBAK_STR-NETWR sy-vline
WA_VBAK_STR-WAERK sy-vline
WA_VBAK_STR-VKORG sy-vline
WA_VBAK_STR-VTWEG sy-vline
WA_VBAK_STR-SPART sy-vline
WA_VBAK_STR-VKGRP sy-vline
WA_VBAK_STR-VKBUR sy-vline
WA_VBAK_STR-GSBER sy-vline
WA_VBAK_STR-GSKST sy-vline
WA_VBAK_STR-GUEBG sy-vline
WA_VBAK_STR-GUEEN sy-vline
WA_VBAK_STR-KNUMV sy-vline
WA_VBAK_STR-VDATU sy-vline
WA_VBAK_STR-VPRGR sy-vline
WA_VBAK_STR-AUTLF sy-vline
WA_VBAK_STR-VBKLA sy-vline
WA_VBAK_STR-VBKLT sy-vline
WA_VBAK_STR-KALSM sy-vline
WA_VBAK_STR-VSBED sy-vline
WA_VBAK_STR-FKARA sy-vline
WA_VBAK_STR-AWAHR sy-vline
WA_VBAK_STR-KTEXT sy-vline
WA_VBAK_STR-BSTNK sy-vline
WA_VBAK_STR-BSARK sy-vline
WA_VBAK_STR-BSTDK sy-vline
WA_VBAK_STR-BSTZD sy-vline
WA_VBAK_STR-IHREZ sy-vline
WA_VBAK_STR-BNAME sy-vline
WA_VBAK_STR-TELF1 sy-vline
WA_VBAK_STR-MAHZA sy-vline
WA_VBAK_STR-MAHDT sy-vline
WA_VBAK_STR-KUNNR sy-vline
WA_VBAK_STR-KOSTL sy-vline
WA_VBAK_STR-STAFO sy-vline
WA_VBAK_STR-STWAE sy-vline
WA_VBAK_STR-AEDAT sy-vline
WA_VBAK_STR-KVGR1 sy-vline
WA_VBAK_STR-KVGR2 sy-vline
WA_VBAK_STR-KVGR3 sy-vline
WA_VBAK_STR-KVGR4 sy-vline
WA_VBAK_STR-KVGR5 sy-vline
WA_VBAK_STR-KNUMA sy-vline
WA_VBAK_STR-KOKRS sy-vline
WA_VBAK_STR-PS_PSP_PNR sy-vline
WA_VBAK_STR-KURST sy-vline
WA_VBAK_STR-KKBER sy-vline
WA_VBAK_STR-KNKLI sy-vline
WA_VBAK_STR-GRUPP sy-vline
WA_VBAK_STR-SBGRP sy-vline
WA_VBAK_STR-CTLPC sy-vline
WA_VBAK_STR-CMWAE sy-vline
WA_VBAK_STR-CMFRE sy-vline
WA_VBAK_STR-CMNUP sy-vline
WA_VBAK_STR-CMNGV sy-vline
WA_VBAK_STR-AMTBL sy-vline
WA_VBAK_STR-HITYP_PR sy-vline
WA_VBAK_STR-ABRVW sy-vline
WA_VBAK_STR-ABDIS sy-vline
WA_VBAK_STR-VGBEL sy-vline
WA_VBAK_STR-OBJNR sy-vline
WA_VBAK_STR-BUKRS_VF sy-vline
WA_VBAK_STR-TAXK1 sy-vline
WA_VBAK_STR-TAXK2 sy-vline
WA_VBAK_STR-TAXK3 sy-vline
WA_VBAK_STR-TAXK4 sy-vline
WA_VBAK_STR-TAXK5 sy-vline
WA_VBAK_STR-TAXK6 sy-vline
WA_VBAK_STR-TAXK7 sy-vline
WA_VBAK_STR-TAXK8 sy-vline
WA_VBAK_STR-TAXK9 sy-vline
WA_VBAK_STR-XBLNR sy-vline
WA_VBAK_STR-VGTYP sy-vline
WA_VBAK_STR-KALSM_CH sy-vline
WA_VBAK_STR-AGRZR sy-vline
WA_VBAK_STR-AUFNR sy-vline
WA_VBAK_STR-QMNUM sy-vline
WA_VBAK_STR-VBELN_GRP sy-vline
WA_VBAK_STR-SCHEME_GRP sy-vline
WA_VBAK_STR-ABRUF_PART sy-vline
WA_VBAK_STR-ABHOD sy-vline
WA_VBAK_STR-ABHOV sy-vline
WA_VBAK_STR-ABHOB sy-vline
WA_VBAK_STR-RPLNR sy-vline
WA_VBAK_STR-VZEIT sy-vline
WA_VBAK_STR-STCEG_L sy-vline
WA_VBAK_STR-LANDTX sy-vline
WA_VBAK_STR-XEGDR sy-vline
WA_VBAK_STR-ENQUEUE_GRP sy-vline
WA_VBAK_STR-DAT_FZAU sy-vline
WA_VBAK_STR-FMBDAT sy-vline
WA_VBAK_STR-VSNMR_V sy-vline
WA_VBAK_STR-HANDLE sy-vline
WA_VBAK_STR-PROLI sy-vline
WA_VBAK_STR-CONT_DG sy-vline
WA_VBAK_STR-CRM_GUID sy-vline
WA_VBAK_STR-UPD_TMSTMP sy-vline
WA_VBAK_STR-MSR_ID sy-vline
WA_VBAK_STR-TM_CTRL_KEY sy-vline
WA_VBAK_STR-HANDOVERLOC sy-vline
WA_VBAK_STR-FPART sy-vline
WA_VBAK_STR-VCLASSIFIC sy-vline
WA_VBAK_STR-/XLSO/SO_VALD_FM sy-vline
WA_VBAK_STR-/XLSO/SO_VALD_TO sy-vline
WA_VBAK_STR-/XLSO/PAYMENT_OP sy-vline
WA_VBAK_STR-/XLSO/TRANS_CTXT sy-vline
WA_VBAK_STR-/XLSO/CATALOG_ID sy-vline
WA_VBAK_STR-/XLSO/VARIANT_ID sy-vline
WA_VBAK_STR-AD01FAREG sy-vline
WA_VBAK_STR-AD01BASDOC sy-vline
WA_VBAK_STR-LASTVCHR sy-vline
WA_VBAK_STR-PLC sy-vline
WA_VBAK_STR-SMB sy-vline
WA_VBAK_STR-ECC sy-vline
WA_VBAK_STR-IPP sy-vline
WA_VBAK_STR-CUR sy-vline
WA_VBAK_STR-ECO sy-vline
WA_VBAK_STR-PCO sy-vline
WA_VBAK_STR-DPT sy-vline
WA_VBAK_STR-TOP sy-vline
WA_VBAK_STR-SUS sy-vline
WA_VBAK_STR-PCN sy-vline
WA_VBAK_STR-TRU sy-vline
WA_VBAK_STR-PCY sy-vline
WA_VBAK_STR-PCD sy-vline
WA_VBAK_STR-PBN sy-vline
WA_VBAK_STR-AMN sy-vline
WA_VBAK_STR-DNO sy-vline
WA_VBAK_STR-PSM_BUDAT sy-vline
WA_VBAK_STR-SWENR sy-vline
WA_VBAK_STR-SMENR sy-vline
WA_VBAK_STR-PHASE sy-vline
WA_VBAK_STR-MTLAUR sy-vline
WA_VBAK_STR-STAGE sy-vline
WA_VBAK_STR-HB_CONT_REASON sy-vline
WA_VBAK_STR-HB_EXPDATE sy-vline
WA_VBAK_STR-HB_RESDATE sy-vline
WA_VBAK_STR-J_3GKBAUL sy-vline
WA_VBAK_STR-MILL_APPL_ID sy-vline
WA_VBAK_STR-TAS sy-vline
WA_VBAK_STR-BETC sy-vline
WA_VBAK_STR-MOD_ALLOW sy-vline
WA_VBAK_STR-CANCEL_ALLOW sy-vline
WA_VBAK_STR-PAY_METHOD sy-vline
WA_VBAK_STR-BPN sy-vline
WA_VBAK_STR-REP_FREQ sy-vline
WA_VBAK_STR-LOGSYSB sy-vline
WA_VBAK_STR-KALCD sy-vline
WA_VBAK_STR-MULTI sy-vline
WA_VBAK_STR-SPPAYM sy-vline
WA_VBAK_STR-WTYSC_CLM_HDR sy-vline INTO ld_text SEPARATED BY SPACE. *Add any further fields from structure WA_EKKO_STR you want to CONCATENATE... ENDLOOP. ENDFORM.