2007 Sep 21 8:08 AM
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.
2007 Sep 21 8:11 AM
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**
2007 Sep 21 8:20 AM
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.
2007 Sep 21 8:23 AM
use append statement to append workarea to internal table like
append <workarea_name> to itab.
2007 Sep 21 8:26 AM
Hi,
work area structure is not matching woth itab structure. So, it is not moving to Itab.
2007 Sep 21 8:29 AM
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.
2007 Sep 21 8:14 AM
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
2007 Sep 21 8:31 AM
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
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |