ABAP Select data from SAP table /SAPAPO/POV_EVAL_OUTPUT_STR 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 /SAPAPO/POV_EVAL_OUTPUT_STR 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 /SAPAPO/POV_EVAL_OUTPUT_STR. 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 /SAPAPO/POV_EVAL_OUTPUT_STR 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_/SAPAPO/POV_EVAL_OUTPUT_STR TYPE STANDARD TABLE OF /SAPAPO/POV_EVAL_OUTPUT_STR, WA_/SAPAPO/POV_EVAL_OUTPUT_STR TYPE /SAPAPO/POV_EVAL_OUTPUT_STR, 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: </SAPAPO/POV_EVAL_OUTPUT_STR> TYPE /SAPAPO/POV_EVAL_OUTPUT_STR. *Process all fields in table header/work area as string values PERFORM process_as_string_field_values CHANGING wa_/SAPAPO/POV_EVAL_OUTPUT_STR. SELECT * *restrict ABAP select to first 10 rows UP TO 10 ROWS FROM /SAPAPO/POV_EVAL_OUTPUT_STR INTO TABLE IT_/SAPAPO/POV_EVAL_OUTPUT_STR. *Select data and declare internal table using in-line method @DATA *SELECT * * FROM /SAPAPO/POV_EVAL_OUTPUT_STR * INTO TABLE @DATA(IT_/SAPAPO/POV_EVAL_OUTPUT_STR2). *--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_/SAPAPO/POV_EVAL_OUTPUT_STR INDEX 1 INTO DATA(WA_/SAPAPO/POV_EVAL_OUTPUT_STR2). *Demonstrate how to loop at an internal table and update values using a FIELD-SYMBOL LOOP AT IT_/SAPAPO/POV_EVAL_OUTPUT_STR ASSIGNING </SAPAPO/POV_EVAL_OUTPUT_STR>.*To update a field value using a field symbol simply change the value via the field symbol pointer
</SAPAPO/POV_EVAL_OUTPUT_STR>-PCLASS_IC = 1.
</SAPAPO/POV_EVAL_OUTPUT_STR>-SSEXT = 1.
</SAPAPO/POV_EVAL_OUTPUT_STR>-RRP_SEL_GROUP = 1.
</SAPAPO/POV_EVAL_OUTPUT_STR>-DISST = 1.
</SAPAPO/POV_EVAL_OUTPUT_STR>-NETCH_RRP = 1.
ENDLOOP. LOOP AT IT_/SAPAPO/POV_EVAL_OUTPUT_STR INTO WA_/SAPAPO/POV_EVAL_OUTPUT_STR. *Write horizonal line to screen report. WRITE:/ sy-uline. *Write selected data to screen/report before conversion. WRITE:/ sy-vline, WA_/SAPAPO/POV_EVAL_OUTPUT_STR-PACKAGE_ID, sy-vline,
WA_/SAPAPO/POV_EVAL_OUTPUT_STR-PROD_HEUR_ID, sy-vline,
WA_/SAPAPO/POV_EVAL_OUTPUT_STR-PART_OF_PACKAGE, sy-vline,
WA_/SAPAPO/POV_EVAL_OUTPUT_STR-MARK_USER, sy-vline,
WA_/SAPAPO/POV_EVAL_OUTPUT_STR-MARK_DATE, sy-vline,
WA_/SAPAPO/POV_EVAL_OUTPUT_STR-MARK_DATUM, sy-vline.
ENDLOOP. *Add any further fields from structure WA_/SAPAPO/POV_EVAL_OUTPUT_STR 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_/SAPAPO/POV_EVAL_OUTPUT_STR 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_/SAPAPO/POV_EVAL_OUTPUT_STR INTO WA_/SAPAPO/POV_EVAL_OUTPUT_STR. *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.
ENDFORM. *&---------------------------------------------------------------------* *& Form process_as_string_field_values *&---------------------------------------------------------------------* FORM process_as_string_field_values CHANGING p_EKKO LIKE wa_EKKO. TYPES: BEGIN OF T_/SAPAPO/POV_EVAL_OUTPUT_STR_STR,
PCLASS_IC TYPE STRING,
SSEXT TYPE STRING,
RRP_SEL_GROUP TYPE STRING,
DISST TYPE STRING,
NETCH_RRP TYPE STRING,
PACKAGE_ID TYPE STRING,
PROD_HEUR_ID TYPE STRING,
PART_OF_PACKAGE TYPE STRING,
MARK_USER TYPE STRING,
MARK_DATE TYPE STRING,
MARK_DATUM TYPE STRING,
MARK_TIME TYPE STRING,
PLAN_USER TYPE STRING,
PLAN_DATE TYPE STRING,
PLAN_DATUM TYPE STRING,
PLAN_TIME TYPE STRING,
BATCH TYPE STRING,
LOGNUMBER TYPE STRING,
PROBCLASS TYPE STRING,
EXGRP TYPE STRING,
HEUR_ID TYPE STRING,
HEUR_TEXT TYPE STRING,
NETCH TYPE STRING,
RUN_TIME TYPE STRING,
ORD_GOOD TYPE STRING,
ORD_LATE TYPE STRING,
ORD_MISSING TYPE STRING,
ORD_OUT TYPE STRING,
ORD_REUSED TYPE STRING,
ORD_DELETED TYPE STRING,
ORD_REEXPLODE TYPE STRING,
ORD_REEX_FAIL TYPE STRING,
PEG_FILE TYPE STRING,
ERRMSG TYPE STRING,END OF T_EKKO_STR. DATA: WA_/SAPAPO/POV_EVAL_OUTPUT_STR_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_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-PCLASS_IC sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-SSEXT sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-RRP_SEL_GROUP sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-DISST sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-NETCH_RRP sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-PACKAGE_ID sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-PROD_HEUR_ID sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-PART_OF_PACKAGE sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-MARK_USER sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-MARK_DATE sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-MARK_DATUM sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-MARK_TIME sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-PLAN_USER sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-PLAN_DATE sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-PLAN_DATUM sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-PLAN_TIME sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-BATCH sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-LOGNUMBER sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-PROBCLASS sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-EXGRP sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-HEUR_ID sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-HEUR_TEXT sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-NETCH sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-RUN_TIME sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-ORD_GOOD sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-ORD_LATE sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-ORD_MISSING sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-ORD_OUT sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-ORD_REUSED sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-ORD_DELETED sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-ORD_REEXPLODE sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-ORD_REEX_FAIL sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-PEG_FILE sy-vline
WA_/SAPAPO/POV_EVAL_OUTPUT_STR_STR-ERRMSG sy-vline INTO ld_text SEPARATED BY SPACE. *Add any further fields from structure WA_EKKO_STR you want to CONCATENATE... ENDLOOP. ENDFORM.