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: 

convert table to structure

Former Member
0 Kudos

hello all,

is there a way to convert a table with header line to a structure?

thanks in advanced'

dana.

9 REPLIES 9

Former Member
0 Kudos

Hi,

I am not sure if you are looking something like this..

DATA: BEGIN OF itab occurs 0.

INCLUDE STRUCTURE Z_MY_DDIC_STURCT.

DATA: end of itab.

OR.

DATA: S_STRUCTURE LIKE ITAB..

READ TABLE ITAB INTO S_STRUCTURE WITH KEY...

Thanks,

Naren

sunilachyut
Contributor
0 Kudos

Can you elaborate more on what exactly you are trying to achieve?

Sunil Achyut

0 Kudos

for the first time i do smartforms.

and when i finish writing my code and ran the program, i found that the function that call the smartforms doesnt use internal table - it used structure only.

so i want to know if there is a way that i can move data from internal table to a structure so that the function will use the structure.

0 Kudos

In a structure you can hold only one row, so you have to use a loop and pass the data to smartforms. Can you specify what FM you are using.

Sunil Achyut

0 Kudos

fm:

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = name

IMPORTING

FM_NAME = lf_fm_name

EXCEPTIONS

NO_FORM = 1

NO_FUNCTION_MODULE = 2

OTHERS = 3.

CALL FUNCTION lf_fm_name

EXPORTING

CONTROL_PARAMETERS = control

parnr = parnr

NAME1 = NAME1

TELF1 = TELF1

vtext = vtext

TABLES

itab_cust = itab_cust.

the error i got:

0 Kudos

the error i got:

An exception occurred. This exception is dealt with in more detail below

. The exception, which is assigned to the class 'CX_SY_DYN_CALL_ILLEGAL_TYPE',

was neither

caught nor passed along using a RAISING clause, in the procedure "SMARTFORMS"

"(FORM)"

.

Since the caller of the procedure could not have expected this exception

to occur, the running program was terminated.

The reason for the exception is:

In the function "/1BCDWB/SF00000137" the STRUCTURE parameter "ITAB_CUST" is

typed in such a way

that actual parameters are not valid, unless they are compatible

according to the Unicode fragment view.

0 Kudos

If I understood your question right, doing the following should resolve your problem

CALL FUNCTION lf_fm_name

EXPORTING

CONTROL_PARAMETERS = control

parnr = parnr

NAME1 = NAME1

TELF1 = TELF1

vtext = vtext

TABLES

itab_cust = itab_cust[].

Just add the braces and it should do it. This is assuming <b>itab_cust</b> is an internal table with a header line.

FYI - Any parameter under Tables Tab is a internal table and not a structure, and since its an internal table with a header line you have to enclose the '[]' braces to indicate the same.

hith

Sunil Achyut

Message was edited by: Sunil Achyut

0 Kudos

you can use like this-->

fm:

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = name

IMPORTING

FM_NAME = lf_fm_name

EXCEPTIONS

NO_FORM = 1

NO_FUNCTION_MODULE = 2

OTHERS = 3.

data mystruct type line of itab.

loop at itab into mystruct.

CALL FUNCTION lf_fm_name

EXPORTING

CONTROL_PARAMETERS = control

parnr = parnr

NAME1 = NAME1

TELF1 = TELF1

vtext = vtext

TABLES

itab_cust = mystruct.

endloop.

are you using this for smartform or pdfform?

in either cases it will print the forms as different documents. suppose if you are having 10 lines in your internal table then it will give 10 diff documents.

reward me if this is helpful.

0 Kudos

im sorry but now i understood what i did:

the structure that the function get not match to the struc. that the SF define.

sorry to bother you,

thank you all very much,

dana.