cancel
Showing results for 
Search instead for 
Did you mean: 

Assign a unstructured field to a dynamic generated structure

Former Member
0 Kudos

Hello,

following problem:

I've a unstructured dataset type char(250).

I want to map this to dynamic generated fieldsysmbol.

When i use move to fill the field symbol i get a shortdump because of unicode.

When i do another assign then i lost the dynamic generated structure.

So what to do?

Best regards,

TomSd

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Thomas,

Is is the same previous problem?

Can you please post the code?

Regards,

Ravi

Former Member
0 Kudos

Hi Ravikumar Allampallam,

is the same problem.

Here the code:

      • Tabellen

DATA: LT_FIELDCATALOG_BW TYPE LVC_T_FCAT.

DATA: LT_RESULTDATA TYPE TABLE OF ZBAPI6116DA.

      • Structure

DATA: LS_RESULTDATA TYPE ZBAPI6116DA.

      • Data References

DATA: RESULTDATA_LINE TYPE REF TO DATA.

DATA: RESULTDATA TYPE REF TO DATA.

      • Field Symbols

FIELD-SYMBOLS: <FS_RESULTDATA_TABLE> TYPE ANY TABLE,

<FS_RESULTDATA_LINE>,

<FS_DATA>.

CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE

EXPORTING

IT_FIELDCATALOG = LT_FIELDCATALOG_BW

IMPORTING

EP_TABLE = RESULTDATA

EXCEPTIONS

GENERATE_SUBPOOL_DIR_FULL = 1

OTHERS = 2.

      • So RESULTDATA now points to our dynamic internal

      • table.

ASSIGN RESULTDATA->* TO <FS_RESULTDATA_TABLE>.

      • Next step is to create a work area for our dynamic *** internal table.

CREATE DATA RESULTDATA_LINE LIKE LINE OF <FS_RESULTDATA_TABLE>.

      • A field-symbol to access that work area

ASSIGN RESULTDATA_LINE->* TO <FS_RESULTDATA_LINE>.

LOOP AT LT_RESULTDATA INTO LS_RESULTDATA.

      • LS_RESULTDATA-DATA contains the data (type char(250))

Now LS_RESULTDATA-DATA should be mapped into a field with the structure <FS_RESULTDATA_TABLE>.

How to do this?

Best Regards,

Thomas Strehle

athavanraja
Active Contributor
0 Kudos

ASSIGN COMPONENT 'DATA' OF STRUCTURE LS_RESULTDATA TO <FS_RESULTDATA_LINE>.

INSERT <FS_RESULTDATA_LINE> INTO TABLE <FS_RESULTDATA_TABLE>.

Regards

Raja

Former Member
0 Kudos

Thomas,

First thing is you need to get that column assigned to the structure.

ASSIGN COMPONENT 'DATA' OF STRUCTURE LS_RESULTDATA TO <FS_ANY>.

Now, <FS_ANY> should be assigned to a structure so that the data is placed properly into the columns of the table, right. Is there a delimiter in the DATA column to separate the columns. I am assuming there is one.

If yes,

SPLIT <fs_any> at 'Delimiter' into <FS_RESULTDATA_LINE>.

If its length delimited, then you can assign directly to <FS_RESULTDATA_LINE>.

Append <FS_RESULTDATA_LINE> to <FS_RESULTDATA_TABLE>

Regards,

Ravi

Former Member
0 Kudos

Hi Ravikumar Allampallam,

data has no delimiter.

So how can i get the structure of <FS_RESULTDATA_LINE> to the data string.

When i assign <fs_any> to <FS_RESULTDATA_LINE> then

<FS_RESULTDATA_LINE> has only one field data.

Best regards,

Strehle Thomas

Former Member
0 Kudos

Some where you need to have work area with a strucutre and split the DATA column and put the column level data properly.

Before assigning <fs_resultdata_line> it has a stucture right?

Regards,

Ravi

Former Member
0 Kudos

Hi,

yes before assigning <fs_resultdata_line> has a structure.

So what to do?

Best regards,

Strehle Thomas

Former Member
0 Kudos

Thomas,

Instead of assigning, can you try

<FS_RESULTDATA_LINE> = <FS_ANY>

Regards,

Ravi

Former Member
0 Kudos

Hi Ravikumar Allampallam,

<FS_RESULTDATA_LINE> = <FS_ANY> runs into an short dump.

'UC_OBJECTS_NOT_CONVERTIBLE'

We have a Unicode system and there its not possible to move <FS_ANY> to <FS_RESULTDATA_LINE> because they havn't the same type.

Best regards,

TomSd