cancel
Showing results for 
Search instead for 
Did you mean: 

internal table from dynpro to html template

matthias_kasig2
Participant
0 Kudos

Hi,

we are on WAS700, internal ITS.

during PBO of a dynpro I have filled an internal table (ig_quantity). I am not using a table control or any visualization on the dynpro layout for this table.

How is the easiest way to loop through the table on the corresponding html template? Is it possible at all if the internal table is not in the dynpro-element list? The point is, I need to insert an input-field on the html side, which needs to be added to an existing tablecontrol.

I am not really into htmlBusiness, but I assume, I need something like this:

`repeat with n from 1 to ig_sublist-quantity`
...<html coding>...
`end`

ig_sublist is my internal table, quantity a field in the table

thanx, matthias

Message was edited by:

Matthias Kasig

Message was edited by:

Matthias Kasig

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Matthias,

your table does not have a visualization (yet)? In order to have access from the

HTML template you must transfer the contents of the internal table to the ITS

context (the pool of Business HTML variables).

Do this using the function module 'ITS_SET_CONTEXT'.

best regards

Tobias

matthias_kasig2
Participant
0 Kudos

Hi Durajraj and Tobias,

to Durajraj: I tried the javascript alert, and the alert displays nothing - no ig_sublist.firstvisible or thelike...

to Tobias: in my PBO Module where I fill my internal table ig_sublist I put in the FM

ITS_SET_CONTEXT like this:

      ig_sublist[] = <sublist>.
      CALL FUNCTION 'ITS_SET_CONTEXT'
        TABLES
          context                 = ig_sublist.

I get an ST22 because of type mismatch. The FM expects a type

context like SAVWCTXT.

SAVWCTXT is a structure with three fields:

FIELDNAME	AVWCTXFLD	CHAR	30	0	ALE/Web (ITS) Kontext-Feldname
FIELDINDEX	AVWCTXIDX	NUMC	8	0	ALE/Web (ITS) Kontext-Index
FIELDCONT	AVWCTXCONT	CHAR	1024	0	ALE/Web (ITS) Kontext-Feldinhalt

my ig_sublist is a table whic consists of a lot of fields, but I only need the quantity field. I can declare a variable like:

DATA: context_table type standard table of SAVWCTXT.

but how do I connect my ig_sublist to the export table context_table then?

kind regards, matthias

ps: sorry for the late reaction, but I didn't have to time to respond earlier, I gave points to both of you

matthias_kasig2
Participant
0 Kudos

Hi Tobias,

now I tried feed the FM ITS_SET_CONTEXT like this:

DATA: ig_cont type standard table of SAVWCTXT,
          wg_cont type SAVWCTXT.

    ig_sublist[] = <sublist>.
    loop at ig_sublist into wg_sublist.
      wg_cont-fieldname = 'quantity'.
      wg_cont-fieldindex = sy-tabix.
      wg_cont-fieldcont = wg_sublist-quantity.
      append wg_cont to ig_cont.
    endloop.
      CALL FUNCTION 'ITS_SET_CONTEXT'
        TABLES
          context                 = ig_cont
*       EXCEPTIONS
*         ITS_NOT_AVAILABLE       = 1
*         OTHERS                  = 2
                .

In the debugger I can see, that ig_cont, the export table for the FM gets filled properly. Still when calling ig_cont on the html template like this:

<script>
alert('`ig_cont.firstvisible`');
</script>

I see no incoming data...

do I need to do something more? field-transport or stuff like that?

kind regards, matthias

Former Member
0 Kudos

Hi Matthias,

what is the value of ig_cont.dim, ig_cont[1].quantity and so on?

You should see a dump of the contents of the ITS context *) if you

set ~record=1 as an URL parameter. This will work if adminenabled (6.20)

or itsp/devmode/contextdump (>6.20) respectively has been set.

regards

Tobias

*) The HTML source contains this dump

Message was edited by:

Tobias Gomer

matthias_kasig2
Participant
0 Kudos

Hi,

what does ig_cont.dim? and where can I see a dump of the contents of the ITS context ? I do not get shortdumps ST22 for my javascript alerts...

but still via the javascript alerts I don't see any values at all.

last thing I tried was:

<script>
alert('`ig_cont.firstvisible`');
alert('`ig_cont.fieldname.value`');
alert('`ig_cont[1].quantity.value`');
</script>

I mean, my ig_cont table now contains the fields fieldname fieldindex and fieldcontent (just like the fields of the type structure for the FM) - do I not have to write eg

ig_cont.fieldname.value (which should be quantity always) and ig_cont.fieldindex.value (which holds my sy-tabix from PBO

and ig_cont.fieldcont.value...

during my PBO loop I just do this:

loop at ig_sublist into wg_sublist.
      wg_cont-fieldname = 'quantity'.
      wg_cont-fieldindex = sy-tabix.
      wg_cont-fieldcont = wg_sublist-quantity.
      append wg_cont to ig_cont.
endloop.

and then ig_cont goes to ITS_CONTEXT_SET

my htmlBusiness knowledge is very limited...

regards, matthias

Former Member
0 Kudos

Hi Matthias,

again: What is the contents of the ITS context. The context dump

can be seen in the HTML-source of the page.

regards Tobias

matthias_kasig2
Participant
0 Kudos

erm - where can I administer these parameters?

<i>if you set ~record=1 as an URL parameter. This will work if adminenabled (6.20)

or itsp/devmode/contextdump (>6.20) respectively has been set.

</i>

i checked transaction smicm --> parameters, but i can't find entries for itsp/devmode/contextdump... and wher is the URL parameter - should I set it in the internetservice itself? tried that, but the F4 help does not provide ~record

I had a look at the html source - I searched for "context" without success.

where in the source I might find what you need?

kind regards, matthias

matthias_kasig2
Participant
0 Kudos

the html source displays for my script alerts:

<script>
alert('');
alert('');
alert('');
</script>

ok, found transaction sitspmon and set

itsp/devmode/contextdump = 1.

I also added the parameter ~RECORD = 1 to my internetservice BBPSEARCH.

still I don't know where to see the context in the html-source,

kind regards, matthias

Message was edited by:

Matthias Kasig

former_member185704
Contributor
0 Kudos

Hi, Matthias,

SAP Note 973226 explains how to set ~record and itsp/devmode/contextdump.

You can either set

~record 1

in the service file or as a URL parameter when you start a new session. Using it in the URL is more convenient because then you only have the context when you need it. Example:

http://[host]:[port]/sap/bc/gui/sap/its/webgui?~record=1

Best regards

Henning

Former Member
0 Kudos

Hi Matthias,

please read the Wiki article ' How to use the HTML source for debugging issues'.

regards

Tobias

matthias_kasig2
Participant
0 Kudos

hi tobias,

ok, I get to see the itscontext now. unfortunately the page I want is part of a frameset. So for the frameset source I can see the itscontext, but not for the framepage itself. Can I get the context of the page in the html frameset?

But interesting:

in my script alert I tried:

alert('quantity.dim `quantity.dim`');

and I see a 2 - This means via the FM I seem to get values transferred to my page.

does that mean, that my internal table is called 'quantity' now?

I put the table ig_cont to the FM, and the structure of the table is

fieldname fieldindex fieldcont

where fieldname is quantity...

thanx a lot,

matthias

former_member185704
Contributor
0 Kudos

Hi,

> ok, I get to see the itscontext now. unfortunately

> the page I want is part of a frameset. So for the

> frameset source I can see the itscontext, but not for

> the framepage itself. Can I get the context of the

> page in the html frameset?

This is not an ITS related question. Please use Google to find information on how to use your web browser correctly.

Henning

Former Member
0 Kudos

Hi,

> in my script alert I tried:

> alert('quantity.dim `quantity.dim`');

> and I see a 2 - This means via the FM I seem to get values transferred to my page.

> does that mean, that my internal table is called 'quantity' now?

Yes, that means that the variable quantity is an array holding two entries.

> I put the table ig_cont to the FM, and the structure of the table is

> fieldname fieldindex fieldcont

> where fieldname is quantity...

As you wrote, the table ig_cont describes the array 'quantity'

regards

Tobias

matthias_kasig2
Participant
0 Kudos

Hi Tobias,

thanx a lot, I am almost through - I get the values on my page

But for the way back - I need to ask during PAI for my quantity array.

I assume, I have to use an FM like "its_get_content" or thelike?

thanx, matthias

Former Member
0 Kudos

Hi,

if you plan to make the field values editable you must provide input fields with an ID. Post parameters are part of the request context - the way back to ABAP.

The function group 'AWRT' contains function modules for retrieving the context values.

regards

Tobias

former_member185704
Contributor
0 Kudos

Hi Matthias,

You can find some documentation on developing IAC's in the SAP Library. For your current problem please have a look at this page where the usage of the field-get macro is explained:

http://help.sap.com/saphelp_nw04/helpdata/en/48/35d5624abf11d18a0f0000e816ae6e/frameset.htm

More general documentation on the whole subject is available in the "Web Transaction Tutorial":

http://help.sap.com/saphelp_nw04/helpdata/en/d5/644d358460e327e10000009b38f889/frameset.htm

Best regards,

Henning

matthias_kasig2
Participant
0 Kudos

Hi Tobias et al,

thanx 4 your valueable input. Tobias initial response concerning using function module 'ITS_SET_CONTEXT' was the clue I needed! Hence 10 points 4 Tobias and his overall effort,

kind regards, matthias

Answers (2)

Answers (2)

Former Member
0 Kudos

Hey Hiii....

Can you please let me know how u resolved the issue. Coz I face the same problem. My internal table gets filled in R/3 but is empty in HTML template at times. I need to fix this issue and is urgent.

Thanks in Advance,

Santhoshi

matthias_kasig2
Participant
0 Kudos

Hi Santoshi,

the clue is as described in my last post in this thread. If you have tables or in general elements, which are not visible in the screenpainter of a dynpro, then you have to transfer it to the html template using FM ITS_CONTEXT_SET. Like this you shall be able to receive the data needed on the template. And the way back from template to dynpro you can use ITS_CONTEXT_GET. It is actually all described in this thread.

If you need further assistance let me know,

regards, matthias

athavanraja
Active Contributor
0 Kudos

it would be something like

`repeat with j from ig_sublist.firstvisible

to ig_sublist.lastvisible`

....

to ge the value of the quantity field it will be

ig_sublist-quantity[j].value

`end`

http://help.sap.com/saphelp_nw04/helpdata/en/5f/1fb0f94aee11d189740000e8322d00/frameset.htm

Raja

matthias_kasig2
Participant
0 Kudos

Hi Raja,

on my html template I wrote:

`repeat with j from ig_sublist.firstvisible to ig_sublist.lastvisible`
<input type="text" name="ig_sublist-QUANTITY[`j`]" VALUE="`ig_sublist-QUANTITY[j].value`" size="10">
`end`

but this does not seem to have any effect - I don't get to see an html- inputfield...

do you have a clue why I can't see the html inputs derived from the internal table?

I checked the table in PBO of the dynpro - it is filled with two lines.

regards, matthias

athavanraja
Active Contributor
0 Kudos

are you sure ig_sublist is available for the template? can you just put it a javascript alert to view the value of firstvisible and lastvisible values.

<script>

alert('`ig_sublist.firstvisible`');

</script>