Application Development and Automation 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: 
Read only

Dyanamic Table

Former Member
0 Likes
567

How we can use Modify <dyanamic Table> from work area Transporting.....?

Please give example for using TRANSPORTING

1 ACCEPTED SOLUTION
Read only

former_member214857
Contributor
0 Likes
531

Hi Rita

You can use TRANSPORTING statment as sample below:

PARAMETERS p_carrid TYPE scarr-carrid.

DATA scarr_tab TYPE SORTED TABLE OF scarr

WITH UNIQUE KEY carrid.

DATA: idx TYPE sy-tabix,

scarr_wa TYPE scarr.

SELECT *

FROM scarr

INTO TABLE scarr_tab.

READ TABLE scarr_tab

WITH TABLE KEY carrid = p_carrid

TRANSPORTING NO FIELDS.

idx = sy-tabix.

scarr_wa-currcode = 'EUR'.

MODIFY scarr_tab INDEX idx FROM scarr_wa

TRANSPORTING currcode.

If you need a dynamic table you can use field symbols and define transporting list into a internal table where each line contains one field name.

Kind regards

Carlos Machado

4 REPLIES 4
Read only

former_member214857
Contributor
0 Likes
532

Hi Rita

You can use TRANSPORTING statment as sample below:

PARAMETERS p_carrid TYPE scarr-carrid.

DATA scarr_tab TYPE SORTED TABLE OF scarr

WITH UNIQUE KEY carrid.

DATA: idx TYPE sy-tabix,

scarr_wa TYPE scarr.

SELECT *

FROM scarr

INTO TABLE scarr_tab.

READ TABLE scarr_tab

WITH TABLE KEY carrid = p_carrid

TRANSPORTING NO FIELDS.

idx = sy-tabix.

scarr_wa-currcode = 'EUR'.

MODIFY scarr_tab INDEX idx FROM scarr_wa

TRANSPORTING currcode.

If you need a dynamic table you can use field symbols and define transporting list into a internal table where each line contains one field name.

Kind regards

Carlos Machado

Read only

0 Likes
531

yes, but this is for general table. I need for dyanamic table where field name is unknown.

Read only

0 Likes
531

Hi

You can use example below:

&----


*& Report ZC020

*&

&----


*&

*&

&----


REPORT ZC020.

PARAMETERS:

p_table LIKE dd02l-tabname OBLIGATORY DEFAULT 'ZC001'.

FIELD-SYMBOLS:

<wa> TYPE ANY,

<fs> TYPE ANY,

<field> TYPE ANY,

<table> TYPE ANY TABLE.

DATA:

x_table LIKE dd02l-tabname,

x_line TYPE REF TO DATA,

x_tabdef TYPE REF TO DATA,

t_fields(30) TYPE c OCCURS 0.

START-OF-SELECTION.

x_table = p_table.

CREATE DATA x_line TYPE (p_table).

ASSIGN x_line->* TO <wa>.

CREATE DATA x_tabdef TYPE STANDARD TABLE OF (p_table) .

ASSIGN x_tabdef->* TO <table>.

SELECT * FROM (p_table) INTO <wa>.

INSERT <wa> INTO TABLE <table>.

DO.

ASSIGN COMPONENT sy-index OF STRUCTURE <wa> to <field>.

IF sy-subrc NE 0.

EXIT.

ENDIF.

  • Make changes in the values as needed

ENDDO.

MODIFY <table> INDEX 1 FROM <wa> TRANSPORTING (x_table).

ENDSELECT.

Read only

0 Likes
531

Thanks for the reply.

But code is not working gave me dump.