cancel
Showing results for 
Search instead for 
Did you mean: 

Retreival of Dynamic Table Datas from Adobe to WebDynpro- ABAP

Former Member
0 Kudos

Dear Friends,

I have Developed an application in Webdynpro-ABAP, where i have integrated Adobe form in the webdynpro.

In the adobe form, dynamic table is there where we can add and delete the rows at runtime.

I am trying to retreive the table datas at runtime from the adobe.

I can able to retreive only the first record from the table, even if the table contain more than one rows.

As per the below code i have retreived the count, where it is showing the count as 1.

using the method get_static_attributes_table i am trying to fetch all the records, but i can able to retreive only the first record.

lo_nd_zsm_fm_transport_tra = wd_context->get_child_node( name = wd_this->wdctx_zsm_fm_transport_tra ).

lo_nd_tr_details_i = lo_nd_zsm_fm_transport_tra->get_child_node( name = wd_this->wdctx_tr_details_i ).

count = lo_nd_tr_details_i->GET_ELEMENT_COUNT( ).

elems_bank_table = lo_nd_tr_details_i->get_elements( ).

lo_nd_tr_details_i->get_static_attributes_table(

importing

table = ls_tr_details_i ).

Even Cardinality i have maintained as 1.N for the node.

Kindly provide me the solution.

Thanks and Regards,

Sathish,,

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

I have to split my reply into 2 parts because of formatting:

the code above allows you to read xml data from pdf file, then you need only to read xml and adding rows to your context:


data : item type string.  DATA: nodechild TYPE REF TO if_ixml_node,
        Childschild TYPE REF TO if_ixml_node.

    data: num_of_children type i,
          x type i,
          y type i,
          num_of_attribute.

node = document->find_from_name('ZAM_PROTSTROJF').
num_of_children = node->num_children( ).

nodechild = node->get_first_child( ).

data: wa_strojdetail type ZAM_PROTSTROJF,
      wa_strojdetail_tab TYPE TABLE OF ZAM_PROTSTROJF.
wa_strojdetail-docnum = ls_zam_protstroj-docnum.
wa_strojdetail-bukrs = 'VVS'.
wa_strojdetail-mandt = sy-mandt.

y = 1.
do Num_of_children times.
       num_of_attribute = nodechild->num_children( ).  " Childschild->num_children( )." Getting the number of attributes
       Childschild = nodechild->get_first_child( ).
       wa_strojdetail-itemnum  = y.
       x = 1.
       do num_of_attribute times.
          item = Childschild->GET_value( ).
          CASE x.
            WHEN 4.
              wa_strojdetail-anln1 = item.
            WHEN 5.
              wa_strojdetail-anln2 = item.
            WHEN 6.
              wa_strojdetail-bubtr = item.
            WHEN 7.
              wa_strojdetail-belnr = item.
          ENDCASE.
          Childschild = Childschild->get_next( ).
          x = x + 1.
      enddo.
      y = y + 1.
      APPEND wa_strojdetail to wa_strojdetail_tab.
      nodechild = nodechild->get_next( ).
 enddo.

This is complete solution for adding rows in interactive forms and working with them in WD4A!

Regards Jiri

Former Member
0 Kudos

Hi, I have solution for read data from dynamic table and add these added row to WD4A context (and then save them to DB) (in ONACTIONPROCESS_SUBMIT event):

DATA: l_fp TYPE REF TO if_fp.

l_fp = cl_fp=>get_reference( ).

DATA: l_pdfobj TYPE REF TO if_fp_pdf_object.

l_pdfobj = l_fp->create_pdf_object( ).

l_pdfobj->set_document( pdfdata = lv_pdfsource ).

l_pdfobj->set_extractdata( ).

l_pdfobj->execute( ).

DATA: pdf_form_data TYPE xstring.

l_pdfobj->get_data( IMPORTING formdata = pdf_form_data ).

DATA: converter TYPE REF TO cl_abap_conv_in_ce, formxml TYPE string.

Converter = cl_abap_conv_in_ce=>create( input = pdf_form_data ).

Converter->read( IMPORTING data = formxml ).

TYPE-POOLS: ixml.

DATA: l_ixml TYPE REF TO if_ixml.

l_ixml = cl_ixml=>create( ).

DATA: streamfactory TYPE REF TO if_ixml_stream_factory,

istream TYPE REF TO if_ixml_istream.

streamfactory = l_ixml->create_stream_factory( ).

istream = streamfactory->create_istream_string( formxml ).

DATA: document TYPE REF TO if_ixml_document.

Document = l_ixml->create_document( ).

DATA: parser TYPE REF TO if_ixml_parser.

parser = l_ixml->create_parser( stream_factory = streamfactory

istream = istream

document = document ).

Parser->parse( ).

the code above allows you to read xml data from pdf file, then you need only to read xml and adding rows to your context:

data : item type string. DATA: nodechild TYPE REF TO if_ixml_node,

Childschild TYPE REF TO if_ixml_node.

data: num_of_children type i,

x type i,

y type i,

num_of_attribute.

node = document->find_from_name('ZAM_PROTSTROJF').

num_of_children = node->num_children( ).

nodechild = node->get_first_child( ).

data: wa_strojdetail type ZAM_PROTSTROJF,

wa_strojdetail_tab TYPE TABLE OF ZAM_PROTSTROJF.

wa_strojdetail-docnum = ls_zam_protstroj-docnum.

wa_strojdetail-bukrs = 'VVS'.

wa_strojdetail-mandt = sy-mandt.

y = 1.

do Num_of_children times.

num_of_attribute = nodechild->num_children( ). " Childschild->num_children( )." Getting the number of attributes

Childschild = nodechild->get_first_child( ).

wa_strojdetail-itemnum = y.

x = 1.

do num_of_attribute times.

item = Childschild->GET_value( ).

CASE x.

WHEN 4.

wa_strojdetail-anln1 = item.

WHEN 5.

wa_strojdetail-anln2 = item.

WHEN 6.

wa_strojdetail-bubtr = item.

WHEN 7.

wa_strojdetail-belnr = item.

ENDCASE.

Childschild = Childschild->get_next( ).

x = x + 1.

enddo.

y = y + 1.

APPEND wa_strojdetail to wa_strojdetail_tab.

nodechild = nodechild->get_next( ).

enddo.

This is complete solution for adding rows in interactive forms and working with them in WD4A!

Regards Jiri

Edited by: Jiri Neuzil on Jun 10, 2009 8:13 AM

Sorry for formatting, but I don't know, how to format text correctly on this site in plain text I have all text correctly formatted, but in preview....

Former Member
0 Kudos

Hi, I have solution for read data from dynamic table and add these added row to WD4A context (and then save them to DB) (in ONACTIONPROCESS_SUBMIT event):


DATA: l_fp TYPE REF TO if_fp.
l_fp = cl_fp=>get_reference( ).

DATA: l_pdfobj TYPE REF TO if_fp_pdf_object.
l_pdfobj = l_fp->create_pdf_object( ).

l_pdfobj->set_document( pdfdata = lv_pdfsource ).

l_pdfobj->set_extractdata( ).

l_pdfobj->execute( ).

DATA: pdf_form_data TYPE xstring.
l_pdfobj->get_data( IMPORTING formdata = pdf_form_data ).

DATA: converter TYPE REF TO cl_abap_conv_in_ce, formxml TYPE string.
Converter = cl_abap_conv_in_ce=>create( input = pdf_form_data ).
Converter->read( IMPORTING data = formxml ).

TYPE-POOLS: ixml.

DATA: l_ixml TYPE REF TO if_ixml.
l_ixml = cl_ixml=>create( ).

DATA: streamfactory TYPE REF TO if_ixml_stream_factory,
istream TYPE REF TO if_ixml_istream.
streamfactory = l_ixml->create_stream_factory( ).
istream = streamfactory->create_istream_string( formxml ).

DATA: document TYPE REF TO if_ixml_document.
Document = l_ixml->create_document( ).

DATA: parser TYPE REF TO if_ixml_parser.
parser = l_ixml->create_parser( stream_factory = streamfactory
                                           istream = istream
                                           document = document ).

Parser->parse( ).

Former Member
0 Kudos

Hi Thomas,

Thanks for your Reply.

SFP side

I created a (Web-Dynpro-Activex) submit button in adobe interactive form with the insertion of webdynpro code in SFP.

Web-dynrpo Side

Also in the Webdynrpo for the adobe UI element - Action Created on the On-Submit Event.

Now can you suggest how to retreive the second Row Datas which has been created using the Dynamic Add Button and also how to create the element when new rows are added in the Interactive Form Side.

Waiting for your Reply.

Thanks and Regards,

Sathish

Former Member
0 Kudos

Hi,

Please Use ZCI layout type for the form and use Web Dynpro Native Submit button.

Now to add empty rows dynamically:

1. Create a button ADDROWS in the view containing the form.

2. Assume TABLE is the node bound to the table element of the form.

3. To display empty rows of the table when the first time form is displayed add the following code in the supply method of the the TABLE node.

DATA LT_TABLE TYPE WD_THIS->ELEMENTS_TABLE.

DATA LS_TABLE LIKE LINE OF LT_TABLE.

APPEND LS_TABLE TO LT_TABLE.

APPEND LS_TABLE TO LT_TABLE.

NODE->BIND_TABLE( NEW_ITEMS = LT_TABLE ).

This will create two empty rows for the first time.

You can also use WDDOINIT to code for initialization.

4. Now code for addition of empty row

write the following code in the ONACTION method of ADDROWS button.

data lo_nd_table type ref to if_wd_context_node.

data lt_el_table type wdr_context_element_set.

data lo_el_table type ref to if_wd_context_element.

data lt_table type wd_this->elements_table.

data ls_table type wd_this->element_table.

*get the reference to TABLE node using GET_CHILD_NODE

lo_nd_table = wd_context->get_child_node( name = wd_this->wdctx_table ).

*get all existing eleemnts

lt_el_table = lo_nd_table->get_elements().

loop at lt_el_table into lo_el_table.

lo_el_table->get_static_attributes(

importing

static_attributes = ls_table ).

append ls_table to lt_table.

endloop.

*add empty row

clear ls_table.

append ls_table to lt_table.

lo_nd_table( lt_table ).

Similarly, you can code for deletion of a row.

Former Member
0 Kudos

Hi,

You need to add / delete element from the node which is bound to the table element of PDF Only then you will get the values in the context node.

If you adding / removing rows using Script in forms then in that case the corresponding elements of the node bound to this are not created.

Hope this will help. Or let me know how are you generating dynamic rows for table in pdf.

Thanks,

Abhishek

Former Member
0 Kudos

Hi,

Thanks for your response.I am Creating the Add/Delete in the JavaScript in the Adobe Form Side, not in the webdynpro.

Can You Suggest how to retreive the added rows.

Thanks and Reagards,

Sathsih

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>

> Hi,

>

> Thanks for your response.I am Creating the Add/Delete in the JavaScript in the Adobe Form Side, not in the webdynpro.

> Can You Suggest how to retreive the added rows.

>

> Thanks and Reagards,

> Sathsih

This action is not supported in Web Dynpro ABAP. It will not accept any context elements that are created on the client side. The recommended approach is to have button in the Adobe Form that triggers a server side event back into Web Dynpro. Only from within ABAP coding on the Web Dynpro side should you add/delete rows by manipulating the context.

Former Member
0 Kudos

Hi,

Thank you for your reply.

But i want to know whether this will create a serious perfromance issue.

Is there is any other method to retreive the dynamic added datas.

if no other method available, can you explain in detail how to call the webdynpro from adobe for each dynamic action and how to retreive the new added datas.

Waiting for your reply.

Thanks and Regards,

Sathish

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

> But i want to know whether this will create a serious perfromance issue.

Performance won't be as good as JavaScript obviously becuase you make a server roundtrip - but no different than if you were doing this in HTML with Web Dynpro. Also consider adding more than one row at time to avoid repetative round trips.

>> Is there is any other method to retreive the dynamic added datas.

Not with the automatic binding for inline interactive forms. Only other option would be to treat this like an offline interactive form and restore the data binding manually by parsing the XML returned by the form. This wouldn't be the recommended approach however.

>> if no other method available, can you explain in detail how to call the webdynpro from adobe for each dynamic action and how to retreive the new added datas.

Just place a normal Web Dynpro button outside the interactiveForm and add elements to the context that is bound to the form. Nothing really Form specific about this.