Application Development and Automation 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: 
Read only

Accessing Table Type

madhu_reddy22
Participant
0 Likes
610

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
Read only

Former Member
0 Likes
583

*-- 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
Read only

Former Member
0 Likes
584

*-- 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

Read only

0 Likes
583

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?

Read only

0 Likes
583

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?