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

structure mapping is incorrect....urgent

Former Member
0 Likes
1,126

Hi Folks,

in the below code itab and itab1 structures are diffetenr. I need to move itab1 data into itab from that itab i suppose to pass data to ztable. when i am chk below code i am getting error as structure is not mapping. Can u plz change the code according to my requiremt.

TABLES: ZCRM_DM_VBRP.

TYPES: BEGIN OF TS_ZCRM_DM_VBRP.

INCLUDE STRUCTURE ZCRM_DM_VBRP.

TYPES: END OF TS_ZCRM_DM_VBRP,

TT_ZCRM_DM_VBRP TYPE STANDARD TABLE OF TS_ZCRM_DM_VBRP .

DATA: WA_ZCRM_DM_VBRP TYPE TS_ZCRM_DM_VBRP,

ITAB TYPE TS_ZCRM_DM_VBRP OCCURS 0 WITH HEADER LINE.

DATA: T_OPTIONS TYPE TABLE OF RFC_DB_OPT INITIAL SIZE 10,

T_FIELDS TYPE TABLE OF RFC_DB_FLD INITIAL SIZE 10.

  • STRUCTURE DECLARATION

TYPES: BEGIN OF TS_DATA. "OCCURS 0,

INCLUDE STRUCTURE TAB512.

TYPES: END OF TS_DATA,

TT_DATA TYPE STANDARD TABLE OF TS_DATA .

*

**WORK AREA DECLARATION

DATA: WA_T_DATA TYPE TS_DATA.

*

    • INTERNAL TABLE DECLARATION

DATA: ITAB1 TYPE TS_DATA OCCURS 0 wIth header line.

********************************************************************************

  • START-OF-SELECTION *

********************************************************************************

START-OF-SELECTION.

*CALLING FUNCTION MODULE TO READ TABLE FROM REMOTE CLIENT.

CALL FUNCTION 'RFC_READ_TABLE' DESTINATION 'DAACLNT060'

EXPORTING

QUERY_TABLE = 'ZCRM_DM_VBRP'

DELIMITER = ' '

NO_DATA = ' '

ROWSKIPS = 0

ROWCOUNT = 0

TABLES

OPTIONS = T_OPTIONS

FIELDS = T_FIELDS

DATA = ITAB1

EXCEPTIONS

TABLE_NOT_AVAILABLE = 1

TABLE_WITHOUT_DATA = 2

OPTION_NOT_VALID = 3

FIELD_NOT_VALID = 4

NOT_AUTHORIZED = 5

DATA_BUFFER_EXCEEDED = 6

OTHERS = 7 .

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • LOOP THE INTERNAL TABLE

LOOP AT ITAB1 INTO WA_T_DATA.

move-corresponding WA_T_DATA TO ITAB.

append itab.

ENDLOOP.

Hi Folks,

in the below code itab and itab1 structures are diffetenr. I need to move itab1 data into itab from that itab i suppose to pass data to ztable. when i am chk below code i am getting error as structure is not mapping. Can u plz change the code according to my requiremt.

TABLES: ZCRM_DM_VBRP.

TYPES: BEGIN OF TS_ZCRM_DM_VBRP.

INCLUDE STRUCTURE ZCRM_DM_VBRP.

TYPES: END OF TS_ZCRM_DM_VBRP,

TT_ZCRM_DM_VBRP TYPE STANDARD TABLE OF TS_ZCRM_DM_VBRP .

DATA: WA_ZCRM_DM_VBRP TYPE TS_ZCRM_DM_VBRP,

ITAB TYPE TS_ZCRM_DM_VBRP OCCURS 0 WITH HEADER LINE.

DATA: T_OPTIONS TYPE TABLE OF RFC_DB_OPT INITIAL SIZE 10,

T_FIELDS TYPE TABLE OF RFC_DB_FLD INITIAL SIZE 10.

  • STRUCTURE DECLARATION

TYPES: BEGIN OF TS_DATA. "OCCURS 0,

INCLUDE STRUCTURE TAB512.

TYPES: END OF TS_DATA,

TT_DATA TYPE STANDARD TABLE OF TS_DATA .

*

**WORK AREA DECLARATION

DATA: WA_T_DATA TYPE TS_DATA.

*

    • INTERNAL TABLE DECLARATION

DATA: ITAB1 TYPE TS_DATA OCCURS 0 wIth header line.

********************************************************************************

  • START-OF-SELECTION *

********************************************************************************

START-OF-SELECTION.

*CALLING FUNCTION MODULE TO READ TABLE FROM REMOTE CLIENT.

CALL FUNCTION 'RFC_READ_TABLE' DESTINATION 'DAACLNT060'

EXPORTING

QUERY_TABLE = 'ZCRM_DM_VBRP'

DELIMITER = ' '

NO_DATA = ' '

ROWSKIPS = 0

ROWCOUNT = 0

TABLES

OPTIONS = T_OPTIONS

FIELDS = T_FIELDS

DATA = ITAB1

EXCEPTIONS

TABLE_NOT_AVAILABLE = 1

TABLE_WITHOUT_DATA = 2

OPTION_NOT_VALID = 3

FIELD_NOT_VALID = 4

NOT_AUTHORIZED = 5

DATA_BUFFER_EXCEEDED = 6

OTHERS = 7 .

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • LOOP THE INTERNAL TABLE

LOOP AT ITAB1 INTO WA_T_DATA.

move-corresponding WA_T_DATA TO ITAB.

append itab.

ENDLOOP.

7 REPLIES 7
Read only

Former Member
0 Likes
1,068

below is the error

  • ITAB TYPE TS_ZCRM_DM_VBRP OCCURS 0 WITH HEADER LINE.

ITAB TYPE standard table of TS_ZCRM_DM_VBRP OCCURS 0 WITH HEADER LINE.

    • reward if solved**

Read only

0 Likes
1,068

hi sreejiyh,

upto work area i am getting data, but it is not moving to itab after modidying the code as per u r suggestion can u chk once again.

Read only

0 Likes
1,068

use append statement to append workarea to internal table like

append <workarea_name> to itab.

Read only

0 Likes
1,068

Hi,

work area structure is not matching woth itab structure. So, it is not moving to Itab.

Read only

0 Likes
1,068

den instead of using move-corresponding, create a workarea with same linetype as dat of itab say workarea2 and move indivaidual fields from previous workarea as

workarea2-field1 = workarea-field2.

workarea2-filed2 = workarea-field5.

.

.

.

append workarea2 to itab.

Read only

former_member404244
Active Contributor
0 Likes
1,068

Hi,

u need to declare ITAB type standard table of ur ztable..like this

DATA : ITAB type standard table of <ZTABLE>.

now u have to make a move-corresponding statement as u weren doing to itab and finally u need to write this

update <ztable> from table itab...it will work...

Regards,

Nagaraj

Read only

Former Member
0 Likes
1,068

Ur correct code is here.

TABLES: ZCRM_DM_VBRP.

TYPES: BEGIN OF TS_ZCRM_DM_VBRP.

INCLUDE STRUCTURE ZCRM_DM_VBRP.

TYPES: END OF TS_ZCRM_DM_VBRP,

TT_ZCRM_DM_VBRP TYPE STANDARD TABLE OF TS_ZCRM_DM_VBRP .

DATA: WA_ZCRM_DM_VBRP TYPE TS_ZCRM_DM_VBRP,

ITAB TYPE standard table of TS_ZCRM_DM_VBRP OCCURS 0 WITH HEADER LINE.

DATA: T_OPTIONS TYPE TABLE OF RFC_DB_OPT INITIAL SIZE 10,

T_FIELDS TYPE TABLE OF RFC_DB_FLD INITIAL SIZE 10.

  • STRUCTURE DECLARATION

TYPES: BEGIN OF TS_DATA. "OCCURS 0,

INCLUDE STRUCTURE TAB512.

TYPES: END OF TS_DATA,

TT_DATA TYPE STANDARD TABLE OF TS_DATA .

*

**WORK AREA DECLARATION

DATA: WA_T_DATA TYPE TS_DATA.

*

    • INTERNAL TABLE DECLARATION

DATA: ITAB1 TYPE TS_DATA OCCURS 0 wIth header line.

********************************************************************************

  • START-OF-SELECTION *

********************************************************************************

START-OF-SELECTION.

*CALLING FUNCTION MODULE TO READ TABLE FROM REMOTE CLIENT.

CALL FUNCTION 'RFC_READ_TABLE' DESTINATION 'DAACLNT060'

EXPORTING

QUERY_TABLE = 'ZCRM_DM_VBRP'

DELIMITER = ' '

NO_DATA = ' '

ROWSKIPS = 0

ROWCOUNT = 0

TABLES

OPTIONS = T_OPTIONS

FIELDS = T_FIELDS

DATA = ITAB1

EXCEPTIONS

TABLE_NOT_AVAILABLE = 1

TABLE_WITHOUT_DATA = 2

OPTION_NOT_VALID = 3

FIELD_NOT_VALID = 4

NOT_AUTHORIZED = 5

DATA_BUFFER_EXCEEDED = 6

OTHERS = 7 .

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • LOOP THE INTERNAL TABLE

LOOP AT ITAB1 INTO WA_T_DATA.

move-corresponding WA_T_DATA TO ITAB.

append itab.

ENDLOOP.

reward if useful.

Amit Singla