Welcome To My BLOG

This site is to give a brief idea for the abap learners who are looking for some real time programs .It consists of collection of programs from my side . I hope these programs are very much used for all of the learners. Please check the links for any information in ABAP.
Please vote for my Blog. And please input me on this mail addrssess.Email me

Share this link with your friends

http://www.rebtel.com/u/15163104576

For every friend who signs up using this link and makes a payment, we'll give you 8 €!


Thursday, September 23, 2010

Calling one alv from other alv

type-pools:slis.
data:inttab type standard table of zemptab1 with header line ,
int_tab type STANDARD TABLE OF zemptabtwo with header line,
in_tab type standard table of zemptabtwo with header line.
data:fieldcat type slis_t_fieldcat_alv with header line,
fieldcat1 type slis_t_fieldcat_alv with header line.
select * from zemptab1 into corresponding fields of table inttab.
select * from zemptabtwo into corresponding fields of table int_tab.
perform buildfieldcat.
perform displayfieldcat.
FORM buildfieldcat.
fieldcat-fieldname = 'ID'.
fieldcat-seltext_m = 'EMPID'.
append fieldcat to fieldcat.
fieldcat-fieldname = 'NAME'.
fieldcat-seltext_m = 'EMPNAME'.
append fieldcat to fieldcat.
fieldcat-fieldname = 'QUALIFICATION'.
fieldcat-seltext_m = 'QUAL'.
append fieldcat to fieldcat.
fieldcat-fieldname = 'CITY'.
fieldcat-seltext_m = 'CITY'.
APPEND fieldcat to fieldcat.
fieldcat-fieldname = 'AGE'.
fieldcat-seltext_m = 'AGE'.
APPEND fieldcat to fieldcat.
ENDFORM. "buildfileldcat
FORM displayfieldcat .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
I_CALLBACK_USER_COMMAND = 'USECOMMAND'
IT_FIELDCAT = FIELDCAT[]
TABLES
t_outtab = int_tab.
IF sy-subrc <> 0.
ENDIF.
ENDFORM. "displayfieldcat
FORM USECOMMAND USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield .
case r_ucomm.
WHEN '&IC1'.
READ TABLE int_tab INDEX
rs_selfield-tabindex.
IF sy-subrc EQ 0.
"loop at int_tab where id eq rs_selfield.
in_tab-id = int_tab-id.
in_tab-dcode = int_tab-dcode.
in_tab-desig = int_tab-desig.
in_tab-exp = int_tab-exp.
append in_tab.
endif.
endcase.
" endloop.
clear fieldcat.
refresh fieldcat.
perform build_fieldcat.
perform display_fieldcat.
ENDFORM. "USECOMMAND
FORM build_fieldcat.
fieldcat-fieldname = 'DCODE'.
fieldcat-seltext_m = 'Desigcode'.
append fieldcat.
fieldcat-fieldname = 'ID'.
fieldcat-seltext_m = 'EMPID'.
APPEND fieldcat to fieldcat.
fieldcat-fieldname = 'DESIG'.
fieldcat-seltext_m = 'Designation'.
append fieldcat to fieldcat.
fieldcat-fieldname = 'EXP'.
fieldcat-seltext_m = 'EXPERIENCE'.
append fieldcat to fieldcat.
ENDFORM. "build_fieldcat
FORM display_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
IT_FIELDCAT = fieldcat[]
TABLES
t_outtab = in_tab
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM. "display_fieldcat

No comments: