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: 

Move Field symbol data to Internal table

Former Member
0 Kudos

Dear All,

Please suggest how to move field symbol data to internal table. The requirement is I have dynamic data in Field symbol which to move to table parameter of a function module.

Thanks in Advance

Rams.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Declare FS type table of ITAB.

Loop at itab assigning FS.

READ TABLE ITAB2 where fld = <FS> - FLD.

IF SY-SUBRC EQ 0..

ITAB-FLD = <FS> - FLD.

endif.

endloop.

Try the above code and let me know

13 REPLIES 13

Former Member
0 Kudos

Hi,

Declare FS type table of ITAB.

Loop at itab assigning FS.

READ TABLE ITAB2 where fld = <FS> - FLD.

IF SY-SUBRC EQ 0..

ITAB-FLD = <FS> - FLD.

endif.

endloop.

Try the above code and let me know

Former Member
0 Kudos

You could just pass the field symobl directly to the function module if the type of the internal table and the dynamic type of the field symbol match

SuhaSaha
Advisor
Advisor
0 Kudos

>

> The requirement is I have dynamic data in Field symbol which to move to table parameter of a function module.

You can directly pass the field symbol to the FM param, but prior to that you have to define it as TYPE (STANDARD / SORTED) TABLE. If you define it as TYPE ANY i think the compiler will give you a syntax error.

BR,

Suhas

Former Member
0 Kudos

Dear Saha,

I have declared the FS as <FS_EXCEL_DATA> TYPE STANDARD TABLE. Now I need to move data from here to the tables parameter in Function Module ITAB.

Kindly suggest me how to proceed further.

Regards,

Ram

Former Member
0 Kudos
FIELD-SYMBOLS <fs> TYPE ANY STANDARD TABLE.

ASSIGN itab TO <fs>.

READ TABLE <fs> WITH TABLE KEY = <KEY FIELD>  INTO wa

.

0 Kudos

What is the FM you are using ? Please be more specific about the info you are providing. W/o proper inputs it is really difficult to provide a solution.

Subhankar
Active Contributor
0 Kudos

Hi ,

If the field symbol type and the Fm table type are same then you can directly pass the field symbol.

Again one thing you can do if the FM is custom and you passing value through field symbol . Instead of table parameter you table table parameter you can define as IMPORTING or EXPORTING parameter based your requirement. You need to declare it as STANDARD TABLE.

Please check the sample FM Importing parameter.

*" IMPORTING

*" VALUE(IM_TABNAME) TYPE CHAR16

*" VALUE(IM_COMP) TYPE CHAR18

*" VALUE(IM_UPLOAD) TYPE CHAR1

*" VALUE(IM_VALIDATE) TYPE CHAR1 OPTIONAL

*" VALUE(IM_MCC_TYPE) TYPE CHAR2 OPTIONAL

*" VALUE(IM_COLUMN) TYPE I

*" VALUE(IM_PART_QUAT) TYPE I

*" VALUE(IM_MARA) TYPE CHAR01 OPTIONAL

*" VALUE(IM_DWG) TYPE CHAR01 OPTIONAL

*" VALUE(IM_VALIDATE_ROW) TYPE CHAR01 OPTIONAL

*" REFERENCE(IM_EXCEL_DATA) TYPE STANDARD TABLE

Former Member
0 Kudos

Dear All,

In need to pass tabular data i.e. multiple entries from field symbol to the table parameter of the custom function module.

Field symbol is declared as below:

FIELD-SYMBOLS: <FS_EXCEL_TAB> TYPE STANDARD TABLE,

<FS_TABLE_HEADER> .

DATA WA_PD LIKE PRICE_DOWNLOAD.

APPEND <FS_TABLE_HEADER> TO <FS_EXCEL_TAB>.

CLEAR <FS_TABLE_HEADER>.

WA_PD-VKORG = <FS_EXCEL_TAB>-VKORG.u201D Problem while using this statement

APPEND WA_PD TO PRICE_DOWNLOAD.

CLEAR WA_PD.

Field symbol <FS_EXCEL_TAB> is populated like this.

VKORG | KUNNR_SH | KUNNR_SP |

0015 | 102105 | 102105 |

Now I need to move this data to table in tables parameter of custom fucntion module.

Thanks in advance,

Rams

0 Kudos

You are trying to use your internal table as a work area. With or without field symbols this will definitely cause problems.

Just to solve your query the structure of the field symbol is dynamic & you cannot directly assign fields to them. You have to use ASSIGN COMPONENT statement to access the field.

FIELD-SYMBOL: <VAL> TYPE ANY.

LOOP AT <FS_EXCEL_TAB> ASSIGNING <FS_TABLE_HEADER>.
  ASSIGN COMPONENT 'VKORG' OF STRUCTURE <FS_TABLE_HEADER>. INTO <VAL>.
  IF SY-SUBRC = 0.
    WA_PD-VKORG = <VAL>.
    APPEND WA_PD TO PRICE_DOWNLOAD.
    CLEAR WA_PD.
  ENDIF.
ENDLOOP.

BR,

Suhas

Former Member
0 Kudos

Dear Saha,

Thanks for ur reply. I have declared the same what u have sent, but still I am having problem. It's returning error with 'Field COMPONENT is unknown'. It is neither declared by data statement nor in specified tables.

Thanks in advace,

Rams

Former Member
0 Kudos

Suhas,

ASSIGN COMPONENT 'VKORG' OF STRUCTURE <FS_TABLE_HEADER>. INTO <VAL>

Is that INTO <VAL> or TO <VAL>. Correct me if i'm wrong?

Former Member
0 Kudos

answerd

0 Kudos

I am facing the same issue any suggestions rams