RUVIDEO
Поделитесь видео 🙏

SAP OpenSQL. Includes inline data declarations. Video 1.

This video explains basic SAP OpenSQL by reading records from a table in the SAP database, storing those records in an internal table and then displaying the contents.

I'm using data declarations for internal tables and type-definitions as well as the newer (ver 7.4 and above) inline declarations.

The code. Please note that the angle bracket (>) is not allowed in YouTube video descriptions. If you intend to copy this code then please substitute the > for the smaller keyboard version.

There are four programs here. I could have done it all with just one but that would have involved a lot of instructions about commenting and un-commenting lines.
_________________________________________________________________
Program One : Selecting all fields and using inline data
declarations.

REPORT z_basic_sql_a.

* Select all fields from MARA and drop the records
* into the internal table lt_mara

SELECT * " * = all fields
FROM mara
INTO TABLE @DATA(lt_mara) "Data declaration for the table
UP TO 10 ROWS.

* Display the records using the Factory method.

IF sy-subrc EQ 0.

DATA: gr_table TYPE REF TO cl_salv_table.

cl_salv_table=>factory( IMPORTING r_salv_table = gr_table
CHANGING t_table = lt_mara ).

gr_table->display( ).

ENDIF.
________________________________________________________________
Program TWO : Selecting specific specific fields and using inline
data declarations.


REPORT z_basic_sql_b.

* Select five fields from MARA and drop the records
* into the internal table lt_mara

SELECT
matnr, "material id
ersda, "date of creation
ernam, "user-profile
mtart, "material type
meins "base unit of measure
FROM mara
INTO TABLE @DATA(lt_mara) "Data declaration for the table
UP TO 10 ROWS. "Limit the selection to 10 rows

* Display the records using the Factory method.

IF sy-subrc EQ 0.

DATA: gr_table TYPE REF TO cl_salv_table.

cl_salv_table=>factory( IMPORTING r_salv_table = gr_table
CHANGING t_table = lt_mara ).

gr_table->display( ).

ENDIF.
_______________________________________________________________
Program THREE : Selecting all fields and using DATA declaration.

REPORT z_basic_sql_d.

* Declare the internal table.

DATA lt_mara TYPE STANDARD TABLE OF mara INITIAL SIZE 10.

* Select all fields from MARA and drop the records
* into the internal table lt_mara

SELECT * " * = all fields
FROM mara
INTO TABLE lt_mara " Already declared
UP TO 10 ROWS.

* Display the records using cl_demo

IF sy-subrc EQ 0.

cl_demo_output=>display( lt_mara ).

ENDIF.
________________________________________________________________
Program FOUR : Selecting specific specific fields and using TYPE
definition and DATA statement.

REPORT z_basic_sql_e.

* Define the TYPE

TYPES: BEGIN OF ty_mara,
matnr TYPE matnr,
ersda TYPE ersda,
ernam TYPE ernam,
mtart TYPE mtart,
meins TYPE meins,
END OF ty_mara.

* Declare the internal table

DATA lt_mara TYPE TABLE OF ty_mara.

* Select the fields

SELECT matnr ersda ernam mtart meins
FROM mara
INTO TABLE lt_mara
UP TO 10 ROWS.

* Display using cl_demo

IF sy-subrc EQ 0.

cl_demo_output=>display( lt_mara ).

ENDIF.

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «SAP OpenSQL. Includes inline data declarations. Video 1.», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.