ABAP TIP EXPORT IMPORT database table(INDX) data

http://abapjoy.blogspot.mx/2015/02/abap-tip-export-import-database.html

EXPORT IMPORT database table(INDX) data

Source : http://abapjoy.blogspot.com

It’s possible to transfer data to other program with EXPORT / IMPORT statement.

EXPORT / IMPORT can handle 3 types of data, which are ABAP memory, shared buffer area, database table.

In this chapter, let’s see how to handle database data with EXPORT / IMPORT.

This method is to save data into INDX table and read data from INDX table, which is very similar to the way we save the data into transparent table.

The below statement describes how to save the data of internal table into INDX table. You can declare the index name freely, which is the area in the table and Key value.

  1. Export data
EXPORT GT_ITAB TO DATABASE INDX(ZK) ID ‘EABAP’.

You can read the data from INDX table and save the data into internal table

  1. Import data
IMPORT gt_itab FROM DATABASE INDX(ZK) ID ‘EABAP’

If the data is transferred to another program, you need to remove unwanted data from INDX table using the delete statement.

  1. Delete data
DELETE FROM DATABASE INDX(ZK)  ID  ‘EABAP’.

Let’s create 2 programs and check how to transfer data between programs.

 [ex 1]

REPORT  ZEXPORT_01.

TABLES INDX.

DATA GT_ITAB TYPE TABLE OF SFLIGHT.
DATA REPORT TYPE SY-REPID.

SELECT * FROM SFLIGHT INTO TABLE GT_ITAB UP TO 5 ROWS.

EXPORT GT_ITAB TO DATABASE INDX(ZK) ID ‘EABAP’.

REPORT = ‘ZIMPORT_01’ .

SUBMIT (REPORT)
AND RETURN.

After execution program 1, the blow data is created in INDX table. If the data volume exceeds the column capacity, the new line is created and the SRTF2 column sequence is increased sequentially.

Now, let’s read the data from INDX table with [ex 2]. As you already know, all sap user can access and use the data in INDX table. So after import data and the data is not needed anymore, you need to delete INDX data.

[ex 2]

REPORT  ZIMPORT_01.

TABLES INDX.

DATA gt_itab TYPE TABLE OF SFLIGHT.
DATA WA LIKE LINE OF gt_itab.

IMPORT gt_itab FROM DATABASE INDX(ZK) ID ‘EABAP’
.

DELETE FROM DATABASE INDX(ZK)  ID  ‘EABAP’.

LOOP AT gt_itab INTO WA.
WRITE WA-CARRID.
ENDLOOP.

 

 

Anuncios

El intervalo 41 no existe para el objeto RF_BELEG 1001 FBN1

El intervalo 41 no existe para el objeto RF_BELEG 1001 FBN1

Nº mensaje: NR751

Diagnóstico

La tabla de base de datos NRIV posee la clase de suministro “C”, es decir, la parametrización previa proporcionada por SAP se encuentra exclusivamente en el mandante 000.

Procedimiento

Cree mediante Customizing el intervalo del rango de números que falta.

Código de transacción: FBN1.

ABAP – Refresh

Refresh sentencia ABAP que se utiliza para inicializar el contenido de una tabla interna.

La sintaxis de la sentencia REFRESH es la siguiente:

REFRESH <tabla_interna>.

En ocasiones se suele confundir las sentencia CLEAR y REFRESH. Es importante tener en cuenta que utilizamos CLEAR para inicializar variables y estructuras, a diferencia de REFRESH el cual es exclusivo para tablas internas.

Es considerada una muy buena práctica de programación borrar el contenido de una tabla interna antes de utilizarla.

Fuente: http://www.cvosoft.com/glosario-sap/sap/refresh-228.html

Concatenate ABAP SAP

DATA: c1(10) TYPE c VALUE ‘sa’,
c2(3) TYPE c VALUE ‘ca’,
c3(5) TYPE c VALUE ‘cor’,
c4(10) TYPE c VALUE ‘cho’,
c5(30) TYPE c,
sep(3) TYPE c VALUE ‘ – ‘.
CONCATENATE c1 c2 c3 c4 INTO c5.
WRITE c5.
CONCATENATE c1 c2 c3 c4 INTO c5 SEPARATED BY sep.
WRITE / c5.

Fuente:  http://sap60.blogspot.mx/2011/07/funciones-utiles-para-cadenas.html