Struggling with f4 handling in ALV grid - Minisap 46D
Hi to all,
I got an abap problem developing with my Minisap 46D,
and i can't realy struggle out for a solution,
Issue concern using of self defined F4 in ALV ( created via objects),
Each program (standard program as in eg.BCALV_GRID_EDIT )
given by SAP to show use of ALV self definded F4 doesn't wark at all this option,
and when i click on the cell in order to show F4 set of values, program brake down in ABAP error,
Always the same happen with my z programs when they calls method written to manage F4,
following existing examplaes i think i put instructions in the right place and in proper way:
I mean defining implementing and registering onf4 event,
Further i see that standard programs with f4 dumping on my minisap are working proper on the normal SAP at work place,
Does this depend on some Minisap strange bugs in standard ALV class? What can i do?
I would be grateful to anyone who help me solving this SAP mistery,
So I got:
Error analysis (and syntesys of the short dump )
ABAP runtime errors CALL_METHOD_CONFLICT_TYPE
The call to method "ON_F4" is incorrect
The system tried to pass field "%_DUMMY$$" to the formal parameter " ".
"CALL_METHOD_CONFLICT_TYPE"
"BCALV_GRID_EDIT " or "BCALV_GRID_EDIT "
"HANDLE_F4"
"HANDLE_F4"
000740 *----
000750 * CLASS lcl_event_receiver IMPLEMENTATION
000780
000790 class lcl_event_receiver implementation.
000800 method handle_data_changed.
000810 perform data_changed using er_data_changed.
000820 endmethod.
000830
> method handle_f4.
000850 perform f4 using e_fieldname
000860 es_row_no
000870 er_event_data
000880 et_bad_cells.
000890 endmethod.
or looking at my custom program:
ABAP runtime errors CALL_METHOD_CONFLICT_TYPE
Error analysis
The call to method "HANDLE_ON_F4" is incorrect.
The system tried to pass field "%_DUMMY$$" to the formal parameter "E_FIELDVALUE".
003430
> method handle_on_f4.
003450
003460 data: pe_fieldname type lvc_fname,
003470 pe_fieldvalue type lvc_value,
003480 pes_row_no type lvc_s_roid,
003490 per_event_data type ref to
cl_alv_event_data,
003500 pet_bad_cells type lvc_t_modi,
003510 pe_display type char01.
003520
003530
003540 perform f4_help using pe_fieldname
pes_row_no.
003550
003560 endmethod.
PS. I'm not showing here code section where I register
and set handling event but is the usual, as
indicated in standard procedure,
I would recommend above all else simply upgrading:
https://www.sdn.sap.com/irj/sdn/downloads
NW04s is the latest FULL ABAP version available with Web Dynpro.
Similar Messages
-
How to merge rows with similar values in alv grid display in webdynpro
Hi experts,
i want to know about how to merge rows with similar values in alv grid display of webdynpro.grouping rows is possible in table display in webdynpro but i am not able to do row grouping in the alv grid display in webdynpro.
kindly suggest.
thanks ,
Anita.Hi Anita,
did you find a solution for this? I have opened a Thread, if you know the answer maybe you could help me out:
Is there an ALV function similar to the TABLE Row grouping?
Thanx in advanced!!!
Kind Regards,
Gerardo J -
Urgent checkboxes handling in alv grid
helo all .i need to handle checkboxes in alv grid.
i did like
case u_comm.
when 'save'.
perform save.
endcase.
in the form.
form save.
loop at it_mara into it_mara1 where chk = 'X'
and moving the contents to it_mara1.
but after doing it is not looping when i have seen in debug .
plz help me
i need to have those selected values and move a head.Hi rakhee,
First add a single charecter field into the internal table you want to display in the ALV.Then set the field cataloge and set the value for Checkbox as 'X'.it wil display the field as a check box.when you check the check box it will update the internal table also.
please check the below code.
TYPE-POOLS : slis.
TYPES : BEGIN OF st_mara.
TYPES : matnr TYPE mara-matnr.
TYPES : a,
END OF st_mara.
DATA : it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat LIKE LINE OF it_fieldcat.
DATA : it_mara TYPE TABLE OF st_mara.
SELECT * FROM mara
INTO CORRESPONDING FIELDS OF TABLE it_mara UP TO 1 ROWS.
wa_fieldcat-col_pos = 1.
wa_fieldcat-fieldname = 'A'.
wa_fieldcat-checkbox = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 2.
wa_fieldcat-fieldname = 'MATNR'.
APPEND wa_fieldcat TO it_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = it_fieldcat
TABLES
t_outtab = it_mara.
BREAK-POINT.
if you are using controls just call the method
CALL METHOD grid1->check_changed_data.
grid1 is the instance of the ALV grid.
when the method is called you will get the internal table with the field marked as 'X'.
Regards
Sandeep -
Moderator message: do not post the same question in more than one forum. Duplicate has been rejected
Hi,
I have 3 ALV Grids in my reports done by using containers with CL_GUI_ALV_GRID....
Each ALV Grid display a table....
Each toolbar of the grid has a print button.....
Here i have 2 questions...
i) when a print button of a grid is pressed..how can i know the grid of which the print button is pressed...i.e. if grid one print button is pressed..then how can i know it is triggered from Grid one and likewise for grid 2 and grid 3.
Im using same method for the event user_command for the three grids.......
ii) WHen layout is changed for a particular ALV grid...i.e. if some columns are made hidden...then when print button is pressed..Then i need to print only the columns of changed layout.............
How can i know the columns of the changed layout..........
<<Forbidden phrase removed>>
Thanks in Advanceeee
Sai Santosh
Edited by: Matt on Dec 15, 2008 3:45 PM1 - In local class definition, use the [SENDER|http://help.sap.com/saphelp_nw04s/helpdata/en/71/a8a77955bc11d194aa0000e8353423/frameset.htm] parameter of the event you manage.
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column sender.
PRIVATE SECTION.
ENDCLASS.
Then in the implemented method check the value, or use the object sender like any alv grid object.
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_double_click.
CASE sender.
WHEN grid1.
(Doc: [Event Handling|http://help.sap.com/saphelp_sm32/helpdata/EN/9b/d080b49fc111d2bd68080009b4534c/frameset.htm])
2-use the method [GET_FRONTEND_FIELDCATALOG|https://www.sdn.sap.com/irj/scn/advancedsearch?query=get_frontend_fieldcatalog&cat=sdn_all] of CL_GUI_ALV_GRID to get the curent layout.
Regards -
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 -
Add column with preq number to ALV grid in me53n
hi all,
i am trying to add column with preq number (BANFN) to ALV with preq items in ME53N. it is not available in column set, when trying to add by "change layout" button - i dont understand why, when the strcucture MEREQ3211GRID contains it :-(
i also tried to add new field ZZBANFN into the structure CI_EBANMEM and after that, i could add the new field to ALV through change layout, but it was empty of course. so i implemented EXIT_SAPLMEREQ_001 from MEREQ001, but ZZBANFN is still empty, because this exit is not called when opening ME53N, but when clicking on tab "customer data" in preq item detail.
how to solve this? is there any exit that is called before displaying the ALV grid?Here is some more detail. I included my code from the Enhancement.
ENHANCEMENT-POINT MM06EFPO_POT_AUFBAUEN_02 SPOTS ES_MM06EFPO_POT_AUFBAUEN INCLUDE BOUND.
ENHANCEMENT 1 Z_MM06EFPO_POT_AUFBAUEN_1. "active version
SELECT SINGLE zz_old_material FROM mara
INTO pot-zz_old_material
WHERE matnr = pot-matnr.
ENDENHANCEMENT.
You will also need to change the layout in Item Overview to bring your field in. -
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. -
Decimal with initial value in ALV GRID
I am using ALV GRID and one of the fields displays quantity. When I have values in this field, it is displayed correctly, but when I do not have value, instead of displaying "0.00000" displays an empty space. How do I display "0.00000"?
Used following code:
wa_fieldcat-tabname = lv_tabname .
wa_fieldcat-fieldname = 'QUANTITY' .
wa_fieldcat-ref_fieldname = 'QUANTITY' .
wa_fieldcat-ref_tabname = lv_tabname .
wa_fieldcat-just = 'R' .
wa_fieldcat-col_pos = i .
wa_fieldcat-seltext_l = text-011 .
wa_fieldcat-seltext_m = text-011 .
wa_fieldcat-seltext_s = text-011 .
wa_fieldcat-outputlen = 20 .
wa_fieldcat-qfieldname = 'ZMENGE_D'.
APPEND wa_fieldcat TO t_fieldcat.
ZMENGE_D' is data element with QUAN data type lenght 5, decimal plaes 5. This data element is used in QUANTITY ref_fieldname.Hi Zhang,
I Set wa_fieldcat-qfieldname and display "0.00000", However, all other fields were plain when you have values. In the second row, for example, a value of "8.000,00000" is displayed with "8000.00000". I need the initial valir appears with "0,00000" and the values filled in the format "8.000,00000". -
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,
Sarathi 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. -
Create unique handle for ALV grid layout
Hi,
in some generic classes we display internal tables in a grid. We want to activate the save&maintain layouts feature by passing the DISVARIANT structure, Here wen have to give Report and handle. As we display some more tables using the same method, we must set a unique handle so that saved ALV layouts do not get merged /confused. As we do not have a table name at this point, my idea is to create a hash key based on the fields in the field catalog (field catalog is only distinguishable object here).
I need an algorithm to create the 4-character handle as a hash value based on the (concatenated) field names in field catalog.
Or a better idea to create unique handles in the generic ALV calls in one program.
Please: Serious answers only.
Regards,
ClemensHere it is
function enqueuecomputehash.
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(INPUT) TYPE STRING
*" VALUE(INPUT_LEN) TYPE I
*" VALUE(HASH_LEN) TYPE I
*" EXPORTING
*" REFERENCE(HASH) TYPE STRING
*" REFERENCE(TIME_USEC) TYPE I
*" EXCEPTIONS
*" INVALID_ARGUMENT
field-symbols <text>.
field-symbols <hash>.
data: tmp_input type text8192.
data: tmp_hash type text8192.
if input_len < 1 or hash_len < 1.
raise invalid_argument.
endif.
assign tmp_input(input_len) to <text>.
assign tmp_hash(hash_len) to <hash>.
data: t1 type i,
t2 type i.
<text> = input.
get run time field t1.
call 'C_ENQ_WILDCARD' id 'TEXT' field <text>
id 'TEXTHASH' field <hash>.
get run time field t2.
hash = <hash>.
time_usec = t2 - t1.
endfunction. -
How to fill field with test data in alv grid display
hi all,
i m adding field TEXT to the structure for displaying grid.
i m modifying program like this
DATA: ALV_OUTPUT LIKE HRPDV_EXPIRED_Q OCCURS 0 WITH HEADER LINE.
TYPES : BEGIN OF FS_OUTPUT .
TEXT(20) TYPE C.
INCLUDE STRUCTURE HRPDV_EXPIRED_Q.
TYPES TEXT(20) TYPE C.
TYPES END OF FS_OUTPUT.
DATA: fs_output like table of alv_output.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'TEXT'.
WA_FIELDCAT-seltext_l = 'Abteilungs Struktur'.
wa_fieldcat-tabname = 'ALV_OUTPUT'.
WA_FIELDCAT-COL_POS = '13'.
APPEND WA_FIELDCAT TO P_GT_FIELDCAT.
this is what i have write for diapalying field. but my question is how to fill test data with field TEXT.I m writing like this but not executed in the aboove grid dispaly statement.
loop at alv_output.
*alv_output-text(20) = 'abcdefgh'.
*modify alv_output.
*endloop.
plz tell me how to fill test datahI..,
Your table declaration has to be like this..
TYPES : BEGIN OF FS_OUTPUT .
INCLUDE STRUCTURE HRPDV_EXPIRED_Q.
TYPES TEXT(20) TYPE C.
TYPES END OF FS_OUTPUT.
DATA: ALV_OUTPUT LIKE standard table of fs_output initial size 0.
loop at alv_output <b>into fs_output</b>.
<b>fs</b>_output-text(20) = 'abcdefgh'.
<b>modify alv_output index sy-tabix from fs_output transporting text.</b>
endloop.
Now give this table alv_output to the GRID_DISPLAY function module..
you will get the required output !!
Plz do remember to close the thread when ur problem is solved !!
reward all helpful answers !!
regards,
sai ramesh -
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 -
F4 help in ALV Grid Control (using classes)
Hi All,
I have created a report using ALV Grid control (using classes). I need to provide F4 help for some of the fields in the Grid control. I couldn't understand the standard demo program BCALV_GRID_F4_HELP. So Can anyone please provide me sample code for the same.
Regards
Jaker.hi check this..programs also
BCALV_GRID_EDIT_DELTA
BCALV_TEST_GRID_F4_HELP
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/how%2bto%2bimplement%2bf4%2bsearch%2bhelp%2bin%2boo%2balv%2bgrid
Struggling with f4 handling in ALV grid - Minisap 46D
regards,
venkat -
Double click on list field in ALV grid control
Hello all,
I developed a report with a ALV grid control. I would like to move some functionality from marking a line and pressing a button in the status line to double clicking a specific field in the output list and execute a command there (i.e. double click on PO number and go to PO display TAC then). Can anybody provide some example coding for that?
Thanks so much for your help!
TorstenHere is your sample program. Copy this code into a z program. Create the screen 100 with a container in it and name it "ALV_CONTAINER". Create the gui-status with "BACK".
report zrich_0001.
tables: ekko.
data: begin of i_alv occurs 0,
ebeln type ekko-ebeln,
end of i_alv.
* CLASS cl_event_receiver DEFINITION Handles Double Click
class cl_event_receiver definition.
public section.
methods handle_double_click
for event double_click of cl_gui_alv_grid
importing e_row e_column.
private section.
endclass.
* CLASS CL_EVENT_RECEIVER IMPLEMENTATION Handles Double Click
class cl_event_receiver implementation.
method handle_double_click.
perform drill_down using e_row-index.
endmethod.
endclass.
data: alv_container type ref to cl_gui_custom_container.
data: event_receiver type ref to cl_event_receiver.
data: alv_grid type ref to cl_gui_alv_grid.
data: layout type lvc_s_layo.
data: fieldcat type lvc_t_fcat.
selection-screen begin of block b1 with frame title text-001 .
select-options: s_ebeln for ekko-ebeln.
selection-screen end of block b1.
start-of-selection.
perform get_data.
call screen 100.
* Module status_0100 OUTPUT
module status_0100 output.
set pf-status '0100'.
set titlebar '0100'.
data: variant type disvariant.
variant-report = sy-repid.
variant-username = sy-uname.
* Create Controls
create object alv_container
exporting
container_name = 'ALV_CONTAINER'.
create object alv_grid
exporting
i_parent = alv_container.
* Create Event Receiver
create object event_receiver.
* Populate Field Catalog
perform get_fieldcatalog.
call method alv_grid->set_table_for_first_display
exporting
is_layout = layout
is_variant = variant
i_save = 'U'
i_structure_name = 'I_ALV'
changing
it_outtab = i_alv[]
it_fieldcatalog = fieldcat[].
* handler for ALV grid
set handler event_receiver->handle_double_click for alv_grid.
endmodule.
* Module USER_COMMAND_0100 INPUT
module user_command_0100 input.
case sy-ucomm.
when 'BACK' or 'CANC'.
if not alv_container is initial.
call method alv_container->free.
clear: alv_container.
free : alv_container.
endif.
if sy-subrc = 0.
set screen 0.
leave screen.
else.
leave program.
endif.
when 'EXIT'.
if not alv_container is initial.
call method alv_container->free.
clear: alv_container.
free : alv_container.
endif.
leave program.
endcase.
endmodule.
* FORM GET_DATA
form get_data.
select * into corresponding fields of table i_alv
from ekko
where ebeln in s_ebeln.
sort i_alv ascending by ebeln.
endform.
* Form Get_Fieldcatalog - Set Up Columns/Headers
form get_fieldcatalog.
data: ls_fcat type lvc_s_fcat.
refresh: fieldcat.
clear: ls_fcat.
ls_fcat-reptext = 'PO Number'.
ls_fcat-coltext = 'PO Number'.
ls_fcat-fieldname = 'EBELN'.
ls_fcat-ref_table = 'I_ALV'.
ls_fcat-outputlen = '12'.
ls_fcat-col_pos = 1.
append ls_fcat to fieldcat.
endform.
* DRILL_DOWN
form drill_down using index.
read table i_alv index index.
if sy-subrc = 0.
set parameter id 'BES' field i_alv-ebeln.
call transaction 'ME23' and skip first screen.
if not alv_container is initial.
call method alv_container->free.
clear: alv_container.
free : alv_container.
endif.
endif.
endform.
Regards,
Rich Heilman
Maybe you are looking for
-
Exporting out of Pages to PDF results in large files
I frequently have to post files for my students to download in PDF. Many of these things are worksheets or outlines that have no pictures on them whatsoever. I've noticed recently that older things that I have exported from MS Word on the PC were sig
-
How to revive a dead 9600/300 and 8500/120 Powermac
I now have a 9600/300 and a 8500/120 Powermac. Both ran perfect when I bought them used for a day after I updated their system software to 8.6 for many hours. After shutting them down both would not restart (completely dead). I did the usual procedur
-
FM FOR CREATING NEW CONDITION RECORDS FROM INPUT FILE
Hello vikas, I need to develop a interface program FOR CREATING NEW CONDITION RECORDS FROM INPUT FILE. Is there ay function module to update or create the condtion records, if u have any example interface program to update conditions records please s
-
ICloud changed my email password
I recently needed to confirm my icloud email account password. (I have no troubles in Mail) When I looked in Keychain and did Show Password, it showed that my password was a very long string of bizarre characters. I never set this up. Does iCloud s
-
Attaching JDeveloper to Java SP in DBMS
Hi. I don't know the debug port number of the JVM running in the RDBMS. Where and how can I find It? I need the port number to debug a remote stored procedure. Thank you, Giora