Alv Report program
Hi Experts
I have created one report program and display the report in the ALV using FM Reuse alv grid
Now i want to handle double click on one of the field to navigate to different transaction .
Please help me in this regard .. also i am not creating any container using classes .
Regards
HItesh
Hi,
Refer this program for interactive alv.
REPORT ZSAMPLE.
TYPE-POOLS:SLIS.
TABLES:MARA, MAKT.
DATA: MYDATE(10).
TYPES:BEGIN OF TY_MARA,
MATNR TYPE MATNR,
ERSDA TYPE ERSDA,
ERNAM TYPE ERNAM,
LAEDA TYPE LAEDA,
END OF TY_MARA.
TYPES:BEGIN OF TY_MAKT,
MATNR TYPE MATNR,
MAKTX TYPE MAKTX,
MAKTG TYPE MAKTG,
END OF TY_MAKT.
DATA:IT_MARA TYPE TABLE OF TY_MARA,
WA_MARA TYPE TY_MARA.
DATA:IT_MAKT TYPE TABLE OF TY_MAKT,
WA_MAKT TYPE TY_MAKT.
DATA : IT_FIELDCAT_MARA TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT_MARA TYPE SLIS_FIELDCAT_ALV.
DATA : IT_FIELDCAT_MAKT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT_MAKT TYPE SLIS_FIELDCAT_ALV.
DATA: I_EVENT TYPE SLIS_T_EVENT ,
W_EVENT TYPE SLIS_ALV_EVENT,
I_LISTHEADER TYPE SLIS_T_LISTHEADER,
W_LISTHEADER TYPE SLIS_LISTHEADER,
W_END TYPE SLIS_LISTHEADER,
I_END TYPE SLIS_T_LISTHEADER.
DATA:I_EXCLUDING TYPE SLIS_T_EXTAB,
W_EXCLUDING TYPE SLIS_EXTAB.
CONCATENATE SY-DATUM6(2) '/' SY-DATUM4(2) '/' SY-DATUM+0(4) INTO MYDATE .
CONSTANTS: C_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
C_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_LIST',
C_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.
SELECTION-SCREEN:BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS:MATERIAL FOR MARA-MATNR.
SELECTION-SCREEN:END OF BLOCK B1.
START-OF-SELECTION.
PERFORM READ_DATA.
PERFORM FIELDCAT.
*PERFORM TOP-OF-PAGE.
*PERFORM END-OF-PAGE.
PERFORM EVENTS_GET USING I_EVENT.
*PERFORM TOP-OF-PAGE.
*PERFORM END-OF-PAGE.
PERFORM DISPLAY.
*& Form READ_DATA
text
--> p1 text
<-- p2 text
FORM READ_DATA .
SELECT MATNR ERSDA ERNAM LAEDA FROM MARA INTO CORRESPONDING FIELDS OF TABLE IT_MARA WHERE MATNR IN MATERIAL.
ENDFORM. " READ_DATA
*& Form FIELDCAT
text
--> p1 text
<-- p2 text
FORM FIELDCAT .
WA_FIELDCAT_MARA-FIELDNAME = 'MATNR'.
WA_FIELDCAT_MARA-TABNAME = 'IT_MARA'.
WA_FIELDCAT_MARA-emphasize = 'X'.
APPEND WA_FIELDCAT_MARA TO IT_FIELDCAT_MARA.
CLEAR WA_FIELDCAT_MARA.
WA_FIELDCAT_MARA-FIELDNAME = 'ERSDA'.
WA_FIELDCAT_MARA-TABNAME = 'IT_MARA'.
APPEND WA_FIELDCAT_MARA TO IT_FIELDCAT_MARA.
CLEAR WA_FIELDCAT_MARA.
WA_FIELDCAT_MARA-FIELDNAME = 'ERNAM'.
WA_FIELDCAT_MARA-TABNAME = 'IT_MARA'.
APPEND WA_FIELDCAT_MARA TO IT_FIELDCAT_MARA.
CLEAR WA_FIELDCAT_MARA.
WA_FIELDCAT_MARA-FIELDNAME = 'LAEDA'.
WA_FIELDCAT_MARA-TABNAME = 'IT_MARA'.
APPEND WA_FIELDCAT_MARA TO IT_FIELDCAT_MARA.
CLEAR WA_FIELDCAT_MARA.
ENDFORM. " FIELDCAT
*& Form DISPLAY
text
--> p1 text
<-- p2 text
FORM DISPLAY .
W_EXCLUDING-FCODE = '&ETA'.
APPEND W_EXCLUDING TO I_EXCLUDING.
W_EXCLUDING-FCODE = '&OUP'.
APPEND W_EXCLUDING TO I_EXCLUDING.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
I_GRID_TITLE = 'MARA DETAILS'
IT_FIELDCAT = IT_FIELDCAT_MARA
IT_EXCLUDING = I_EXCLUDING
IT_EVENTS = I_EVENT
TABLES
T_OUTTAB = IT_MARA[]
ENDFORM. " DISPLAY
FORM USER_COMMAND USING USER_COMMAND LIKE SY-UCOMM USR TYPE SLIS_SELFIELD.
refresh it_makt.
SELECT * FROM MAKT INTO CORRESPONDING FIELDS OF TABLE IT_MAKT WHERE MATNR = USR-VALUE.
PERFORM FIELDCAT1.
PERFORM DISPLAY1.
ENDFORM.
*& Form FIELDCAT1
text
--> p1 text
<-- p2 text
FORM FIELDCAT1 .
clear it_fieldcat_makt[].
WA_FIELDCAT_MAKT-FIELDNAME = 'MATNR'.
WA_FIELDCAT_MAKT-TABNAME = 'IT_MAKT'.
APPEND WA_FIELDCAT_MAKT TO IT_FIELDCAT_MAKT.
CLEAR WA_FIELDCAT_MAKT.
WA_FIELDCAT_MAKT-FIELDNAME = 'MAKTX'.
WA_FIELDCAT_MAKT-TABNAME = 'IT_MAKT'.
APPEND WA_FIELDCAT_MAKT TO IT_FIELDCAT_MAKT.
CLEAR WA_FIELDCAT_MAKT.
WA_FIELDCAT_MAKT-FIELDNAME = 'MAKTG'.
WA_FIELDCAT_MAKT-TABNAME = 'IT_MAKT'.
APPEND WA_FIELDCAT_MAKT TO IT_FIELDCAT_MAKT.
CLEAR WA_FIELDCAT_MAKT.
ENDFORM. " FIELDCAT1
*& Form DISPLAY1
text
--> p1 text
<-- p2 text
FORM DISPLAY1 .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = IT_FIELDCAT_MAKT
TABLES
T_OUTTAB = IT_MAKT
ENDFORM. " DISPLAY1
*& Form TOP-OF-PAGE
text
--> p1 text
<-- p2 text
FORM TOP_OF_PAGE .
CLEAR I_LISTHEADER.
W_LISTHEADER-TYP = 'H'.
W_LISTHEADER-INFO = 'MATERIALS DOCUMENT'.
APPEND W_LISTHEADER TO I_LISTHEADER.
CLEAR W_LISTHEADER.
W_LISTHEADER-TYP = 'S'.
W_LISTHEADER-KEY = 'DATE:'.
W_LISTHEADER-INFO = MYDATE.
APPEND W_LISTHEADER TO I_LISTHEADER.
CLEAR W_LISTHEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = I_LISTHEADER
I_LOGO = 'ENJOYSAP_LOGO'
I_END_OF_LIST_GRID =
I_ALV_FORM = 'X'
ENDFORM. " TOP-OF-PAGE
*& Form EVENTS_GET
text
--> p1 text
<-- p2 text
FORM EVENTS_GET USING P_I_EVENT TYPE SLIS_T_EVENT..
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 4
IMPORTING
ET_EVENTS = P_I_EVENT
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*ENDFORM. " EVENTS_GET
READ TABLE P_I_EVENT WITH KEY NAME = SLIS_EV_TOP_OF_PAGE INTO W_EVENT.
IF SY-SUBRC = 0.
MOVE C_TOP_OF_PAGE TO W_EVENT-FORM.
APPEND W_EVENT TO I_EVENT.
ENDIF.
READ TABLE P_I_EVENT WITH KEY NAME = SLIS_EV_END_OF_LIST INTO W_EVENT.
IF SY-SUBRC = 0.
MOVE C_END_OF_PAGE TO W_EVENT-FORM.
APPEND W_EVENT TO I_EVENT.
ENDIF.
READ TABLE P_I_EVENT WITH KEY NAME = SLIS_EV_USER_COMMAND INTO W_EVENT.
IF SY-SUBRC = 0.
MOVE C_USER_COMMAND TO W_EVENT-FORM.
APPEND W_EVENT TO I_EVENT.
ENDIF.
ENDFORM. " events_get
*& Form END-OF-PAGE
text
--> p1 text
<-- p2 text
FORM END_OF_LIST .
W_END-TYP = 'S'.
W_END-INFO = 'END-OF-PAGE'.
APPEND W_END TO I_END.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = I_END
I_LOGO = 'ENJOYSAP_LOGO'
I_END_OF_LIST_GRID =
I_ALV_FORM = 'X'
ENDFORM. " END-OF-PAGE
Please reward points if helpful
Similar Messages
-
Calling a ALV Report program via a Remote Function module.
H All,
The thing which I am looking out for is ,to know a technique to acheive this,
To start with,
For the transaction MB51-(Material Document List),which is a Report Program "RM07DOCS",I also observed that this uses a ALV to display the output.
Now what I actually require is another extra field (from MARA table ) along with the standard output that is displayed from this report.
Also this needs to be passed to a different UI system(build using VC ).
So I have a RFC eg DisplayList(),where in I need to exeucte this report program ,get the output what it gives ,add my additional information what I want to and pass it as a export parameter,
So this is the structure which I can visualise,
FUNCTION ZFUN_MB51TXN.
I would get all the import parameters here ,from who ever is calling my fun module,
*Call the report program,pass the input parameters required
*get the output from this report program
*send the output to the caller through export parameters
ENDFUNCTION.
So Here I need to know ,Can this be achieved something using Submit report or anything,Any guidelines to move further would be really of great help!Hi All,
It would really be great if you can explain with the reference to the same report program,the same selection screen elemetns or something.
Thanks,
Archies! -
ALV Report program linking 5 db tables.
What should be the general approach to generate a simple ALV program that links 5 database tables, where the selection criteria is date field?
Edited by: Matt on Dec 4, 2008 11:38 AM - Removed all capsSAP Query is a bit of an abomination -- complicated to use correctly and definitely difficult to maintain.
If you need to get stuff from 5 different databases in one report it might be better from a Systems Performance perspective to create a "Z_object" containing the data you want and then simply run your ABAP ALV against your "Z_Object".
Depending on the frequency / content of your report you could run say a batch job every evening to update your "Z_Object".
The other possibility would be to run your query on a BW/BI system if the volume of data is quite large -- however if you don't have BW then OK this is not a possible solution.
My preference would be to go for the "Z-Object".
I also have to wonder at how the original application was designed if you really do need to collect data from 5 different data bases --perhaps you should re-design the original application.
Cheers
jimbo. -
Help need on ALV Report Program
Hi all.....
im facing problem in the following code....it shows 'No records found' (as same as my coding generated)whenever i give wrong vendor no:(lifnr), but if i gives the correct one(as in table lfa1)...it shows Runtime error as <b>"the occupied line length in the program text must not exceed the width of the internal table"</b>..
pls verify...
just go thru my code and revert me the feedback of what i did wrong and pls i dont want any example codes from u guys since i've seen so much and couldnt solve it with that...
hope u understand......what i need
Rewards based on the above reuirements....only
*******************************CODING***********************************************
REPORT ZALV_MERGE.
TABLES:lfa1.
DATA:BEGIN OF itab OCCURS 100,
lifnr LIKE lfa1-lifnr,
land1 LIKE lfa1-land1,
name1 LIKE lfa1-name1,
ort01 LIKE lfa1-ort01,
regio LIKE lfa1-regio,
sortl LIKE lfa1-sortl,
END OF itab.
data: i_repid like sy-repid,
i_tabix like sy-tabix.
TYPE-POOLS: slis.
DATA: fcat TYPE slis_t_fieldcat_alv.
SELECT-OPTIONS: LIFNR FOR LFA1-LIFNR.
SELECT * FROM LFA1 INTO CORRESPONDING FIELDS OF TABLE itab WHERE lifnr IN LIFNR.
clear i_tabix.
describe table itab lines i_tabix.
if i_tabix lt 1.
write:/ 'No materials found'.
exit.
endif.
i_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = i_repid
I_INTERNAL_TABNAME = 'ITAB'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = I_REPID
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = fcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = i_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME = 'ITAB'
IS_LAYOUT =
IT_FIELDCAT = fcat
I_SAVE = 'A'
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.Hi,
think inthis program in the function module REUSE_ALV_FIELDCATALOG_MERGE
in exporting parameter you are using -->
I_INTERNAL_TABNAME = <itab_name>
this <itab_name> is not like any physical structure .So make a structure through SE11 like <itab_name>.
u have to create a structure in SE11 with the fields, and then pass that structure into the REUSE_ALV_FIELDCATALOG_MERGE , in the parameter
I_internal_tabname = ' structure name '.
even though u create a structure, u need to pass it to the table parameter.
then it will work.
Otherwise manually build the fieldcatalog.
find the following code as an example.
DATA : l_pos TYPE i VALUE 1.
ist_fieldcat-fieldname = 'POSID'.
ist_fieldcat-tabname = 'IT_FINAL'.
ist_fieldcat-outputlen = 24.
ist_fieldcat-col_pos = l_pos.
ist_fieldcat-ddictxt = 'L'.
ist_fieldcat-key = 'X'.
ist_fieldcat-seltext_l = 'Appropriation Request Number'.
APPEND ist_fieldcat.
CLEAR ist_fieldcat.
l_pos = l_pos + 1.
ist_fieldcat-fieldname = 'TXT04'.
ist_fieldcat-tabname = 'IT_FINAL'.
ist_fieldcat-outputlen = 4.
ist_fieldcat-col_pos = l_pos.
ist_fieldcat-ddictxt = 'L'.
ist_fieldcat-key = 'X'.
ist_fieldcat-seltext_l = 'Status'.
ist_fieldcat-EMPHASIZE = 'C400'.
APPEND ist_fieldcat.
CLEAR ist_fieldcat.
l_pos = l_pos + 1.
ist_fieldcat-fieldname = 'UDATE'.
ist_fieldcat-tabname = 'IT_FINAL'.
ist_fieldcat-outputlen = 8.
ist_fieldcat-col_pos = l_pos.
ist_fieldcat-ddictxt = 'L'.
ist_fieldcat-key = 'X'.
ist_fieldcat-seltext_l = 'Status Date'.
IST_FIELDCAT-EMPHASIZE = 'C600'.
APPEND ist_fieldcat.
CLEAR ist_fieldcat.
<i><b>Reward point if find helpful
Debjani</b></i> -
HI I AM NEW TO ABAP..CAN ANYONE PROVIDE WITH A STEP BY STEP GUIDE TO ALV PROGRAMMING AND MODULE POOL PROGRAMMING
Hi,
Please check this PDF documents.
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CAGTFLV/CAGTFLV.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf
Hope this will help to start with.
Regards,
Ferry Lianto
Please reward points if helpful. -
Adding color to few rows in ALV report output
Hi,
I have developed a ALV report program which displays the project details of the employees.In the output the rows containing the employees who have been part of the project should be displayed in different color.I have used necessary code for this but still the rows are not displayed in different color.
Given below is my program.Please suggest me possible solution for this.
REPORT ZPROJ_ALL_DETAILS.
TYPE-POOLS: SLIS.
Tables: zheempl,zhealoc,zheproj,zheskil.
types: begin of ty_zheempl,
empid like zheempl-empid,
grade like zheempl-grade,
location like zheempl-location,
pu like zheempl-pu,
name1 like zheempl-name1,
end of ty_zheempl.
types: begin of ty_zhealoc,
project like zhealoc-project,
stdat like zhealoc-stdat,
endat like zhealoc-endat,
role like zhealoc-role,
end of ty_zhealoc.
types: begin of ty_output,
empid like zheempl-empid,
grade like zheempl-grade,
location like zheempl-location,
pu like zheempl-pu,
name1 like zheempl-name1,
role like zhealoc-role,
stdat like zhealoc-stdat,
endat like zhealoc-endat,
cellcolor(4) type c,
end of ty_output.
data: t_zheempl type standard table of ty_zheempl,
t_zhealoc type standard table of ty_zhealoc,
t_output type standard table of ty_output with header line.
data: wa_zheempl type ty_zheempl,
wa_zhealoc type ty_zhealoc,
wa_output type ty_output.
DATA : T_FIELDCAT TYPE slis_t_fieldcat_alv.
Data : wa_fieldcat type slis_fieldcat_alv.
Data: it_top TYPE slis_t_listheader,
wa_top TYPE slis_listheader.
Data: t_cellcolor TYPE lvc_t_scol WITH HEADER LINE,
wa_cellcolor TYPE lvc_s_scol.
Data: t_layout TYPE slis_layout_alv.
*selection-screen
selection-screen: begin of block b1 with frame title text-001.
select-options: s_proj for wa_zhealoc-project,
s_empid for wa_zheempl-empid.
parameters: p_date like sy-datum obligatory.
selection-screen: end of block b1.
selection-screen: begin of block b2 with frame title text-002.
parameters: p_prtosr radiobutton group g1 default 'X',
p_prusly radiobutton group g1.
selection-screen: end of block b2.
selection-screen: begin of block b3 with frame title text-003.
parameters: p_dwtodk as checkbox default 'X'.
selection-screen: end of block b3.
selection-screen: begin of block b4 with frame title text-004.
parameters: p_shwhis as checkbox default 'X'.
selection-screen: end of block b4.
Start-of-selection
IF p_shwhis = 'X'.
SELECT l~empid
l~grade
l~location
l~pu
l~name1
c~role
c~stdat
c~endat
INTO TABLE t_output
FROM ( zheempl AS l
INNER JOIN zhealoc
AS c ON lempid = cempid )
where project IN s_proj
AND endat < p_date
OR endat > p_date.
t_output-cellcolor = 'C310'.
MODIFY t_output transporting cellcolor where endat < p_date.
ELSE.
select l~empid
l~grade
l~location
l~pu
l~name1
c~role
c~stdat
c~endat
INTO TABLE t_output
FROM ( zheempl AS l
INNER JOIN zhealoc
AS c ON lempid = cempid )
WHERE project in s_proj
AND endat > p_date.
ENDIF.
wa_fieldcat-col_pos = '1'.
wa_fieldcat-tabname = 't_output'.
wa_fieldcat-fieldname = 'EMPID'.
wa_fieldcat-seltext_m = 'Employee ID'.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat to t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '2'.
wa_fieldcat-tabname = 't_output'.
wa_fieldcat-fieldname = 'NAME1'.
wa_fieldcat-seltext_m = 'Name 1'.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat to t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '3'.
wa_fieldcat-tabname = 't_output'.
wa_fieldcat-fieldname = 'ROLE'.
wa_fieldcat-seltext_m = 'Role of employee in the project'.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat to t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '4'.
wa_fieldcat-tabname = 't_output'.
wa_fieldcat-fieldname = 'STDAT'.
wa_fieldcat-seltext_m = 'Start Date'.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat to t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '5'.
wa_fieldcat-tabname = 't_output'.
wa_fieldcat-fieldname = 'ENDAT'.
wa_fieldcat-seltext_m = 'End Date'.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat to t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '6'.
wa_fieldcat-tabname = 't_output'.
wa_fieldcat-fieldname = 'GRADE'.
wa_fieldcat-seltext_m = 'Salary Level'.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat to t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '7'.
wa_fieldcat-tabname = 't_output'.
wa_fieldcat-fieldname = 'PU'.
wa_fieldcat-seltext_m = 'Department Number'.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat to t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '8'.
wa_fieldcat-tabname = 't_output'.
wa_fieldcat-fieldname = 'LOCATION'.
wa_fieldcat-seltext_m = 'Work Location'.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat to t_fieldcat.
CLEAR wa_fieldcat.
t_layout-no_input = 'X'.
t_layout-colwidth_optimize = 'x'.
t_layout-info_fieldname = 'LINE_COLOR'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
i_callback_top_of_page = 'TOP'
is_layout = t_layout
IT_FIELDCAT = T_FIELDCAT
i_save = 'X'
TABLES
t_outtab = T_OUTPUT
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Form top.
Refresh it_top.
wa_top-typ = 'S'.
wa_top-key = 'Requestor'.
wa_top-info = sy-uname.
APPEND wa_top to it_top.
CLEAR wa_top.
wa_top-typ = 'S'.
wa_top-key = 'Program'.
wa_top-info = sy-repid.
APPEND wa_top to it_top.
CLEAR wa_top.
wa_top-typ = 'S'.
wa_top-key = 'Page'.
wa_top-info = sy-pagno.
APPEND wa_top to it_top.
CLEAR wa_top.
wa_top-typ = 'S'.
wa_top-key = 'Date'.
wa_top-info = sy-datum.
APPEND wa_top to it_top.
CLEAR wa_top.
wa_top-typ = 'H'.
wa_top-info = 'Project Details'.
APPEND wa_top to it_top.
CLEAR wa_top.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_top.
ENDFORM.{ REPORT ZPROJ_ALL_DETAILS.
TYPE-POOLS: SLIS.
Tables: zheempl,zhealoc,zheproj,zheskil.
types: begin of ty_zheempl,
empid like zheempl-empid,
grade like zheempl-grade,
location like zheempl-location,
pu like zheempl-pu,
name1 like zheempl-name1,
end of ty_zheempl.
types: begin of ty_zhealoc,
project like zhealoc-project,
stdat like zhealoc-stdat,
endat like zhealoc-endat,
role like zhealoc-role,
end of ty_zhealoc.
types: begin of ty_output,
empid like zheempl-empid,
grade like zheempl-grade,
location like zheempl-location,
pu like zheempl-pu,
name1 like zheempl-name1,
role like zhealoc-role,
stdat like zhealoc-stdat,
endat like zhealoc-endat,
cellcolor(4) type c,
end of ty_output.
data: t_zheempl type standard table of ty_zheempl,
t_zhealoc type standard table of ty_zhealoc,
t_output type standard table of ty_output with header line,
t_output1 type standard table of ty_output with header line.
data: wa_zheempl type ty_zheempl,
wa_zhealoc type ty_zhealoc,
wa_output type ty_output,
wa_output1 type ty_output.
DATA : T_FIELDCAT TYPE slis_t_fieldcat_alv.
Data : wa_fieldcat type slis_fieldcat_alv.
Data: it_top TYPE slis_t_listheader,
wa_top TYPE slis_listheader.
Data: t_cellcolor TYPE lvc_t_scol WITH HEADER LINE,
wa_cellcolor TYPE lvc_s_scol.
Data: t_layout TYPE slis_layout_alv.
*selection-screen
selection-screen: begin of block b1 with frame title text-001.
select-options: s_proj for wa_zhealoc-project,
s_empid for wa_zheempl-empid.
parameters: p_date like sy-datum obligatory.
selection-screen: end of block b1.
selection-screen: begin of block b2 with frame title text-002.
parameters: p_prtosr radiobutton group g1 default 'X',
p_prusly radiobutton group g1.
selection-screen: end of block b2.
selection-screen: begin of block b3 with frame title text-003.
parameters: p_dwtodk as checkbox default 'X'.
selection-screen: end of block b3.
selection-screen: begin of block b4 with frame title text-004.
parameters: p_shwhis as checkbox default 'X'.
selection-screen: end of block b4.
Start-of-selection
IF p_shwhis = 'X'.
SELECT l~empid
l~grade
l~location
l~pu
l~name1
c~role
c~stdat
c~endat
INTO TABLE t_output
FROM ( zheempl AS l
INNER JOIN zhealoc
AS c ON lempid = cempid )
where project IN s_proj
AND endat < p_date
OR endat > p_date.
t_output-cellcolor = 'C310'.
MODIFY t_output transporting cellcolor where endat < p_date.
ELSE.
select l~empid
l~grade
l~location
l~pu
l~name1
c~role
c~stdat
c~endat
INTO TABLE t_output
FROM ( zheempl AS l
INNER JOIN zhealoc
AS c ON lempid = cempid )
WHERE project in s_proj
AND endat > p_date.
ENDIF.
wa_fieldcat-col_pos = '1'.
wa_fieldcat-tabname = 't_output'.
wa_fieldcat-fieldname = 'EMPID'.
wa_fieldcat-seltext_m = 'Employee ID'.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat to t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '2'.
wa_fieldcat-tabname = 't_output'.
wa_fieldcat-fieldname = 'NAME1'.
wa_fieldcat-seltext_m = 'Name 1'.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat to t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '3'.
wa_fieldcat-tabname = 't_output'.
wa_fieldcat-fieldname = 'ROLE'.
wa_fieldcat-seltext_m = 'Role of employee in the project'.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat to t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '4'.
wa_fieldcat-tabname = 't_output'.
wa_fieldcat-fieldname = 'STDAT'.
wa_fieldcat-seltext_m = 'Start Date'.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat to t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '5'.
wa_fieldcat-tabname = 't_output'.
wa_fieldcat-fieldname = 'ENDAT'.
wa_fieldcat-seltext_m = 'End Date'.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat to t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '6'.
wa_fieldcat-tabname = 't_output'.
wa_fieldcat-fieldname = 'GRADE'.
wa_fieldcat-seltext_m = 'Salary Level'.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat to t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '7'.
wa_fieldcat-tabname = 't_output'.
wa_fieldcat-fieldname = 'PU'.
wa_fieldcat-seltext_m = 'Department Number'.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat to t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '8'.
wa_fieldcat-tabname = 't_output'.
wa_fieldcat-fieldname = 'LOCATION'.
wa_fieldcat-seltext_m = 'Work Location'.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat to t_fieldcat.
CLEAR wa_fieldcat.
t_layout-no_input = 'X'.
t_layout-colwidth_optimize = 'x'.
t_layout-info_fieldname = 'LINE_COLOR'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
i_callback_top_of_page = 'TOP'
is_layout = t_layout
IT_FIELDCAT = T_FIELDCAT
i_save = 'X'
TABLES
t_outtab = T_OUTPUT
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Form top.
Refresh it_top.
wa_top-typ = 'S'.
wa_top-key = 'Requestor'.
wa_top-info = sy-uname.
APPEND wa_top to it_top.
CLEAR wa_top.
wa_top-typ = 'S'.
wa_top-key = 'Program'.
wa_top-info = sy-repid.
APPEND wa_top to it_top.
CLEAR wa_top.
wa_top-typ = 'S'.
wa_top-key = 'Page'.
wa_top-info = sy-pagno.
APPEND wa_top to it_top.
CLEAR wa_top.
wa_top-typ = 'S'.
wa_top-key = 'Date'.
wa_top-info = sy-datum.
APPEND wa_top to it_top.
CLEAR wa_top.
wa_top-typ = 'H'.
wa_top-info = 'Project Details'.
APPEND wa_top to it_top.
CLEAR wa_top.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_top.
ENDFORM.} -
Problem in ALV report o/p to Excel
Hi to all
I have developed an ALV report, which is showing correct display and out put.
But when I am downloading it to excel, o/p is not coming in proper way. Fields are misplaced from there actual place and not in readable condition.
Please guide me..
Regards
AnubhavHello Lakshmiraj
I am sending you the coding of my ALV report program.
Please check.
REgards
Anubhav
*& Report YRMR033_AMENDMENT_ORDER_LIST
*& DEVELOPER : ANUBHAV GUPTA
*& DATE : 21.03.2008
*& REPORT DESCRIPTION : REPORT TO DISPLAY AMENDMENTS IN PURCDHASE ORDERS
WITH OLD VALUES AND NEW VALUES.
REPORT YRMR033_AMENDMENT_ORDER_LIST LINE-SIZE 132 NO STANDARD PAGE HEADING
LINE-COUNT 065(001)
MESSAGE-ID VR.
TABLES: DD04T,
CDHDR,
CDPOS,
DD03L,
DD41V,
T685T,
VBPA,
TPART,
KONVC,
EKKO.
TABLES : NAST, LFA1,ekpo.
SELECT-OPTIONS: "XUDATE FOR nast-erdat OBLIGATORY, "Created on date
XUDATE FOR CDHDR-UDATE OBLIGATORY, "Amendment date
S_EKGRP FOR EKKO-EKGRP,
s_lifnr for ekko-lifnr.
SELECTION-SCREEN SKIP.
DATA: WFLAG,
WCHANGENR LIKE CDHDR-CHANGENR.
DATA: INDTEXT(60) TYPE C.
DATA: BEGIN OF ICDHDR OCCURS 50.
INCLUDE STRUCTURE CDHDR.
DATA: END OF ICDHDR.
DATA: BEGIN OF ICDSHW OCCURS 50.
INCLUDE STRUCTURE CDSHW.
DATA: END OF ICDSHW.
DATA: BEGIN OF EKKEY,
EBELN LIKE EKET-EBELN,
EBELP LIKE EKET-EBELP,
ETENR LIKE EKET-ETENR,
END OF EKKEY.
DATA: BEGIN OF ITAB OCCURS 50,
BEGIN OF EKKEY,
EBELN LIKE EKET-EBELN,
EBELP LIKE EKET-EBELP,
ETENR LIKE EKET-ETENR,
END OF EKKEY,
ebeln like ekko-ebeln,
ebelp like ekpo-ebelp,
CHANGENR LIKE CDHDR-CHANGENR,
UDATE LIKE CDHDR-UDATE,
UTIME LIKE CDHDR-UTIME,
USERNAME LIKE CDHDR-USERNAME,
CHNGIND LIKE CDSHW-CHNGIND,
FNAME LIKE CDSHW-FNAME, "ADDED BY ANUBHAV
FTEXT LIKE CDSHW-FTEXT,
OUTLEN LIKE CDSHW-OUTLEN,
F_OLD LIKE CDSHW-F_OLD,
F_NEW LIKE CDSHW-F_NEW,
END OF ITAB.
DATA : BEGIN OF ITAB1 OCCURS 0,
EBELN LIKE EKET-EBELN,
bedat like ekko-bedat,
EBELP LIKE EKET-EBELP,
txz01 like ekpo-txz01,
lifnr like ekko-lifnr,
name1 like lfa1-name1,
UDATE LIKE CDHDR-UDATE,
FTEXT LIKE CDSHW-FTEXT,
F_OLD LIKE CDSHW-F_OLD,
ekgrp like ekko-ekgrp,
F_NEW LIKE CDSHW-F_NEW,
CHANGENR LIKE CDHDR-CHANGENR,
UTIME LIKE CDHDR-UTIME,
USERNAME LIKE CDHDR-USERNAME,
CHNGIND LIKE CDSHW-CHNGIND,
FNAME LIKE CDSHW-FNAME, "ADDED BY ANUBHAV
OUTLEN LIKE CDSHW-OUTLEN,
AMDNO TYPE CHAR4,
END OF ITAB1.
DATA: OLD_OBJECTID LIKE CDHDR-OBJECTID.
INTERNAL TABLES
----"modification
DATA: BEGIN OF I_NAST OCCURS 0,
OBJKY TYPE NAST-OBJKY,
ERDAT TYPE NAST-ERDAT,
KAPPL TYPE NAST-KAPPL,
KSCHL TYPE NAST-KSCHL,
PARVW TYPE NAST-PARVW,
PARNR TYPE NAST-PARNR,
ERUHR TYPE NAST-ERUHR,
AMDNO TYPE CHAR4,
EBELN TYPE EKKO-EBELN,
END OF I_NAST.
DATA : I_NAST1 LIKE TABLE OF I_NAST WITH HEADER LINE.
DATA: BEGIN OF I_TAB OCCURS 0,
OBJKY TYPE NAST-OBJKY,
ERDAT TYPE NAST-ERDAT,
KAPPL TYPE NAST-KAPPL,
KSCHL TYPE NAST-KSCHL,
PARVW TYPE NAST-PARVW,
PARNR TYPE NAST-PARNR,
ERUHR TYPE NAST-ERUHR,
END OF I_TAB.
DATA: INDEX TYPE I.
TYPE-POOLS : SLIS.
ALV Declarations *
DATA: W_REPID LIKE SY-REPID,
P_I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
P_I_HEADING TYPE SLIS_T_LISTHEADER,
I_LAYOUT TYPE SLIS_LAYOUT_ALV,
I_EVENTS TYPE SLIS_T_EVENT,
I_HEADING TYPE SLIS_T_LISTHEADER.
DATA: WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
SR TYPE I.
INITIALIZATION----
INITIALIZATION.
CLEAR I_NAST.
CLEAR I_TAB.
REFRESH I_NAST.
REFRESH I_TAB.
AT SELECTIN SCREEN----
AT SELECTION-SCREEN.
PERFORM DATA_VALIDATION.
TOP OF PAGE----
TOP-OF-PAGE.
PERFORM TOP_OF_PAGE.
END OF PAGE----
END-OF-PAGE.
START OF SELECTION----
START-OF-SELECTION.
PERFORM BUILD_COMMENT USING I_HEADING.
PERFORM EVENT_BUILD CHANGING I_EVENTS.
SELECT * FROM EKKO . " WHERE EBELN IN XEBELN AND
*LIFNR IN XLIFNR.
CLEAR CDHDR.
CLEAR CDPOS.
CDHDR-OBJECTCLAS = 'EINKBELEG'.
CDHDR-OBJECTID = EKKO-EBELN.
PERFORM GETCHGDOCS.
ENDSELECT.
DELETE ITAB WHERE ( FNAME NE 'NETPR'
AND FNAME NE 'NETWR'
AND FNAME NE 'MENGE' ).
loop at itab.
read table itab.
itab-ebeln = itab-ekkey+0(10).
itab-ebelp = itab-ekkey+11(4).
modify itab.
endloop.
LOOP AT ITAB.
MOVE-CORRESPONDING ITAB TO ITAB1.
APPEND ITAB1.
ENDLOOP.
LOOP AT ITAB1.
SELECT OBJKY ERDAT KAPPL KSCHL PARVW PARNR ERUHR
FROM NAST
INTO CORRESPONDING FIELDS OF TABLE I_NAST
WHERE OBJKY = ITAB1-EBELN
AND KAPPL = 'EF'
AND KSCHL = 'ZNEU'
AND PARVW = 'LF'
AND SPRAS = SY-LANGU.
IF SY-SUBRC NE 0.
DELETE ITAB1.
ENDIF.
LOOP AT I_NAST.
MOVE-CORRESPONDING I_NAST TO I_NAST1.
APPEND I_NAST1.
ENDLOOP.
ENDLOOP.
SORT I_NAST1 BY OBJKY ASCENDING ERDAT DESCENDING ERUHR DESCENDING.
DELETE ADJACENT DUPLICATES FROM I_NAST1 COMPARING OBJKY.
* Select data from TABLE NAST to get ebeln before selected date
IF I_NAST1[] IS NOT INITIAL.
SELECT OBJKY ERDAT KAPPL KSCHL PARVW PARNR ERUHR
FROM NAST
INTO CORRESPONDING FIELDS OF TABLE I_TAB
FOR ALL ENTRIES IN I_NAST1
WHERE OBJKY = I_NAST1-OBJKY
AND ERDAT <= I_NAST1-ERDAT
AND PARNR = I_NAST1-PARNR
AND KAPPL = 'EF'
AND KSCHL = 'ZNEU'
AND PARVW = 'LF'
AND SPRAS = SY-LANGU.
ENDIF.
Logic to get no of amendments for one po
LOOP AT I_NAST1.
CLEAR INDEX.
LOOP AT I_TAB WHERE OBJKY = I_NAST1-OBJKY.
INDEX = INDEX + 1.
ENDLOOP.
I_NAST1-AMDNO = INDEX - 1.
I_NAST1-EBELN = I_NAST1-OBJKY.
MODIFY I_NAST1 TRANSPORTING AMDNO EBELN.
ENDLOOP.
*LOOP AT I_NAST1.
*READ TABLE ITAB1 WITH KEY EBELN = I_NAST1-EBELN.
*IF SY-SUBRC = 0.
*ITAB1-AMDNO = I_NAST1-AMDNO.
*MODIFY ITAB1 TRANSPORTING AMDNO .
*ENDIF.
*ENDLOOP.
DELETE I_NAST1 WHERE AMDNO = 0. "ADDED BY ANUBHAV
LOOP AT ITAB1.
READ TABLE I_NAST1 WITH KEY EBELN = ITAB1-EBELN.
IF SY-SUBRC NE 0.
DELETE ITAB1.
ENDIF.
ENDLOOP.
loop at itab1.
select single *
from ekko
into ekko
where ebeln = itab1-ebeln.
if sy-subrc = 0.
itab1-bedat = ekko-bedat.
itab1-lifnr = ekko-lifnr.
itab1-ekgrp = ekko-ekgrp.
modify itab1.
endif.
endloop.
DELETE ITAB1 WHERE EKGRP NOT IN S_EKGRP.
DELETE ITAB1 WHERE LIFNR NOT IN S_LIFNR.
loop at itab1.
select single *
from lfa1
into lfa1
where lifnr = itab1-lifnr.
if sy-subrc = 0.
itab1-name1 = lfa1-name1.
modify itab1.
endif.
endloop.
loop at itab1.
select single *
from ekpo
into ekpo
where ebeln = itab1-ebeln
and ebelp = itab1-ebelp.
if sy-subrc = 0.
itab1-txz01 = ekpo-txz01.
modify itab1.
endif.
endloop.
sort itab1 by udate descending ebeln ebelp.
building field catelogue
ADD 1 TO SR.
WA_FIELDCAT-COL_POS = SR.
WA_FIELDCAT-ROW_POS = 1.
WA_FIELDCAT-TABNAME = 'Itab1'.
WA_FIELDCAT-JUST = 'L' .
WA_FIELDCAT-FIELDNAME = 'EBELN'.
WA_FIELDCAT-SELTEXT_L = 'PO NO '.
APPEND WA_FIELDCAT TO P_I_FIELDCAT.
CLEAR WA_FIELDCAT.
ADD 1 TO SR.
WA_FIELDCAT-COL_POS = SR.
WA_FIELDCAT-ROW_POS = 1.
WA_FIELDCAT-TABNAME = 'Itab1'.
WA_FIELDCAT-JUST = 'L' .
WA_FIELDCAT-FIELDNAME = 'BEDAT'.
WA_FIELDCAT-SELTEXT_L = 'PO DATE '.
APPEND WA_FIELDCAT TO P_I_FIELDCAT.
CLEAR WA_FIELDCAT.
ADD 1 TO SR.
WA_FIELDCAT-COL_POS = SR.
WA_FIELDCAT-ROW_POS = 1.
WA_FIELDCAT-TABNAME = 'Itab1'.
WA_FIELDCAT-JUST = 'L' .
WA_FIELDCAT-FIELDNAME = 'EBELP'.
WA_FIELDCAT-SELTEXT_L = 'Item No '.
APPEND WA_FIELDCAT TO P_I_FIELDCAT.
CLEAR WA_FIELDCAT.
ADD 1 TO SR.
WA_FIELDCAT-COL_POS = SR.
WA_FIELDCAT-ROW_POS = 1.
WA_FIELDCAT-TABNAME = 'Itab1'.
WA_FIELDCAT-JUST = 'L' .
WA_FIELDCAT-FIELDNAME = 'TXZ01'.
WA_FIELDCAT-SELTEXT_L = 'Item Description'.
APPEND WA_FIELDCAT TO P_I_FIELDCAT.
CLEAR WA_FIELDCAT.
ADD 1 TO SR.
WA_FIELDCAT-COL_POS = SR.
WA_FIELDCAT-ROW_POS = 1.
WA_FIELDCAT-TABNAME = 'Itab1'.
WA_FIELDCAT-JUST = 'L' .
WA_FIELDCAT-FIELDNAME = 'LIFNR'.
WA_FIELDCAT-SELTEXT_L = 'Vendor NO '.
APPEND WA_FIELDCAT TO P_I_FIELDCAT.
CLEAR WA_FIELDCAT.
ADD 1 TO SR.
WA_FIELDCAT-COL_POS = SR.
WA_FIELDCAT-ROW_POS = 1.
WA_FIELDCAT-TABNAME = 'Itab1'.
WA_FIELDCAT-JUST = 'L' .
WA_FIELDCAT-FIELDNAME = 'NAME1'.
WA_FIELDCAT-SELTEXT_L = 'Vendor Name'.
APPEND WA_FIELDCAT TO P_I_FIELDCAT.
CLEAR WA_FIELDCAT.
ADD 1 TO SR.
WA_FIELDCAT-COL_POS = SR.
WA_FIELDCAT-ROW_POS = 1.
WA_FIELDCAT-TABNAME = 'ITAB1'.
WA_FIELDCAT-JUST = 'L' .
WA_FIELDCAT-FIELDNAME = 'UDATE'.
WA_FIELDCAT-SELTEXT_L = 'Amendment Date'.
APPEND WA_FIELDCAT TO P_I_FIELDCAT.
CLEAR WA_FIELDCAT.
ADD 1 TO SR.
WA_FIELDCAT-COL_POS = SR.
WA_FIELDCAT-ROW_POS = 1.
WA_FIELDCAT-TABNAME = 'ITAB1'.
WA_FIELDCAT-JUST = 'L' .
WA_FIELDCAT-FIELDNAME = 'FTEXT'.
WA_FIELDCAT-SELTEXT_l = 'Change Field Description'.
WA_FIELDCAT-just = 'L'.
APPEND WA_FIELDCAT TO P_I_FIELDCAT.
CLEAR WA_FIELDCAT.
ADD 1 TO SR.
WA_FIELDCAT-COL_POS = SR.
WA_FIELDCAT-ROW_POS = 1.
WA_FIELDCAT-TABNAME = 'ITAB1'.
WA_FIELDCAT-JUST = 'L' .
WA_FIELDCAT-FIELDNAME = 'F_OLD'.
WA_FIELDCAT-SELTEXT_L = 'Old Value '.
APPEND WA_FIELDCAT TO P_I_FIELDCAT.
CLEAR WA_FIELDCAT.
ADD 1 TO SR.
WA_FIELDCAT-COL_POS = SR.
WA_FIELDCAT-ROW_POS = 1.
WA_FIELDCAT-TABNAME = 'ITAB1'.
WA_FIELDCAT-JUST = 'L' .
WA_FIELDCAT-FIELDNAME = 'F_NEW'.
WA_FIELDCAT-JUST = 'L' .
WA_FIELDCAT-SELTEXT_L = 'New Value '.
APPEND WA_FIELDCAT TO P_I_FIELDCAT.
CLEAR WA_FIELDCAT.
DATA : L_REPID TYPE SYREPID,
L_REPID1 LIKE DISVARIANT.
L_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = 'X'
I_CALLBACK_PROGRAM = L_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = P_I_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = 'X'
IS_VARIANT = L_REPID1
IT_EVENTS = I_EVENTS
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = ITAB1[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*& Form GETCHGDOCS
text
FORM GETCHGDOCS.
CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'
EXPORTING
DATE_OF_CHANGE = CDHDR-UDATE
OBJECTCLASS = CDHDR-OBJECTCLAS
OBJECTID = CDHDR-OBJECTID
TIME_OF_CHANGE = CDHDR-UTIME
USERNAME = CDHDR-USERNAME
TABLES
I_CDHDR = ICDHDR
EXCEPTIONS
NO_POSITION_FOUND = 1
OTHERS = 2.
CHECK SY-SUBRC EQ 0.
DELETE ICDHDR WHERE CHANGE_IND EQ 'I'.
CHECK NOT ICDHDR[] IS INITIAL.
LOOP AT ICDHDR.
CHECK ICDHDR-UDATE IN XUDATE.
CHECK ICDHDR-USERNAME IN XNAME.
CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'
EXPORTING
CHANGENUMBER = ICDHDR-CHANGENR
IMPORTING
HEADER = CDHDR
TABLES
EDITPOS = ICDSHW
EXCEPTIONS
NO_POSITION_FOUND = 1
OTHERS = 2.
CHECK SY-SUBRC EQ 0.
DELETE ICDSHW WHERE ( CHNGIND NE 'U' OR TABNAME NE 'EKPO' ).
LOOP AT ICDSHW.
CHECK ICDSHW-TEXT_CASE EQ SPACE.
MOVE-CORRESPONDING ICDSHW TO ITAB.
MOVE-CORRESPONDING ICDHDR TO ITAB.
MOVE ICDSHW-TABKEY+3 TO ITAB-EKKEY.
APPEND ITAB.
ENDLOOP.
ENDLOOP.
ENDFORM. "GETCHGDOCS
*& Form BUILD_COMMENT
text
-->P_I_HEADING text
FORM BUILD_COMMENT USING P_I_HEADING TYPE SLIS_T_LISTHEADER.
DATA: WA_LINE TYPE SLIS_LISTHEADER,
TEXT1(50) TYPE C,
TEXT2(40) TYPE C,
W_DATE1(10) TYPE C,
W_DATE2(10) TYPE C.
CONCATENATE ' CHAMBAL FERTILISERS AND CHEMICALS LIMITED' ' ' INTO TEXT1.
WA_LINE-TYP = 'H'.
WA_LINE-INFO = TEXT1.
APPEND WA_LINE TO P_I_HEADING.
CLEAR TEXT1.
CONCATENATE ' AMENDED ORDERS' ' ' INTO TEXT1.
WA_LINE-TYP = 'S'.
WA_LINE-INFO = TEXT1.
APPEND WA_LINE TO P_I_HEADING.
write xudate-low to w_date1 DD/MM/YYYY .
write xudate-high to w_date2 DD/MM/YYYY .
concatenate 'PERIOD FROM : ' W_DATE1 ' TO ' W_DATE2 INTO TEXT2 SEPARATED BY SPACE.
WA_LINE-TYP = 'S'.
WA_LINE-INFO = TEXT2.
APPEND WA_LINE TO P_I_HEADING.
ENDFORM. " build_comment
*& Form EVENT_BUILD
text
-->P_I_EVENTS text
FORM EVENT_BUILD CHANGING P_I_EVENTS TYPE SLIS_T_EVENT.
DATA: W_EVENT TYPE SLIS_ALV_EVENT.
CONSTANTS:
GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = P_I_EVENTS.
READ TABLE P_I_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO W_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_TOP_OF_PAGE TO W_EVENT-FORM.
APPEND W_EVENT TO P_I_EVENTS.
ENDIF.
ENDFORM. " event_build
*& Form TOP_OF_PAGE
text
FORM TOP_OF_PAGE .
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = I_HEADING
I_LOGO = 'CFCLLOGO'.
ENDFORM. " top_of_page -
hi,
I have written an ABAP report using ALV . We need to add a button to the menu bar of the screen that appears after the report is run, not on the selection screen. And when report is executed user will choose for example STOCK then it has to go to the transaction(QA03).
thanks in advance.
Anu.Hi,
Goto SE41, create a pf-status for your alv report program.
On the next screen, click menu EXTRAS --> click option ADJUST TEMPLATES and select radiobutton LIST VIEWER --> you will get all standard buttons of alv in the pf-status.
Delete the unwanted buttons and also you can add new buttons if reqd.
Activate pf-status --> and apply in alv program.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_rep_id " report id
i_callback_pf_status_set = 'PF' " for PF-STATUS
i_callback_user_command = 'USER_COMMAND' " for User-Command
is_layout = wa_layout " for layout
it_fieldcat = it_field " field catalog
it_sort = it_sort " sort info
TABLES
t_outtab = it_final " internal table
EXCEPTIONS
program_error = 1
OTHERS = 2.
*& Form pf
* SUB-ROUTINE PF IS USED TO SET THE PF-STATUS OF THE SCREEN
* ON WHICH THE ALV GRID IS DISPLAYED
* -->RT_EXTAB
FORM pf USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZTG_STAT'.
ENDFORM. "pf
*& Form USER_COMMAND
* SUB-ROUTINE USER_COMMAND IS USED TO HANDLE THE USER ACTION
* AND EXECUTE THE APPROPIATE CODE
* -->LV_OKCODE used to capture the function code
* of the user-defined push-buttons
* -->L_SELFIELD text
FORM user_command USING lv_okcode LIKE sy-ucomm l_selfield TYPE slis_selfield.
* assign the function code to variable v_okcode
lv_okcode = sy-ucomm.
* handle the code execution based on the function code encountered
CASE lv_okcode.
* when the function code is STOCK
WHEN 'STOCK'.
SET PARAMETER ID '<param_id>' FIELD '<field_value>'.
CALL TRANSACTION 'QA03' AND SKIP FIRST SCREEN.
ENDCASE.
ENDFORM. "USER_COMMAND
Hope this helps you.
Regards,
Tarun -
How to restrict the users in ALV Report
HI Experts,
I have a requirement that in an ALV report i have 10colums in the otput of an alv report program now if i want the 5 users to see only the 4 column and if i want the other users to see only 3colums how can we do thal please help me on this
Thanks in advance.Hi,
We can simply Hide those columns in Fieldcat settings According to User Name
But those columns again appear if the Layout Settings are changed in ALV.
So,Fill that field cat according to User login i.e, one structure with 4 columns and
other structure with 3 columns.
data : begin of itab occurs 0,
a type i,
b type i,
c type i,
d type i,
e type i,
end of itab.
*Here I am filling Fieldcat According to user names and
* FILL_FIELDCAT is a Subroutine write your code to fill Fieldcat
if sy-uname = 'DDIC'.
perform fill_fcat using a.
perform fill_fcat using b.
elseif sy-uname = 'SAP*'.
perform fill_fcat using a.
perform fill_fcat using b.
perform fill_fcat using c.
perform fill_fcat using d.
elseif sy-uname = 'SAPUSER'.
perform fill_fcat using a.
perform fill_fcat using b.
perform fill_fcat using c.
perform fill_fcat using d.
perform fill_fcat using e.
endif.
Regards,
Raghava Channooru -
How to resolve the error in bdc call transaction in ALV report
Dear Experts, i am executing the alv report program and in alv report program one bdc is there..
after executing output is showing in alv format but one button is there (update master)..when i am clicking update button the bdc is run but is not updated in the material master..after executing my bdc is not updated in mm02.
how to resove it?
CALL TRANSACTION 'MM02' USING BDCDATA MODE MODE
UPDATE 'S'
MESSAGES INTO MESSTAB.Hi Kaustav,
Looking at the code you attached, it appears to me that your BDC (Form USER_COMMAND) is not executed at all as you haven't passed the 'USER_COMMAND' in FM REUSE_ALV_GRID_DISPLAY for ALV display.
You must pass the importing parameter I_CALLBACK_USER_COMMAND of this FM as 'USER_COMMAND', only then this form will be executed and your BDC will run.
Thereafter, in case your BDC update fails, you can put a break-point in the form (at CALL TRANSACTION statement) and analyze the message table MESSTAB.
Hope it helps.
Regards,
Sapeksh -
How to call the Report program into Function module
Hi Experts,
Actually I want to create the DataSource. But I have only the ALV report program. I need to create function module but I dont know how to call the ALV report program using in function module
So could you please any one send the Document or step by step method?
Advance Thanks,
SathisIf the report is just based out of a table than create a Generic Extractor using View.
If its an InfoSet query than create a Generic Extractor on that InfoSet.
If its an ABAP report than create a Generic Extractor using FM
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8df33 -
Hi frnds,
I want to write an alv report program using oops concepts.CAn anybody send me a simple code to generate an alv reports?
Thanks a lot in advance.Hi
http://www.sapdev.co.uk/reporting/alv/alvobjgrid/alvobject_sort.htm
*& Report ZLCL_ALV_INVOICE *
REPORT ZLCL_ALV_INVOICE .
TABLES: VBRK.
DATA: ITAB LIKE VBRP OCCURS 1 WITH HEADER LINE.
DATA: O_CONT TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
O_GRID TYPE REF TO CL_GUI_ALV_GRID.
START-OF-SELECTION.
SET SCREEN 100.
*& Form GET_DATA
text
FORM GET_DATA .
SELECT *
FROM VBRP
INTO TABLE ITAB
WHERE VBELN = VBRK-VBELN.
ENDFORM. " GET_DATA
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MENU'.
IF O_CONT IS INITIAL.
CREATE OBJECT O_CONT
EXPORTING
CONTAINER_NAME = 'INV_CONT' "Screen custom control name
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
OTHERS = 6
IF SY-SUBRC <> 0.
MESSAGE I000(Z00) WITH 'Error in custom container'.
EXIT.
ENDIF.
CREATE OBJECT O_GRID
EXPORTING
I_PARENT = O_CONT "Custom container class object
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE I000(Z00) WITH 'Error in alv grid linking'.
EXIT.
ENDIF.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module SHOW_ALV_GRID INPUT
text
MODULE SHOW_ALV_GRID INPUT.
PERFORM GET_DATA.
CALL METHOD O_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'VBRP'
CHANGING
IT_OUTTAB = ITAB[]
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
MESSAGE I000(Z00) WITH 'Error in showing alv grid'.
EXIT.
ENDIF.
ENDMODULE. " SHOW_ALV_GRID INPUT
you can understand very easily -
how can u maintain top-of -page end-of -page ,at-line selection,at user command all in one alv report program?
hi,
try like this
TYPE-POOLS : slis.
TABLES : mara,
makt,
marc.
DATA : BEGIN OF itab OCCURS 0,
matnr LIKE mara-matnr,
maktx LIKE makt-maktx,
werks LIKE marc-werks,
END OF itab.
DATA : t_fcat TYPE slis_t_fieldcat_alv,
t_eve TYPE slis_t_event,
st_line TYPE slis_listheader,
t_list_top_page TYPE slis_t_listheader,
t_list_end_page TYPE slis_t_listheader.
DATA : t_mat LIKE mara-matnr.
SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : mat FOR mara-matnr.
SELECTION-SCREEN : END OF BLOCK blk1.
INITIALIZATION.
PERFORM build_cat USING t_fcat.
PERFORM build_eve.
START-OF-SELECTION.
PERFORM get_data.
PERFORM build_header USING t_list_top_page[].
PERFORM build_footer USING t_list_end_page[].
PERFORM dis_data.
*& Form buils_cat
text
-->TEMP_FCAT text
FORM build_cat USING temp_fcat TYPE slis_t_fieldcat_alv.
DATA : wa_fcat TYPE slis_fieldcat_alv.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MATNR'.
wa_fcat-seltext_m = 'Material'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MAKTX'.
wa_fcat-seltext_m = 'Material Description'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'WERKS'.
wa_fcat-seltext_m = 'Plant'.
wa_fcat-row_pos = 2.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
ENDFORM. "build_cat
*& Form build_eve
text
FORM build_eve.
DATA : wa_eve TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = t_eve
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE t_eve INTO wa_eve WITH KEY name = 'END_OF_LIST'.
IF sy-subrc = 0.
wa_eve-form = 'END_OF_PAGE'.
MODIFY t_eve FROM wa_eve INDEX sy-tabix.
ENDIF.
ENDFORM. "build_eve
*& Form get_data
text
FORM get_data.
SELECT maramatnr maktmaktx marc~werks INTO CORRESPONDING FIELDS OF TABLE itab
FROM mara INNER JOIN makt ON
maramatnr = maktmatnr
INNER JOIN marc ON
maramatnr = marcmatnr
WHERE mara~matnr IN mat.
ENDFORM. "get_data
*& Form dis_data
text
FORM dis_data.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZALV_PRDS'
i_callback_user_command = 'USER_COMMAND'
i_callback_top_of_page = 'TOP_OF_PAGE'
it_fieldcat = t_fcat
i_save = 'A'
it_events = t_eve
TABLES
t_outtab = itab
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "dis_data
*& Form build_header
text
-->TEMP_LIST text
-->TTYPE text
-->SLIS_T_LISTHEADER text
FORM build_header USING temp_list TYPE slis_t_listheader.
CLEAR st_line.
st_line-typ = 'H'.
st_line-info = 'Material Info'.
APPEND st_line TO temp_list.
CLEAR st_line.
st_line-typ = 'H'.
st_line-info = '----
APPEND st_line TO temp_list.
CLEAR st_line.
st_line-typ = 'H'.
st_line-info = 'Material Info1'.
APPEND st_line TO temp_list.
ENDFORM. "build_header
*& Form build_footer
text
-->TEMP_LIST text
FORM build_footer USING temp_list TYPE slis_t_listheader.
CLEAR st_line.
st_line-typ = 'H'.
st_line-info = 'Dhwani Shah'.
APPEND st_line TO temp_list.
ENDFORM. "build_header
*& Form top_Of_page
text
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_list_top_page.
ENDFORM. "top_Of_page
*& Form end_of_page
text
FORM end_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_list_end_page.
ENDFORM. "end_of_page
*& Form user_command
text
FORM user_command USING u_com LIKE sy-ucomm sel_field TYPE slis_selfield.
CASE u_com.
WHEN '&IC1'.
IF sel_field-fieldname = 'MATNR'.
READ TABLE itab INDEX sel_field-tabindex.
IF sy-subrc = 0.
t_mat = itab-matnr.
SET PARAMETER ID 'MAT' FIELD t_mat.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
ENDIF.
ENDIF.
ENDCASE.
ENDFORM. "user_command
In this
END-OF-page, top-of-page, user_commamnd (&IC1 for double click like line selection) used
reward if usefull. -
How to call an alv report from another program and return back
Hello ,
I am calling one abap program (Prgm B) from another program (Prgrm A).
Here, Prgm B is an ALV report. I have fetch some data from Prgem B that gets stored in an internal table.
Now, I am using below code in Prgrm A,
SUBMIT Prgrm B VIA SELECTION-SCREEN
WITH SELECTION-TABLE rspar
EXPORTING LIST TO MEMORY
AND RETURN.
When Prgrm A executed, it lead me to selection screen of Prgrm B and when I click F8, it shows me the report output, In short, it doesnt return back to Prgrm A. It ends up showing me the alv report if Prgrm B even afetr using RETURN statement.
I want to get back to Prgrm A by fetching some data from Prgrm B.
Please let me know, if i am missing something.
Regards,
SeemaHi Seema,
Refer below code.
DATA: v_matnr LIKE mara-matnr.
DATA: t_listobject TYPE abaplist OCCURS 0 WITH HEADER LINE.
DATA: t_mara TYPE mara OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF t_ascilist OCCURS 0,
line(200).
DATA: END OF t_ascilist.
data var(3) type c.
SELECT-OPTIONS: s_matnr FOR v_matnr.
var = ' 3'.
START-OF-SELECTION.
SUBMIT ztestaks1 WITH s_matnr IN s_matnr EXPORTING LIST TO MEMORY
AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = t_listobject
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
CALL FUNCTION 'LIST_TO_ASCI'
* EXPORTING
* LIST_INDEX = -1
* WITH_LINE_BREAK = ' '
TABLES
listasci = t_ascilist
listobject = t_listobject
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
WRITE:/ 'Below are the lines from the submitted program.'.
LOOP AT t_ascilist.
WRITE:/ t_ascilist-line.
ENDLOOP.
SKIP 2.
ENDIF.
ENDIF.
IMPORT t_mara FROM MEMORY ID 'T_MARA'.
WRITE:/
'Here is the output from the table exported from the submitted program.'
LOOP AT t_mara.
WRITE:/ t_mara-matnr.
ENDLOOP.
Submitted program
REPORT ZTESTAKS1.
DATA: v_matnr LIKE mara-matnr,
v_maktx LIKE makt-maktx.
DATA: t_mara TYPE mara OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF t_makt OCCURS 0,
matnr LIKE makt-matnr.
DATA: END OF t_makt.
SELECT-OPTIONS: s_matnr FOR v_matnr,
s_maktx FOR v_maktx.
START-OF-SELECTION.
SELECT matnr INTO TABLE t_makt
FROM makt
WHERE matnr IN s_matnr
AND maktx IN s_maktx.
if not t_makt[] is initial.
SELECT * FROM mara
INTO TABLE t_mara FOR ALL ENTRIES IN t_makt
WHERE matnr = t_makt-matnr.
endif.
EXPORT t_mara TO MEMORY ID 'T_MARA'.
WRITE:/ 'This list is from the submitted program'.
SKIP 1.
LOOP AT t_mara.
WRITE:/ t_mara-mtart.
ENDLOOP.
Hopes this helps you.
Thanks,
Ashok. -
Need a sample program for hierarchial oops ALV report
Hello experts,
I Need a sample program for hierarchial oops ALV report.Hi,
Check the following sample code...
T A B L E S
tables : ekko.
data definition
types : begin of ty_ekko,
ebeln type ekko-ebeln,
lifnr type ekko-lifnr,
bsart type ekko-bsart,
aedat type ekko-aedat,
ernam type ekko-ernam,
end of ty_ekko.
types : begin of ty_eket,
ebeln type ekpo-ebeln,
ebelp type ekpo-ebelp,
werks type ekpo-werks,
matnr type ekpo-matnr,
menge type eket-menge,
wamng type eket-wamng,
netpr type ekpo-netpr,
end of ty_eket.
data : it_ekko type table of ty_ekko,
it_eket type table of ty_eket.
data: ob_hieralv type ref to cl_salv_hierseq_table.
data: it_binding type salv_t_hierseq_binding,
is_binding type salv_s_hierseq_binding.
S E L C T O P T I O N S
select-options : s_ebeln for ekko-ebeln.
S T A R T O F S E L E C T I O N
start-of-selection.
select ebeln
lifnr
bsart
aedat
ernam from ekko
into corresponding fields of table it_ekko
where ebeln in s_ebeln.
if sy-subrc eq 0.
select aebeln aebelp
awerks amatnr
bmenge bwamng
a~netpr from ekpo as a join eket as b
on amandt = bmandt
and aebeln = bebeln
and aebelp = bebelp
into corresponding fields of table it_eket
where a~ebeln in s_ebeln.
endif.
is_binding-master = 'EBELN'.
is_binding-slave = 'EBELN'.
append is_binding to it_binding.
*TRY.
call method cl_salv_hierseq_table=>factory
exporting
t_binding_level1_level2 = it_binding
importing
r_hierseq = ob_hieralv
changing
t_table_level1 = it_ekko
t_table_level2 = it_eket .
*CATCH cx_salv_data_error .
*CATCH cx_salv_not_found .
*ENDTRY.
call method ob_hieralv->display( ).
Cheers,
Ram
Maybe you are looking for
-
I have restarted, reset, erased all data and network settings, tried different ports and different cords, restarted computers, reinstalled and updated iTunes... and now I cannot use my iPod at all. It is less than 6 months old, Apple won't help me on
-
Using iPhoto with time capsule
Can I use time capsule as a Network Hard Drive to place my all of my Photos, and keep the iPhoto config, events, places, faces???
-
Anyone has pointers to online comprehensive documentation on how to get started with Pro*C? The usual oracle documentation is still too much for me. I would like something explaining which headers and libs are involved, using short examples, and Make
-
Complaint on Macbook Air Repair - To whom this may concern
Complaint on Macbook Air Repair - To whom this may concern I would like to file a complaint through this community regarding my encounter with the Apple Hardware Repair Service in HongKong involving both Apple Technical Support in Hong Kong (Tel: 211
-
Hello, I'm new with FCX and I have watched many tutorials on the WEB. I have one question to make sure I'm doing this right. My main drive which is an SSD resides my OS and Home folder, however all movies (original files from the camera), pictures an