How to populate a dynamic table according to the choice of the viewer
Hi there,
I ran into a dead-end on my "Events" page.
There is a dynamic table getting the info from a database. It will initially show the Upcoming Events.
At this point my question is this:
*Can I populate the dynamic table based on a condition where the current date and the event date (as in the db) will be compared and if the event date is later than the current date, it will be displayed in the table. Otherwise, it won't.
If I can do that, can someone please help me out with the code?
Besides that, on the right side of the page there are 3 options for the viewer:
1. View upcoming events
2. View past events
3. Search events by month and year
What I want to do is that when the viewer clicks on 'past events', the table will be reset and populated with those events whose date has passed.
When the viewer clicks on "upcoming events", the table is reset again and populated with the relevant events.
When the viewer selects a month and a year, search the database to find the relevant records.
Can all of this be written in php? Since I read smwhere that php doesn't work with onclick functions... i got confused. Cuz the data in my table will have to vary depending on what the viewer is clicking (upcoming events/past events/search events). I do not wish to create separate pages for each type of event.
If anybody has a better suggestion to carry out this task, please share!
Thanks!
>Can I populate the dynamic table based on a condition where the current date and the event date (as in the db)
>will be compared and if the event date is later than the current date, it will be displayed in the table. Otherwise, it won't.
Of course. You just need to compare the date field in your database with the current date as returned by your DBMS date function. Assuming you are using MySQL, you would compare your column with the currdate() function and use the appropriate greater than/ less than operators in the SQL WHERE clause. If you don't know what a WHERE clause is then I would urge you to learn SQL as soon as possible. You can't build data driven sites without a basic understanding of SQL.
>Since I read smwhere that php doesn't work with onclick functions..
What this means is that php is a server side language, where user interactions always occur at the client site. But that does not mean you can't invoke a server side action from a client side event. You most certainly can and would.
You might consider adding links to the dynamic table page that pass a querystring to the php script which determine what filter to add in the WHERE clause- greater than the current date, less than, etc.
Also, in the future, please post these questions to the application development forum.
Similar Messages
-
How to make a dynamic table in front panel to show the result?
Hi,
Dear friends!It was a long time that I can't visit here.It is labview that brings me good luck. I will never forget all friends who answer me in time. Thank you all.Let's keep contact with each other without breaking. I have no question Today.I think I will not enter this zone if I do not attach a question.So please do not answer this question.If u want to make a big project,Labview is your best choice.
yours sincerely,DillySee answer
Christian Loew, CLA
Principal Systems Engineer, National Instruments
Please tip your answer providers with kudos.
Any attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system,
or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject
to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense -
How to populate data dynamically in WSelect web element.
How to populate data dynamically in WSelect web element. what is the syntax of WSelect web element to populate data from the database
Hi Jamie,
There is no Url to download ackage, instead the link is taking here
Crystal Reports webElements
Can you give me correct link? -
How to use JSTL create a dynamic table according to a database???
How to use JSTL create a dynamic table according to a database in a web page? Who can help me? Thanks.
How to use JSTL create a dynamic table according to a
database in a web page? Who can help me? Thanks.???
Could you rephrase your quesion?
Do you want to display records by reading from a table in DB? -
How to populate a jsf table with an array?
I have a JSF project where I'm using a table and I would like to populate that table with some custom information without using a database. I'm trying to write my own data provider. I was wondering if anyone knows how to populate a jsf table using an array. Any help would be appreciated. Thanks.
Hey thanks for replying. I'm not quite sure what you mean, but I am using a woodstock table in Netbeans. I would love to skip writing the data provider since I've never done that before, but I'm not sure how I would go about populating the table with a regular List or Model. I have populated a JTable with my own model, but never a woodstock table. They don't seem to work the same way. Thanks for the help. I've spent hours trying to figure this out.
-
How to create a dynamic table were the JTable columns keep varying
How to create a dynamic table were the JTable columns keep varying based on the input to the jtable
Oooh, I lied. DefaultTableModel has an API for adding and
removing columns. I didn't know that. You should have read
the API.
As for preferring to extend AbstractTableModel rather than
DefaultTableModel, I think it's more correct. DefaultTableModel
is a simple implementation of Abstract for basic cases. It isn't
intended to be extended. I figure most people extending
DefaultTableModel are also extending JFrame, JPanel, and Thread
instead of encapsulating the first two and implementing
Runnable for the third. -
How to populate tax area for IT 207? what is the common practice?
Gurus,
How to populate tax area for IT 207? what is the common practice?
The residential address IT 0006 is a new your address with ZIP code 10001
PA30 for IT 207 displays 4 tax areas for the new york address.
FED Federal 0000-0001 99999-9999
NY State of New York 14999-9999
NY01 New York City 14999-9999
NY02 Yonkers 14999-9999
I thought, each zip code will map to only one tax area.
Thanks,This is the real world ! SAP does not design tax area based on zip codes. In our company, the tax lady calls the tax authorities to check what zip codes fall under that tax authorities.
and BTW, with new BSI upgrade, you will find 12 more tax authorities for NY.
Cheers !!!!
W -
I tried to send a mail message to too many addees. when the rejection came back "cannot send message using the server..." the window is too long to be able to see the choices at the bottom of it. how can I see the choices at the bottom of that window?
I tried to send it through gmail and the acct is a POP acct
I'm not concerned about sending to the long address list. I just can't get the email and window that says "cannot send emai using the server..." to go away. The default must be "retry", because although I cannot see the choices at the bottom of the window if I hit return it trys again... and then of course comes back with the very long pop up window that I cannot see the bottom of so I can tell it to quit trying... -
Hi, i need some advice on how to manage a requirement i have.
My application receives an uploaded CSV as input. I can easily model the content in an internal table, but the CSV has an arbitrary number of columns, with arbitrary names of the fields (the first line acts as a header, and contains labels) in no particular order.
Since I'm really new to Web Dynpro, i'm wondering what's the most manageable way of storing the information in a central way, since the data contained needs to be used in many views, and other data needs to be extrapolated from it.
Please consider that i'm a neophyte to Web Dynpro, so i'm not looking for the state-of-the-art solution, but the easiest to manage. So far I've thought of 3 ways:
Dynamically create a node in the controller context, with the corresponding element representing a record and an attribute for each column.
Create a class which encapsulates the internal table, which will be stored as an attribute. However i'm not sure if i can instantiate this class in the code of one controller, and reference it from anothere (besides, it violates MVC model, not that i really care tbh)
Use the assistance class and do as in the previous point, since it is automatically instantiated at runtime and can be referenced in every point of the WD component, as far as i know
Do you have any other advice? Do you recommend one of the above answers as the most manageable? I tried the first but it's so slow to code that i'm exploring the second option.
Edited by: Giuseppe on Oct 11, 2010 2:23 PMHi,
I would suggest that you use assistance class, as this would be the most performance effecient way of achieveing the requirement. I would suggest you to define an attribute at class level and use it across views. I would also suggest if you are thinking of defining components for easy maitenance and reusability then go for global class. and then bring the reference of root context of various views to the class level and bind the data to those attributes and contexts.
Now coming to the display of data :
Since the number of columns is not known at design time you have to go for dynamic programming,
But one thing which you could do is limit yourself to manipulate things at runtime. You could define minimum number of columns at design time which you expect from the excel and then take the reference of that table and then add columns accordingly, you also have scope while displaying the data that is how you pass the data from internal table to the context.
Regards
Anurag Chopra -
How to show multiple dynamic tables on a single screen?
right now im displaying alv for singlr attribute of dimension.
eg for dimension PRODUCT attribute PROFITCENTER im displaying in alv when user executes it.
but the requirement is that multiple attributes can be there so multiple tables is to be displayed on a single screen.
User basically wants to see data of all attributes. if there are 10 attributes hee wants to see 10 tables as every attribute has a different table.
what i have achieved is below in snapshots. only one attribute table PRODUCT im able to display. since i believe multiple headers cant be displyed in alv so even if i display multiple dynamically populated tables on a single screen then it will be fine.
i have also ADDED my code below: ZMDREPORT
this report is for SAP BPC.
*& Report ZMDREPORT
REPORT zmdreport.
TABLES /1cpmb/bfrdp3rp.
DATA: gw_datatbl TYPE tabname,
gw_datatbl1 TYPE tabname,
gw_descrptbl TYPE tabname,
gw_attribute TYPE tabname.
DATA:
BEGIN OF gw_attr,
appset_id TYPE uja_dim_attr-appset_id,
dimension TYPE uja_dim_attr-dimension,
tech_name TYPE uja_dim_attr-tech_name,
attribute_name TYPE uja_dim_attr-attribute_name,
caption TYPE uja_dim_attr-caption,
END OF gw_attr,
gt_attr LIKE TABLE OF gw_attr.
DATA: gt_slis_fcat1 TYPE slis_t_fieldcat_alv,
gw_slis_fcat1 LIKE LINE OF gt_slis_fcat1.
DATA : gt_except TYPE TABLE OF zbpcbt007,
gw_except LIKE LINE OF gt_except,
gt_except_t TYPE TABLE OF zbpcbt007,
gt_attrib TYPE TABLE OF tabname,
gw_attrib LIKE LINE OF gt_attrib.
DATA: gr_r_ref TYPE REF TO data.
DATA:BEGIN OF gw_mdr,
appset_id TYPE uj_appset_id,
dimension TYPE uj_dim_name,
reasoncd TYPE zmdreason,
refdimension TYPE uj_dim_name,
attrib TYPE uj_attr_name,
END OF gw_mdr,
gt_mdr1 LIKE TABLE OF gw_mdr,
gt_mdr2 LIKE TABLE OF gw_mdr,
gt_mdtable1 TYPE zbpctt_attr,
gt_mdtable2 TYPE zbpctt_attr,
gw_mdtable2 LIKE LINE OF gt_mdtable2,
gt_mdtable3 TYPE zbpctt_attr,
gt_mdtable4 TYPE zbpctt_attr,
gw_mdtable4 LIKE LINE OF gt_mdtable4,
BEGIN OF gw_finalattr,
dim(32) TYPE c,
END OF gw_finalattr,
gt_finalattr LIKE TABLE OF gw_finalattr,
gt_tab1 LIKE TABLE OF gw_finalattr,
gw_tab1 LIKE LINE OF gt_tab1,
gt_tab2 LIKE TABLE OF gw_finalattr,
gw_tab2 LIKE LINE OF gt_tab2.
FIELD-SYMBOLS: <gfs_tab1> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <gfs_tab2> TYPE STANDARD TABLE,
<gfs_tab3> TYPE STANDARD TABLE,
<gfs_tab4> TYPE STANDARD TABLE.
FIELD-SYMBOLS:<gfs_attr> TYPE any,
<gfs_field3> TYPE any,
<gfs_field4> TYPE any.
DATA: gw_sortcond TYPE string.
FIELD-SYMBOLS: <gfs_t_final> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <gfs_final> TYPE any.
FIELD-SYMBOLS: <gfs_data> TYPE any .
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_env TYPE uja_dimension-appset_id OBLIGATORY.
PARAMETERS: p_dim TYPE uja_dimension-dimension OBLIGATORY.
SELECT-OPTIONS: s_member FOR /1cpmb/bfrdp3rp-mbr_name .
PARAMETERS: p_hir TYPE /1cpmb/bfrdp3rp-/cpmb/hir.
PARAMETERS:p_attr TYPE uj_attr_name MODIF ID m1.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS: p_radio1 RADIOBUTTON GROUP g1 USER-COMMAND abc DEFAULT 'X',
p_radio2 RADIOBUTTON GROUP g1.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
PARAMETERS: p_reason TYPE zbpcbt007-reasoncd MODIF ID m1.
SELECTION-SCREEN END OF BLOCK b3.
*********************************************************************alv
DATA :gt_fcat TYPE lvc_t_fcat.
DATA: gw_ok_code TYPE sy-ucomm,
gw_okcode TYPE sy-ucomm.
DATA: go_custom_container TYPE REF TO cl_gui_custom_container,
gw_g_container TYPE scrfname VALUE 'CC1',
go_grid1 TYPE REF TO cl_gui_alv_grid.
DATA:BEGIN OF gw_table,
dimension TYPE uja_dimension-dimension,
END OF gw_table,
gt_tab LIKE TABLE OF gw_table ,
BEGIN OF gw_member,
mbr_name TYPE uj_dim_member,
END OF gw_member ,
gt_member LIKE TABLE OF gw_member,
BEGIN OF gw_hir ,
hir TYPE /1cpmb/bfrdp3rp-/cpmb/hir,
END OF gw_hir,
gt_hir LIKE TABLE OF gw_hir.
DATA:gt_slis_fcat2 TYPE slis_t_fieldcat_alv,
gw_slis_fcat2 LIKE LINE OF gt_slis_fcat2 .
DATA: lr_data TYPE REF TO data.
DATA :gt_fcat1 TYPE lvc_t_fcat,
gt_fcat2 TYPE lvc_t_fcat,
gt_fcat3 TYPE lvc_t_fcat,
gt_fcat2_t TYPE lvc_t_fcat,
gw_fcat LIKE LINE OF gt_fcat2,
gw_fcat3 LIKE LINE OF gt_fcat3.
DATA: gt_fcat3_t LIKE gt_fcat3.
DATA: gw_desc TYPE uj_desc.
DATA : gw_string TYPE string,
gw_str TYPE string.
DATA: gw_len TYPE string,
BEGIN OF gw_refdim,
dimension TYPE uja_dimension-dimension,
END OF gw_refdim,
gt_refdim LIKE TABLE OF gw_refdim,
gt_refdim_t LIKE TABLE OF gw_refdim,
BEGIN OF gw_refdata,
data_table TYPE tabname,
desc_table TYPE tabname,
END OF gw_refdata,
gt_refdata LIKE TABLE OF gw_refdata,
BEGIN OF gw_techattr,
tech_name TYPE uja_dim_attr-tech_name,
END OF gw_techattr,
gt_techattr LIKE TABLE OF gw_techattr,
gw_cond TYPE string.
DATA:gw_hircond TYPE string.
DATA: gt_dynpread TYPE TABLE OF dynpread,
gw_dynpread LIKE LINE OF gt_dynpread,
gw_dynpread2 LIKE LINE OF gt_dynpread,
gw_dim TYPE string,
gw_env TYPE string.
FIELD-SYMBOLS: <gfs_w_tab1> TYPE any,
<gfs_w_tab2> TYPE any,
<gfs_w_tab3> TYPE any,
<gfs_field> TYPE any,
<gfs_field2> TYPE any,
<gfs_field_final> TYPE any,
<gfs_s_fcat> TYPE lvc_s_fcat,
<gfs_s_fcat2> TYPE lvc_s_fcat,
<gfs_s_fcat3> TYPE lvc_s_fcat
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_dim.
REFRESH gt_dynpread.
gw_dynpread-fieldname = 'P_ENV'.
APPEND gw_dynpread TO gt_dynpread.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-repid
dynumb = sy-dynnr
* TRANSLATE_TO_UPPER = ' '
* REQUEST = ' '
* PERFORM_CONVERSION_EXITS = ' '
* PERFORM_INPUT_CONVERSION = ' '
* DETERMINE_LOOP_INDEX = ' '
* START_SEARCH_IN_CURRENT_SCREEN = 'X'
* start_search_in_main_screen = ' '
* START_SEARCH_IN_STACKED_SCREEN = ' '
* START_SEARCH_ON_SCR_STACKPOS = ' '
* SEARCH_OWN_SUBSCREENS_FIRST = ' '
* SEARCHPATH_OF_SUBSCREEN_AREAS = ' '
TABLES
dynpfields = gt_dynpread
EXCEPTIONS
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
invalid_parameter = 7
undefind_error = 8
double_conversion = 9
stepl_not_found = 10
OTHERS = 11.
IF sy-subrc EQ 0.
READ TABLE gt_dynpread INTO gw_dynpread INDEX 1.
IF sy-subrc EQ 0.
TRY .
REFRESH gt_tab.
SELECT dimension
FROM uja_dimension CLIENT SPECIFIED
INTO TABLE gt_tab
WHERE mandt EQ sy-mandt
AND appset_id EQ gw_dynpread-fieldvalue.
IF sy-subrc EQ 0.
SORT gt_tab BY dimension.
DELETE ADJACENT DUPLICATES FROM gt_tab COMPARING dimension.
IF gt_tab IS NOT INITIAL.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' "#EC CI_SUBRC
EXPORTING
* DDIC_STRUCTURE = ''
retfield = 'DIMENSION'
* PVALKEY = ' '
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'P_DIM'(004)
* STEPL = 0
* WINDOW_TITLE =
* VALUE = ' '
value_org = 'S'
* MULTIPLE_CHOICE = ' '
* display = ''
* CALLBACK_PROGRAM = ' '
* CALLBACK_FORM = ' '
* CALLBACK_METHOD =
* MARK_TAB =
* IMPORTING
* USER_RESET =
TABLES
value_tab = gt_tab
* FIELD_TAB =
* RETURN_TAB =
* DYNPFLD_MAPPING =
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3
IF sy-subrc NE 0.
ENDIF.
ENDIF.
ENDIF.
CATCH cx_root.
ENDTRY.
ENDIF.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_member-low.
REFRESH gt_dynpread.
gw_dynpread-fieldname = 'P_ENV'.
APPEND gw_dynpread TO gt_dynpread.
gw_dynpread-fieldname = 'P_DIM'.
APPEND gw_dynpread TO gt_dynpread.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-repid
dynumb = sy-dynnr
* TRANSLATE_TO_UPPER = ' '
* REQUEST = ' '
* PERFORM_CONVERSION_EXITS = ' '
* PERFORM_INPUT_CONVERSION = ' '
* DETERMINE_LOOP_INDEX = ' '
* START_SEARCH_IN_CURRENT_SCREEN = 'X'
* start_search_in_main_screen = ' '
* START_SEARCH_IN_STACKED_SCREEN = ' '
* START_SEARCH_ON_SCR_STACKPOS = ' '
* SEARCH_OWN_SUBSCREENS_FIRST = ' '
* SEARCHPATH_OF_SUBSCREEN_AREAS = ' '
TABLES
dynpfields = gt_dynpread
EXCEPTIONS
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
invalid_parameter = 7
undefind_error = 8
double_conversion = 9
stepl_not_found = 10
OTHERS = 11.
IF sy-subrc EQ 0.
SORT gt_dynpread BY fieldname.
DELETE ADJACENT DUPLICATES FROM gt_dynpread COMPARING fieldname.
IF gt_dynpread IS NOT INITIAL.
LOOP AT gt_dynpread INTO gw_dynpread.
IF gw_dynpread-fieldname EQ 'P_ENV'.
gw_env = gw_dynpread-fieldvalue.
ELSEIF gw_dynpread-fieldname EQ 'P_DIM'.
gw_dim = gw_dynpread-fieldvalue.
ENDIF.
ENDLOOP.
IF sy-subrc EQ 0.
CLEAR: gw_datatbl1, gt_member.
SELECT SINGLE data_table
INTO (gw_datatbl1)
FROM uja_dimension CLIENT SPECIFIED
WHERE mandt EQ sy-mandt
AND appset_id EQ gw_env
AND dimension EQ gw_dim.
IF sy-subrc EQ 0.
TRY .
REFRESH gt_member.
SELECT mbr_name
INTO TABLE gt_member
FROM (gw_datatbl1) CLIENT SPECIFIED
WHERE mandt EQ sy-mandt .
IF sy-subrc EQ 0.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = ' '
retfield = 'MBR_NAME'
* PVALKEY = ' '
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'S_MEMBER'
* STEPL = 0
* WINDOW_TITLE =
* VALUE = ' '
value_org = 'S'
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '
callback_program = sy-repid
callback_form = 'F4CALLBACK'
* CALLBACK_METHOD =
* MARK_TAB =
* IMPORTING
* USER_RESET =
TABLES
value_tab = gt_member
* FIELD_TAB =
* RETURN_TAB =
* DYNPFLD_MAPPING =
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.
CATCH cx_root.
ENDTRY.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_member-high.
REFRESH gt_dynpread.
gw_dynpread-fieldname = 'P_ENV'.
APPEND gw_dynpread TO gt_dynpread.
gw_dynpread-fieldname = 'P_DIM'.
APPEND gw_dynpread TO gt_dynpread.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-repid
dynumb = sy-dynnr
* TRANSLATE_TO_UPPER = ' '
* REQUEST = ' '
* PERFORM_CONVERSION_EXITS = ' '
* PERFORM_INPUT_CONVERSION = ' '
* DETERMINE_LOOP_INDEX = ' '
* START_SEARCH_IN_CURRENT_SCREEN = 'X'
* start_search_in_main_screen = ' '
* START_SEARCH_IN_STACKED_SCREEN = ' '
* START_SEARCH_ON_SCR_STACKPOS = ' '
* SEARCH_OWN_SUBSCREENS_FIRST = ' '
* SEARCHPATH_OF_SUBSCREEN_AREAS = ' '
TABLES
dynpfields = gt_dynpread
EXCEPTIONS
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
invalid_parameter = 7
undefind_error = 8
double_conversion = 9
stepl_not_found = 10
OTHERS = 11.
IF sy-subrc EQ 0.
SORT gt_dynpread BY fieldname.
DELETE ADJACENT DUPLICATES FROM gt_dynpread COMPARING fieldname.
IF gt_dynpread IS NOT INITIAL.
LOOP AT gt_dynpread INTO gw_dynpread.
IF gw_dynpread-fieldname EQ 'P_ENV'.
gw_env = gw_dynpread-fieldvalue.
ELSEIF gw_dynpread-fieldname EQ 'P_DIM'.
gw_dim = gw_dynpread-fieldvalue.
ENDIF.
ENDLOOP.
IF sy-subrc EQ 0.
CLEAR: gw_datatbl1.
SELECT SINGLE data_table
INTO (gw_datatbl1)
FROM uja_dimension CLIENT SPECIFIED
WHERE mandt EQ sy-mandt
AND appset_id EQ gw_env
AND dimension EQ gw_dim.
IF sy-subrc EQ 0.
TRY .
REFRESH gt_member.
SELECT mbr_name
INTO TABLE gt_member
FROM (gw_datatbl1) CLIENT SPECIFIED
WHERE mandt EQ sy-mandt.
IF sy-subrc EQ 0.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = ' '
retfield = 'MBR_NAME'
* PVALKEY = ' '
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'S_MEMBER'
* STEPL = 0
* WINDOW_TITLE =
* VALUE = ' '
value_org = 'S'
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '
callback_program = sy-repid
callback_form = 'F4CALLBACK'
* CALLBACK_METHOD =
* MARK_TAB =
* IMPORTING
* USER_RESET =
TABLES
value_tab = gt_member
* FIELD_TAB =
* RETURN_TAB =
* DYNPFLD_MAPPING =
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.
CATCH cx_root.
ENDTRY.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
*& Form F4CALLBACK
* text
* -->RECORD_TAB text
* -->SHLP text
* -->CALLCONTROL text
FORM f4callback TABLES record_tab STRUCTURE seahlpres
CHANGING shlp TYPE shlp_descr
callcontrol TYPE ddshf4ctrl.
callcontrol-no_maxdisp = ''.
ENDFORM. "F4CALLBACK
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_hir.
REFRESH gt_dynpread.
CLEAR gw_dynpread.
gw_dynpread-fieldname = 'P_ENV'.
APPEND gw_dynpread TO gt_dynpread.
gw_dynpread-fieldname = 'P_DIM'.
APPEND gw_dynpread TO gt_dynpread.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-repid
dynumb = sy-dynnr
* TRANSLATE_TO_UPPER = ' '
* REQUEST = ' '
* PERFORM_CONVERSION_EXITS = ' '
* PERFORM_INPUT_CONVERSION = ' '
* DETERMINE_LOOP_INDEX = ' '
* START_SEARCH_IN_CURRENT_SCREEN = 'X'
* start_search_in_main_screen = ' '
* START_SEARCH_IN_STACKED_SCREEN = ' '
* START_SEARCH_ON_SCR_STACKPOS = ' '
* SEARCH_OWN_SUBSCREENS_FIRST = ' '
* SEARCHPATH_OF_SUBSCREEN_AREAS = ' '
TABLES
dynpfields = gt_dynpread
EXCEPTIONS
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
invalid_parameter = 7
undefind_error = 8
double_conversion = 9
stepl_not_found = 10
OTHERS = 11.
IF sy-subrc EQ 0.
SORT gt_dynpread BY fieldname.
DELETE ADJACENT DUPLICATES FROM gt_dynpread COMPARING fieldname.
LOOP AT gt_dynpread INTO gw_dynpread.
IF gw_dynpread-fieldname EQ 'P_ENV'.
gw_env = gw_dynpread-fieldvalue.
ELSEIF gw_dynpread-fieldname EQ 'P_DIM'.
gw_dim = gw_dynpread-fieldvalue.
ENDIF.
ENDLOOP.
IF sy-subrc EQ 0.
CLEAR: gw_datatbl1.
SELECT SINGLE data_table
INTO (gw_datatbl1)
FROM uja_dimension CLIENT SPECIFIED
WHERE mandt EQ sy-mandt
AND appset_id EQ gw_env
AND dimension EQ gw_dim.
IF sy-subrc EQ 0.
REFRESH gt_member.
TRY .
SELECT /cpmb/hir
INTO TABLE gt_hir
FROM (gw_datatbl1) CLIENT SPECIFIED
WHERE mandt EQ sy-mandt.
IF sy-subrc EQ 0.
SORT gt_hir BY hir.
DELETE ADJACENT DUPLICATES FROM gt_hir COMPARING hir.
IF gt_hir IS NOT INITIAL.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = ' '
retfield = '/CPMB/HIR'
* PVALKEY = ' '
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'P_HIR'
* STEPL = 0
* WINDOW_TITLE =
* VALUE = ' '
value_org = 'S'
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '
* CALLBACK_PROGRAM = ' '
* CALLBACK_FORM = ' '
* CALLBACK_METHOD =
* MARK_TAB =
* IMPORTING
* USER_RESET =
TABLES
value_tab = gt_hir
* FIELD_TAB =
* RETURN_TAB =
* DYNPFLD_MAPPING =
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.
ENDIF.
CATCH cx_root.
ENDTRY.
ENDIF.
ENDIF.
ENDIF.
* CLASS lcl_main DEFINITION
CLASS lcl_main DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
create_alv1,
create_alv2,
create_alv3,
create_fieldcatalog,
create_dynamicalv,
merge_tables,
show_alv1
ENDCLASS. "lcl_main DEFINITION
* CLASS lcl_main IMPLEMENTATION
CLASS lcl_main IMPLEMENTATION.
METHOD create_fieldcatalog.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE' "#EC CI_SUBRC
EXPORTING
i_structure_name = gw_datatbl
CHANGING
ct_fieldcat = gt_fcat1
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE' "#EC CI_SUBRC
EXPORTING
i_structure_name = gw_descrptbl
CHANGING
ct_fieldcat = gt_fcat2
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDMETHOD. "create_fieldcatalog
METHOD create_dynamicalv.
* DATA: lr_data TYPE REF TO data.
CLEAR lr_data.
CALL METHOD cl_alv_table_create=>create_dynamic_table
"#EC CI_SUBRC
EXPORTING
* i_style_table =
it_fieldcatalog = gt_fcat2
* i_length_in_byte =
IMPORTING
ep_table = lr_data
* e_style_fname =
EXCEPTIONS
generate_subpool_dir_full = 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.
ENDMETHOD. "create_dynamicalv
METHOD merge_tables.
SORT gt_fcat2 BY col_pos.
ASSIGN lr_data->* TO <gfs_t_final>.
LOOP AT <gfs_tab1> ASSIGNING <gfs_w_tab1>.
APPEND INITIAL LINE TO <gfs_t_final> ASSIGNING <gfs_final>.
LOOP AT gt_fcat2 ASSIGNING <gfs_s_fcat>. "#EC CI_NESTED
ASSIGN COMPONENT <gfs_s_fcat>-fieldname OF STRUCTURE
<gfs_w_tab1> TO <gfs_field>.
IF sy-subrc EQ 0 AND <gfs_field> IS ASSIGNED.
ASSIGN COMPONENT <gfs_s_fcat>-fieldname OF STRUCTURE
<gfs_final> TO <gfs_field_final>.
IF sy-subrc EQ 0 AND <gfs_field_final> IS ASSIGNED.
<gfs_field_final> = <gfs_field>.
ENDIF.
*** Creating dynamic where clause for the key fields
IF <gfs_s_fcat>-key = 'X'.
READ TABLE gt_fcat2_t ASSIGNING <gfs_s_fcat2>
WITH KEY
key = abap_true
fieldname = <gfs_s_fcat>-fieldname.
IF sy-subrc EQ 0.
IF gw_string IS INITIAL.
*Putting value into quotes
CONCATENATE `'` <gfs_field> `'` INTO gw_str.
*Concatenating first field into string
CONCATENATE <gfs_s_fcat>-fieldname '=' gw_str
INTO gw_string SEPARATED BY space.
CLEAR gw_str.
ELSE.
*Concatenating rest all key fields
CONCATENATE `'` <gfs_field> `'` INTO gw_str.
CONCATENATE gw_string 'AND' <gfs_s_fcat>-fieldname
'=' gw_str INTO gw_string SEPARATED BY space.
CLEAR gw_str.
ENDIF.
ENDIF.
*** End of Creation
ENDIF.
ENDIF.
ENDLOOP.
IF NOT gw_string IS INITIAL.
*Concatenating sy-langu (-> always present)
CONCATENATE gw_string 'AND LANGU = SY-LANGU'
INTO gw_string SEPARATED BY space.
ENDIF.
*** Filling Description field based on dynamically created where clause
LOOP AT <gfs_tab2> ASSIGNING <gfs_w_tab2> WHERE (gw_string).
"#EC CI_NESTED
ASSIGN COMPONENT 'TXTLG' OF STRUCTURE <gfs_w_tab2>
TO <gfs_field>.
IF sy-subrc EQ 0 AND <gfs_field> IS ASSIGNED.
ASSIGN COMPONENT 'TXTLG' OF STRUCTURE <gfs_final>
TO <gfs_field_final>.
IF sy-subrc EQ 0 AND <gfs_field_final> IS ASSIGNED.
<gfs_field_final> = <gfs_field>.
ENDIF.
ENDIF.
ENDLOOP.
CLEAR gw_string.
ENDLOOP.
ENDMETHOD. "merge_tables
METHOD create_alv3.
CREATE DATA gr_r_ref TYPE TABLE OF (gw_datatbl).
ASSIGN gr_r_ref->* TO <gfs_tab1>.
SELECT *
INTO TABLE <gfs_tab1>
FROM (gw_datatbl) CLIENT SPECIFIED
WHERE mandt EQ sy-mandt
AND mbr_name IN s_member
AND /cpmb/calc EQ 'N'.
IF sy-subrc EQ 0.
IF p_hir IS NOT INITIAL.
CLEAR gw_hircond.
CONCATENATE '/CPMB/HIR' 'NE' 'P_HIR' INTO gw_hircond
SEPARATED BY space.
DELETE <gfs_tab1> WHERE (gw_hircond).
ENDIF.
CLEAR: gr_r_ref.
CREATE DATA gr_r_ref TYPE TABLE OF (gw_descrptbl).
ASSIGN gr_r_ref->* TO <gfs_tab2>.
SELECT *
FROM (gw_descrptbl) CLIENT SPECIFIED
INTO TABLE <gfs_tab2>
WHERE mandt EQ sy-mandt
AND langu EQ sy-langu.
IF sy-subrc EQ 0.
READ TABLE gt_refdata INTO gw_refdata INDEX 1.
IF sy-subrc EQ 0.
CLEAR gr_r_ref.
CREATE DATA gr_r_ref TYPE TABLE OF (gw_refdata-data_table).
ASSIGN gr_r_ref->* TO <gfs_tab3>.
SELECT *
INTO TABLE <gfs_tab3>
FROM (gw_refdata-data_table) CLIENT SPECIFIED
WHERE mandt EQ sy-mandt
AND /cpmb/calc EQ 'N'.
IF sy-subrc EQ 0.
CLEAR gr_r_ref.
CREATE DATA gr_r_ref TYPE TABLE OF (gw_refdata-desc_table).
ASSIGN gr_r_ref->* TO <gfs_tab4>.
SELECT *
INTO TABLE <gfs_tab4>
FROM (gw_refdata-desc_table) CLIENT SPECIFIED
WHERE mandt EQ sy-mandt
AND langu EQ sy-langu.
lcl_main=>create_fieldcatalog( ).
gt_fcat2_t[] = gt_fcat2[].
DELETE gt_fcat2 WHERE fieldname NE 'TXTLG'.
APPEND LINES OF gt_fcat1 TO gt_fcat2.
gw_len = lines( gt_fcat2 ).
gw_len = gw_len + 1.
gw_fcat-fieldname = 'TXTLG1'.
gw_fcat-reptext = 'Attribute Description'.
gw_fcat-col_pos = gw_len.
gw_fcat-outputlen = 60.
APPEND gw_fcat TO gt_fcat2.
SORT gt_fcat2 BY fieldname.
READ TABLE gt_techattr INTO gw_techattr INDEX 1.
LOOP AT gt_fcat2 INTO gw_fcat.
READ TABLE gt_attr INTO gw_attr
WITH KEY tech_name = gw_fcat-fieldname.
IF sy-subrc EQ 0.
gw_fcat-reptext = gw_attr-caption.
ENDIF.
IF gw_fcat-fieldname = 'TXTLG'.
gw_fcat-outputlen = 60.
ENDIF.
MODIFY gt_fcat2 FROM gw_fcat TRANSPORTING
outputlen reptext .
IF gw_fcat-fieldname NE 'MBR_NAME'
AND gw_fcat-fieldname NE 'TXTLG'
AND gw_fcat-fieldname NE 'TXTLG1'
AND gw_fcat-fieldname NE gw_techattr-tech_name."gw_attrib.
gw_fcat-no_out = 'X'.
MODIFY gt_fcat2 FROM gw_fcat TRANSPORTING no_out.
ENDIF.
ENDLOOP.
lcl_main=>create_dynamicalv( ).
lcl_main=>merge_tables( ).
CLEAR gw_cond.
READ TABLE gt_techattr INTO gw_techattr INDEX 1.
* CONCATENATE 'MBR_NAME =' '<Gfs_field>' INTO Gw_cond
* SEPARATED BY space.
TRANSLATE gw_techattr-tech_name TO UPPER CASE.
CONCATENATE `'` gw_techattr-tech_name `'`
'=' '<Gfs_field>' INTO gw_cond
SEPARATED BY space.
CHECK NOT <gfs_t_final> IS INITIAL.
SORT <gfs_t_final> BY (gw_techattr-tech_name).
LOOP AT <gfs_tab3> ASSIGNING <gfs_w_tab3>.
ASSIGN COMPONENT 'MBR_NAME' OF STRUCTURE <gfs_w_tab3>
TO <gfs_field>.
IF sy-subrc EQ 0 AND <gfs_field> IS ASSIGNED.
DELETE <gfs_t_final> WHERE (gw_cond).
ENDIF.
IF <gfs_t_final> IS INITIAL.
EXIT.
ENDIF.
ENDLOOP.
*adding attribute description
DATA gw_cond1 TYPE string.
DATA gw_cond2 TYPE string.
CLEAR gw_cond1.
CONCATENATE `'` gw_techattr-tech_name `'` 'eq' '<gfs_field>'
INTO gw_cond1 SEPARATED BY space.
CLEAR gw_cond2.
CONCATENATE 'TXTLG1' 'eq' 'SPACE'
INTO gw_cond2 SEPARATED BY space.
CLEAR gw_cond.
CONCATENATE 'TXTLG' 'NE' 'SPACE' INTO gw_cond SEPARATED BY
space.
gw_sortcond = 'TXTLG'.
SORT <gfs_tab4> BY (gw_sortcond).
LOOP AT <gfs_t_final> ASSIGNING <gfs_final> WHERE
(gw_cond2).
ASSIGN COMPONENT gw_techattr-tech_name OF STRUCTURE
<gfs_final> TO <gfs_field>.
IF sy-subrc EQ 0 AND <gfs_field> IS ASSIGNED.
ASSIGN COMPONENT 'TXTLG1' OF STRUCTURE
<gfs_final> TO <gfs_field4>.
IF sy-subrc EQ 0 AND <gfs_field4> IS ASSIGNED.
LOOP AT <gfs_tab4> ASSIGNING <gfs_attr>
WHERE (gw_cond).
ASSIGN COMPONENT 2 OF STRUCTURE <gfs_attr> TO
<gfs_field2>.
IF sy-subrc EQ 0 AND <gfs_field2> IS ASSIGNED.
ASSIGN COMPONENT 5 OF STRUCTURE <gfs_attr>
TO <gfs_field3>.
IF sy-subrc EQ 0 AND <gfs_field3> IS ASSIGNED.
IF <gfs_field> EQ <gfs_field2>.
<gfs_field4> = <gfs_field3>.
MODIFY <gfs_t_final> FROM <gfs_final>
TRANSPORTING ('TXTLG1') WHERE (gw_cond1).
EXIT.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDLOOP.
* LOOP AT <gfs_tab4> ASSIGNING <gfs_attr> WHERE (gw_cond) .
* ASSIGN COMPONENT 2 OF STRUCTURE <gfs_attr> TO
* <gfs_field2>.
* IF sy-subrc EQ 0 AND <gfs_field2> IS ASSIGNED.
* ASSIGN COMPONENT 5 OF STRUCTURE <gfs_attr> TO
* <gfs_field3>.
* IF sy-subrc EQ 0 AND <gfs_field3> IS ASSIGNED.
* LOOP AT <gfs_t_final> ASSIGNING <gfs_final>
* WHERE (gw_cond2).
* ASSIGN COMPONENT gw_techattr-tech_name OF STRUCTURE
* <gfs_final> TO <gfs_field>.
* IF sy-subrc EQ 0 AND <gfs_field> IS ASSIGNED.
* ASSIGN COMPONENT 'TXTLG1' OF STRUCTURE <gfs_final>
* TO <gfs_field4>.
* IF sy-subrc EQ 0 AND <gfs_field4> IS ASSIGNED.
* IF <gfs_field> EQ <gfs_field2>.
* <gfs_field4> = <gfs_field3>.
* MODIFY <gfs_t_final> FROM <gfs_final>
* TRANSPORTING ('TXTLG1') WHERE (gw_cond1).
* EXIT.
* ENDIF.
* ENDIF.
* ENDIF.
* ENDLOOP.
* ENDIF.
* ENDIF.
* ENDLOOP.
IF <gfs_t_final> IS NOT INITIAL.
CALL SCREEN 9000.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDMETHOD. "create_alv3
METHOD create_alv2.
READ TABLE gt_techattr INTO gw_techattr INDEX 1.
CONCATENATE gw_techattr-tech_name 'EQ' 'space' INTO gw_cond
SEPARATED
BY
space.
CREATE DATA gr_r_ref TYPE TABLE OF (gw_datatbl).
ASSIGN gr_r_ref->* TO <gfs_tab1>.
SELECT *
INTO TABLE <gfs_tab1>
FROM (gw_datatbl) CLIENT SPECIFIED
WHERE mandt EQ sy-mandt
AND mbr_name IN s_member
AND /cpmb/calc EQ 'N'
AND (gw_cond).
IF sy-subrc EQ 0.
IF p_hir IS NOT INITIAL.
CLEAR gw_hircond.
CONCATENATE '/CPMB/HIR' 'NE' 'P_HIR' INTO gw_hircond
SEPARATED BY space.
DELETE <gfs_tab1> WHERE (gw_hircond).
ENDIF.
CLEAR: gr_r_ref.
CREATE DATA gr_r_ref TYPE TABLE OF (gw_descrptbl).
ASSIGN gr_r_ref->* TO <gfs_tab2>.
SELECT *
FROM (gw_descrptbl) CLIENT SPECIFIED
INTO TABLE <gfs_tab2>
WHERE mandt EQ sy-mandt
AND langu EQ sy-langu.
IF sy-subrc EQ 0.
lcl_main=>create_fieldcatalog( ).
gt_fcat2_t[] = gt_fcat2[].
DELETE gt_fcat2 WHERE fieldname NE 'TXTLG'.
APPEND LINES OF gt_fcat1 TO gt_fcat2.
SORT gt_fcat2 BY fieldname.
LOOP AT gt_fcat2 INTO gw_fcat.
READ TABLE gt_attr INTO gw_attr WITH KEY
tech_name = gw_fcat-fieldname.
IF sy-subrc EQ 0.
gw_fcat-reptext = gw_attr-caption.
ENDIF.
IF gw_fcat-fieldname = 'TXTLG'.
gw_fcat-outputlen = 60.
ENDIF.
MODIFY gt_fcat2 FROM gw_fcat TRANSPORTING outputlen reptext.
* READ TABLE gt_attrib INTO gw_attrib INDEX 1.
* IF sy-subrc EQ 0.
IF gw_fcat-fieldname NE 'MBR_NAME'
AND gw_fcat-fieldname NE 'TXTLG'
AND gw_fcat-fieldname NE gw_techattr-tech_name."gw_attrib.
gw_fcat-no_out = 'X'.
MODIFY gt_fcat2 FROM gw_fcat TRANSPORTING no_out.
ENDIF.
* ENDIF.
ENDLOOP.
lcl_main=>create_dynamicalv( ).
lcl_main=>merge_tables( ).
CHECK NOT <gfs_t_final> IS INITIAL.
SORT <gfs_t_final> BY ('MBR_NAME').
CALL SCREEN 9000.
ENDIF.
ENDIF.
ENDMETHOD. "create_alv2
METHOD create_alv1.
CREATE DATA gr_r_ref TYPE TABLE OF (gw_datatbl).
ASSIGN gr_r_ref->* TO <gfs_tab1>.
SELECT *
FROM (gw_datatbl) CLIENT SPECIFIED
INTO TABLE <gfs_tab1>
WHERE mandt EQ sy-mandt
AND mbr_name IN s_member.
IF sy-subrc EQ 0.
IF p_hir IS NOT INITIAL.
CLEAR gw_hircond.
CONCATENATE '/CPMB/HIR' 'NE' 'P_HIR'
INTO gw_hircond SEPARATED BY
space.
DELETE <gfs_tab1> WHERE (gw_hircond).
ENDIF.
CLEAR: gr_r_ref.
CREATE DATA gr_r_ref TYPE TABLE OF (gw_descrptbl).
ASSIGN gr_r_ref->* TO <gfs_tab2>.
SELECT *
FROM (gw_descrptbl) CLIENT SPECIFIED
INTO TABLE <gfs_tab2>
WHERE mandt EQ sy-mandt
AND langu EQ sy-langu.
IF sy-subrc EQ 0.
lcl_main=>create_fieldcatalog( ).
SORT gt_fcat2 BY col_pos fieldname.
gt_fcat2_t[] = gt_fcat2[].
DELETE gt_fcat2 WHERE fieldname NE 'TXTLG'.
APPEND LINES OF gt_fcat1 TO gt_fcat2.
SORT gt_fcat2 BY fieldname.
SORT gt_attr BY tech_name.
LOOP AT gt_fcat2 INTO gw_fcat .
IF gw_fcat-reptext IS INITIAL.
READ TABLE gt_attr INTO gw_attr
WITH KEY tech_name = gw_fcat-fieldname BINARY SEARCH.
IF sy-subrc EQ 0.
gw_fcat-reptext = gw_attr-caption.
ELSE.
gw_fcat-reptext = gw_fcat-fieldname.
ENDIF.
ENDIF.
IF gw_fcat-fieldname EQ 'OBJVERS'.
gw_fcat-no_out = 'X'.
ELSEIF gw_fcat-fieldname EQ 'ROWFLAG'.
gw_fcat-no_out = 'X'.
ELSEIF gw_fcat-fieldname EQ 'MBR_NAME'.
gw_fcat-no_out = 'X'.
ELSEIF gw_fcat-fieldname EQ '/CPMB/CALC'.
gw_fcat-no_out = 'X'.
ELSEIF gw_fcat-fieldname EQ 'TXTLG'.
gw_fcat-outputlen = 70.
ELSEIF gw_fcat-fieldname EQ '/CPMB/HIR'.
gw_fcat-outputlen = 20.
ENDIF.
MODIFY gt_fcat2 FROM gw_fcat
TRANSPORTING reptext no_out outputlen.
ENDLOOP.
lcl_main=>create_dynamicalv( ).
lcl_main=>merge_tables( ).
CHECK NOT <gfs_t_final> IS INITIAL.
* SORT <gfs_t_final> BY ('TXTLG').
CALL SCREEN 9000.
ENDIF.
ENDIF.
ENDMETHOD. "show_alv1
METHOD show_alv1.
IF go_custom_container IS INITIAL.
CREATE OBJECT go_custom_container
EXPORTING
* parent =
container_name = gw_g_container
* style =
* lifetime = lifetime_default
* repid =
* dynnr =
* no_autodef_progid_dynnr =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_grid1
EXPORTING
* i_shellstyle = 0
* i_lifetime =
i_parent = go_custom_container
* i_appl_events = 'X'
* i_parentdbg =
* i_applogparent =
* i_graphicsparent =
* i_name =
* i_fcat_complete = SPACE
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD go_grid1->set_table_for_first_display "#EC CI_SUBRC
* EXPORTING
* i_buffer_active =
* i_bypassing_buffer =
* i_consistency_check =
* i_structure_name =
* is_variant =
* i_save = 'X'
** i_default = 'X'
* is_layout =
** is_print =
** it_special_groups =
* it_toolbar_excluding =
* it_hyperlink =
* it_alv_graphics =
* it_except_qinfo =
* ir_salv_adapter =
CHANGING
it_outtab = <gfs_t_final>
it_fieldcatalog = gt_fcat2
* it_sort =
* it_filter =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.
ENDMETHOD. "SHOW_alv1
ENDCLASS. "lcl_main IMPLEMENTATION
AT SELECTION-SCREEN OUTPUT.
IF p_radio1 EQ 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'M1'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
* IF screen-group1 = 'M'.
* screen-active = 0.
* MODIFY SCREEN.
* ENDIF.
ENDLOOP.
ENDIF.
* IF p_radio2 EQ 'X'.
* LOOP AT SCREEN.
* IF p_reason EQ 30.
* IF screen-group1 = 'M2'.
* screen-active = 0.
* MODIFY SCREEN.
* ENDIF.
* ENDIF.
* ENDLOOP.
* ENDIF.
START-OF-SELECTION.
IF p_radio1 EQ 'X'.
SELECT SINGLE data_table desc_table
INTO (gw_datatbl , gw_descrptbl)
FROM uja_dimension CLIENT SPECIFIED
WHERE mandt EQ sy-mandt
AND appset_id EQ p_env
AND dimension EQ p_dim.
IF sy-subrc EQ 0.
SELECT appset_id dimension tech_name attribute_name caption
INTO TABLE gt_attr
FROM uja_dim_attr CLIENT SPECIFIED
WHERE mandt EQ sy-mandt
AND appset_id EQ p_env
AND dimension EQ p_dim.
IF sy-subrc EQ 0.
lcl_main=>create_alv1( ).
ENDIF.
ENDIF.
ELSE.
IF p_reason NE 30.
SELECT *
INTO TABLE gt_except
FROM zbpcbt007 CLIENT SPECIFIED
WHERE mandt EQ sy-mandt
AND appset_id EQ p_env
AND dimension EQ p_dim
AND reasoncd EQ p_reason.
IF sy-subrc EQ 0.
SELECT SINGLE data_table desc_table
INTO (gw_datatbl,gw_descrptbl)
FROM uja_dimension CLIENT SPECIFIED
WHERE mandt EQ sy-mandt
AND appset_id EQ p_env
AND dimension EQ p_dim.
IF sy-subrc EQ 0.
SELECT appset_id dimension tech_name attribute_name caption
INTO TABLE gt_attr
FROM uja_dim_attr CLIENT SPECIFIED
WHERE mandt EQ sy-mandt
AND appset_id EQ p_env
AND dimension EQ p_dim.
IF sy-subrc EQ 0.
gt_except_t[] = gt_except[].
SORT gt_except_t.
DELETE ADJACENT DUPLICATES FROM gt_except_t.
IF gt_except_t IS NOT INITIAL.
SELECT tech_name
INTO TABLE gt_techattr
FROM uja_dim_attr CLIENT SPECIFIED
FOR ALL ENTRIES IN gt_except_t
WHERE mandt EQ sy-mandt
AND appset_id EQ p_env
AND dimension EQ p_dim
AND attribute_name EQ gt_except_t-attrib.
IF sy-subrc EQ 0.
lcl_main=>create_alv2( ).
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ELSEIF p_reason EQ 30.
SELECT SINGLE data_table desc_table
INTO (gw_datatbl,gw_descrptbl)
FROM uja_dimension CLIENT SPECIFIED
WHERE mandt EQ sy-mandt
AND appset_id EQ p_env
AND dimension EQ p_dim.
IF sy-subrc EQ 0.
* gt_except_t[] = gt_except[].
* SORT gt_except_t BY attrib.
* DELETE ADJACENT DUPLICATES FROM gt_except_t COMPARING attrib.
* IF gt_except_t IS NOT INITIAL.
SELECT refdimension
INTO TABLE gt_refdim
FROM zbpcbt009 CLIENT SPECIFIED
* FOR ALL ENTRIES IN gt_except_t
WHERE mandt EQ sy-mandt
AND appset_id EQ p_env
AND dimension EQ p_dim
AND attrib EQ p_attr."gt_except_t-attrib.
IF sy-subrc EQ 0.
gt_refdim_t[] = gt_refdim[].
SORT gt_refdim_t BY dimension.
DELETE ADJACENT DUPLICATES FROM gt_refdim_t COMPARING
dimension.
IF gt_refdim_t IS NOT INITIAL.
SELECT data_table desc_table
INTO TABLE gt_refdata
FROM uja_dimension CLIENT SPECIFIED
FOR ALL ENTRIES IN gt_refdim_t
WHERE mandt EQ sy-mandt
AND appset_id EQ p_env
AND dimension EQ gt_refdim_t-dimension.
IF sy-subrc EQ 0.
SELECT appset_id dimension tech_name attribute_name
caption
INTO TABLE gt_attr
FROM uja_dim_attr CLIENT SPECIFIED
WHERE mandt EQ sy-mandt
AND appset_id EQ p_env
AND dimension EQ p_dim.
IF sy-subrc EQ 0.
SELECT tech_name
INTO TABLE gt_techattr
FROM uja_dim_attr CLIENT SPECIFIED
* FOR ALL ENTRIES IN gt_except_t
WHERE mandt EQ sy-mandt
AND appset_id EQ p_env
AND dimension EQ p_dim
AND attribute_name EQ p_attr."gt_except_t-attrib.
IF sy-subrc EQ 0.
REFRESH: gt_refdim_t.",gt_except_t.
lcl_main=>create_alv3( ).
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
* ENDIF.
* ENDIF.
ENDIF.
ENDIF.
*& Module SHOW_ALV1 OUTPUT
*&-------Yes you can, although you need to do it slightly differently, depending on what your 'original' form is doing.
You end up having to do two things:
1. In your second tabular form, you need to explicitly identify the relevant form fields using calls to the relevant APEX_ITEM functions - as well as this, you need to 'manually' specify the array number in the arguments for the function call, ensuring it doesn't overlap with your original form. Normally, this aspect is done for you.
2. Create your own custom CRUD processes, referencing the above elements. There are a few threads floating around the forum relating to how to deal with this. Do a search for "APEX_APPLICATION.G_F" or "HTMLDB_APPLICATION.G_F" for pointers.
Happy hunting! -
How to create a dynamic table (repeating) with static header?
Hello
My purpose is to create a table which should be dynamically filled at runtime depending on the number of elements in the datasource($record.list). If the list is empty, the table shouldn't be displayed at all.
I created a subform which holds a table, ticking "Repeat Subform for each data item" and I set the binding of the table elements to $record.list[*].myelement. This works fine so far.
For the table header I created a second subform with a table having exactly the same size like the other table with text fields that contain the table header texts.
My problem now is that I would like to control the display of the subform which serves as table header row depending on whether $record.list is empty or not.
What's the best way to do this? How can I have access to the datasource for a form?
Thank you very much for your help!!!
Best regards
Bettina HeppHi,
Instead of creating the header row outside the table.
Create it inside the same table as header row.
So when you create a condition then automatically applicable for the header row also.
This is the best option.
Regards,
sasi -
How to populate an internal table from three different tables
My requirement is to populate an itab by retrieving data from three diff db tables,
ekko,ekpo and Ekbe.
below is the code for data retrieval .
SELECT EBELN INTO TABLE IT_EKKO FROM EKKO WHERE EBELN IN S_EBELN.
IF NOT IT_EKKO[] IS INITIAL.
SELECT EBELP TXZ01 NETWR BUKRS INTO CORRESPONDING FIELDS OF TABLE IT_EKPO FROM EKPO FOR ALL ENTRIES IN IT_EKKO
WHERE EBELN EQ IT_EKKO-EBELN.
IF NOT IT_EKPO[] IS INITIAL.
SELECT EMATN WAERS WERKS GJAHR BEWTP INTO CORRESPONDING FIELDS OF TABLE IT_EKBE FROM EKBE FOR ALL ENTRIES IN IT_EKPO
WHERE EBELN EQ IT_EKPO-EBELN
AND EBELP EQ IT_EKPO-EBELP
AND BEWTP EQ 'E' OR BEWTP EQ 'Q'.
ENDIF.
ENDIF.
please tell me how to populate data from it_ekko,it_ekpo and it_ekbe into an internal table ITAB.Hi Mayana,
You take one final structure & final internal table, & within that structure take all the fields which is required to be displayed as a final output.
for data fetching from different table, you take three different structures & three internal table for that, because into corresponding fields of table is not good for performance wise. Use into table syntax.
follow the below example:(similarly)
sort it_klah by key fields.
LOOP AT IT_KSSK INTO WA_KSSK.
READ TABLE IT_KLAH INTO WA_KLAH WITH KEY CLINT = WA_KSSK-CLINT
KLART = WA_KSSK-KLART.
IF SY-SUBRC EQ 0.
MOVE: WA_KLAH-OBJEK to WA_final-OBJEK.
Read another table........(2nd one)
IF SY-SUBRC EQ 0.
MOVE: ....................................
APPEND WA_final TO IT_final.
ENDIF.
clear wa_final.
ENDLOOP.
finally display it_final records.
Hope this can solve your problems.
Regards,
Tutun -
How to populate one internal table from another using field symbols
Hi Gurus,
I have a problem. I have to populate one internal table (sructure t_otput) from another internal table (sructure t_from) using field symbol.
Structure for from table.
types: begin of t_from,
year(4) type c,
ww(2) type c,
site type marc-werks,
demand type i,
end of t_from.
Structure for output table.
types: begin of t_display,
title(30),
WW1(10),
WW2(10),
WW3(10),
end of t_display.
The from table looks like this:
Year | WW | Site | Demand
2005 | 1 | OR1 | 12.00
2005 | 2 | OR1 | 13.00
2005 | 3 | OR1 | 14.00
The display table which has to be populated should look like this:
Title | WW1 | WW2 | WW3
OR1 | | |
Demand | 12.00 | 13.00 | 14.00
How to populate display table using field symbol?
Please give code snippets
Thanks,
GopalGopal,
Here is the code, however I am not vary clear about the ORG1 and Demand display that you have shown in the display. I am sure with this code it should not be a big deal to tweak in whatever manner you want.
TABLES : marc.
TYPES: BEGIN OF type_display,
title(30),
ww1(10),
ww2(10),
ww3(10),
END OF type_display.
TYPES: BEGIN OF type_from,
year(4) TYPE c,
ww(2) TYPE c,
site TYPE marc-werks,
demand TYPE i,
END OF type_from.
data : t_from type table of type_from,
t_display type table of type_display.
field-symbols : <fs_from> type type_from,
<fs_display> type type_display.
data : wa_from type type_From,
wa_display type type_display.
wa_from-year = '2005'.
wa_from-ww = '1'.
wa_from-site = 'OR1'.
wa_from-demand = '12.00'.
insert wa_from into table t_from.
wa_from-year = '2005'.
wa_from-ww = '2'.
wa_from-site = 'OR1'.
wa_from-demand = '13.00'.
insert wa_from into table t_from.
wa_from-year = '2005'.
wa_from-ww = '3'.
wa_from-site = 'OR1'.
wa_from-demand = '14.00'.
insert wa_from into table t_from.
data : variable(3) type c.
field-symbols : <fs_any> type any.
break-point.
Loop at t_from assigning <fs_from>.
variable = 'WW'.
wa_display-title = <fs_from>-site.
concatenate variable <fs_from>-ww into variable.
assign component variable of structure wa_display to <fs_any>.
<fs_any> = <fs_from>-demand.
endloop.
append wa_display to t_display.
clear wa_display.
loop at t_display assigning <Fs_display>.
write :/ <fs_display>.
endloop.
Note : Please award points if this helps you.
Regards,
Ravi -
How to populate data from table into datagrid in form
hi there. may i know how to populate data from a table into a datagrid? i have created a datagrid in a form using OLE's microsoft datagrid. i'm having problem to populate data from table into the grid. can i know how to do that? thanks
Not exactly. I want to enter input from form and the user can have all options to choose i.e. HIGH, MEDIUM or so on.
Suppose, you have option to select HIGH, MEDIUM or LOW and you can see all these options together. You select LOW and when you save, it is saves in the table as a value. So when you view the table again, it will show LOW as active and HIGH and MEDIUM are null. -
How to populate values dynamically & allows user to edit some other columns
Hi..I am new to Apex..please help me to sove it out...
I have a scenario like editing the some of the Customer details where as one field is dynamically populating from a different table.
Columns like Include, Frequency, Communication, Address and Exclude has to be displayed in tabular format and data should be stored in a table called "om_customer_catalog ".
In this "Communication " column value is dynamically populating from a table called "om_customer_settings" and the no. of records in the om_customer_settings table may vary time to time as per the settins in the Admin module.
I want the user to edit all details except Communication column for all the rows which is displayed and the no. of rows should be displayed dynamically as per the settings.
how can i achieve this?...which way i need to proceed like whether report kind of thing..or someother way..
hope some reply....
More Column details:
Include - a Check box with editable(values Y or N)
Communication - text field with display only(values like Promotional Email, All Email etc.)
Frequecny - Drop downbox with editable(values Annually/Monthly/Weekly etc)
Address - Drop down with editable(static values like Me, Father, Mother,Brother etc)
Exclude Reason - text field with editable(any text value)
Apply - a button for saving the changes
thanks in advace...
renjishHello Renjish,
Solution is quite tricky, You have to make a procedure which select each row of your tabular form and executes the update statement (customized).
e.g
to select each row of table use
begin
FOR I in 1..APEX_APPLICATION.G_F01.COUNT
LOOP
insert into table_name values(APEX_APPLICATION.G_F01(i),'PENDING',sysdate,'RESOURCE','','','','');
end loop;
end;
here APEX_APPLICATION.G_F01(i) will return the value of the first column of selected row. Pick the values and make a cutomized update command.
Regards,
bhanwar
Maybe you are looking for
-
How to read multiple files in the same folder?
Suppose I have 100 txt files in the same folder, and I want to read them one by one. (order is not important). File name is also part of the information I want. How to do that? Thanks
-
Removing RAM from new Aluminum 24" iMac
What's the best way to remove the RAM chips from the new aluminum 24" iMac? I had a leftover 256 MB chip that I installed for a total of 1.25 GB of RAM, but now I would like to go to 4 GB. The RAM is very snug in there, and I don't want to break or d
-
Bright White Pixel on LCD - But NOT Visible on Black Background
Hi All, Just noticed today on my macbook pro (Early 08 - july manufacture) that a small white spot has appeared. Not the blobby large spots that were common lcd problems before on older models, but almost a pinprick of a white spot. Now its not a dea
-
Hi, We have a situation where we need to add an additional field "reason for water usage" as an optional field with drop down choices in MAM/MAU I am new to Mobile. Kindly let me know how to progress on this. Regards, Sanjay
-
Z97 MPOWER MAX AC - strange wet places on board
Hello, I noticed on my motherboard strange wet places. I do not know whether it is wet or greasy, it is look's like this: There is few more in other places, most of them with connectors. So what is this ?