Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Accessing Table Type

madhu_reddy22
Participant
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

*-- Table type is a table.. when you refere to a table type u need not use again standard table of , or occurs 0 addition the follwoing statmenet will declare x as a internal table with out header line.

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

*-- Structure is a flat structure and x is a work area not internal table.

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

if you have to create x as intenaal table using strrucre ST then

data : x type standard table of ST..

Thanks

Mahesh

3 REPLIES 3

Former Member
0 Kudos

*-- Table type is a table.. when you refere to a table type u need not use again standard table of , or occurs 0 addition the follwoing statmenet will declare x as a internal table with out header line.

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

*-- Structure is a flat structure and x is a work area not internal table.

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

if you have to create x as intenaal table using strrucre ST then

data : x type standard table of ST..

Thanks

Mahesh

0 Kudos

HI Mahesh,

Thanks a lot for the response. Just a few more doubts.

In the code above as per the functionality i am assuming the function module will pass only one record to the table type. So i am just fetching that record and passing it to the next function module.Does it mean that the table type can store only one record at a time? Or can it store multiple records(like a normal internal table)?

I am just storing the information obtained(ITAB_WRKAREA) from the first FM and passing it to the next function. So i do not need any work area . I can just pass ITAB_WRKAREA to the second FM. Am i right?

0 Kudos

HI Mahesh,

Thanks a lot for the response. Just a few more doubts.

In the code above as per the functionality i am assuming the function module will pass only one record to the table type. So i am just fetching that record and passing it to the next function module.Does it mean that the table type can store only one record at a time? Or can it store multiple records(like a normal internal table)?

I am just storing the information obtained(ITAB_WRKAREA) from the first FM and passing it to the next function. So i do not need any work area . I can just pass ITAB_WRKAREA to the second FM. Am i right?