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

append structure to itab

Former Member
0 Likes
595

I have a structure credit_total and a corresponding itab i_credit_total. I move the string field v_row to the structure. Now I want to append the structure to the internal table. I have too many fields in the structure to do it individually. My code gives me errors at APPEND credit_detail TO i_credit_detail.

TYPES: BEGIN OF credit_total,
      formattype(2) TYPE c,
      groupclientnumber(4) TYPE n,
      clientnumber(4) TYPE n,
      juliandate(3) TYPE c,
      hrextraction(2) TYPE c,
      recordtype(2) TYPE n,
      filler(7) TYPE n,
      recordcnt(5) TYPE n,
      totalamt(9) TYPE n,
      futureuse(187) TYPE c,
      END OF credit_total.
DATA:      i_credit_total TYPE TABLE OF credit_total.

      MOVE v_row TO credit_detail.
      APPEND credit_detail TO i_credit_detail.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
539

Hi,

Please try this.


TYPES: BEGIN OF credit_detail,
         formattype(2) TYPE c,
         groupclientnumber(4) TYPE n,
         clientnumber(4) TYPE n,
         juliandate(3) TYPE c,
         hrextraction(2) TYPE c,
         recordtype(2) TYPE n,
         filler(7) TYPE n,
         recordcnt(5) TYPE n,
         totalamt(9) TYPE n,
         futureuse(187) TYPE c,
       END OF credit_detail.
 
DATA: v_row TYPE string.
DATA: i_credit_total TYPE TABLE OF credit_detail.
 
...
 
MOVE v_row(2)   TO credit_detail-formattype.
MOVE v_row+2(4) TO credit_detail-groupclientnumber.
MOVE v_row+6(4) TO credit_detail-clientnumber.
MOVE v_row10(3) TO credit_detail-juliandate.
....
 
move-corresponding credit_detail to i_credit_total.
append i_credit_total.

Regards,

Ferry Lianto

3 REPLIES 3
Read only

suresh_datti
Active Contributor
0 Likes
539

credit_detail or credit_total?

change the code to

MOVE v_row TO credit_total.

APPEND credit_total TO i_credit_total.

~Suresh

Read only

Former Member
0 Likes
539

In unicode systems u cannot pass the String variables data into a field string (work area) of different fields.. U need to pass the data from this string variable to the individual fields of work area (not directly) and then onli u can append it.

<b>in the attributes

GOTO --> Attributes..</b>

of your program just uncheck the check box Unicode .. then your code will not have any problem .. it will be error free..

Or if u want your program to be Unicode enabled and u can solve this problem by using the field-symbols... without using all the fields..

u can use

<b>LOOP AT

ASSIGNING COMPONENT SY-INDEX OF STRUCTURE FS_WA TO <FS>.

IF SY-SUBRC NE 0.

EXIT.

ENDIF.

ENDLOOP.</b>

regards,

sai ramesh

Read only

Former Member
0 Likes
540

Hi,

Please try this.


TYPES: BEGIN OF credit_detail,
         formattype(2) TYPE c,
         groupclientnumber(4) TYPE n,
         clientnumber(4) TYPE n,
         juliandate(3) TYPE c,
         hrextraction(2) TYPE c,
         recordtype(2) TYPE n,
         filler(7) TYPE n,
         recordcnt(5) TYPE n,
         totalamt(9) TYPE n,
         futureuse(187) TYPE c,
       END OF credit_detail.
 
DATA: v_row TYPE string.
DATA: i_credit_total TYPE TABLE OF credit_detail.
 
...
 
MOVE v_row(2)   TO credit_detail-formattype.
MOVE v_row+2(4) TO credit_detail-groupclientnumber.
MOVE v_row+6(4) TO credit_detail-clientnumber.
MOVE v_row10(3) TO credit_detail-juliandate.
....
 
move-corresponding credit_detail to i_credit_total.
append i_credit_total.

Regards,

Ferry Lianto