MUNDOSAP

Regresar   MUNDOSAP > DESARROLLO > Programación ABAP IV
Nombre de Usuario
Contraseña
Home Descargas Registrar FAQ Miembros Calendario Buscar Temas de Hoy Marcar Foros Como Leídos




 
Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Viejo 02/06/13, 22:48:30
funkeeiads funkeeiads is offline
Member
 
Fecha de Ingreso: mar 2013
Localización: Chile
Mensajes: 47
Post Duda con inserción a itab

Hola a todos, tengo una consulta que no me deja tranquilo.

Codigo de ejemplo:
DATA : it_test TYPE STANDARD TABLE OF ty_test WITH HEADER LINE INITIAL SIZE 10.

DATA : wa TYPE ty_test.


it_test-code = 300.
it_test-name = 'Ramesh'.
it_test-amount = 5500.
APPEND it_test.

*acá se puede asignar directamente.

wa-code = 207.
wa-name = 'Prem'.
wa-amount = 5000.
APPEND wa TO it_test.

*aca se usó un workarea.

it_test-code = 117.
it_test-name = 'James Bond'.
it_test-amount = 9900.
INSERT it_test INDEX 3.

* acá con INSERT e INDEX 3.

PreguntaS:
Cuando se usa un workarea para la asignacion de valores?
Cuando se usa el INSERT, y que quiere decir INDEX 3?

Saludos
Responder Con Cita
  #2  
Viejo 02/06/13, 23:20:47
Mauricio Hidalgo Mauricio Hidalgo is offline
Senior Member
 
Fecha de Ingreso: may 2006
Localización: Santiago, Chile
Mensajes: 481
Respuesta 1: Una work área se usa cuando quieres independizar el área de entrada de datos de tu tabla interna, esta técnica de trabajo es obligatoria en un entorno OO. Fuera de OO puedes usar el área explicita (WA) o implícita (línea de cabecera de tu tabla interna) indistintamente.

Respuesta 2: La inserción se hace explícitamente en la fila 3 de la tabla interna. Tipicamente esto se usa cuando quieres insertar nuevos datos entre registros existentes.

Saludos
Responder Con Cita
  #3  
Viejo 06/06/13, 11:49:05
manu_lolo27 manu_lolo27 is offline
Member
 
Fecha de Ingreso: mar 2008
Localización: Madrid -España
Mensajes: 90
Hola,

Los INSERT NUNCA se usan para una tabla interna, en todo caso, tendrias q poner APPEND it_test index 3. PERO NO ENTIENDO para que quieres esto, solo con un APPEND valdria.

Explicanos mas que es lo q quieres hacer
saludo
Manuel H.
Responder Con Cita
  #4  
Viejo 07/06/13, 01:19:46
funkeeiads funkeeiads is offline
Member
 
Fecha de Ingreso: mar 2013
Localización: Chile
Mensajes: 47
[quote=Una work área se usa cuando quieres independizar el área de entrada de datos de tu tabla interna[/QUOTE]

No entendí esa parte..
Gracias por la respuesta
Responder Con Cita
  #5  
Viejo 07/06/13, 14:38:37
Mauricio Hidalgo Mauricio Hidalgo is offline
Senior Member
 
Fecha de Ingreso: may 2006
Localización: Santiago, Chile
Mensajes: 481
Siempre es mejor la explicación oficial.

You can define internal tables either with (addition WITH HEADER LINE) or
without header line. An internal table with header line consists of a work area
(header line) and the actual table body. You address both objects using the same
name.
The way in which the system interprets the name depends on the context. For
example, the name stands for the header line in MOVE and CLEAR, but for the
body in SEARCH and REFRESH. To avoid confusion, we recommend using
internal tables without header lines. This is particularly important when you
use nested tables.
However, internal tables with header line do offer a shorter syntax in several
statements (APPEND, INSERT, MODIFY, COLLECT, DELETE, READ, and LOOP
AT).
Within object-oriented contexts, however you can only use internal table without
a header line.
You can always address the body of an internal table itab explicitly by using
the following syntax: itab[]. This syntax is always valid, whether the internal
table has a header line or not.
288 ©
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Reglas de Mensajes
no puedes crear nuevos temas
no puedes responder temas
no puedes adjuntar archivos
no puedes editar tus mensajes

El código vB está On
Las caritas están On
Código [IMG] está On
Código HTML está Off
Saltar a Foro


Husos Horarios son GMT. La hora en este momento es 20:39:17.


www.mundosap.com 2006 - Spain
software crm, crm on demand, software call center, crm act, crm solutions, crm gratis, crm web