Skip to Content
0
Aug 28, 2007 at 04:40 PM

Accessing Table Type

17 Views

Hi All,

In the code below WFAT_EMP_INT_EMPWA is a table type.

For the function module 'WFA_EMP_DATA_GET' , ET_EMP_WORKAREA is an export parameter of type WFAT_EMP_INT_EMPWA

For the function module 'WFA_EMP_DATA_MODIFY' , IT_EMP_WORKAREA is an import parameter of the same type.

I need to get the parameter from one function module and pass it to the next function module.

Do i need to create a work area for the table type or can we simply define the table type and just pass it to the next FM as shown below.

DATA: ITAB_WRKAREA TYPE WFAT_EMP_INT_EMPWA.

DATA: itab_bapiret TYPE BAPIRET2_T,

wa_bapiret TYPE LINE OF BAPIRET2_T.

DATA: itab_bapiret1 TYPE BAPIRET2_T,

wa_bapiret1 TYPE LINE OF BAPIRET2_T.

FORM GET_WRKAREA_CODE.

CALL FUNCTION 'WFA_EMP_DATA_GET'

EXPORTING

IV_EMP_BPID = W_BUPNR

IV_ORG_OBJID = W_ORGEH

IV_EFFECTIVE_WEEK = SY-DATUM

IV_TEMPORARY = GC_SPACE

IMPORTING

ET_EMP_WORKAREA = ITAB_WRKAREA

ET_RETURN = itab_bapiret.

LOOP AT itab_bapiret

INTO wa_bapiret.

WRITE :/ wa_bapiret-MESSAGE.

ENDLOOP.

ENDFORM. "get_wrkarea

FORM TRANSFER_WRKAREA.

CALL FUNCTION 'WFA_EMP_DATA_MODIFY'

EXPORTING

IV_EMP_BPID = W_BUPNR

IV_ORG_OBJID = W_ORGEH

IV_EFFECTIVE_WEEK = SY-DATUM

IS_EMP_INTERFACE_ADMIN = WA_WFAS_EMP_INT_ADMIN

IT_EMP_WORKAREA = ITAB_WRKAREA

IMPORTING

ET_RETURN = itab_bapiret1.

LOOP AT itab_bapiret1

INTO wa_bapiret1.

WRITE :/ wa_bapiret1-MESSAGE.

ENDLOOP.

ENDFORM. "transfer_wrkarea

In the above context does ITAB_WRKAREA(table type) will have only one record.

What is the difference between these 2 statements

DATA: x type TT. " TT refers to table type

DATA: x type ST. "ST refers to structure type

I am getting confused with the table types and structures . Table type refers to a line type which inturn refers to a structure? Can some one explain this.

Thanks in Advance