Problem with print preview in alv grid
Hello all,
I have to display base unit of measure(meins) in alv grid output. i am using a conversion routine to convert it from ST TO PC before display.After executing the report i am getting the correct data. the problem is when i select the print preview
alv list is displayed. in that the unit of measure pc is not displayed, it is comming as '*******. what i came to know is the same conversion routine is triggered in the standard program for the display. so it canot convert that.
so please help me out in solving this.
Thanks in advance,
Sarat
hi sarath,
this is an example code try using the statement before displaying, i think it works.
*example cdoe.
LOOP AT i_grp1 INTO wa_grp1.
AT NEW tknum.
READ TABLE i_grp1 intto wa_grp1 index sy-tabix.
SUM.
MOVE-CORRESPONDING wa_grp1 TO wa_grp2.
APPEND wa_grp2 TO i_grp2.
ENDAT.
ENDLOOP.
Similar Messages
-
I had a problem with print preview of billing document.
HI all,
I had a problem with print preview of billing document which contains two output types ZR1 ZR2..
For the footer text of billing document I maintained the font size as 7,5 pts, But when i go for print preview from output type ZR1 the font size of footer text is very small and looks good for output type ZR2.
If i change the print options-->logical destination of output type ZR1 same as Output type ZR2, the footer text looks good.
I think there is some issue with logical destination in print options for the output type ZR1, how can i resolve it.hi,
for both the output types , r u using same sapscript or smartform?
if yes then, u can control it in output options of smartform and also in sapscript , you can control through if condition.
and if differect sapscript or smartform then you should not get such problem.
you can check the sapscript or smartfrom in TNAPR table. -
Problems with Print Preview in PO.
Hi Experts, I need your help!!
I have problems with print preview in purchase order, if the PO has moviments ( GR or Invoice ) I cant see the form of PO in Print Preview...Anybody has idea about happen?
I can see the form before i make the movements after i cant see anymore..This is right?
There is the document explain the problem
[http://www.easy-share.com/1903543233/PO_PROBLEM1.doc]
ThanksHi,
What is the particular error message which prevented you from print preview? I have not seen such case before in many systems.
Cheers,
HT -
Problem with Print Preview and Print events
Hello Experts,
We have developed a program, in which, I m trying to display the % values in the Sub Totals and Grand Total lines, The logic and program functionality is performing very well. The report is displaying the output the way end user is willing to see.
The main problem is, the entire % values are going to a toss when we click the Print Preview or trying to print the report, which is not supposed to go that way. I have even tried to debug the program where the problem is evolving in the code, but it is not raised from the code.
Please refer to the screen shots.Before clicking the Print Preview and after clicking the print preview.
Do anybody face the same kind of problem ever?
If so please let me know what could be the best possible solution.
Thanks & Regards
Harish Kumar MKHi Harish,
I have use the below code but not for percentage... I think for percentage you just have to calculate the normal percentage and replace it with a subtotal value.
This is not your complete code it will be better if you mail your complete code so that i can debug and check.
TABLES: vbak.
TYPE-POOLS: slis. " ALV Global types
SELECT-OPTIONS :
s_vkorg FOR vbak-vkorg, " Sales organization
s_kunnr FOR vbak-kunnr, " Sold-to party
s_vbeln FOR vbak-vbeln. " Sales document
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.
PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
DATA:
BEGIN OF gt_vbak OCCURS 0,
vkorg LIKE vbak-vkorg, " Sales organization
kunnr LIKE vbak-kunnr, " Sold-to party
vbeln LIKE vbak-vbeln, " Sales document
netwr LIKE vbak-netwr, " Net Value of the Sales Order
waerk LIKE vbak-waerk, " Document currency
END OF gt_vbak.
INITIALIZATION.
v_1 = 'Maximum of records to read'.
START-OF-SELECTION.
PERFORM f_read_data.
PERFORM f_display_data.
* Form f_read_data
FORM f_read_data.
SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_vbak
FROM vbak
UP TO p_max ROWS
WHERE kunnr IN s_kunnr
AND vbeln IN s_vbeln
AND vkorg IN s_vkorg.
ENDFORM. " F_READ_DATA
* Form f_display_data
FORM f_display_data.
DEFINE m_fieldcat.
add 1 to ls_fieldcat-col_pos.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = 'VBAK'.
ls_fieldcat-do_sum = &2.
ls_fieldcat-cfieldname = &3.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DEFINE m_sort.
add 1 to ls_sort-spos.
ls_sort-fieldname = &1.
ls_sort-up = 'X'.
ls_sort-subtot = &2.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA:
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv,
lt_sort TYPE slis_t_sortinfo_alv,
ls_sort TYPE slis_sortinfo_alv,
ls_layout TYPE slis_layout_alv.
m_fieldcat 'VKORG' '' ''.
m_fieldcat 'KUNNR' '' ''.
m_fieldcat 'VBELN' '' ''.
m_fieldcat 'NETWR' 'X' 'WAERK'.
m_fieldcat 'WAERK' '' ''.
m_sort 'VKORG' 'X'. " Sort by vkorg and subtotal
m_sort 'KUNNR' 'X'. " Sort by kunnr and subtotal
m_sort 'VBELN' ''. " Sort by vbeln
ls_layout-cell_merge = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_sort = lt_sort
TABLES
t_outtab = gt_vbak.
ENDFORM. " F_DISPLAY_DATA
BR
Sumeet -
Missing columns in print preview of ALV Grid
In a report using ALV grid the output is ok in ALV grid when press print preview the 1st column is always missing and the 1st row shift by 1 character. Why is it happening. The same is happening in print out or when list saved in excel also.
the coding is like
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_interface_check = ' '
i_buffer_active = ' '
i_callback_program = i_repname
i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
i_callback_pf_status_set = ' '
i_callback_user_command = 'FRM_ALV_USER_COMMAND'
i_structure_name = 'IT_REPORT'
i_background_id = ' '
is_layout = i_layout
it_fieldcat = i_fieldtab[]
it_sort = i_sort[]
i_default = 'X'
i_save = 'A'
is_variant = i_variant
it_events = i_events[]
is_print = i_print
tables
t_outtab = it_report.
Kindly resolve.
thanks
anyaSample code:
REPORT ZALV_DISPLAY_CHANGE.
TABLES :T247.
TYPE-POOLS SLIS. "Type definitions for alv report
DATA: IT_FIELDCAT TYPE LVC_T_FCAT,
WA_FIELDCAT TYPE LVC_S_FCAT.
DATA: WA_LAYOUT TYPE LVC_S_LAYO.
DATA : BEGIN OF IT_FINAL OCCURS 0,
CHECK(1),
CELLTAB TYPE LVC_T_STYL, " Switch between display/change
MNR LIKE T247-MNR,
LTX LIKE T247-LTX,
END OF IT_FINAL.
DATA : WA_FINAL LIKE IT_FINAL.
DATA : W_REPID LIKE SY-REPID.
W_REPID = SY-REPID.
REFRESH IT_FINAL.
SELECT MNR LTX
FROM T247
INTO CORRESPONDING FIELDS OF TABLE IT_FINAL
WHERE SPRAS EQ 'E'.
WA_FIELDCAT-FIELDNAME = 'CHECK'.
WA_FIELDCAT-TABNAME = 'IT_FINAL'.
WA_FIELDCAT-CHECKBOX = 'X'.
WA_FIELDCAT-EDIT = 'X'..
WA_FIELDCAT-OUTPUTLEN = '3'.
WA_FIELDCAT-COL_POS = '1'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'MNR'.
WA_FIELDCAT-TABNAME = 'IT_FINAL'.
WA_FIELDCAT-OUTPUTLEN = '8'.
WA_FIELDCAT-COL_POS = '2'.
WA_FIELDCAT-REPTEXT = 'Month'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'LTX'.
WA_FIELDCAT-TABNAME = 'IT_FINAL'.
WA_FIELDCAT-OUTPUTLEN = '20'.
WA_FIELDCAT-COL_POS = '3'.
WA_FIELDCAT-REPTEXT = 'Month Desc'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
DATA: WA_CELLTAB TYPE LVC_S_STYL,
IT_CELLTAB TYPE LVC_T_STYL,
L_INDEX TYPE I.
CLEAR : WA_CELLTAB,WA_FINAL,IT_CELLTAB.
REFRESH IT_CELLTAB.
*Initialize the celltab table
LOOP AT IT_FINAL INTO WA_FINAL.
L_INDEX = SY-TABIX.
WA_CELLTAB-FIELDNAME = 'CHECK'.
WA_CELLTAB-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_ENABLED.
INSERT WA_CELLTAB INTO TABLE IT_CELLTAB.
INSERT LINES OF IT_CELLTAB INTO TABLE WA_FINAL-CELLTAB.
MODIFY IT_FINAL FROM WA_FINAL INDEX L_INDEX.
ENDLOOP.
*Make the first five 5 rows as disabled
CLEAR L_INDEX.
LOOP AT IT_FINAL INTO WA_FINAL.
L_INDEX = SY-TABIX.
IF SY-TABIX LE 5.
LOOP AT WA_FINAL-CELLTAB INTO WA_CELLTAB.
IF WA_CELLTAB-FIELDNAME EQ 'CHECK' .
WA_CELLTAB-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
MODIFY WA_FINAL-CELLTAB FROM WA_CELLTAB.
MODIFY IT_FINAL INDEX L_INDEX FROM WA_FINAL TRANSPORTING CELLTAB.
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
WA_LAYOUT-BOX_FNAME = 'CHECK'.
WA_LAYOUT-NO_ROWMARK = 'X'.
WA_LAYOUT-STYLEFNAME = 'CELLTAB'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
I_CALLBACK_PROGRAM = W_REPID
I_GRID_TITLE = 'GRID DISPLAY'
IS_LAYOUT_LVC = WA_LAYOUT
IT_FIELDCAT_LVC = IT_FIELDCAT
TABLES
T_OUTTAB = IT_FINAL
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
Please give me reward point If it is useful
Thanks
Murali Poli -
Problem with Print Preview Urgent!
Hello BW Experts,
1.I am trying to use the Print functionality for web printing.In the print preveiew i see all the text in black and white.It is completely different from the page that is displayed in the browser.
--I tried using the same print stylesheet but it does not work.
2.In the print preview how do i change the default header line height to some other value.
3.If i select file>print preview in internet explorer it is treating the logo as a different page,so the logo is printing in seperate page followed by the text.
I appreciate all your help.
Thank you all!
RajThanks deepak for the reply.
I am using the stylesheet and media = print but i still have the problem.
This is the javascript function i am using
<head>
<link href="/sap/bw/Mime/BCT/StyleSheets/ServicePortalBWReports.css" type="text/css" rel="stylesheet"/>
<script>
<script language=javascript>
function callPrintHelpService(parameter, cell_type, filter, parameter1, parameter2, item, dataprovider, x, y) {
var print_service = "Z_PRINT_HELP_SERVICE"
<!--if ( parameter == "inches") print_service = "Z_PRINT_HELP_SERVICE_IMP";
var cmd = url + "&DATA_PROVIDER=DP&HELP_SERVICE_CLASS=" + print_service;--->
SAP_BW_URL_Get();
if( dataprovider == "DP") window.open(url, "Print", "width=800, height=600, menubar=yes, toolbar=no, scrollbars=yes, resizable=yes"); }
</script>
<!-- Query description in the window title bar --->
<title>
<object>
<param name="OWNER" value="SAP_BW"/>
<param name="CMD" value="GET_ITEM"/>
<param name="NAME" value="TITLE"/>
<param name="ITEM_CLASS" value="CL_RSR_WWW_ITEM_TEXT_ELEMENTS"/>
<param name="DATA_PROVIDER" value="DP"/>
<param name="GENERATE_CAPTION" value=""/>
<param name="ELEMENT_TYPE_1" value="COMMON"/>
<param name="ELEMENT_NAME_1" value="REPTXTLG"/>
<param name="ONLY_VALUES" value="X"/>
<param name="ELEMENT_NAME" value="REPTXTLG"/>
ITEM: TITLE
</object>
</title>
<link href="/sap/bw/Mime/BEx/StyleSheets/ServicePortalBWReports.css" type="text/css" rel="stylesheet" media="print"/>
</head>
1.---can you please be more specific where i need to change the default header height value.
2.In the print preview of the report it looks fine but when i say file>print preview from internet explorer it is considering the logo as seperate page .Do i need to make any settings somewhere.
3.In the print preview it remains same eventhough i use the same stylesheet as that of the report.
Please advice.
Thank you,
Raja -
Problem with check box in ALV Grid Display
I am Displaying Material Master Data in ALV Grid Display with Check Box for each record and if i checked check box then i am processing Update operation in Database, my question is after perform update operation check box should be clear.
Kindly help me!!!!Hello Raj
Given the fact that you do not tell us the most important piece of information (namely whether you are using OO-based ALV or not) I assume you are using fm-based ALV lists.
In this case you probably have defined a USER_COMMAND routine as described in the documentation of the fm.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
* define local data
DATA: ls_outtab LIKE LINE OF gt_outtab,
ld_idx TYPE i.
LOOP AT gt_outtab INTO ls_outtab
WHERE ( chkbox = 'X' ).
ld_idx = syst-tabix.
" Call your update function / method / perform
ls_outtab-chkbox = space.
MODIFY gt_outtab FROM ls_outtab INDEX ld_Idx
TRANSPORTING chkbox.
ENDLOOP.
" And now trigger refresh of the ALV display:
rs_selfield-refresh = 'X'. " <<< !!!
ENDFORM.
Regards
Uwe -
Problem with Excel button in ALV Grid...URGENT
Hi All,
I have developed a report in ALV Grid. As we all know that by default we get few buttons in ALV Grid, like summation, sorting download, etc.. In that we have one excel button. When i click that excel button the output of the report should give the output in excel sheet. But this is not working.
The report is running fine except the excel button.
Do anyone of u have any idea how to do that?
Its very urgent...
Regards,
Parvez.Go through the code and Execute it on your system, I think this will do for you.
In this code I used 3 radio buttons in my selection screen:
If u selects the first radio button your out put shows into to the Excel sheet.
If u selects the second radio button your out put shows the in the Editor screen.
If u clicks the third radio button your output shows into the Excel as well as in the Editor.
*& DATA DECLARATION *
TABLES: MARA, "GENERAL MASTER DATA
MARC, "PLANT DATA FOR MATERIAL
MARD, "STORAGE LOCATION DATA FOR MATERIAL
MBEW, "MATERIAL VALUATION
MVKE, "SALES DATA FOR MATERIAL
MAKT, "MATERIAL DESCRIPTION
EKKO, "PURCHASING DOCUMENT HEADER
EKPO, "PURCHASING DOCUMENT ITEM
VBAK, "SALES DOCUMENT HEADER DATA
VBAP. "SALES DOCUMENT ITEM DATA
TYPE-POOLS : SLIS.
DATA: VT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
V_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
V_LAYOUT TYPE SLIS_LAYOUT_ALV,
BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
BEGIN OF I_MARA OCCURS 0,
MATNR LIKE MARA-MATNR, "MATERIAL NUMBER
MBRSH LIKE MARA-MBRSH, "INDUSTRY SECTOR
MEINS LIKE MARA-MEINS, "BASE UNIT OF MEASURE
MATKL LIKE MARA-MATKL, "MATERIAL GROUP
END OF I_MARA,
BEGIN OF I_MARC OCCURS 0,
MATNR LIKE MARC-MATNR, "MATERIAL NUMBER
WERKS LIKE MARC-WERKS, "PLANT
LVORM LIKE MARC-LVORM, "FLAG MATERIAL FOR DELETION AT PLANT
"LEVEL
DISPO LIKE MARC-DISPO, "MRP CONTROLLER
END OF I_MARC,
BEGIN OF I_MAKT OCCURS 0,
MATNR LIKE MAKT-MATNR, "MATERIAL NUMBER
MAKTX LIKE MAKT-MAKTX, "MATERIAL DESCRIPTION
SPRAS LIKE MAKT-SPRAS, "LANGUAGE KEY
END OF I_MAKT,
BEGIN OF I_MVKE OCCURS 0,
MATNR LIKE MVKE-MATNR, "MATERIAL NUMBER
VKORG LIKE MVKE-VKORG, "SALES ORGANIZATION
VTWEG LIKE MVKE-VTWEG, "DISTRIBUTION CHANNEL
END OF I_MVKE,
BEGIN OF I_MARD OCCURS 0,
MATNR LIKE MARD-MATNR, "MATERIAL NUMBER
LGORT LIKE MARD-LGORT, "STORAGE LOCATION
LABST LIKE MARD-LABST, "VALUATED STOCK WITH UNRESTRICTED USE
END OF I_MARD,
BEGIN OF I_EKPO OCCURS 0,
EBELN LIKE EKPO-EBELN, "PURCHASING DOCUMENT NUMBER
EBELP LIKE EKPO-EBELP, "ITEM NUMBER OF PURCHASING DOCUMENT
MATNR LIKE EKPO-MATNR, "MATERIAL NUMBER
END OF I_EKPO,
BEGIN OF I_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN, "SALES DOCUMENT
POSNR LIKE VBAP-POSNR, "SALES DOCUMENT ITEM
MATNR LIKE VBAP-MATNR, "MATERIAL NUMBER
END OF I_VBAP,
BEGIN OF I_OUT OCCURS 0,
MATNR LIKE MARC-MATNR,
WERKS LIKE MARC-WERKS,
LVORM LIKE MARC-LVORM,
DISPO LIKE MARC-DISPO,
MBRSH LIKE MARA-MBRSH,
MEINS LIKE MARA-MEINS,
MATKL LIKE MARA-MATKL,
VKORG LIKE MVKE-VKORG,
VTWEG LIKE MVKE-VTWEG,
SPRAS LIKE MAKT-SPRAS,
MAKTX LIKE MAKT-MAKTX,
LGORT LIKE MARD-LGORT,
LABST LIKE MARD-LABST,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
END OF I_OUT,
BEGIN OF I_HEADING OCCURS 0,
TEXT1(20),
TEXT2(20),
TEXT3(20),
TEXT4(20),
TEXT5(20),
TEXT6(20),
TEXT7(20),
TEXT8(20),
TEXT9(20),
TEXT10(20),
TEXT11(40),
TEXT12(20),
TEXT13(20),
TEXT14(20),
TEXT15(20),
TEXT16(20),
TEXT17(20),
END OF I_HEADING.
*& S E L E C T I O N - S C R E E N *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-100.
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR. "OBLIGATORY.
PARAMETERS: P_WERKS LIKE MARC-WERKS. "OBLIGATORY.
SELECT-OPTIONS: S_LGORT FOR MARD-LGORT,
S_DISPO FOR MARC-DISPO,
S_EBELN FOR EKPO-EBELN .
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-101.
PARAMETERS : RB1 RADIOBUTTON GROUP G1,
RB2 RADIOBUTTON GROUP G1,
RB3 RADIOBUTTON GROUP G1.
SELECTION-SCREEN END OF BLOCK B2.
*& S T A R T - O F - S E L E C T I O N *
START-OF-SELECTION.
SELECT MATNR WERKS LVORM DISPO FROM MARC
INTO CORRESPONDING FIELDS OF TABLE I_MARC
WHERE MATNR IN S_MATNR
AND DISPO IN S_DISPO
AND WERKS = P_WERKS.
IF I_MARC[] IS INITIAL.
WRITE:/ 'NO MATCHING DATA AVAILABLE FROM MARC'.
EXIT.
ENDIF.
PERFORM PURCHASEDATA_VALIDATION.
PERFORM SALESDATA_VALIDATION.
SELECT MATNR LGORT LABST FROM MARD INTO TABLE I_MARD
FOR ALL ENTRIES IN I_MARC
WHERE MATNR = I_MARC-MATNR
AND WERKS EQ P_WERKS
AND LGORT IN S_LGORT.
IF I_MARD[] IS INITIAL.
WRITE:/ 'NO MATCHING DATA AVAILABLE FROM MARD'.
EXIT.
ENDIF.
SELECT MATNR VKORG VTWEG FROM MVKE INTO TABLE I_MVKE
FOR ALL ENTRIES IN I_MARC
WHERE MATNR = I_MARC-MATNR.
IF I_MVKE[] IS INITIAL.
WRITE:/ 'NO MATCHING DATA AVAILABLE FROM MVKE'.
EXIT.
ENDIF.
LOOP AT I_MARC.
MOVE-CORRESPONDING I_MARC TO I_OUT.
CLEAR MARC.
SELECT SINGLE MATNR MBRSH MEINS MATKL FROM MARA
INTO CORRESPONDING FIELDS OF MARA
WHERE MATNR = I_OUT-MATNR.
IF SY-SUBRC = 0.
MOVE: MARA-MBRSH TO I_OUT-MBRSH,
MARA-MEINS TO I_OUT-MEINS,
MARA-MATKL TO I_OUT-MATKL.
ELSE.
CONTINUE.
ENDIF.
SELECT SINGLE MATNR MAKTX SPRAS FROM MAKT
INTO CORRESPONDING FIELDS OF MAKT
WHERE MATNR = I_OUT-MATNR.
IF SY-SUBRC = 0.
MOVE: MAKT-MAKTX TO I_OUT-MAKTX,
MAKT-SPRAS TO I_OUT-SPRAS.
ELSE.
CONTINUE.
ENDIF.
LOOP AT I_EKPO WHERE MATNR = I_MARC-MATNR.
MOVE: I_EKPO-EBELN TO I_OUT-EBELN,
I_EKPO-EBELP TO I_OUT-EBELP.
ENDLOOP.
LOOP AT I_VBAP WHERE MATNR = I_MARC-MATNR.
MOVE: I_VBAP-VBELN TO I_OUT-VBELN,
I_VBAP-POSNR TO I_OUT-POSNR.
ENDLOOP.
LOOP AT I_MARD WHERE MATNR = I_MARC-MATNR.
MOVE: I_MARD-LABST TO I_OUT-LABST,
I_MARD-LGORT TO I_OUT-LGORT.
ENDLOOP.
LOOP AT I_MVKE WHERE MATNR = I_MARC-MATNR.
MOVE: I_MVKE-VKORG TO I_OUT-VKORG,
I_MVKE-VTWEG TO I_OUT-VTWEG.
APPEND I_OUT.
ENDLOOP.
CLEAR I_OUT.
ENDLOOP.
PERFORM OPTIONS.
FORM OPTIONS *
FORM OPTIONS.
IF RB2 = 'X'.
PERFORM FIELDCAT.
PERFORM OUTPUT.
ELSE.
IF RB1 = 'X'.
PERFORM HEADINGS.
PERFORM DLOAD.
ELSE.
IF RB3 = 'X'.
PERFORM HEADINGS.
PERFORM DLOAD.
PERFORM FIELDCAT.
PERFORM OUTPUT.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. "OPTIONS
FORM HEADINGS *
FORM HEADINGS.
I_HEADING-TEXT1 = 'MATNR'.
I_HEADING-TEXT2 = 'WERKS'.
I_HEADING-TEXT3 = 'LVORM'.
I_HEADING-TEXT4 = 'DISPO'.
I_HEADING-TEXT5 = 'MBRSH'.
I_HEADING-TEXT6 = 'MEINS'.
I_HEADING-TEXT7 = 'MATKL'.
I_HEADING-TEXT8 = 'VKORG'.
I_HEADING-TEXT9 = 'VTWEG'.
I_HEADING-TEXT10 = 'SPRAS'.
I_HEADING-TEXT11 = 'MAKTX'.
I_HEADING-TEXT12 = 'LGORT'.
I_HEADING-TEXT13 = 'LABST'.
I_HEADING-TEXT14 = 'EBELN'.
I_HEADING-TEXT15 = 'EBELP'.
I_HEADING-TEXT16 = 'VBELN'.
I_HEADING-TEXT17 = 'POSNR'.
APPEND I_HEADING.
ENDFORM. "HEADINGS
FORM DLOAD *
FORM DLOAD.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:\MATSTK.XLS'
FILETYPE = 'DAT'
WRITE_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = I_HEADING
EXCEPTIONS
FILE_WRITE_ERROR = 1.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:\MATSTK.XLS'
FILETYPE = 'DAT'
APPEND = 'X'
WRITE_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = I_OUT.
ENDFORM. "DLOAD
FORM FIELDCAT *
FORM FIELDCAT.
V_FIELDCAT-COL_POS = '1'.
V_FIELDCAT-FIELDNAME = 'MATNR'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-HOTSPOT = 'X'.
V_FIELDCAT-REF_FIELDNAME = 'MATNR'.
V_FIELDCAT-REF_TABNAME = 'MARC'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '2'.
V_FIELDCAT-FIELDNAME = 'WERKS'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'WERKS'.
V_FIELDCAT-REF_TABNAME = 'MARC'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '3'.
V_FIELDCAT-FIELDNAME = 'LVORM'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'LVORM'.
V_FIELDCAT-REF_TABNAME = 'MARC'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '4'.
V_FIELDCAT-FIELDNAME = 'DISPO'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'DISPO'.
V_FIELDCAT-REF_TABNAME = 'MARC'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '5'.
V_FIELDCAT-FIELDNAME = 'MBRSH'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'MBRSH'.
V_FIELDCAT-REF_TABNAME = 'MARA'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '6'.
V_FIELDCAT-FIELDNAME = 'MEINS'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'MEINS'.
V_FIELDCAT-REF_TABNAME = 'MARA'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '7'.
V_FIELDCAT-FIELDNAME = 'MATKL'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'MATKL'.
V_FIELDCAT-REF_TABNAME = 'MARA'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '8'.
V_FIELDCAT-FIELDNAME = 'VKORG'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'VKORG'.
V_FIELDCAT-REF_TABNAME = 'MVKE'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '9'.
V_FIELDCAT-FIELDNAME = 'VTWEG'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'VTWEG'.
V_FIELDCAT-REF_TABNAME = 'MVKE'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '10'.
V_FIELDCAT-FIELDNAME = 'SPRAS'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'SPRAS'.
V_FIELDCAT-REF_TABNAME = 'MAKT'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '11'.
V_FIELDCAT-FIELDNAME = 'MAKTX'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'MAKTX'.
V_FIELDCAT-REF_TABNAME = 'MAKT'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '12'.
V_FIELDCAT-FIELDNAME = 'LGORT'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'LGORT'.
V_FIELDCAT-REF_TABNAME = 'MARD'.
V_FIELDCAT-SELTEXT_L = 'STRG LOCT'.
V_FIELDCAT-OUTPUTLEN = 10.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '13'.
V_FIELDCAT-FIELDNAME = 'LABST'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-SELTEXT_M = 'STOCK'.
V_FIELDCAT-OUTPUTLEN = 15.
V_FIELDCAT-REF_FIELDNAME = 'LABST'.
V_FIELDCAT-REF_TABNAME = 'MARD'.
V_FIELDCAT-DO_SUM = 'X'.
V_LAYOUT-TOTALS_TEXT = 'TOTAL STOCK:'.
V_FIELDCAT-HOTSPOT = 'X'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '14'.
V_FIELDCAT-FIELDNAME = 'EBELN'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-HOTSPOT = 'X'.
V_FIELDCAT-REF_FIELDNAME = 'EBELN'.
V_FIELDCAT-REF_TABNAME = 'EKPO'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '15'.
V_FIELDCAT-FIELDNAME = 'EBELP'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'EBELP'.
V_FIELDCAT-REF_TABNAME = 'EKPO'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '16'.
V_FIELDCAT-FIELDNAME = 'VBELN'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-HOTSPOT = 'X'.
V_FIELDCAT-REF_FIELDNAME = 'VBELN'.
V_FIELDCAT-REF_TABNAME = 'VBAP'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '17'.
V_FIELDCAT-FIELDNAME = 'POSNR'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'POSNR'.
V_FIELDCAT-REF_TABNAME = 'VBAP'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
ENDFORM. "FIELDCAT
FORM OUTPUT *
FORM OUTPUT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
I_GRID_TITLE = 'CLICK ON MATERIAL/PURDOC/SALESDOC FOR DETAILS'
I_CALLBACK_USER_COMMAND = 'DISPLAYDETAILS'
IS_LAYOUT = V_LAYOUT
IT_FIELDCAT = VT_FIELDCAT1
TABLES
T_OUTTAB = I_OUT.
IF SY-SUBRC <> 0.
ENDIF.
ENDFORM. "OUTPUT
FORM TOP-OF-PAGE *
FORM TOP-OF-PAGE.
DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
WA_HEADER TYPE SLIS_LISTHEADER.
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = 'REPORT FOR : '.
APPEND WA_HEADER TO T_HEADER.
CLEAR WA_HEADER.
WA_HEADER-TYP = 'S'.
WA_HEADER-INFO = 'MATERIAL DETAILS'.
APPEND WA_HEADER TO T_HEADER.
CLEAR WA_HEADER.
WA_HEADER-TYP = 'S'.
WA_HEADER-INFO = 'PURCHASE ORDER DETAILS'.
APPEND WA_HEADER TO T_HEADER.
CLEAR WA_HEADER.
WA_HEADER-TYP = 'S'.
WA_HEADER-INFO = 'SALES ORDER DETAILS'.
APPEND WA_HEADER TO T_HEADER.
CLEAR WA_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
I_LOGO = 'GEAR'
IT_LIST_COMMENTARY = T_HEADER.
ENDFORM. "TOP-OF-PAGE
*& FORM PURCHASEDATA_VALIDATION *
FORM PURCHASEDATA_VALIDATION.
SELECT EBELN EBELP MATNR
FROM EKPO
INTO TABLE I_EKPO
FOR ALL ENTRIES IN I_MARC
WHERE MATNR = I_MARC-MATNR
AND EBELN IN S_EBELN
AND WERKS EQ P_WERKS.
IF I_EKPO[] IS INITIAL.
WRITE:/ 'NO MATCHING DATA IS SELECTED FROM TABLE EKPO'.
EXIT.
ENDIF.
DATA: T_EKPO LIKE I_EKPO OCCURS 0 WITH HEADER LINE.
T_EKPO[] = I_EKPO[].
REFRESH I_EKPO.
FREE I_EKPO.
LOOP AT T_EKPO.
SELECT SINGLE EBELN FROM EKKO INTO EKPO-EBELN
WHERE EBELN = T_EKPO-EBELN.
IF SY-SUBRC = 0.
MOVE-CORRESPONDING T_EKPO TO I_EKPO.
APPEND I_EKPO.
CLEAR I_EKPO.
ELSE.
CONTINUE.
ENDIF.
ENDLOOP.
SORT I_EKPO.
ENDFORM. "PURCHASEDATA_VALIDATION
*& FORM SALESDATA_VALIDATION *
FORM SALESDATA_VALIDATION.
SELECT VBELN POSNR MATNR
FROM VBAP
INTO CORRESPONDING FIELDS OF TABLE
I_VBAP FOR ALL ENTRIES IN I_MARC
WHERE MATNR = I_MARC-MATNR.
DATA: T_VBAP LIKE I_VBAP OCCURS 0 WITH HEADER LINE.
T_VBAP[] = I_VBAP[].
REFRESH I_VBAP.
FREE I_VBAP.
LOOP AT T_VBAP.
SELECT SINGLE VBELN FROM VBAK INTO VBAK-VBELN
WHERE VBELN = T_VBAP-VBELN.
IF SY-SUBRC = 0.
MOVE-CORRESPONDING T_VBAP TO I_VBAP.
APPEND I_VBAP.
CLEAR I_VBAP.
ELSE.
CONTINUE.
ENDIF.
ENDLOOP.
SORT I_VBAP.
ENDFORM. "SALESDATA_VALIDATION -
Problems with F4 help in ALV grid
Hi all,
I am trying to create a F4 help for the field Payee number in my reprot output (ALV Grid OO), i am able to get the window for selection of the value in the F4 help , but i am unable to pass the value back on to the screen.
I need to insert the selected value from the F4 help and aslo need to populate the Name of the payee into the Payee field.
Can some one help me in finding what error have i done in the code.
Thanks in advance for all.
I have the following code
*& Include ZRMM_ALV_TOP *
data: gc_control100 type ref to cl_gui_custom_container,
gc_control101 type ref to cl_gui_custom_container.
data: gi_outtab100 type table of ty_purchase.
data: g_cont0100 type ref to cl_gui_custom_container,
g_grid0100 type ref to cl_gui_alv_grid, " For Screen 100 Grid
gi_fcat0100 type lvc_t_fcat, " Field Catalog for Screen 100
gi_sort0100 type lvc_t_sort,
g_lout0100 type lvc_s_layo.
data: okcode_100 like sy-ucomm,
save_0100 like sy-ucomm,
okcode_200 like sy-ucomm,
save_0200 like sy-ucomm.
types: begin of f4_itab_type,
LIFNR type lifnr,
BUKRS type name1,
end of f4_itab_type.
data: f4_itab type table of f4_itab_type,
ls_f4_itab type f4_itab_type.
data : it_IZEMTAB type table of IZEMTAB,
wa_IZEMTAB type IZEMTAB.
Class Definitions.
class event_receiver_0100 definition.
PUBLIC SECTION.
types: begin of onf4_event_parameters_type,
c_fieldname type lvc_fname,
cs_row_no type lvc_s_roid,
cr_event_data type ref to cl_alv_event_data,
ct_bad_cells type lvc_t_modi,
c_display type char01,
end of onf4_event_parameters_type.
data: fieldcatalog type lvc_t_fcat.
data : f4_alv type ref to cl_gui_alv_grid,
f4_cont type ref to cl_gui_custom_container.
data: f4_params type onf4_event_parameters_type.
METHODS:
ON_F4 FOR EVENT ONF4 of cl_gui_alv_grid
importing sender
e_fieldname
e_fieldvalue
es_row_no
er_event_data
et_bad_cells
e_display.
on_data_changed for event
data_changed of cl_gui_alv_grid
importing e_onf4
e_onf4_before
e_onf4_after
er_data_changed
e_ucomm
sender.
endclass. "lcl_event_receiver DEFINITION
data: gs_variant type disvariant,
gc_save value 'A',
gs_toolbar TYPE stb_button,
gs_toolbar1 type stb_button,
gs_toolbar2 type stb_button.
DATA : T_RETURN TYPE STANDARD TABLE OF DDSHRETVAL WITH HEADER LINE.
DATA : event_receiver_0100 TYPE REF TO EVENT_RECEIVER_0100.
Class Implementation.
class event_receiver_0100 implementation.
For f4 help.
method on_f4.
data: ls_outtab type ty_purchase.
field-symbols <itab> type lvc_t_modi.
data: ls_modi type lvc_s_modi,
ls_f4_itab type f4_itab_type.
f4_params-c_fieldname = e_fieldname.
f4_params-cs_row_no = es_row_no.
f4_params-cr_event_data = er_event_data.
f4_params-ct_bad_cells = et_bad_cells.
f4_params-c_display = e_display.
read table it_purchase into ls_outtab index f4_params-cs_row_no-row_id.
Clear f4_itab[].
CALL FUNCTION 'FI_VENDOR_ALTERN_PAYERS_READ'
EXPORTING
I_LIFNR = ls_outtab-lifnr
I_BUKRS = ls_outtab-bukrs
TABLES
T_ZEMTAB = it_izemtab.
clear f4_itab[].
if not ls_outtab-lifnr is initial.
loop at it_izemtab into wa_izemtab.
ls_f4_itab-LIFNR = wa_izemtab-empfb.
ls_f4_itab-BUKRS = wa_izemtab-name1.
append ls_f4_itab to f4_itab.
endloop.
endif.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'LIFNR'
DYNPPROG = sy-repid
DYNPNR = '100'
WINDOW_TITLE = 'f4 help for PAYEE'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = f4_itab
RETURN_TAB = T_RETURN.
IF SY-SUBRC <> 0.
ENDIF.
assign f4_params-cr_event_data->m_data->* to <itab>.
ls_modi-row_id = f4_params-cs_row_no-row_id.
read table f4_itab into ls_f4_itab index es_row_no-row_id.
if not f4_itab is initial.
ls_modi-row_id = es_row_no-row_id.
ls_modi-value = ls_f4_itab-LIFNR.
ls_modi-FIELDNAME = 'LIFNR'.
append ls_modi to <itab>.
ls_modi-row_id = es_row_no-row_id.
ls_modi-value = ls_f4_itab-BUKRS.
ls_modi-FIELDNAME = 'NAME1'.
append ls_modi to <itab>.
endif.
er_event_data->m_event_handled = 'X'.
ENDMETHOD.
*--ENDMETHOD SHOW_F4--
endclass. "lcl_event_receiver IMPLEMENTATIONI have used the following FM for F4 help on editable ALV grid column and it worked fine.Try the below.
Call function for Input helps
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
i_title = text-049
i_selection = c_check
i_zebra = c_check
i_screen_start_column = 55
i_screen_end_column = 125
i_screen_start_line = 10
i_screen_end_line = 20
i_tabname = c_fcat_str
it_fieldcat = tl_fieldcat
IMPORTING
es_selfield = wal_selfield
TABLES
t_outtab = tl_code
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSEIF sy-subrc = 0 AND NOT wal_selfield IS INITIAL.
wl_index = wal_selfield-tabindex.
READ TABLE tl_code ASSIGNING <l_code>
INDEX wl_index.
IF sy-subrc = 0.
<l_fgis_lots>-status = <l_code>.
ENDIF.
ENDIF.
ENDIF. -
Problem with print preview dialog action in CS4
I have a automation plugin for Photoshop that print a image playing a Photoshop print preview dialog.
The script works on CS3 but not in CS4. There is some specific platform tags (Mac uses 'keyPrintSettings' and 'keyPageFormat' that are OpaqueStructPtr and it's not possible to take the size, and Windows uses 'keySystemInfo' and there is no information about this data) and it's not possible to ignore.
I attach a sample functions for CS3 (working) and CS4 (not working).
Some one have information about this problem?Hi, try to implement the note 1116359.
reward if usefull. -
Problem with 'BACK' option for ALV grid
Hi Friends,
I'm using FM, REUSE_ALV_GRID_DISPLAY in my report.
Once I got an ALV output, when I press the BACK button,
it's going to blank sceen again when I press BACK am getting selection screen.
From output am not able to goto the selection screen. Kindly suggest on this issue.
Thanks in advance.
Regards,
Bharat.Hi,
I don't have write statement anywhere in my prog.
pls refer to the code.
REPORT ZCDC_TRACKING_REPORT no standard page heading message-id zz1
tables:vbak,
vbap,
vbkd,
vtfa,
vbfa,
vtrkh,
vttk.
TYPE-POOLS: SLIS. "Field catalog structure
DATA: FCATALOG TYPE SLIS_FIELDCAT_ALV OCCURS 30.
DATA: FZEILE TYPE SLIS_FIELDCAT_ALV OCCURS 30 with header line.
data:w_disp_variant TYPE disvariant,
s_alv_layout type slis_layout_alv.
DATA: W_REPID LIKE SY-REPID,
W_SUBRC LIKE SY-SUBRC,
W_LOOPCOUNT LIKE SY-TABIX,
W_LINES TYPE I,
IS_VARIANT LIKE DISVARIANT,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV.
*Internal table declaration.
data: begin of i_vbak occurs 0,
vbeln like vbak-vbeln,
kunnr like vbak-kunnr,
bstnk like vbak-bstnk,
end of i_vbak.
data: begin of i_vbfa occurs 0,
vbeln like vbfa-vbeln,
vbelv like vbfa-vbelv,
end of i_vbfa.
data: begin of i_vtfa occurs 0,
tknum like vtfa-tknum,
vbeln like vbak-vbeln,
end of i_vtfa.
data: begin of i_vttp occurs 0,
tknum like vtfa-tknum,
vbeln like vbak-vbeln,
end of i_vttp.
data: begin of i_vttk occurs 0,
tknum like vtfa-tknum,
vsart like vttk-vsart,
dtabf like vttk-dtabf,
tdlnr like vttk-tdlnr,
TNDR_TRKID like vttk-TNDR_TRKID,
end of i_vttk.
data: begin of i_final occurs 0,
kunnr like vbak-kunnr,
name1 like kna1-name1,
vbeln like vbak-vbeln,
bstkd like vbkd-bstkd,
dtabf like vttk-dtabf,
tdlnr like vttk-tdlnr,
TNDR_TRKID like vttk-TNDR_TRKID,
end of i_final,
wa_final like i_final.
data: v_name1 like kna1-name1,
v_trackno like vtrkh-trackn.
**selection-screen.
SELECTION-SCREEN begin of block b1 with frame.
parameters: R1 RADIOBUTTON GROUP rad1 DEFAULT 'X'.
parameters: p_vbeln like vbak-vbeln,
p_bstkd like vbkd-bstkd.
SKIP.
SKIP.
*SELECTION-SCREEN end of block b1.
*SELECTION-SCREEN begin of block b2.
parameters: R2 RADIOBUTTON GROUP rad1.
select-options: s_kunnr for vbak-kunnr.
select-options: s_dtabf for VTTK-DTABF.
SELECTION-SCREEN end of block b1.
SELECTION-SCREEN begin of block b2 with frame.
parameters: P_track RADIOBUTTON GROUP rad2 default 'X',
P_car RADIOBUTTON GROUP rad2,
P_both RADIOBUTTON GROUP rad2.
SELECTION-SCREEN end of block b2.
**Initialization.
Initialization.
MOVE SY-REPID TO W_REPID.
*At selection-screen.
At selection-screen.
if R1 eq 'X'.
if p_vbeln eq ' ' and p_bstkd eq ' '.
message e000(zz1) with 'Please enter either PO # or SO #'.
endif.
elseif R2 eq 'X'.
if ( s_kunnr-low is initial and s_kunnr-high is initial ) and
( s_dtabf-low is initial and s_dtabf-high is initial ) .
message e000(zz1) with 'Please limit your selection criteria, this'
'cannot run without a Customer # & Date range'.
endif.
endif.
**start-of-selection.
start-of-selection.
**if option foreground is selected
IF R1 eq 'X'.
**step1 select data from VBAK,VBKD
**step2 select data from VTTK
perform get_data_foreground.
Perform process_data.
elseif R2 eq 'X'.
**if option Batch processing selected
**select data from KNA1,VBAK,VTTKelseif R2 eq 'X'.
perform get_data_batch_processing.
endif.
Perform process_data.
end-of-selection.
*& Form get_data_foreground
text
--> p1 text
<-- p2 text
form get_data_foreground .
if p_vbeln ne ' ' and p_bstkd ne ' '.
select vbeln
kunnr
bstnk
from vbak into table i_vbak
where vbeln eq p_vbeln
and bstnk eq p_bstkd.
elseif p_vbeln eq ' ' .
select vbeln
kunnr
bstnk
from vbak into table i_vbak
where bstnk eq p_bstkd.
elseif p_bstkd eq ' '.
select vbeln
kunnr
bstnk
from vbak into table i_vbak
where vbeln eq p_vbeln.
endif.
**Get data from VBFA
if not i_vbak[] is initial.
select vbeln
vbelv from VBFA into table i_vbfa
for all entries in i_vbak
where vbelv = i_vbak-vbeln
and vbtyp_n = 'J'.
endif.
**select data from VTTP
if not i_vbfa[] is initial.
select tknum
vbeln
from vttp into table i_vttp
for all entries in i_vbfa
where vbeln = i_vbfa-vbeln.
endif.
*select data from VTTK
if not i_vttp[] is initial.
select tknum
vsart
dtabf
tdlnr
TNDR_TRKID from vttk into table i_vttk
for all entries in i_vttp
where tknum eq i_vttp-tknum.
endif.
**select data from VTFA
if not i_vbak[] is initial.
select tknum
vbeln
from vtfa into table i_vtfa
for all entries in i_vbak
where vbeln = i_vbak-vbeln.
endif.
*select data from VTTK
if not i_vtfa[] is initial.
select tknum
dtabf
tdlnr
TNDR_TRKID from vttk into table i_vttk
for all entries in i_vtfa
where tknum eq i_vtfa-tknum.
endif.
endform. " get_data_foreground
*& Form get_data_batch_processing
text
--> p1 text
<-- p2 text
form get_data_batch_processing .
select vbeln
kunnr
bstnk
from vbak into table i_vbak
where kunnr in s_kunnr.
**Get data from VBFA
if not i_vbak[] is initial.
select vbeln from VBFA into table i_vbfa
for all entries in i_vbak
where vbelv = i_vbak-vbeln
and vbtyp_n = 'J'.
endif.
**select data from VTTP
if not i_vbfa[] is initial.
select tknum
vbeln
from vttp into table i_vttp
for all entries in i_vbfa
where vbeln = i_vbfa-vbeln.
endif.
*select data from VTTK
if not i_vttp[] is initial.
select tknum
vsart
dtabf
tdlnr
TNDR_TRKID from vttk into table i_vttk
for all entries in i_vttp
where tknum eq i_vttp-tknum
and dtabf eq s_dtabf.
endif.
**select data from VTFA
if not i_vbak[] is initial.
select tknum
vbeln
from vtfa into table i_vtfa
for all entries in i_vbak
where vbeln = i_vbak-vbeln.
endif.
**select data from VTTK
if not i_vtfa[] is initial.
select tknum
dtabf
tdlnr
TNDR_TRKID from vttk into table i_vttk
for all entries in i_vtfa
where tknum eq i_vtfa-tknum
and dtabf eq s_dtabf.
endif.
endform. " get_data_batch_processing
*& Form process_data
text
--> p1 text
<-- p2 text
form process_data .
**loop processing
loop at i_vbak.
wa_final-vbeln = i_vbak-vbeln.
wa_final-bstkd = i_vbak-bstnk.
wa_final-kunnr = i_vbak-kunnr.
select single name1 into v_name1
from kna1
where kunnr eq wa_final-kunnr.
if sy-subrc eq 0.
wa_final-name1 = v_name1.
endif.
read table i_vbfa with key vbelv = i_vbak-vbeln.
if sy-subrc eq 0.
read table i_vttp with key vbeln = i_vbfa-vbeln.
if sy-subrc eq 0.
read table i_vttk with key tknum = i_vttp-tknum.
if sy-subrc eq 0.
wa_final-dtabf = i_vttk-dtabf.
if p_track eq 'X'.
if i_vttk-vsart = 'LTL'.
wa_final-TNDR_TRKID = i_vttk-TNDR_TRKID.
else.
select single trackn from VTRKH into v_trackno
where uevbeln = i_vbfa-vbeln
and uevbtyp = 'J'
and vbtyp = 'X'.
if sy-subrc eq 0.
wa_final-TNDR_TRKID = v_trackno.
endif.
endif.
elseif P_car eq 'X'.
wa_final-tdlnr = i_vttk-tdlnr.
else.
wa_final-tdlnr = i_vttk-tdlnr.
if i_vttk-vsart = 'LTL'.
wa_final-TNDR_TRKID = i_vttk-TNDR_TRKID.
else.
select single trackn from VTRKH into v_trackno
where uevbeln = i_vbfa-vbeln
and uevbtyp = 'J'
and vbtyp = 'X'.
if sy-subrc eq 0.
wa_final-TNDR_TRKID = v_trackno.
endif.
endif.
endif.
endif.
endif.
endif.
append wa_final to i_final.
clear : i_final, wa_final,i_vbak,i_vbfa,i_vttp, i_vttk,v_name1.
endloop.
IF R1 eq 'X'.
PERFORM FIELDCATALOG.
PERFORM LAYOUT_BUILD CHANGING GS_LAYOUT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = W_REPID
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = FCATALOG
TABLES
T_OUTTAB = i_final
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
else.
PERFORM BACKGROUND_JOB.
**Transfer of data into Application server
OPEN DATASET P_PFILE for output IN TEXT MODE encoding DEFAULT .
if sy-subrc eq 0.
loop at itab.
transfer itab to p_pfile.
endloop.
else.
message e000(zz1) with p_pfile.
endif.
CLOSE dataset p_pfile.
endif.
endform. " process_data
*& Form FIELDCATALOG
text
--> p1 text
<-- p2 text
form FIELDCATALOG .
DATA: L_FIELDNO LIKE SY-TABIX.
L_FIELDNO = 1.
**Cust. Number
CLEAR FZEILE.
FZEILE-COL_POS = L_FIELDNO.
L_FIELDNO = L_FIELDNO + 1.
FZEILE-FIELDNAME = 'KUNNR'.
FZEILE-DATATYPE = 'CHAR'.
FZEILE-OUTPUTLEN = 15.
FZEILE-SELTEXT_L = 'Customer' .
FZEILE-LOWERCASE = 'X'.
FZEILE-SP_GROUP = 'A'.
FZEILE-KEY = 'X'.
FZEILE-DDICTXT = 'M'. " medium text
APPEND FZEILE TO FCATALOG.
**Customer name
CLEAR FZEILE.
FZEILE-COL_POS = L_FIELDNO.
L_FIELDNO = L_FIELDNO + 1.
FZEILE-FIELDNAME = 'NAME1'.
FZEILE-DATATYPE = 'CHAR'.
FZEILE-OUTPUTLEN = 35.
FZEILE-SELTEXT_L = 'Customer Name' .
FZEILE-LOWERCASE = 'X'.
FZEILE-SP_GROUP = 'A'.
FZEILE-KEY = 'X'.
FZEILE-DDICTXT = 'M'. " medium text
APPEND FZEILE TO FCATALOG.
**Sales order
CLEAR FZEILE.
FZEILE-COL_POS = L_FIELDNO.
L_FIELDNO = L_FIELDNO + 1.
FZEILE-FIELDNAME = 'VBELN'.
FZEILE-DATATYPE = 'CHAR'.
FZEILE-OUTPUTLEN = 10.
FZEILE-SELTEXT_L = 'Sales order' .
FZEILE-LOWERCASE = 'X'.
FZEILE-SP_GROUP = 'A'.
FZEILE-KEY = 'X'.
FZEILE-DDICTXT = 'M'. " medium text
APPEND FZEILE TO FCATALOG.
**Custmoer PO
CLEAR FZEILE.
FZEILE-COL_POS = L_FIELDNO.
L_FIELDNO = L_FIELDNO + 1.
FZEILE-FIELDNAME = 'BSTKD'.
FZEILE-DATATYPE = 'CHAR'.
FZEILE-OUTPUTLEN = 30.
FZEILE-SELTEXT_L = 'Custmoer PO' .
FZEILE-LOWERCASE = 'X'.
FZEILE-SP_GROUP = 'A'.
FZEILE-KEY = 'X'.
FZEILE-DDICTXT = 'M'. " medium text
APPEND FZEILE TO FCATALOG.
**Date shipped
CLEAR FZEILE.
FZEILE-COL_POS = L_FIELDNO.
L_FIELDNO = L_FIELDNO + 1.
FZEILE-FIELDNAME = 'DTABF'.
FZEILE-DATATYPE = 'CHAR'.
FZEILE-OUTPUTLEN = 15.
FZEILE-SELTEXT_L = 'Date shipped' .
FZEILE-LOWERCASE = 'X'.
FZEILE-SP_GROUP = 'A'.
FZEILE-KEY = 'X'.
FZEILE-DDICTXT = 'M'. " medium text
APPEND FZEILE TO FCATALOG.
**Carrier
CLEAR FZEILE.
FZEILE-COL_POS = L_FIELDNO.
L_FIELDNO = L_FIELDNO + 1.
FZEILE-FIELDNAME = 'TDLNR'.
FZEILE-DATATYPE = 'CHAR'.
FZEILE-OUTPUTLEN = 15.
FZEILE-SELTEXT_L = 'Carrier' .
FZEILE-LOWERCASE = 'X'.
FZEILE-SP_GROUP = 'A'.
FZEILE-KEY = 'X'.
FZEILE-DDICTXT = 'M'. " medium text
APPEND FZEILE TO FCATALOG.
**Tracking/Pro #
CLEAR FZEILE.
FZEILE-COL_POS = L_FIELDNO.
L_FIELDNO = L_FIELDNO + 1.
FZEILE-FIELDNAME = 'TNDR_TRKID'.
FZEILE-DATATYPE = 'CHAR'.
FZEILE-OUTPUTLEN = 15.
FZEILE-SELTEXT_L = 'Tracking/Pro#' .
FZEILE-LOWERCASE = 'X'.
FZEILE-SP_GROUP = 'A'.
FZEILE-KEY = 'X'.
FZEILE-DDICTXT = 'M'. " medium text
APPEND FZEILE TO FCATALOG.
CLEAR FZEILE.
endform. " FIELDCATALOG
*& Form LAYOUT_BUILD
text
<--P_GS_LAYOUT text
form LAYOUT_BUILD changing p_gs_layout TYPE SLIS_LAYOUT_ALV.
CLEAR P_GS_LAYOUT.
P_GS_LAYOUT-ZEBRA = 'X'.
P_GS_LAYOUT-BOX_FIELDNAME = SPACE.
P_GS_LAYOUT-MAX_LINESIZE = 250.
endform. " LAYOUT_BUILD
*& Form BACKGROUND_JOB
text
--> p1 text
<-- p2 text
form BACKGROUND_JOB .
DATA: JOB_NAME LIKE TBTCO-JOBNAME,
JOB_NR LIKE TBTCO-JOBCOUNT,
JOB_RELEASED TYPE C,
JOB_START_SOFORT TYPE C.
DATA: TITEL(15) TYPE C,
TEXT1(35) TYPE C,
TEXT2(40) TYPE C,
ANSWER TYPE C.
DATA: PARAMS LIKE PRI_PARAMS,
VALID TYPE C.
JOB_NAME = SYST-REPID.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
JOBNAME = JOB_NAME
IMPORTING
JOBCOUNT = JOB_NR
EXCEPTIONS
CANT_CREATE_JOB = 1
INVALID_JOB_DATA = 2
JOBNAME_MISSING = 3
OTHERS = 4.
IF SYST-SUBRC NE 0.
MESSAGE I162(00) WITH
'An error occured while creating the background job.'.
STOP.
ELSE.
*set print parameters to output any errors to spool...
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
IMMEDIATELY = ' '
MODE = 'BATCH'
NO_DIALOG = 'X'
RELEASE = 'X'
NEW_LIST_ID = 'X'
LINE_SIZE = SY-LINSZ
*LIST_NAME = 'RBE'
LIST_TEXT = 'Extract Results'
IMPORTING
OUT_PARAMETERS = PARAMS
VALID = VALID
EXCEPTIONS
ARCHIVE_INFO_NOT_FOUND = 1
INVALID_PRINT_PARAMS = 2
INVALID_ARCHIVE_PARAMS = 3
OTHERS = 4.
IF VALID NE SPACE.
*submit job with all the selection screen params...
SUBMIT (JOB_NAME) USER SYST-UNAME
VIA JOB JOB_NAME NUMBER JOB_NR
*WITH CLIENT = CLIENT
*WITH MONIFROM = MONIFROM
*WITH MONI_TO = MONI_TO
*WITH TQ_FROM = TQ_FROM
*WITH TQ_TO = TQ_TO
*WITH WORKLOAD = WORKLOAD
*WITH ALL = ALL
*WITH SPL1 = SPL1
*WITH APPSERV1 = APPSERV1
*WITH SPOOLNR = SPOOLNR
*WITH APPPATH1 = APPPATH1
*WITH PCPATH = PCPATH
*WITH SPL2 = SPL2
*WITH APPSERV2 = APPSERV2
TO SAP-SPOOL SPOOL PARAMETERS PARAMS
WITHOUT SPOOL DYNPRO
AND RETURN.
IF SYST-SUBRC <> 0.
CASE SYST-SUBRC.
WHEN 4.
MESSAGE I162(00) WITH
'Error defining background job!'
' Background job canceled by User.'.
WHEN 8.
MESSAGE I162(00) WITH
'Error defining background job!'
' Error in job scheduling (JOB_SUBMIT)'.
WHEN 12.
MESSAGE I162(00) WITH
'Error defining background job!'
' Error in internal number assignment'.
ENDCASE.
ENDIF.
endif.
endif.
endform. " BACKGROUND_JOB -
Problem with 'Print' button in ALV
Hi All,
I have developed a OOPs based ALV report. When ever we create an ALV we also have to create Menu bar I did that providing fuctionality for 'BACK' and 'CANCEL' buttons in main toolbar. But user wants funtionality for 'SAVE' and 'PRINT'.
How do I do this ? Is there any stadard code which I can paste in PAI and use it. Classic ALVs handle this by default and OOPs doesn't do this it handles only a table level. But in my report I have a header information also. If user uses the standard 'PRINT' button at table level, only table contents are printed not the header information.
Please let me know how to handle 'PRINT' & 'SAVE' button in OOPs ALV.
Thanks in advance.Cancelled
-
Problem with printing ALV lists
Hey Guys,
I have a problem with printing ALV lists ,
I created a report with several ALV lists (not grids) on the same screen but when i attempt to print the report
it prints each alv list on a different page..so if i have 3 alv lists in the same report it will print the report on 3 pages
How can i print them all in one page?
Thanks in advance
Noha Salah.Hey Max,
I tried setting the Layout-list_append before my block_list_append function call
And setting the is_print-NO_NEW_PAGE , it printed the 3 lists on one page the only problem i have
is that the lists are truncated and the list formats has totally been messed up..how can i restore them back
to their original format? -
I need to print logo in alv grid
I need to print logo in alv grid .As of now its getting displayed but it cannot be printed .Kindly tell me wether there is any option to print it .Eitjer using ALV or Object oriented ALV.Please reply soon
Hi Deepti,
Refer the code below.
report sy-repid.
type-pools : slis.
*ALV Formatting tables /structures
data: gt_fieldcat type slis_t_fieldcat_alv.
data: gt_events type slis_t_event.
data: gs_layout type slis_layout_alv.
data: gt_page type slis_t_listheader.
data: gs_page type slis_listheader.
data: v_repid like sy-repid.
*ALV Formatting work area
data: w_fieldcat type slis_fieldcat_alv.
data: w_events type slis_alv_event.
data: gt_bsid type table of bsid with header line.
initialization.
perform build_events.
perform build_page_header.
start-of-selection.
*perform build_comment. "top_of_page - in initialization at present
select * from bsid into table gt_bsid up to 10 rows.
*perform populate_for_fm using '1' '3' 'BUKRS' '8' 'GT_BSID' 'Whee'.
*USING = Row, Column, Field name, display length, table name, heading
*OR
perform build_fieldcat.
gs_layout-zebra = 'X'.
*top of page event does not work without I_callback_program
v_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = v_repid
i_structure_name = 'BSID'
i_background_id = 'ALV_BACKGROUND'
i_grid_title = 'This is the grid title'
I_GRID_SETTINGS =
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
it_events = gt_events[]
tables
t_outtab = gt_bsid.
Form..............: populate_for_fm
Description.......: Populates fields for function module used in ALV
form populate_for_fm using p_row
p_col
p_fieldname
p_len
p_table
p_desc.
w_fieldcat-row_pos = p_row. "Row Position
w_fieldcat-col_pos = p_col. "Column Position
w_fieldcat-fieldname = p_fieldname. "Field name
w_fieldcat-outputlen = p_len. "Column Lenth
w_fieldcat-tabname = p_table. "Table name
w_fieldcat-reptext_ddic = p_desc. "Field Description
w_fieldcat-input = '1'.
append w_fieldcat to gt_fieldcat.
clear w_fieldcat.
endform. " populate_for_fm
*& Form build_events
form build_events.
data: ls_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = gt_events.
read table gt_events with key name = slis_ev_user_command
into ls_event.
if sy-subrc = 0.
move slis_ev_user_command to ls_event-form.
append ls_event to gt_events.
endif.
read table gt_events with key name = slis_ev_top_of_page
into ls_event.
if sy-subrc = 0.
move slis_ev_top_of_page to ls_event-form.
append ls_event to gt_events.
endif.
endform. " build_events
*& Form USER_COMMAND
When user command is called it uses 2 parameters. The itab
passed to the ALV is in whatever order it currently is on screen.
Therefore, you can read table itab index rs_selfield-tabindex to get
all data from the table. You can also check r_ucomm and code
accordingly.
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
read table gt_bsid index rs_selfield-tabindex.
error checking etc.
set parameter id 'KUN' field gt_bsid-kunnr.
call transaction 'XD03' and skip first screen.
endform.
*& Form top_of_page
Your own company logo can go here if it has been saved (OAOR)
If the logo is larger than the size of the headings in gt_page,
the window will not show full logo and will have a scroll bar. Thus,
it is a good idea to have a standard ALV header if you are going to
use logos in your top of page.
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = gt_page
i_logo = 'ENJOYSAP_LOGO'.
endform.
*& Form build_fieldcat
*Many and varied fields are available here. Have a look at documentation
*for FM REUSE_ALV_LIST_DISPLAY and REUSE_ALV_FIELDCATALOG_MERGE
form build_fieldcat.
w_fieldcat-fieldname = 'BUDAT'.
w_fieldcat-seltext_m = 'Dte pst'.
w_fieldcat-ddictxt(1) = 'M'.
Can change the position of fields if you do not want them in order
of the DDIC or itab
w_fieldcat-row_pos = '1'.
w_fieldcat-col_pos = '10'.
append w_fieldcat to gt_fieldcat.
clear w_fieldcat.
endform. " build_fieldcat
*& Form build_page_header
gt_page is used in top of page (ALV subroutine - NOT event)
*H = Header, S = Selection, A = Action
form build_page_header.
For Headers, Key is not printed and is irrelevant. Will not cause
a syntax error, but is not used.
gs_page-typ = 'H'.
gs_page-info = 'Header 1'.
append gs_page to gt_page.
gs_page-typ = 'H'.
gs_page-info = 'Header 2'.
append gs_page to gt_page.
For Selections, the Key is printed (bold). It can be anything up to 20
bytes. It gets printed in order of code here, not by key value.
gs_page-typ = 'S'.
gs_page-key = 'And the winner is:'.
gs_page-info = 'Selection 1'.
append gs_page to gt_page.
gs_page-typ = 'S'.
gs_page-key = 'Runner up:'.
gs_page-info = 'Selection 2'.
append gs_page to gt_page.
For Action, Key is also irrelevant.
gs_page-typ = 'A'.
gs_page-info = 'Action goes here'.
append gs_page to gt_page.
endform. " build_page_header
Settings for the Logo :
01) GOTO - OAOR (Business Document Navigator)
02) Give Class Name - PICTURES
Class Type - OT
Object type - whatever you want to call your area EG: OURCOMP.... then Execute
03) Top left will say PICTURES. Bottom left will have multi tab. Select Create and double-click on Screen.
04) Select your image from the appropriate directory.
05) Give the image an appropriate name (not Screen)
06) It will tell you document stored successfully.
07) You can now find your logo under the heading OURCOMP in top left window.
08) You can reference the logo in things like FM REUSE_ALV_COMMENTARY_WRITE or any other area which may reference these things. EG: I_LOGO = 'OURCOMP'. You can preview image by double-clicking it.
<b>Please reward points if it helps.</b>
Regards,
Amit Mishra
Message was edited by: Amit Mishra -
Problem with printing-- logo comes upside down
Hi ,
We have some problem with printing.
While testing the print output for billing we are experiencing some problems. Every thing in the layout looks fine in the print preview but when i take a print out in my local printer , i see the client logo comes upside down and some lines are missing .
Can some body suggest me how to correct the same.
Regards,
Sekhar.Hi Michael,
Thanks....
We have checked the printer earlier also and seems to be fine.
Aditional info:
1) We are getting this problem while printing Billing from "VF01" transaction.
2) In this also we have two invoice numbers given by functional guy out of which in for one we are getting the problem that "lines of the first box are not printing" and for second "logo is coming inverted & lines of the first box are not printing"
Regards,
Sekhar.
Maybe you are looking for
-
How can u transfer games from one iPad to another on
I have an older iPad and would like to transfer some games from this one to the new ipad4, is there a way to do this
-
Hi I want to determine the variance for a column of numerical values. I gather I should use 'insert function' in a new cell for this. I'll get a display like this: =VAR(num-date,num-date...). What do I enter to calculate the variance for, say, the
-
The default font for the "Centered" title option appears to be Gils Sans. Does anyone know how to set a different default font, perhaps either for that title option alone or for all title options? Not a big deal, but since I always use Arial for my t
-
Sending Acknowledgements for IDOCs
I have reviewed the document "How To... Handle Acknowledgements for IDOC" and "Configuration Tips for a Business Service/Integration Process to Send Back ALE Audit IDOC". These don't seem to work for the situation I have. We have two R3 systems send
-
My password was reset today but I still cannot open Adobe Reader - help!