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: 

Global method for table update.

Former Member
0 Kudos

Hi Folks,

I have scenario like to update bunch of ztables.

Thus i decided to build a class globally to minimize the efforts of developers.

I have created importing parameter(ZTB_PR_001) type any for which table to be updated another importing table parameter (type any table GT_FINAL) to import matrix data to be inserted in ztable.

WHILE NOT GT_FINAL IS INITIAL.
     

        APPEND LINES OF GT_FINAL FROM 1 TO 100000 TO LT_FINAL_TMP. <---- I can not able to define temporary table here due to type any table
        DELETE GT_FINAL FROM 1 TO 100000.

        "modify data in clusters
        MODIFY ZTB_PR_001 FROM TABLE LT_FINAL_TMP.


ENDWHILE.

Can I know alternate solution.

-Amit

6 REPLIES 6

former_member210008
Active Participant
0 Kudos

DATA data TYPE REF TO data.

CREATE DATA data LIKE GT_FINAL.

FIELD-SYMBOLS <table> TYPE STANDARD TABLE.

ASSIGN data->* TO <table>.

APPEND LINES OF GT_FINAL FROM 1 TO 10 TO <TABLE>.

0 Kudos

Hi,

My GT_FINAL table is type any table and hence it is giving below error.

-Amit

0 Kudos

Dear Amit,

Intead of defining your Table into any.

Define below way,

field-symbol <gt_final> type  standard table .

then all the modify and append statement will work for you.

Because if you can define the <gt_final> any , at runtime it could be of any type. That why compiler doesn't allow you to perform operation.

Thanks and Regards,

Nishant

former_member210008
Active Participant
0 Kudos

Main problem in ANY TABLE: you cant use index access on it.

There some ways to fix it:

1) change type from ANY TABLE to STANDARD TABLE ( no problem if you don't use sorted/hashed tables)

2) use LOOP with counter to copy N records.

3) use field symbol with type STANDARD TABLE. But it also can cause problems if you use sorted/hashed tables.

Former Member
0 Kudos

Hi Guys,

Problem solved.

Just I wanted to mark question answered but unfortunately I am not able to see answered question...

-Amit

0 Kudos

Look for the "Mark this discussion as a question" checkbox