ABAP: copy alv variant to another program

*&---------------------------------------------------------------------* *& Report ZTEST1 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* * from this site * http://scn.sap.com/thread/3200295 REPORT ZTEST1. TYPE-POOLS: slis. TABLES : LTDXT. PARAMETERS: P_REP LIKE SY-REPID, P_REP2 LIKE SY-REPID. DATA : T_VAR TYPE STANDARD TABLE OF LTVARIANT, L_VAR TYPE LTVARIANT. DATA: LS_VARKEY LIKE LTDXKEY. DATA: LS_VARIANT LIKE DISVARIANT. DATA: LT_DBFIELDCAT LIKE LTDXDATA OCCURS 0 WITH HEADER LINE. DATA: LT_DBSORTINFO LIKE LTDXDATA OCCURS 0 WITH HEADER LINE. DATA: LT_DBFILTER LIKE LTDXDATA OCCURS 0 WITH HEADER LINE. DATA: LT_DBLAYOUT LIKE LTDXDATA OCCURS 0 WITH HEADER LINE. DATA: LT_FCAT TYPE SLIS_T_FIELDCAT_ALV. DATA: L_LAYOUT TYPE SLIS_LAYOUT_ALV. RANGES: LR_REPORT FOR LTDX-REPORT. LR_REPORT-SIGN = 'I'. LR_REPORT-OPTION = 'EQ'. LR_REPORT-LOW = P_REP. APPEND LR_REPORT. CALL FUNCTION 'LT_VARIANTS_READ_FROM_LTDX' EXPORTING I_TOOL = 'LT' I_TEXT = 'X' TABLES ET_VARIANTS = T_VAR IT_RA_REPORT = LR_REPORT EXCEPTIONS NOT_FOUND = 1 OTHERS = 2. IF SY-SUBRC <> 0. * Implement suitable error handling here ENDIF. * LOOP AT T_VAR INTO L_VAR. MOVE-CORRESPONDING L_VAR TO LS_VARKEY. CALL FUNCTION 'LT_DBDATA_READ_FROM_LTDX' EXPORTING I_TOOL = 'LT' IS_VARKEY = LS_VARKEY TABLES T_DBFIELDCAT = LT_DBFIELDCAT T_DBSORTINFO = LT_DBSORTINFO T_DBFILTER = LT_DBFILTER T_DBLAYOUT = LT_DBLAYOUT EXCEPTIONS NOT_FOUND = 1 WRONG_RELID = 2 OTHERS = 3. IF SY-SUBRC <> 0. * Implement suitable error handling here ENDIF. * MOVE-CORRESPONDING L_VAR TO LS_VARIANT. LS_VARKEY-REPORT = P_REP2. LS_VARIANT-REPORT = P_REP2. CALL FUNCTION 'LT_DBDATA_WRITE_TO_LTDX' EXPORTING I_TOOL = 'LT' IS_VARKEY = LS_VARKEY IS_VARIANT = LS_VARIANT TABLES T_DBFIELDCAT = LT_DBFIELDCAT T_DBSORTINFO = LT_DBSORTINFO T_DBFILTER = LT_DBFILTER T_DBLAYOUT = LT_DBLAYOUT EXCEPTIONS NOT_FOUND = 1 WRONG_RELID = 2 OTHERS = 3. IF SY-SUBRC <> 0. ELSE. MOVE-CORRESPONDING LS_VARKEY TO LTDXT. LTDXT-RELID = 'LT'. LTDXT-LANGU = SY-LANGU. LTDXT-TEXT = LS_VARIANT-TEXT. INSERT LTDXT. IF SY-SUBRC NE 0. UPDATE LTDXT. ENDIF. ENDIF. ENDLOOP.
0 comments:

Post a Comment

message

Labels

NuffNang

Search google

Blog Archive

My Blog List

Twitter

Message

Followers