Interactive alv report......with one table having more than 2 foreign key
*& Report ZRAHUL_ALV_SFLIGHT2
REPORT zrahul_alv_sflight2 NO STANDARD PAGE HEADING.
TYPE-POOLS slis.
DATA: fcat TYPE slis_fieldcat_alv,
it_fcat TYPE slis_t_fieldcat_alv,
fcat1 TYPE slis_fieldcat_alv,
it_fcat1 TYPE slis_t_fieldcat_alv,
fcat2 TYPE slis_fieldcat_alv,
it_fcat2 TYPE slis_t_fieldcat_alv,
lout TYPE slis_layout_alv,
head TYPE slis_listheader,
it_head TYPE slis_t_listheader.
TABLES: SFLIGHT, SCURX, SAPLANE.
DATA: BEGIN OF it_sflight OCCURS 0,
carrid TYPE sflight-carrid, "PK
connid TYPE sflight-connid,
fldate TYPE sflight-fldate,
currency TYPE sflight-currency, "FK 1
planetype TYPE sflight-planetype, "FK 2
END OF it_sflight.
DATA: BEGIN OF it_scurx OCCURS 0,
currkey TYPE scurx-currkey, "PK 1
currdec TYPE scurx-currdec,
END OF it_scurx.
DATA: BEGIN OF it_saplane OCCURS 0,
planetype TYPE saplane-planetype, "PK 2
seatsmax TYPE saplane-seatsmax,
tankcap TYPE saplane-tankcap,
weight TYPE saplane-weight,
END OF it_saplane.
SELECTION-SCREEN: BEGIN OF BLOCK blk WITH FRAME TITLE t.
SELECT-OPTIONS: id FOR it_sflight-carrid,
id2 FOR it_sflight-connid.
SELECTION-SCREEN END OF BLOCK blk.
INITIALIZATION.
t = 'enter required criterias'.
lout-zebra = 'X'.
START-OF-SELECTION.
SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE it_sflight
WHERE carrid IN id AND connid IN id2.
END-OF-SELECTION.
****FCAT F0R IT_SFLIGHT
fcat-col_pos = 1.
fcat-tabname = 'IT_SFLIGHT'.
fcat-fieldname = 'CARRID'.
fcat-outputlen = 10.
fcat-seltext_m = 'PLANE ID'.
APPEND fcat TO it_fcat.
CLEAR fcat.
fcat-col_pos = 2.
fcat-tabname = 'IT_SFLIGHT'.
fcat-fieldname = 'CONNID'.
fcat-outputlen = 10.
fcat-seltext_m = 'CONN ID'.
APPEND fcat TO it_fcat.
CLEAR fcat.
fcat-col_pos = 3.
fcat-tabname = 'IT_SFLIGHT'.
fcat-fieldname = 'FLDATE'.
fcat-outputlen = 10.
fcat-seltext_m = 'FLDATE'.
APPEND fcat TO it_fcat.
CLEAR fcat.
fcat-col_pos = 4.
fcat-tabname = 'IT_SFLIGHT'.
fcat-fieldname = 'CURRENCY'.
fcat-outputlen = 10.
fcat-seltext_m = 'CURRENCY'.
APPEND fcat TO it_fcat.
CLEAR fcat.
fcat-col_pos = 5.
fcat-tabname = 'IT_SFLIGHT'.
fcat-fieldname = ';PLANETYPE'.
fcat-outputlen = 10.
fcat-seltext_m = 'PLANETYPE'.
APPEND fcat TO it_fcat.
CLEAR fcat.
*****GRID DISPLAY
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = 'ZRAHUL_ALV_SFLIGHT2'
I_CALLBACK_PF_STATUS_SET = ' '
i_callback_user_command = 'CLICK'
i_callback_top_of_page = 'HEADER'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
i_grid_title = 'GRID 1'
I_GRID_SETTINGS =
is_layout = lout
it_fieldcat = it_fcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_sflight
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*& Form header
text
FORM header.
CLEAR it_head.
head-typ = 'H'.
head-info = 'KINGFISHER'.
APPEND head TO it_head.
head-typ = 'S'.
head-key = 'KEY'.
head-info = 'AIRLINES'.
APPEND head TO it_head.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_head
i_logo = 'KING_LOGO'
I_END_OF_LIST_GRID =
I_ALV_FORM =
ENDFORM. "header
*& Form CLICK
text
-->OK text
-->SEL text
FORM click USING ok TYPE sy-ucomm
sel TYPE slis_selfield.
CLEAR it_fcat.
CASE ok.
WHEN '&IC1'.
********SAPLANE RELATION
READ TABLE it_sflight INDEX sel-tabindex.
SELECT * FROM saplane INTO CORRESPONDING FIELDS OF TABLE it_saplane WHERE planetype = it_sflight-planetype.
fcat-col_pos = 1.
fcat-tabname = 'IT_SAPLANE'.
fcat-fieldname = 'PLANETYPE'.
fcat-outputlen = 10.
fcat-seltext_m = 'TYPE OF PLANE'.
APPEND fcat TO it_FCAT.
CLEAR fcat.
fcat-col_pos = 2.
fcat-tabname = 'IT_SAPLANE'.
fcat-fieldname = 'SEATSMAX'.
fcat-outputlen = 10.
fcat-seltext_m = 'MAX SEATS'.
APPEND fcat TO it_FCAT.
CLEAR fcat.
fcat-col_pos = 3.
fcat-tabname = 'IT_SAPLANE'.
fcat-fieldname = 'TANKCAP'.
fcat-outputlen = 10.
fcat-seltext_m = 'FUEL TANK CAPACITY'.
APPEND fcat TO it_FCAT.
CLEAR fcat.
fcat-col_pos = 4.
fcat-tabname = 'IT_SAPLANE'.
fcat-fieldname = 'WEIGHT'.
fcat-outputlen = 10.
fcat-seltext_m = 'WEIGHT F PLANE'.
APPEND fcat TO it_FCAT.
CLEAR fcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = 'ZRAHUL_ALV_SFLIGHT2'
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
i_callback_top_of_page = 'HEADER'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
i_grid_title = 'GRID 2'
I_GRID_SETTINGS =
is_layout = LOUT
it_fieldcat = IT_FCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = IT_SAPLANE
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*******SCURX RELATION
CLEAR: IT_FCAT2,IT_FCAT.
READ TABLE IT_SFLIGHT INDEX SEL-TABINDEX.
SELECT * FROM SCURX INTO CORRESPONDING FIELDS OF TABLE IT_SCURX WHERE CURRKEY = IT_SFLIGHT-CURRENCY.
FCAT2-COL_POS = 1.
FCAT2-TABNAME = 'IT_SCURX'.
FCAT2-FIELDNAME = 'CURRKEY'.
FCAT2-OUTPUTLEN = 15.
FCAT2-SELTEXT_M = 'CURRENCY'.
APPEND FCAT2 TO IT_FCAT2.
CLEAR FCAT2.
FCAT2-COL_POS = 2.
FCAT2-TABNAME = 'IT_SCURX'.
FCAT2-FIELDNAME = 'CURRDEC'.
FCAT2-OUTPUTLEN = 15.
FCAT2-SELTEXT_M = 'CURRENCY DEC'.
APPEND FCAT2 TO IT_FCAT2.
CLEAR FCAT2.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = 'ZRAHUL_ALV_SFLIGHT2'
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = 'HEADER'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = 'GRID 3'
I_GRID_SETTINGS =
IS_LAYOUT = LOUT
IT_FIELDCAT = IT_FCAT2
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = IT_SCURX
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDCASE.
ENDFORM. "click
this program runs fine when one navigation is used......but when both the foreign keys come in picture then its shows sequencialy...cant we jump directly to the third one which i require....
plz guide me.thank u.
in short i want help on table having multiple foreign keys....and how to navigate in this when working on ALV reports.....
its easy when using interactive reports by using sy-cucol and sy-curow.....
reply asap.
thank u in advance.
Similar Messages
-
Trouble with the SQL smt to :list tables having more than 1000 rows
Please I trying to list only tables having more than 1000 rows, but the sql stmt below doesn't work, can someone gives me a tips
select table_name from user_tables where table_name in ( select table_name from user_tables where rownum > 1000 ) : The result is no rows!
But I know that I have at lest 50 tables having more than 1000 rows
Thanks a lot for the helpIf your tables are reasonably analyzed, then you can simply query:
SELECT table_name,
num_rows
FROM user_tables
WHERE num_rows >= 1000This will give you quite a reasonable estimate.
Otherwise you have to go for dynamic sql or use the data dictionary to help you generate suitable scripts .... -
Can i create IN/UP/DE Trigger on a existing table having more than 2L rows
Hi All,
Can i create a INSERT/UPDATE/DELETE Trigger on a existing table having more than 2 lacs records ? if yes (is that works for only some kind of triggers? or for all ?). if not, tell me the reasons and limitations with guidelines.
Thanks in Advance.Hi,
Sure; you can create new triggers for tables that already have rows. The type of trigger and the number of rows already in the table don't matter.
Try it. If the trigger works with a small table in your Development database, then there's no reason to expect it won't work on a larger table in your Production datbase. -
Logical table having more than one Logical table sources
Hi ,
Is it possible a logical table has 2 logical table sources and there is no join between the underlying table of logical table sources?
What will happen if we create the request which contains one attribute from each source?
Will BI server return records with Cartesian join?
Is it mandatory if logical table is having more than one logical table sources(exp. Logical table sources are X,Y and underlying table is A,B respectively),
The underlying tables (A&B) must be joined ?
Can someone explain the logic behind the logical table sources? How does it work?
Any reference of document will be appreciable.
Thanks,AshishHi Stijn,
Thanks for response.
You are saying that Oracle BI server will run a query against both tables and combine the results. But if there is no possibilty of any type of join, how BI server will combine the results from both tables.
I have a scenario like below -
Suppose i have 2 tables A and B at physical layer. Both table contains the information of any common subject area.
But there is no attribute is common between A and B so not any kind of join possible between two.
Now if i create a logical table with 2 logical table source A and B and create any request having one column from A and one from B ,
What will happen? How BI server will combine the result? Will BI server not result records after Cartesian join.
How can i model this scenario? -
Populating more than one table and more than one field
I need some suggestions and this forum has always been a great source of good advice.
I have a web form at the following location: http://www.webdevpractice.com/genoptix/CE/register.php
Here's what the web form needs to do:
Send a confirmation email listing seminars the visitor checked on the form.
Create a similar message on a confirmation page.
Populate 2 two tables.
Items 1 and 2 are working fine.
The advice I need is on how to populate two tables in the database.
There are three tables:
ACCOUNTS
account_id
first_name
last_name
medtech_id
job_title
npi
company
city
state
email
phone
contact
ATTENDANCE
attendance_id
account_id
seminar_id
SEMINARS
seminar_id
seminar
speaker_first_name
speaker_last_name
date
The web form contains data that need to go into the ACCOUNTS table and the ATTENDANCE table. The challenge is getting the account_id and seminar_id into the ATTENDANCE table. If all the information was inserted properly, I could write a query that revealed who was taking what seminar.
Inserting data into the ACCOUNTS table is not a problem. I will create another form to insert information into the SEMINARS so that should not be a problem. But inserting the account_id and the seminar_id is what I am wondering about. Also, can more than one record be inserted in a table? If an user checks more that one seminar, each seminar (seminar_id) would need to be inserted in the ATTENDANCE table as separate records along with the account_id. I'm thinking I may have to do this manually. Also, the values for each seminar are their dates and titles. I used these as values to send the confirmations.
I'm just looking for advice at this point. Is this doable?Bregent,
The table I am wondering about is the ATTENDANCE table. There are two fields in addition to the primary key: account_id and seminar_id. The field I am concern with is the seminar_id which comes from a group of checkboxs on the form. So, one form could create several records. For example, presently there are three seminars that are offered. If the visitor selects all three seminars, that would create three records in the SEMINARS table. So, it might look like this:
attendance_id account_id seminar_id
1 1 1
2 1 2
3 1 3
My PHP skills are basic. I've done other forms and use PHP in other ways. But I have never had to populate several rows in one table with an array of checkboxes nor have I be able to find an example of this.
So the advice I am seeking (and perhaps this is premature) is this:
Can one field from a table populate more than one record?
Should I set up checkboxs as a group or individually with a different name?
I am also considering setting up my tables differently so there is a table from each seminar--that may solve my problem. -
Interactive alv report with migo miro and purchase order
hi all
to make my alv interactive i put the following code....
i dont know whether it is correct or not coz i hav not done alv before
FORM display.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
is_layout = wa_layout
I_CALLBACK_USER_COMMAND = 'HANDLE_USER_COMMAND'
it_fieldcat = it_fieldcat
TABLES
t_outtab = itab.
ENDFORM. "DISPLAY
FORM HANDLE_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
IF RS_SELFIELD-FIELDNAME = 'EBELN'.
READ TABLE ITAB INDEX RS_SELFIELD-TABINDEX.
SET PARAMETER ID 'ITAB-EBELN' FIELD ITAB-EBELN.
call transaction 'ME23N' AND SKIP FIRST SCREEN.
CLEAR RS_SELFIELD.
ENDIF.
ENDCASE.
ENDFORM. "HANDLE_USER_COMMAND
this code is working
but i hav some problems
when ever i double click on PO number
1. it always opne the last PO number of the my alv list
2. I want to open the migo with migo number when i double clik on the migo number
3. and same for the MIRO
plz help its very urgent...
points wil b rewarded.Hi,
Following report will explains how to do interactive list in alv report regarding purchase order. Kindly go through that one.
REPORT YMS_ALVINTERSAMPLE NO STANDARD PAGE HEADING LINE-SIZE 650
MESSAGE-ID ZZ_9838.
TYPE-POOLS: SLIS.
*type declaration for values from ekko
TYPES: BEGIN OF I_EKKO,
EBELN LIKE EKKO-EBELN,
AEDAT LIKE EKKO-AEDAT,
BUKRS LIKE EKKO-BUKRS,
BSART LIKE EKKO-BSART,
LIFNR LIKE EKKO-LIFNR,
END OF I_EKKO.
DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
WA_EKKO TYPE I_EKKO.
*type declaration for values from ekpo
TYPES: BEGIN OF I_EKPO,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
MATNR LIKE EKPO-MATNR,
MENGE LIKE EKPO-MENGE,
MEINS LIKE EKPO-MEINS,
NETPR LIKE EKPO-NETPR,
END OF I_EKPO.
DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
WA_EKPO TYPE I_EKPO .
*variable for Report ID
DATA: V_REPID LIKE SY-REPID .
*declaration for fieldcatalog
DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
declaration for events table where user comand or set PF status will
be defined
DATA: V_EVENTS TYPE SLIS_T_EVENT,
WA_EVENT TYPE SLIS_ALV_EVENT.
declartion for layout
DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
declaration for variant(type of display we want)
DATA: I_VARIANT TYPE DISVARIANT,
I_VARIANT1 TYPE DISVARIANT,
I_SAVE(1) TYPE C.
*PARAMETERS : p_var TYPE disvariant-variant.
*Title displayed when the alv list is displayed
DATA: I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
DATA: I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
INITIALIZATION.
V_REPID = SY-REPID.
PERFORM BUILD_FIELDCATLOG.
PERFORM EVENT_CALL.
PERFORM POPULATE_EVENT.
START-OF-SELECTION.
PERFORM DATA_RETRIEVAL.
PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
PERFORM DISPLAY_ALV_REPORT.
*& Form BUILD_FIELDCATLOG
Fieldcatalog has all the field details from ekko
FORM BUILD_FIELDCATLOG.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'EBELN'.
WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'AEDAT'.
WA_FIELDCAT-SELTEXT_M = 'DATE.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'BUKRS'.
WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'BUKRS'.
WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'LIFNR'.
WA_FIELDCAT-NO_OUT = 'X'.
WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. "BUILD_FIELDCATLOG
*& Form EVENT_CALL
we get all events - TOP OF PAGE or USER COMMAND in table v_events
FORM EVENT_CALL.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = V_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "EVENT_CALL
*& Form POPULATE_EVENT
Events populated for TOP OF PAGE & USER COMAND
FORM POPULATE_EVENT.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'TOP_OF_PAGE'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-FORM.
ENDIF.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'USER_COMMAND'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-NAME.
ENDIF.
ENDFORM. "POPULATE_EVENT
*& Form data_retrieval
retreiving values from the database table ekko
FORM DATA_RETRIEVAL.
SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
ENDFORM. "data_retrieval
*& Form bUild_listheader
text
-->I_LISTHEADEtext
FORM BUILD_LISTHEADER USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
DATA HLINE TYPE SLIS_LISTHEADER.
HLINE-INFO = 'this is my first alv pgm'.
HLINE-TYP = 'H'.
ENDFORM. "build_listheader
*& Form display_alv_report
text
FORM DISPLAY_ALV_REPORT.
V_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_GRID_TITLE = I_TITLE_EKKO
I_GRID_SETTINGS =
IS_LAYOUT = ALV_LAYOUT
IT_FIELDCAT = I_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
i_default = 'ZLAY1'
I_SAVE = 'A'
is_variant = i_variant
IT_EVENTS = V_EVENTS
TABLES
T_OUTTAB = IT_EKKO
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "display_alv_report
*& Form TOP_OF_PAGE
text
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_LISTHEADER
i_logo =
I_END_OF_LIST_GRID =
ENDFORM. "TOP_OF_PAGE
*& Form USER_COMMAND
text
-->R_UCOMM text
-->, text
-->RS_SLEFIELDtext
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
PERFORM BUILD_FIELDCATLOG_EKPO.
PERFORM EVENT_CALL_EKPO.
PERFORM POPULATE_EVENT_EKPO.
PERFORM DATA_RETRIEVAL_EKPO.
PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
PERFORM DISPLAY_ALV_EKPO.
ENDCASE.
ENDFORM. "user_command
*& Form BUILD_FIELDCATLOG_EKPO
text
FORM BUILD_FIELDCATLOG_EKPO.
WA_FIELDCAT-TABNAME = 'IT_EKPO'.
WA_FIELDCAT-FIELDNAME = 'EBELN'.
WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKPO'.
WA_FIELDCAT-FIELDNAME = 'EBELP'.
WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'MENGE'.
WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'MEINS'.
WA_FIELDCAT-SELTEXT_M = 'UOM'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'NETPR'.
WA_FIELDCAT-SELTEXT_M = 'PRICE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. "BUILD_FIELDCATLOG_EKPO
*& Form event_call_ekpo
we get all events - TOP OF PAGE or USER COMMAND in table v_events
FORM EVENT_CALL_EKPO.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = V_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "event_call_ekpo
*& Form POPULATE_EVENT
Events populated for TOP OF PAGE & USER COMAND
FORM POPULATE_EVENT_EKPO.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'TOP_OF_PAGE'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-FORM.
ENDIF.
ENDFORM. "POPULATE_EVENT
*& Form TOP_OF_PAGE
text
FORM F_TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_LISTHEADER
i_logo =
I_END_OF_LIST_GRID =
ENDFORM. "TOP_OF_PAGE
*& Form USER_COMMAND
text
-->R_UCOMM text
-->, text
-->RS_SLEFIELDtext
*retreiving values from the database table ekko
FORM DATA_RETRIEVAL_EKPO.
SELECT EBELN EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO.
ENDFORM.
FORM BUILD_LISTHEADER_EKPO USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
DATA: HLINE1 TYPE SLIS_LISTHEADER.
HLINE1-TYP = 'H'.
HLINE1-INFO = 'CHECKING PGM'.
ENDFORM.
FORM DISPLAY_ALV_EKPO.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'F_USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = I_TITLE_EKPO
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = I_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT =
I_SAVE = 'A'
IS_VARIANT =
IT_EVENTS = V_EVENTS
TABLES
T_OUTTAB = IT_EKPO
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.
Thanks,
Sankar M -
Hi All,
i am facing impact of trigger in MYSQL, scenario is this:
I am Having one table with duplicate records that is consist of (eid,tin,status and some other columns are also there but i need only these three). there is another table which is having same these three columns (eid, tin, status).
eid and tin will be same for given combination only status will be different i.e.
1245 23 0
1245 23 1
1245 23 5
1233 33 3
1211 24 2
1211 24 5
so as per above example i have to feed data into other table as
1245 23 0
1233 33 3
1211 24 5
priority of status is like 0 will be inserted if that is present in record otherwise it will be decrease from 5 to 1.
so i have designed trigger for this which will insert data after reading each row, but it is taking around 6.5 minutes for inserting 300000 records. so is there any other way to improve performance for this mysql program.
DELIMITER $$
CREATE
/*[DEFINER = { user | CURRENT_USER }]*/
TRIGGER `kyr_log`.`upd_status` AFTER INSERT
ON `kyr_log`.`kyrlog_bup`
FOR EACH ROW
BEGIN
DECLARE v_eid VARCHAR(28);
DECLARE v_status INT(11);
SELECT kyrl_eid,kyrl_status INTO v_eid,v_status FROM kyrlog_bup ORDER BY kyrl_id DESC LIMIT 1;
IF v_eid NOT IN (SELECT kyrl_eid FROM update_status.new_status) THEN
INSERT INTO update_status.new_status(kyrl_eid,kyrl_tin,kyrl_status)
SELECT kyrl_eid,kyrl_tin,kyrl_status FROM kyrlog_bup ORDER BY kyrl_id DESC LIMIT 1;
ELSE IF v_status=2 THEN
IF v_status > ANY (SELECT kyrl_status FROM kyrlog_bup WHERE kyrl_eid=v_eid AND kyrl_status<>0) THEN
UPDATE update_status.new_status SET kyrl_status=v_status WHERE kyrl_eid=v_eid;
END IF;
ELSE IF v_status=3 THEN
IF v_status > ANY (SELECT kyrl_status FROM kyrlog_bup WHERE kyrl_eid=v_eid AND kyrl_status<>0) THEN
UPDATE update_status.new_status SET kyrl_status=v_status WHERE kyrl_eid=v_eid;
END IF;
ELSE IF v_status=4 THEN
IF v_status > ANY (SELECT kyrl_status FROM kyrlog_bup WHERE kyrl_eid=v_eid AND kyrl_status<>0) THEN
UPDATE update_status.new_status SET kyrl_status=v_status WHERE kyrl_eid=v_eid;
END IF;
ELSE IF v_status=5 THEN
IF v_status > ANY (SELECT kyrl_status FROM kyrlog_bup WHERE kyrl_eid=v_eid AND kyrl_status<>0) THEN
UPDATE update_status.new_status SET kyrl_status=v_status WHERE kyrl_eid=v_eid;
END IF;
ELSE IF v_status=0 THEN
UPDATE update_status.new_status SET kyrl_status=v_status WHERE kyrl_eid=v_eid;
END IF;
END IF;
END IF;
END IF;
END IF;
END IF;
END;
$$
DELIMITER ;
please suggest me if there is possibility of any other solution.
thanksactually you didn't have seen discussion on this link , there are many discussion related to MYSQL . and mysql is owned by oracle. so i post it here.
thanks for suggestion -
How to validate values in alv report with check table
Hi All,
I have created one editable ALV in which user can enter material(matnr). Now I want to validate the value entered by the user before saving it to my custom table. I am using 'SLIS_T_FIELDCAT_ALV' as field catalog. Is there any field in this which I need to pass to validate material. I don't want to go for coding for this. I tried to search for this but did not get anything. Please help.
Regards,
Manish SethiaHi Andreas,
I tried but that is not working. Do I need to handle some event or command to get it validated. My code is as follows.
FORM f_build_field_catalouge USING p_fieldname TYPE any
p_tabname TYPE any
p_inputlen TYPE any
p_fieldtext TYPE any
p_edit TYPE any
CHANGING p_col_pos TYPE any.
CLEAR wa_fcat.
p_col_pos = p_col_pos + 1.
wa_fcat-fieldname = p_fieldname .
wa_fcat-tabname = p_tabname.
IF p_fieldname = 'MATNR'.
wa_fcat-ref_tabname = 'MARA'.
wa_fcat-ref_fieldname = 'MATNR'.
ELSEIF p_fieldname = 'MATPGRP'.
wa_fcat-ref_tabname = 'ZOTC_FLEX_MAT'.
wa_fcat-ref_fieldname = 'MATPGRP'.
ENDIF.
wa_fcat-intlen = p_inputlen . "colume width
wa_fcat-seltext_m = p_fieldtext.
wa_fcat-edit = p_edit ."'X'.
wa_fcat-col_pos = p_col_pos.
APPEND wa_fcat TO t_fcat.
ENDFORM.
But this one is not working.
Regards -
Nested Table having more than 1 column comparison using ORACLE MULTISET
Dear ALL,
I am using ORACLE 10gR2 Database.
I am currently trying to compare two sets of data that I get from two queries in PL/SQL. I want to use Oracle MULTISET UNION, MULTISET INTERSECT, MULTISET EXCEP for those operations.
But When I am executing the below given code I am getting the error.
PLS-00306: wrong number or types of arguments in call to 'MULTISET_EXCEPT_ALL'
My Code
declare
type wh_unique_record is record (cpy_key number(22),cnc_id varchar2(22),cust_type_id number,
device_info_id number,scope_id number,excep_id number,
config_date date);
type wh_previous_data_table is table of wh_unique_record;
wh_previous_data wh_previous_data_table;
wh_current_data wh_previous_data_table;
wh_union_data wh_previous_data_table;
wh_intersect_data wh_previous_data_table;
-- This cursor I am using to populate the data into the nested tables
cursor c_previous_data is select cpy_key,cnc_id,cust_type_id,device_info_id,scope_id,excep_id,config_date
from r_cfg_wh_excep
where cpy_key=17278
and trunc(config_date)=trunc(to_date('06-jul-2009','dd-mon-yyyy'));
cursor c_current_data is select cpy_key,cnc_id,cust_type_id,device_info_id,scope_id,excep_id,config_date
from r_cfg_wh_excep
where cpy_key=17278
and trunc(config_date)=trunc(to_date('16-jul-2009','dd-mon-yyyy'));
begin
open c_previous_data;
fetch c_previous_data bulk collect into wh_previous_data;
close c_previous_data;
open c_current_data;
fetch c_current_data bulk collect into wh_current_data;
close c_current_data;
dbms_output.put_line('Previous count '||wh_previous_data.count);
dbms_output.put_line('Current count '||wh_current_data.count);
--FYI: MULTISET UNION IS WORKING.*
wh_union_data := wh_current_data multiset union wh_previous_data;
dbms_output.put_line('New count '||wh_union_data.count);
wh_intersect_data:=wh_current_data MULTISET EXCEPT wh_previous_data;
dbms_output.put_line('The records that are repeating are '||wh_intersect_data.count);
end;
Previous count 74062
Current count 74508
New count 148570
PL/SQL procedure successfully completed.
FYI: If I comment the MULTISET EXCEPT conditin then I am getting the output for MULTISET UNION.
IS THERE ANY WAY ORACLE IS PROVIDING A FUNCTIONALITY WHERE WE CAN HAVE A NESTED TABLE WITH MULTIPLE COLUMNS AND THAT CAN BE USED IN PL/SQL AND USE BULK OPERATION TO POPULATE THE NESTED TABLE WITH MULTIPLE COLUMNS AND USE THE SAME IN MULTISET EXCEPT, MULTISET EXCEPT ETC.
Appreciate your help on this.
Thanks,
Madhu K.Madhu,
I am totally amazed. I didn't think any of the MULTISET operations would work with NTs of records. Lucky you!
As for the EXCEPT, well, clearly it is a restriction or bug in PL/SQL.
You may want to report it to Oracle Support.
Regards,SF
At 11:45 AM 10/1/2009, you wrote:
Dear Steven,
I am using ORACLE 10gR2 Database.
I am currently trying to compare two sets of data that I get from two queries in PL/SQL. I want to use Oracle MULTISET UNION, MULTISET INTERSECT, MULTISET EXCEP for those operations.
But When I am executing the below given code I am getting the error.
PLS-00306: wrong number or types of arguments in call to 'MULTISET_EXCEPT_ALL'
My Code
declare
type wh_unique_record is record (cpy_key number(22),cnc_id varchar2(22),cust_type_id number,
device_info_id number,scope_id number,excep_id number,
config_date date);
type wh_previous_data_table is table of wh_unique_record;
wh_previous_data wh_previous_data_table;
wh_current_data wh_previous_data_table;
wh_union_data wh_previous_data_table;
wh_intersect_data wh_previous_data_table;
-- This cursor I am using to populate the data into the nested tables
cursor c_previous_data is select cpy_key,cnc_id,cust_type_id,device_info_id,scope_id,excep_id,config_date
from r_cfg_wh_excep
where cpy_key=17278
and trunc(config_date)=trunc(to_date('06-jul-2009','dd-mon-yyyy'));
cursor c_current_data is select cpy_key,cnc_id,cust_type_id,device_info_id,scope_id,excep_id,config_date
from r_cfg_wh_excep
where cpy_key=17278
and trunc(config_date)=trunc(to_date('16-jul-2009','dd-mon-yyyy'));
begin
open c_previous_data;
fetch c_previous_data bulk collect into wh_previous_data;
close c_previous_data;
open c_current_data;
fetch c_current_data bulk collect into wh_current_data;
close c_current_data;
dbms_output.put_line('Previous count '||wh_previous_data.count);
dbms_output.put_line('Current count '||wh_current_data.count);
--FYI: MULTISET UNION IS WORKING.
wh_union_data := wh_current_data multiset union wh_previous_data;
dbms_output.put_line('New count '||wh_union_data.count);
wh_intersect_data:=wh_current_data MULTISET EXCEPT wh_previous_data;
dbms_output.put_line('The records that are repeating are '||wh_intersect_data.count);
end;
Previous count 74062
Current count 74508
New count 148570
PL/SQL procedure successfully completed.
FYI: If I comment the MULTISET EXCEPT conditin then I am getting the output for MULTISET UNION.
IS THERE ANY WAY ORACLE IS PROVIDING A FUNCTIONALITY WHERE WE CAN HAVE A NESTED TABLE WITH MULTIPLE COLUMNS AND THAT CAN BE USED IN PL/SQL AND USE BULK OPERATION TO POPULATE THE NESTED TABLE WITH MULTIPLE COLUMNS AND USE THE SAME IN MULTISET EXCEPT, MULTISET EXCEPT ETC.
Appreciate your help on this.
Thanks,
Madhu K. -
Create pagination for table contain more than 2 PK
Guys;
Is there any way to use the wizard for creating FORM PAGINATION for tables having more than 2 PK??
Regards;Hi dimitri;
after the user login & start using this form thiswhat should happen to these 3 PKs:
-1st PK will be a unique number for the questions.
-2nd PK should be the ID for each survey ( created as global variable in Zero Page ).
-3rd PK will be the division for this user (also created as a global variable in ZERO PAGE)..so this is the only field which will nt be changed while the user is logged..
i tried to use the 1st 2 PKs...& set the last one to get a default value..it worked in the begining but gave me the 1st record for each Survey but my problem that i couldnt navigate to the 2nd record..& after that once i log out & relogin it willnt give me anything.
Regards;
ehammad -
Hi Experts,
I am new to ALV Reports, can any one provide some inputs on how to create an Interactive ALV Reports using OOPS Concept.
I am getting the data from SFLIGHT on first ALV and i want that when i single click any cell or row or any check box associated with the row i should get the corresponding booking details from table SBOOK.
Thanks
RaviHi dude,
Go through this Link: [http://www.sap-img.com/abap/an-interactive-alv-report.htm]
for more information search in SDN only..
Re: Interactive ALV Report Using Function...? -
ALV Reporting with drill down capabillities
I'm creating a abap custom report using the ALV. I want to drill down to CJ03 which is projects. I know how to do it in regular custom reporting, but I don't seem to be able to get it to work using the ALV. Can anyone help?
Thanks.
LindaHi Linda,
Take a look at this sample program. The logic to handle any interaction with the user is in my "PORCESS_USER_COMMANDS" routine.
This is defined in the "I_CALLBACK_USER_COMMAND" parameter in the ALV FM.
Hope this helps.
Cheers,
Pat.
[code]
Modification History
Date | Author | Chg Req # | Description
15.08.2001| Pat Yee | $TMP | Program Creation
This program is an example of how the ALV Display works.
It will display Customer Data.
This report will also show how to display an ALV report with different
colored lines and icons
REPORT zpat.
Include Programs
INCLUDE <icon>.
Database Tables
TABLES: kna1. "Customer Master
Types
TYPE-POOLS: kkblo.
Structures
Structure to hold the Color Information
DATA: BEGIN OF st_color,
color(3) TYPE c,
END OF st_color.
Structure to hold the Icon Information
DATA: BEGIN OF st_icon,
icon(4) TYPE c,
END OF st_icon.
ALV Field Catalog Structure
DATA: st_fieldcat TYPE slis_fieldcat_alv.
ALV Layout Structure
DATA: st_layout TYPE slis_layout_alv.
Internal Tables
Output Table
DATA: BEGIN OF tbl_kna1 OCCURS 0.
INCLUDE STRUCTURE st_icon. "Icon Structure
INCLUDE STRUCTURE kna1. "Customer Master Structure
INCLUDE STRUCTURE st_color. "Color Structure
DATA: END OF tbl_kna1.
ALV Field Catalog Table
DATA: tbl_fieldcat TYPE slis_t_fieldcat_alv.
Variables
DATA: fieldname(30) TYPE c,
g_repid LIKE sy-repid.
Start of Selection
START-OF-SELECTION.
g_repid = sy-repid.
PERFORM get_data.
End of Selection
END-OF-SELECTION.
PERFORM do_fancy_stuff.
PERFORM get_layout.
PERFORM get_fieldcat.
PERFORM create_report.
*& Form CREATE_REPORT
Learn to read the subroutine name!
FORM create_report.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_interface_check = ' '
i_callback_program = g_repid
i_callback_user_command = 'PROCESS_USER_COMMANDS'
it_fieldcat = tbl_fieldcat
i_default = 'X'
i_save = ' '
is_layout = st_layout
TABLES
t_outtab = tbl_kna1
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " CREATE_REPORT
*& Form GET_FIELDCAT
Build the Field Catalog
FORM get_fieldcat.
Here the field catalog is created. To display more fields simply
'uncomment' the additional lines and add the field name. Also note
that the field catalog is much more powerful than this. You can
intensify fields, change the colour, assign reference fields, etc.
Look at type slis_fieldcat_alv for more options.
PERFORM write_fieldcat USING 'ICON' 'TBL_KNA1' ' ' 'X' 1 '2' 'X'
PERFORM write_fieldcat USING 'KUNNR' 'TBL_KNA1' 'KNA1' 'X' 2 ' ' ' '
PERFORM write_fieldcat USING 'NAME1' 'TBL_KNA1' 'KNA1' ' ' 3 '10' ' '
'X'.
PERFORM write_fieldcat USING 'STRAS' 'TBL_KNA1' 'KNA1' ' ' 4 ' ' ' '
PERFORM write_fieldcat USING 'TELF1' 'TBL_KNA1' 'KNA1' ' ' 5 ' ' ' '
PERFORM write_fieldcat USING 'ORT01' 'TBL_KNA1' 'KNA1' ' ' 6 ' ' ' '
PERFORM write_fieldcat USING 'PSTLZ' 'TBL_KNA1' 'KNA1' ' ' 7 ' ' ' '
PERFORM write_fieldcat USING 'SORTL' 'TBL_KNA1' 'KNA1' ' ' 8 ' ' ' '
PERFORM write_fieldcat USING 'ERNAM' 'TBL_KNA1' 'KNA1' ' ' 9 ' ' ' '
PERFORM write_fieldcat USING 'SPRAS' 'TBL_KNA1' 'KNA1' ' ' 10 ' ' ' '
perform write_fieldcat using ' ' 'TBL_KNA1' 'KNA1' ' ' 10 ' '.
perform write_fieldcat using ' ' 'TBL_KNA1' 'KNA1' ' ' 11 ' '.
perform write_fieldcat using ' ' 'TBL_KNA1' 'KNA1' ' ' 12 ' '.
ENDFORM. " GET_FIELDCAT
*& Form WRITE_FIELDCAT
Write the Field Catalog data to the Field Catalog Table
-->name Field name
-->tab Table name
-->st Structure Name
-->key Is this field a Key?
-->pos Position Number
-->length Field Length
-->icon Display as Icon
-->hot Hotspot
FORM write_fieldcat USING name tab st key pos length icon hot.
st_fieldcat-fieldname = name.
st_fieldcat-tabname = tab.
st_fieldcat-ref_tabname = st.
st_fieldcat-key = key.
st_fieldcat-col_pos = pos.
st_fieldcat-outputlen = length.
st_fieldcat-icon = icon.
st_fieldcat-hotspot = hot.
APPEND st_fieldcat TO tbl_fieldcat.
CLEAR st_fieldcat.
ENDFORM. " WRITE_FIELDCAT
*& Form PROCESS_USER_COMMANDS
Interactive Reporting Commands
FORM process_user_commands USING syst-ucomm LIKE syst-ucomm
selfield TYPE slis_selfield.
This subroutine is called when there is user interaction in the output
In this case if the user double clicks the Customer Number then the
program will call transaction XD03 and display the Customer Master
Data
CASE syst-ucomm.
WHEN '&IC1'.
get cursor field fieldname.
READ TABLE tbl_kna1 INDEX selfield-tabindex.
SET PARAMETER ID 'KUN' FIELD tbl_kna1-kunnr.
CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
ENDCASE.
ENDFORM. " PROCESS_USER_COMMANDS
*& Form GET_LAYOUT
set the layout of the ALV.
add color to the row?
FORM get_layout.
st_layout-info_fieldname = 'COLOR'.
st_layout-colwidth_optimize = 'X'.
st_layout-get_selinfos = 'X'.
ENDFORM. " GET_LAYOUT
*& Form get_data
Get some data to play with
FORM get_data.
SELECT * FROM kna1 INTO CORRESPONDING FIELDS OF TABLE tbl_kna1
UP TO 30 ROWS.
ENDFORM. " get_data
*& Form do_fancy_stuff
Do some fancy pants stuff for example changing the color of
lines and adding icons
FORM do_fancy_stuff.
Here we will demonstrate changing the color of ALV Record lines as
well as displaying Icons
LOOP AT tbl_kna1.
All records where NAME1 begins with 'M', will be displayed in Bluish
Green
IF tbl_kna1-name1(1) EQ 'M'.
tbl_kna1-color = 'C41'. "Bluish Green
MODIFY tbl_kna1 TRANSPORTING color.
ENDIF.
All records with no TELF1 will be displayed in White and have a
Warning Icon
IF tbl_kna1-telf1 IS INITIAL.
tbl_kna1-color = 'C00'. "White
tbl_kna1-icon = '@AH@'. "Warning Icon
MODIFY tbl_kna1 TRANSPORTING icon color.
ENDIF.
ENDLOOP.
ENDFORM. " do_fancy_stuff[/code] -
Steps to create interactive alv report
plz tell me the steps needed to create interactive alv report. explaining the importance of events. please tell me with suitable example
Hello Yogesh,
I did not see as you mentioned Interactive ALV , sorry for wrong reply.
Please use proper parameter to function module ,here you need to use user command,this user command will call form routine(Dynamic) ,here you can do whatever ,below example one interactive ,if user clicks on material it will goto MM02 transaction.
See the simple example one in ALV :
REPORT Z_GET_REFRESH no standard page heading.
type-pools : slis.
tables : makt,
mara.
data : i_fieldcat type slis_t_fieldcat_alv.
data : begin of i_makt occurs 0,
matnr like makt-matnr,
maktx like makt-maktx,
end of i_makt.
data : v_repid like sy-repid,
g_user_command type slis_formname value 'USER_COMMAND',
g_status_set type slis_formname value 'SET_PF_STATUS'.
DATA:LC_GLAY TYPE LVC_S_GLAY.
select-options s_matnr for mara-matnr .
start-of-selection.
select matnr maktx from makt into table i_makt
where matnr in s_matnr.
end-of-selection.
Fill the fieldcatlog
perform fill_field.
Call the FM
perform call_fm.
*& Form fill_field
text
--> p1 text
<-- p2 text
FORM fill_field.
data wa_fieldcat type slis_fieldcat_alv.
clear : wa_fieldcat.
wa_fieldcat-tabname = 'I_MAKT'.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-outputlen = '18'.
wa_fieldcat-seltext_l = 'Material #'.
wa_fieldcat-col_pos = '1'.
append wa_fieldcat to i_fieldcat.
clear : wa_fieldcat.
wa_fieldcat-tabname = 'I_MAKT'.
wa_fieldcat-fieldname = 'MAKTX'.
wa_fieldcat-outputlen = '40'.
wa_fieldcat-seltext_l = 'Material Desc'.
wa_fieldcat-col_pos = '2'.
append wa_fieldcat to i_fieldcat.
ENDFORM. " fill_field
*& Form call_fm
text
--> p1 text
<-- p2 text
FORM call_fm.
v_repid = sy-repid.
LC_GLAY-EDT_CLL_CB = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = v_repid
I_CALLBACK_PF_STATUS_SET = g_status_set
I_CALLBACK_USER_COMMAND = g_user_command
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS = LC_GLAY
IS_LAYOUT =
IT_FIELDCAT = i_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_ADD_FIELDCAT =
IT_HYPERLINK =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IT_EXCEPT_QINFO =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = i_makt
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " call_fm
FORM USER_COMMAND *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield. "#EC CALLED
data i_RSPARAMS like RSPARAMS occurs 0.
CASE R_UCOMM.
WHEN '&IC1'.
read table i_makt index rs_selfield-tabindex.
SET PARAMETER ID 'MAT' FIELD i_makt-matnr.
if not i_makt-matnr is initial.
call transaction 'MM02' and skip first screen.
endif.
when 'REFRESH'.
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
CURR_REPORT = v_repid
IMPORTING
SP =
TABLES
SELECTION_TABLE = i_RSPARAMS
EXCEPTIONS
NOT_FOUND = 1
NO_REPORT = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
submit z_get_refresh with selection-table i_RSPARAMS.
rs_selfield-refresh = 'X'.
ENDCASE.
MOVE 'REFRESH' TO r_ucomm.
ENDFORM.
FORM set_pf_status *
FORM SET_PF_STATUS USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZSTANDARD' EXCLUDING rt_extab.
SET TITLEBAR sy-tcode.
ENDFORM.
Thanks
Seshu -
Hi all,
i am facing problem while generating Test Result word document after successful execution of TestStand.
The Problem is :
i want to add rows Formatted as table headings, table headings are repeated when a table spans more than one page(marked as Red).
Example:
Page No. 1
| Test case Number | Test Step number |
| 100 | 100 |
Page No. 2
| Test case Number | Test Step number |
| 200 | 300 |
Test Result word document should generate with Table headings(marked as Red) in every pages of the document, but i am not getting as per above example.
Please through light on this.
Regards,
Susa.Hi Santiago,
Thank you very much for your valuable reply.
i want to generate MS-word report for TestStand after successful testing using MS-word2000.
Test report contains Actual values, Expected values and Pass/Fail status.
In my program i have customized all fields i can able to generate test report which contains Verification engineer name , test mode, test date, start time, end time Actual values, Expected values and Pass/Fail status.etc....
To put all values of test case number, Test step number, Actual values, Expected values and Pass/Fail status in to table for each time, i will
insert a row into table every time values arrives, once the table exceedes its page size it moves to the next page, next page should start with table row header but it start with values of above said parameters.
so i'm not able to repeat table row header for each page.
Please find the attached file for your reference.
Attched file expected.doc : This file contains what i wanted to generate MS-word report. Here table row header "Test Case Number and Test Step Number " is repeated in second page.
Attached file Actual output from source code.doc : This report generated from the source code. Here table row header "Test Case Number and Test Step Number" is not repeated in second page.
Do you know any property to set "repeat as header row at the top of each page" using MS-word ActiveX in CVI/Labwindows.
i think this information is sufficient for you,
Still if you need some information please ask me.
Thanks
Susa.
Attachments:
Actual output from source code.doc 25 KB
expected.doc 26 KB -
How to devolped an Interactive ALV Report to display sales orders
hi,
how to devolped an Interactive ALV Report to display sales orders pertaining to the selected Customers and item details in the secondary list.For this report what are the tables and fields wehave to used give with example.
thank you
radhakrishnaHi,
look via se38 for BCALV* and SALV*.
Try ABAPDOCU.
Regards, Dieter
Maybe you are looking for
-
Custom Table Entry not in Sync between Different Environment
Hi All, we have different environment like Dev System, Quality system, performance testing system etc... these are all environment customs table entry not in syn .. Table entry should be syn. How to make it syn all the entry between all environment w
-
2 iPhone Household w/ Outlook Profile Sync Issues with iTunes beyond 7.3.1
I'm huge Apple supporter and have to say this is the most frustrating computer issue I have ever come across. My wife and I both have iPhones and we sync them to the same pc except different Outlook profiles. iTunes 7.3.1 works fine when we sync our
-
How do I copy photos from an iPad to an iMac?
Please note these are NOT photos on my camera roll or photo stream. Thanks.
-
Premium Message Blocking - What does recipient and sender see?
I recently blocked all texts that could come via a website or PC under the Verizon Safeguards link because I was receiving harrassing texts, and I am wondering what would I see if someone were to attempt to send me a text from their email or website?
-
How can I get rid of mystart.incredibar completely?
I have been through this process several times. I cannot work out how mystart.incredibar gets back in. I now only use Firefox to prevent incredibar creeping in from other browsers. But it is still in the new page tabs. Also, given that this is a majo