How to have Dynamic Columns based on Work centers in CRHD table?
i need to create dynamic internal table......based on the number of entries(work centers ) in CRHD table....this is number of work centers...like how many manufac unit....How to have the work center names at heading and how to fill values at rows...as the number of workcenters may differ dynamic.....how to fill the values...for a dynamic internal table
Hi Meena,
For Dynamic display ,go through it
REPORT yusmm_text1 NO STANDARD PAGE HEADING
LINE-SIZE 199.
T A B L E S
TABLES: MARA,
MAKT,
THEAD.
GLOBAL TYPE-POOLS
TYPE-POOLS : SLIS.
GLOBAL TYPES
TYPES : BEGIN OF TP_FINAL,
MATNR TYPE MARA-MATNR,
BEGRU TYPE MARA-BEGRU,
MTART TYPE MARA-MTART,
MAKTX TYPE MAKT-MAKTX,
SPRAS TYPE MAKT-SPRAS,
LTXT(2000) TYPE C ,
SRNO TYPE N ,
END OF TP_FINAL.
TYPES : BEGIN OF TP_T002,
SPRAS TYPE T002-SPRAS,
LAISO TYPE T002-LAISO,
SRNO TYPE N ,
END OF TP_T002.
TYPES : BEGIN OF TP_MARA_MAKT,
MATNR TYPE MARA-MATNR,
BEGRU TYPE MARA-BEGRU,
MTART TYPE MARA-MTART,
SPRAS TYPE MAKT-SPRAS,
MAKTX TYPE MAKT-MAKTX,
END OF TP_MARA_MAKT.
Types: BEGIN OF tp_matnr,
matnr TYPE mara-matnr,
END OF tp_matnr.
GLOBAL ELEMENTARY VARIABLES
DATA : gv_date TYPE sy-datum.
DATA : gv_repid TYPE sy-repid.
DATA : g_var1(10) TYPE C.
DATA : gv_index TYPE sy-tabix.
DATA: gv_strg TYPE string,
gv_strg1(2000) TYPE C.
DATA : gv_lang TYPE sy-langu.
DATA : g_v(3) TYPE N .
DATA : gv_lines(3) TYPE N .
DATA : gv_var(3) TYPE N .
DATA : gv_var1(3) TYPE N.
DATA: gv_str TYPE STRING.
DATA: gv_str1 TYPE STRING.
DATA : gv_li TYPE I,
gv_lit TYPE I,
gv_lin TYPE I.
DATA: g_var11(3) TYPE N,
gv_li1(3) TYPE N,
g_var2(3) TYPE N.
DATA : gv_i1 TYPE I.
DATA : gv_i TYPE I.
DATA: gl_lenght TYPE I.
GLOBAL STRUCTURES
DATA: T_NEWTABLE TYPE REF TO DATA,
T_NEWLINE TYPE REF TO DATA,
T_FLDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
T_FLDCAT TYPE LVC_T_FCAT,
WA_IT_FLDCAT TYPE LVC_S_FCAT,
WA_IT_FLDCAT1 TYPE SLIS_FIELDCAT_ALV,
WA_COLNO(2) TYPE N,
WA_FLNAME(5) TYPE C,
L_LT TYPE SLIS_LAYOUT_ALV.
GLOBAL INTERNAL TABLES (WITH INCLUDE STRUCTURE)
DATA : IG_MARA_MAKT TYPE STANDARD TABLE OF TP_MARA_MAKT,
WG_MARA_MAKT TYPE TP_MARA_MAKT.
DATA : IG_T002 TYPE STANDARD TABLE OF TP_T002,
WG_T002 TYPE TP_T002.
DATA : IG_FINAL TYPE STANDARD TABLE OF TP_FINAL,
WG_FINAL TYPE TP_FINAL.
data : IG_MATNR TYPE STANDARD TABLE OF TP_MATNR WITH HEADER LINE,
WG_MATNR TYPE TP_MATNR.
DATA:BEGIN OF IG_THEAD OCCURS 0.
INCLUDE STRUCTURE THEAD .
DATA: END OF IG_THEAD.
DATA:BEGIN OF IG_TLINE OCCURS 0.
INCLUDE STRUCTURE TLINE .
DATA:END OF IG_TLINE.
FIELD-SYMBOLS
FIELD-SYMBOLS: <T_DYNTABLE> TYPE STANDARD TABLE,"Dynamic internal
"tablename
<FS_DYNTABLE>, "Field symbol to create work area
<FS_FLDVAL> TYPE ANY. " Field symbol to assign values
COMPULSORY
FIELD-SYMBOLS: <FS_DATA> TYPE REF TO DATA,
<FS_DATA1> TYPE REF TO DATA,
<FS_2> TYPE STANDARD TABLE,
<FS_22> TYPE STANDARD TABLE,
<FS_1>,
<FS_11>,
<F>,
<FA>,
<LWA_LINE_WA>,
<LWA_LINE_WA1>.
------- Create Dyn Table From FC
DATA: LT_DATA TYPE REF TO DATA,
LT_DATA1 TYPE REF TO DATA,
LWA_LINE TYPE REF TO DATA,
LWA_LINE1 TYPE REF TO DATA,
LI_FIELD_CAT TYPE LVC_T_FCAT,
LWA_FIELD_CAT TYPE LVC_S_FCAT.
PARAMETERS & SELECT-OPTIONS
SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : S_SPRAS FOR MAKT-SPRAS NO INTERVALS DEFAULT 'EN'
OBLIGATORY ,
S_MATNR FOR MARA-MATNR,
S_MTART FOR MARA-MTART.
PARAMETERS: GP_SIZE TYPE I DEFAULT '200'.
SELECTION-SCREEN : END OF BLOCK B1.
INITIALIZATION
INITIALIZATION.
gv_repid = sy-repid.
gv_date = sy-datum.
AT SELECTION-SCREEN
AT SELECTION-SCREEN.
IF GP_SIZE < 0.
MESSAGE E002(00).
ENDIF.
IF GP_SIZE > 50000.
MESSAGE W130(26) WITH TEXT-004.
SET CURSOR FIELD 'gp_size'.
ENDIF.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM FIELDCAT.
PERFORM LAYOUT.
PERFORM DATA_FETCH.
PERFORM READ_DATA_TO_FINAL.
SORT ig_final BY matnr spras.
gv_lin = gv_li.
gv_li = gv_li - 2.
LOOP AT ig_final INTO wg_final.
ASSIGN COMPONENT 1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = 'Material Number'.
ASSIGN COMPONENT 2 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = 'Authorization Group'.
g_VAR11 = wg_final-srno + 2.
gv_li1 = gv_li1 + 2.
MOVE : g_var11 TO gv_i1.
ASSIGN COMPONENT g_var11 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = 'MatDesc'.
g_var2 = g_var11 + gv_lines.
ASSIGN COMPONENT g_var2 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = 'BasicData'.
APPEND <LWA_LINE_WA1> TO <FS_22>.
EXIT.
ENDLOOP.
LOOP AT ig_final INTO wg_final.
AT NEW matnr.
gv_index = sy-tabix.
ASSIGN COMPONENT 1 OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = wg_final-matnr.
ENDAT.
AT NEW MATNR.
GV_INDEX = SY-TABIX.
ASSIGN COMPONENT 1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = wg_final-matnr.
ENDAT.
ASSIGN COMPONENT 2 OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = wg_final-begru.
ASSIGN COMPONENT 2 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = wg_final-begru.
gv_var = wg_final-srno + 2.
gv_li = gv_li + 2.
MOVE : gv_var TO gv_i.
ASSIGN COMPONENT gv_var OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = wg_final-maktx.
ASSIGN COMPONENT gv_var OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = wg_final-maktx.
gv_var1 = gv_var + gv_lines .
ASSIGN COMPONENT gv_var1 OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = wg_final-ltxt.
ASSIGN COMPONENT gv_var1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = wg_final-ltxt.
AT END OF matnr.
APPEND <LWA_LINE_WA> TO <FS_2>.
CLEAR <LWA_LINE_WA>.
ENDAT.
AT END OF matnr.
APPEND <LWA_LINE_WA1> TO <FS_22>.
CLEAR <LWA_LINE_WA1>.
ENDAT.
ENDLOOP.
PERFORM display..
*& Form data_fetch
text
--> p1 text
<-- p2 text
FORM DATA_FETCH .
SELECT matnr
from mara up to gp_size rows
appending corresponding fields of table ig_matnr
where matnr in s_matnr
and mtart in s_mtart.
loop at ig_matnr.
SELECT MARA~MATNR
MARA~BEGRU
MARA~MTART
MAKT~SPRAS
MAKT~MAKTX FROM MARA INNER JOIN MAKT
ON MARAMATNR = MAKTMATNR
appending corresponding fields of TABLE ig_mara_makt UP TO GP_SIZE
ROWS
WHERE makt~spras IN s_spras
AND mara~matnr IN s_matnr
AND mara~mtart IN s_mtart
AND mara~matnr EQ ig_matnr-matnr.
endloop.
IF sy-subrc = 0.
SORT ig_mara_makt.
ENDIF.
ENDFORM. " data_fetch
*& Form read_data_to_final
text
--> p1 text
<-- p2 text
FORM READ_DATA_TO_FINAL .
LOOP AT ig_mara_makt INTO wg_mara_makt .
wg_final-MATNR = wg_mara_makt-MATNR.
wg_final-BEGRU = wg_mara_makt-BEGRU.
wg_final-MTART = wg_mara_makt-MTART.
wg_final-SPRAS = wg_mara_makt-SPRAS.
wg_final-MAKTX = wg_mara_makt-MAKTX.
READ TABLE ig_t002 INTO wg_t002 WITH KEY spras = wg_final-spras.
IF sy-subrc = 0.
wg_final-srno = wg_t002-srno.
ENDIF.
CLEAR ig_thead[].
ig_thead-TDOBJECT = 'MATERIAL'.
ig_thead-TDNAME = wg_final-matnr.
ig_thead-TDID = 'GRUN'.
ig_thead-TDSPRAS = wg_final-spras.
CALL FUNCTION 'TEXT_READ'
EXPORTING
I_HEADER = IG_THEAD
I_READONLY = 'X'
IMPORTING
E_HEADER = IG_THEAD
TABLES
T_LINES = IG_TLINE[]
EXCEPTIONS
NOTFOUND = 1.
IF sy-subrc EQ 0.
LOOP AT ig_tline.
gv_strg = ig_tline-tdline.
IF gv_strg1 <> ' '.
CONCATENATE gv_strg1 ';' gv_strg INTO gv_strg1.
ELSE.
gv_strg1 = gv_strg.
ENDIF.
ENDLOOP.
wg_final-ltxt = gv_strg1.
APPEND wg_final TO ig_final.
CLEAR wg_final.
gv_strg1 = ' '.
ELSE.
APPEND wg_final TO ig_final.
ENDIF.
ENDLOOP.
ENDFORM. " read_data_to_final
" read_data_to_final
*& Form layout
text
--> p1 text
<-- p2 text
FORM LAYOUT .
CLEAR L_LT.
L_LT-ZEBRA = 'X'.
L_LT-COLWIDTH_OPTIMIZE = 'X'.
L_LT-WINDOW_TITLEBAR = 'MATERIAL DETAILS'.
ENDFORM. " layout
*& Form fieldcat
text
--> p1 text
<-- p2 text
FORM FIELDCAT .
SELECT SPRAS
LAISO FROM t002 INTO CORRESPONDING FIELDS OF TABLE ig_t002
WHERE spras IN s_spras.
DESCRIBE TABLE ig_t002 LINES gv_lines.
LOOP AT ig_t002 INTO wg_t002.
g_v = g_v + 1.
Wg_t002-srno = g_v.
MODIFY ig_t002 FROM wg_t002 TRANSPORTING SRNO.
ENDLOOP.
LOOP AT ig_t002 INTO wg_t002.
CLEAR WA_IT_FLDCAT.
MOVE SY-INDEX TO WA_COLNO.
CONCATENATE 'MD-' wg_t002-LAISO
WA_COLNO
INTO WA_FLNAME.
WA_IT_FLDCAT-FIELDNAME = WA_FLNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-SELTEXT = WA_FLNAME.
WA_IT_FLDCAT-INTLEN = 250.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
APPEND WA_IT_FLDCAT TO T_FLDCAT.
CLEAR wg_t002.
ENDLOOP.
LOOP AT ig_t002 INTO wg_t002.
CLEAR WA_IT_FLDCAT.
MOVE SY-INDEX TO WA_COLNO.
CONCATENATE 'BD-' wg_t002-LAISO
WA_COLNO
INTO WA_FLNAME.
WA_IT_FLDCAT-FIELDNAME = WA_FLNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-SELTEXT = WA_FLNAME.
WA_IT_FLDCAT-INTLEN = 250.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
APPEND WA_IT_FLDCAT TO T_FLDCAT.
CLEAR wg_t002.
ENDLOOP.
MOVE 'MATNR' TO WA_FLNAME.
WA_IT_FLDCAT-FIELDNAME = WA_FLNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-SELTEXT = 'Material No'.
WA_IT_FLDCAT-INTLEN = 18.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
INSERT WA_IT_FLDCAT INTO T_FLDCAT INDEX 1.
MOVE 'BEGRU' TO WA_FLNAME.
WA_IT_FLDCAT-FIELDNAME = WA_FLNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-SELTEXT = 'Authorization Group'.
WA_IT_FLDCAT-INTLEN = 4.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
INSERT WA_IT_FLDCAT INTO T_FLDCAT INDEX 2.
DESCRIBE TABLE T_FLDCAT LINES gv_li.
ASSIGN LT_DATA TO <FS_DATA>.
Creating the Dynamic Internal Table
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = T_FLDCAT " Fieldcatalogue
IMPORTING
EP_TABLE = <FS_DATA> " Dynamic Internal Table
EXCEPTIONS
GENERATE_SUBPOOL_DIR_FULL = 1
OTHERS = 2.
Assign Dyn Table To Field Sumbol
ASSIGN <FS_DATA>->* TO <FS_1>.
Assigning the Internal Table TYPE ANY to Standard internal Table
ASSIGN <FS_1> TO <FS_2>.
Creating a Workarea
CREATE DATA LWA_LINE LIKE LINE OF <FS_2> .
Assigning the Content to the workares as a Pointer
ASSIGN LWA_LINE->* TO <LWA_LINE_WA>.
LOOP AT T_FLDCAT INTO WA_IT_FLDCAT.
WA_IT_FLDCAT1-FIELDNAME = WA_IT_FLDCAT-FIELDNAME.
WA_IT_FLDCAT1-TABNAME = WA_IT_FLDCAT-TABNAME.
WA_IT_FLDCAT1-SELTEXT_L = WA_IT_FLDCAT-SELTEXT.
WA_IT_FLDCAT1-REF_TABNAME = 'MARC'.
APPEND WA_IT_FLDCAT1 TO T_FLDCAT1.
CLEAR : WA_IT_FLDCAT,WA_IT_FLDCAT1.
ENDLOOP.
ASSIGN LT_DATA1 TO <FS_DATA1>.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = T_FLDCAT " Fieldcatalogue
IMPORTING
EP_TABLE = <FS_DATA1> " Dynamic Internal table
EXCEPTIONS
GENERATE_SUBPOOL_DIR_FULL = 1
OTHERS = 2.
Assign Dyn Table To Field Sumbol
ASSIGN <FS_DATA1>->* TO <FS_11>.
Assigning the Internal Table TYPE ANY to Standard internal Table
ASSIGN <FS_11> TO <FS_22>.
Creating a Workarea
CREATE DATA LWA_LINE1 LIKE LINE OF <FS_22> .
Assigning the Content to the workares as a Pointer
ASSIGN LWA_LINE1->* TO <LWA_LINE_WA1>.
ENDFORM. " fieldcat
*& Form show
text
--> p1 text
<-- p2 text
FORM Display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = GV_REPID
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS_SET'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = L_LT
IT_FIELDCAT = T_FLDCAT1[]
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 = <FS_2>
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
FORM PF_STATUS_SET USING RS_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'DISPLAY' .
ENDFORM. "PF_STATUS_SET
*& Form Name: user_command *
*& Form Desc: For Handling USER_COMMAND *
FORM USER_COMMAND USING IF_UCOMM TYPE SY-UCOMM
IS_SELFIELD TYPE SLIS_SELFIELD.
CASE IF_UCOMM.
WHEN 'DOWNLOAD'.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = ' '
DIAGNOSE_OBJECT = ' '
TEXT_QUESTION = 'Data download to excel'
TEXT_BUTTON_1 = 'Ja'(001)
ICON_BUTTON_1 = ' '
TEXT_BUTTON_2 = 'Nein'(002)
ICON_BUTTON_2 = ' '
DEFAULT_BUTTON = '1'
DISPLAY_CANCEL_BUTTON = 'X'
USERDEFINED_F1_HELP = ' '
START_COLUMN = 25
START_ROW = 6
POPUP_TYPE =
IMPORTING
ANSWER =
TABLES
PARAMETER =
EXCEPTIONS
TEXT_NOT_FOUND = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = 'C:\Material-Text.xls'
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = 'X'
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = 'X'
IMPORTING
FILELENGTH = GL_LENGHT
TABLES
DATA_TAB = <FS_22>
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF GL_LENGHT NE 0.
MESSAGE S398(00) WITH 'DATA downloaded to EXCEL'.
ENDIF.
ENDCASE.
ENDFORM. "user_command
Thanks
Ankur SHarma
Similar Messages
-
How to Create Dynamic Columns based on Fiscal Period
HI BI World;) We are on BI &.0
I have a requirement to create a time series BI query
It must take the variable value (range) from the user abd create all months within this range in a time series displaying the key figure value for the respective periods.
I have so far added the fiscal year period characteristic to the columns with the key figure under this and the fiscal/year period is on a restiction in the filter area by a variable (range)
When I run this query it only shows the fiscal periods which have a value for the key figure. Is it possible to show all fiscal periods and have blank columns where there is no value for the respective key figure/period.
I have tried using master data for the fiscal period but this does not work as has some junk values.
Any ideas? I need to show alll periods between the dates whether they have values or not.
Best,
Stevo
Points will be awarded.
Thanks in advanceHi,
Try restricting the fiscal period inside the keyfigure and in the output format try drill across of fiscal period.
in tne fical period char properties try masterdata relationship option.
Thanks,
Arun. -
How to create dynamic context based on a structure defined in the program?
Hi Experts,
I need to create a dynamic context based on a structure wa_struc which i have define programatically.
When I pass wa_struc to structure_name parameter of create_nodeinfo_from_struc, i get a runtime error:
"Parameter STRUCTURE_NAME contains an invalid value wa_struc."
How to create dynamic context based on a structure defined in the program?
I have written the code like this:
TYPES: BEGIN OF t_type,
v_carrid TYPE sflight-carrid,
v_connid TYPE sflight-connid,
END OF t_type.
Data: i_struc type table of t_type,
wa_struc type t_type.
data: dyn_node type ref to if_wd_context_node.
data: rootnode_info type ref to if_wd_context_node_info.
rootnode_info = wd_context->get_node_info( ).
clear i_struc. refresh i_struc.
select carrid connid into corresponding fields of table i_struc from sflight where carrid = 'AA'.
cl_wd_dynamic_tool=>create_nodeinfo_from_struct(
parent_info = rootnode_info
node_name = 'dynflight'
structure_name = 'wa_struc'
is_multiple = abap_true ).
dyn_node = wd_context->get_child_node( name = 'dynflight' ).
dyn_node->bind_table( i_struc ).
Thanks
Gopal
Message was edited by: gopalkrishna baligaHi Michelle,
First of all Special thanks for your informative answers to my other forum questions. I really appreciate your help.
Coming back to this question I am still waiting for an answer. Please help. Note that my structure is not in a dictionary.
I am trying to create a new node. That is
CONTEXT
- DYNFLIGHT
CARRID
CONNID
As you see above I am trying to create 'DYNFLIGHT' along with the 2 attributes which are inside this node. The structure of the node that is, no.of attributes may vary based on some condition. Thats why I am trying to create a node dynamically.
Also I cannot define the structure in the ABAP dictionary because it changes based on condition
I have updated my code like the following and I am getting error:
TYPES: BEGIN OF t_type,
CARRID TYPE sflight-carrid,
CONNID TYPE sflight-connid,
END OF t_type.
Data: i_struc type table of t_type,
dyn_node type ref to if_wd_context_node,
rootnode_info type ref to if_wd_context_node_info,
i_node_att type wdr_context_attr_info_map,
wa_node_att type line of wdr_context_attr_info_map.
wa_node_att-name = 'CARRID'.
wa_node_att-TYPE_NAME = 'SFLIGHT-CARRID'.
insert wa_node_att into table i_node_att.
wa_node_att-name = 'CONNID'.
wa_node_att-TYPE_NAME = 'SFLIGHT-CONNID'.
insert wa_node_att into table i_node_att.
clear i_struc. refresh i_struc.
select carrid connid into corresponding fields of table i_struc from sflight where carrid = 'AA'.
rootnode_info = wd_context->get_node_info( ).
rootnode_info->add_new_child_node( name = 'DYNFLIGHT'
attributes = i_node_att
is_multiple = abap_true ).
dyn_node = wd_context->get_child_node( 'DYNFLIGHT' ).
dyn_node->bind_table( i_struc ).
l_ref_interfacecontroller->set_data( dyn_node ).
But now I am getting the following error :
The following error text was processed in the system PET : Line types of an internal table and a work area not compatible.
The error occurred on the application server FMSAP995_PET_02 and in the work process 0 .
The termination type was: RABAX_STATE
The ABAP call stack was:
Method: IF_WD_CONTEXT_NODE~GET_STATIC_ATTRIBUTES_TABLE of program CL_WDR_CONTEXT_NODE_VAL=======CP
Method: GET_REF_TO_TABLE of program CL_SALV_WD_DATA_TABLE=========CP
Method: EXECUTE of program CL_SALV_WD_SERVICE_MANAGER====CP
Method: APPLY_SERVICES of program CL_SALV_BS_RESULT_DATA_TABLE==CP
Method: REFRESH of program CL_SALV_BS_RESULT_DATA_TABLE==CP
Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE_DATA of program CL_SALV_WD_C_TABLE_V_TABLE====CP
Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
Method: IF_SALV_WD_COMP_TABLE_DATA~UPDATE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
Method: IF_SALV_WD_VIEW~MODIFY of program CL_SALV_WD_C_TABLE_V_TABLE====CP
Method: IF_SALV_WD_COMPONENT~VIEW_MODIFY of program CL_SALV_WD_A_COMPONENT========CP
-Gopal
Message was edited by: gopalkrishna baliga -
How to display dynamic column added by vo.addDynamicAttribute in jspx?
Hi,
I met problem when programmatically add cloumn and display it on screen. Here are my steps:
0. define a ViewObject using xml. Define a transient column Addtion2. later will add a dynamic column Addtion3, but not defined here.
1. Implement Application Module, adding a method init() and expose it to client.
2. In init() method, get target VO and use vo.addDynamicAttribute("Addition3"). Then iterate it use row.setAttribute("Addition3", Math.random()). Add init() to page binding and invoke it.( it's invoked )
3. In jspx, use dynamic table. But Addition3 never shows up.
This is my last question: Re: How to display dynamic column added by vo.addDynamicAttribute in jspx? People say I should use dynamic table.
please have a look at my code:
Application Module: when it runs, it will print 6 coulmns. vo.getAttributeCount() is <font color="red">6</font>.
<pre>
public void init() {
ViewObject vo = this.getCountryView1();
if (vo.getAttributeIndexOf("Addition3") == -1) {
vo.addDynamicAttribute("Addition3");
vo.executeQuery();
for (AttributeDef deft : vo.getAttributeDefs()) {
System.out.println(deft.getColumnName() + ": " + deft.getName());
RowSetIterator it = vo.createRowSetIterator("i1");
while (it.hasNext()) {
Row r = it.next();
r.setAttribute("Addition2", Math.random());
r.setAttribute("Addition3", Math.random());
it.closeRowSetIterator();
for (AttributeDef deft : vo.getAttributeDefs()) {
System.out.println(deft.getColumnName() + ": " + deft.getName());
System.out.println(vo.getAttributeCount()); //vo.getAttributeCount() is 6
</pre>
jspx: when it runs, only 5 columns are shown. Column Addition2's values are set as expected. but Column Addition3 never shows up. And #{bindings.CountryView1.attributeCount} shows <font color="red">5</font>.
<pre>
<af:table rows="#{bindings.CountryView1.rangeSize}"
fetchSize="#{bindings.CountryView1.rangeSize}"
emptyText="#{bindings.CountryView1.viewable ? 'No data to display.' : 'Access Denied.'}"
var="row" rowBandingInterval="0"
value="#{bindings.CountryView1.collectionModel}"
selectedRowKeys="#{bindings.CountryView1.collectionModel.selectedRow}"
selectionListener="#{bindings.CountryView1.collectionModel.makeCurrent}"
rowSelection="single" id="t1">
<af:forEach items="#{bindings.CountryView1.attributeDefs}" var="def">
<af:column headerText="#{def.name}"
sortable="true" sortProperty="#{def.name}" id="c1">
<af:outputText value="#{row[def.name]}" id="ot1"/>
</af:column>
</af:forEach>
</af:table>
<af:forEach items="#{bindings.CountryView1.attributeDefs}" var="def">
<af:outputText value="#{def.name}" id="ot2"/>
</af:forEach>
<af:outputText value="#{bindings.CountryView1.attributeCount}" id="ot3"/>
</pre>
it's quite weird for me. The vo.getAttributeCount() is 6, but #{bindings.CountryView1.attributeCount} shows 5. And column Addtion3 never shows up.
what's the matter? How can I show the dynamic added column Addtion3?
Edited by: simon li on 2012-9-10 下午7:31
Edited by: simon li on 2012-9-10 下午8:00Hi,
Can you check the tree binding (CountryView1 - in the pagedef) and see it has the 5 attributes hardcoded in it. If yes, try removing everything and then run the page to see if it works fine.
-Arun -
How to set dynamic color , based on xml element
Hi,
We have a requirement, where based on certain conditions, a cell will be shown in a specific color. We would like the coloir to be based on an XML element. The xml element will have values like '#FF00FF' etc..
We tried using xsl attribute with the following syntax ,
<xsl:attribute xdofo:ctx="block"name="color"><?stdcolor?></xsl:attribute><?end if?>
where stdcolor is the xml element, but when we use this , this is giving a syntax error.
Let us know, if this is possible or is there any other alternate way to do this.
Regards,
- Vasu -Hi Vasu,
http://winrichman.blogspot.com/2008/09/how-to-set-dynamic-color-based-on-xml.html
use the following :)
<xsl:attribute xdofo:ctx="block" name="color" ><xsl:value-of select="stdcolor" /></xsl:attribute>
TO get the colors you wanted , you can refer to
http://www.w3schools.com/Html/html_colors.asp -
How to aggregate a column based date column (for weekly single row)?
How to aggregate a column based date column (for weekly single row)?
Hi,
Consider the below statement for daily bases which is ok
SELECT ID, DATE, SUM(AMOUNT) FROM TABLE_NAME GROUP BY ID, DATE ORDER BY ID, DATE
The same like the above statement, I want output on weekly, fortnightly, and monthly bases, How to do this? Need your help... -
How to have a web-based interface for Lumira that also performs Ad-Hoc visualizations on data that should be loaded live from HANA. I have another tool that puts data into HANA, So don't want to reload this new data into Lumira every time I want to run a report.
so do i have the ability to create polished ad hoc dashboards, reports, infographics and storyboards Apart from Ad-Hoc reports, I also need a dashboard with some fixed reports that update with the live data.
So please suggest me to accomplish this task.
Thanks and regards
Shashi kiranPlease have a look at Ludek's document here which contains links: SAP Lumira Family Supported Versions Matrix
Ludek has also attached the PAM's as zipped files; Lumira comes in many flavors so I encourage you to research options
Also see this "HANA Live" document: [SAP HANA Academy] Visualized: Lumira & HANA -
How to add dynamic column in jfreereport
hi,
i am working on a project aboit accounting package.
i had created a report in jfreereport .. buti am facing the problem of dynamic column addition in that..
i have to create the number of column as per user given range that will from 2 to 365
i had generated column for that
that should be like
1 - 5 , 6 -10 , 11 - 15 , etc...
how can i represent that alll column in print preview i can't represent that report in horizontal fashion . is there any way to display it ..
this report has no bound in horizontal or verticle means i have any number of rows or columns..
pls help.
kamleshhi,
that means u have fixed columns right? ie 5 columns in a report
if it write, than u can find out how u can rename the columns with exiting
one.
that means while runing report u have to pass all the 5 columns to report
instead of the exiting columns (ie rename the columns that u want add
columns)
u have to search in code for renaming in the code ie jfreereport package.
i think u understood.
daya -
How to use dynamic column fields in formulas
Hi,
we changed from CR 8.5 to CR XI R2.
Many of our reports use dynamic queries with different count of columns.
These reports are designed for the maximum count of columns.
This works fine with CR 8.5 but with CR XI R2 it seems to be that if one of these columns is missing i get an error in all formulas using this missing columns.
How can i use or check this columns in formulas?
regards
MichaelCould it be because of null values? Try File -> Report Options and then check the box next to convert null values to default values and see it that helps or you can go into the formulae and choose Default Values for Nulls. Either of these options should plug a zero if the values happen to be nulls.
-
How to create dynamic tree based on BAPI
Hi
I am able to create dynamic tree based on flat file structure example given in SDN . But how to create the tree from BAPI directly.Also when I will be clicking on any leaf node of the tree some data related to the node will be passed to another view.
Regards
AnandaWhat i'm trying to do is create an organizational structure.
Global>Region>Plant-->Corporation
The output from the RFC is a structure containing every possible combination for orgazational hierarchy. Basically a flat table with record for every possible combinaton of Region-Plant-Corporation. This data needs to be bound to a tree structure so that we can call BW queries based on that level. For example: Give me aged inventory for the SAP corporation within the plant Berlin that is located in the Europe region.
Now that you understand the business reason will the nodes that represent Region and Plant and corporation be non-singleton nodes or recursive? I was thinking a hierarchy of non-singleton nodes.
I can bind these nodes to the Region - Plant - Corporation elements returned from in the flat table structure. I will probably get duplicates as a specific Region will be listed multiple times for every possible combination of the data beneath it. I'm not so concerned about that right now as I want to make sure I understand how in Web Dynpro to bind the data to the tree.
Hopefully this makes some sense. Can you elaborate on how this may be constructed in context of the view?
Would i create a model node for region (0..n), model node for plant (0..n), and a model node for Corporation (0..n)?
Or does this sound totally incorrect?
julian
We have 3 regions over 50 plants and probably around 500 corporations. -
HOW to add Dynamic Columns in ADF Faces CORE Table
In ADF im going to display the dynamic column in Coretable,
Header are displaying very fine. but im unable to display rows sucessfuly,how to resolve.
Second thing is that JSF page isn't getting the value from dataList, whats wrong in JSF code.
// JSF PAGE CODE
<af:table binding="#{backing_test1.table1}" id="table1"
value="{backing_test1.dataList}" var="myRec"/>
public void setTable1(CoreTable table1) {
this.table1 = table1;
public CoreTable getTable1() {
//create this table
table1 = new CoreTable();
CoreColumn dynamicCol;
CoreOutputText outText;
Application app=FacesContext.getCurrentInstance().getApplication();
DCIteratorBinding iter = (DCIteratorBinding)bindings.get("listAllMonthsIter");
RowSetIterator rsIter = iter.getRowSetIterator();
rsIter.reset();
Row row;
while (rsIter.hasNext()) {
row = rsIter.next();
String header = (String)row.getAttribute("element");
// element contain the value JAN, FEB...
dynamicCol = new CoreColumn();
dynamicCol.setHeaderText(header);
String currRec = table1.getVar();
outText = new CoreOutputText();
ValueBinding vb = app.createValueBinding("#{myRec.value}");
outText.setValueBinding("value",vb);
outText.setRendererType("Text");
dynamicCol.getChildren().add(outText);
table1.getChildren().add(dynamicCol);
public void setDataList(List dataList) {
this.dataList = dataList;
public List getDataList() {
BindingContainer bindings = getBindings();
OperationBinding operationBinding =
bindings.getOperationBinding("listAllMonths");
if (operationBinding == null)
return null;
List dataList = (Vector)operationBinding.execute();
return dataList;
}Well issue is that
I have a list of values that can be chnaged any time during application execution sya its list of Fav Fruits..
and in an other page i need a data table having these fruits as coulmns and their details as rows...
how to achieve this..
we can not guess the number of columns before time.. so can make the estimate and hide them. -
How to use dynamic select query which queries from 3 different table.
Hi All,
I am new to Toplink, i would like to use a named query to select some of the columns from 3 different tables with dynamic where clause.
I have used the following lines. Please tell me how to get code for the dynamic where clause.
First try :
Vector objPersons = (Vector)session.executeQuery("findPersonByGlobalID",Person.class,vQueryArguments);
The above method is not returning the vector or collection.
Second Try:
ReadAllQuery query = new ReadAllQuery(Person.class);
query.useCollectionClass(LinkedList.class);
LinkedList person = (LinkedList) session.executeQuery(query);
The second try is returning the collection but, this fetches all the record from the table.
1. How to query for range of records?
2. How to query from multiple tables for some range. How to use dynamic range values ?
Please reply with your answers or some pointers would help.
Thanks and Regards,
Vijay.BHi,
Did you try using a SQLCall ? It might be able to satisfy you requirements .. :-
Employee employee = (Employee) session.executeSelectingCall(
new SQLCall("SELECT * FROM EMPLOYEE WHERE EMP_ID = 44")
);You can get more information here :-
http://www.oracle.com/technology/products/ias/toplink/doc/1013/MAIN/_html/qrybas004.htm
Regards,
Sandeep -
How tu update a column having type 'Long raw' in oracle table with an image
Hello,
I must change the image loading in a column with 'long raw' type in the table. I find an image data already in the table.
I have my new imgae in a file .bmp.
What SQL instruction I mut use to update this column to load my new image ?
I work in Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod.
thanks for your helps.
Regards.Unless I'm missing something MSFT are making it unecessarily complex by not implementing the SQL/XML standard...
SQL> alter table emp add ( emp_xml xmltype)
2 /
Table altered.
SQL> update emp set emp_xml = XMLELEMENT("EMPLOYEE",xmlattributes(EMPNO as "id"), XMLElement("Name",ENAME))
2
SQL> /
14 rows updated.
SQL> set pages 0
SQL> select EMPNO, EMP_XML from EMP
2 /
7369
<EMPLOYEE id="7369">
<Name>SMITH</Name>
</EMPLOYEE>
7499
<EMPLOYEE id="7499">
<Name>ALLEN</Name>
</EMPLOYEE>
7521
<EMPLOYEE id="7521">
<Name>WARD</Name>
</EMPLOYEE>
7566
<EMPLOYEE id="7566">
<Name>JONES</Name>
</EMPLOYEE>
7654
<EMPLOYEE id="7654">
<Name>MARTIN</Name>
</EMPLOYEE>
7698
<EMPLOYEE id="7698">
<Name>BLAKE</Name>
</EMPLOYEE>
7782
<EMPLOYEE id="7782">
<Name>CLARK</Name>
</EMPLOYEE>
7788
<EMPLOYEE id="7788">
<Name>SCOTT</Name>
</EMPLOYEE>
7839
<EMPLOYEE id="7839">
<Name>KING</Name>
</EMPLOYEE>
7844
<EMPLOYEE id="7844">
<Name>TURNER</Name>
</EMPLOYEE>
7876
<EMPLOYEE id="7876">
<Name>ADAMS</Name>
</EMPLOYEE>
7900
<EMPLOYEE id="7900">
<Name>JAMES</Name>
</EMPLOYEE>
7902
<EMPLOYEE id="7902">
<Name>FORD</Name>
</EMPLOYEE>
7934
<EMPLOYEE id="7934">
<Name>MILLER</Name>
</EMPLOYEE>
14 rows selected.
SQL> -
COOIS report: not able to select operations based on work centers
Hi All,
When accessing the COOIS report using operation listv& selecting the std profile.I need to get the operation perfomred on specific work center.
I enter the work center & plant code in the selection fields available in the "select at operarion level" & i get the all the work center.
Need to get list of operation performed at the entered work center.
The requirement is due to the reason that a order is performed in two or three production facilities & production guys needs to look at operation list for given work centers.
Regards
VineetHi,
This one of the options we had explored, but it would be better if we can get the report by work center. The focus is to reduce the effort to get the report as there is need to get the same report for atleasr 8to 10 different group of work centers ( which are not in serial nos).
We would then need to put the work centers in the filters & save the layout.
Regards
Vineet -
Hi All,
Suppose I have table, whose structure changes frequently on daily basis.
For eg. desc my_table gives you following column name on Day 1
SQL > desc my_table;
Output
Name
Age
Phone
On Day 2, two more columns are added, viz, Address and Salary.
SQL > desc my_table;
Output
Name
Age
Phone
Address
Salary
Now I want to create an Dynnamic RTF report which would fetch data from ALL columns from my_table on daily basis. For that I have defined a concurrent program with XML as output type and have attached a data template/data definition to it which takes in XML as input and gives final output of conc program in EXCEL layout. I am able to do this for constant number of columns, but dont know how to do it when the number of columns to be displayed changes dynamically.
For Day 1 my XML file should be like this.
<?xml version="1.0" encoding="UTF-8"?>
<dataTemplate name="XYZ" description="iExpenses Report" Version="1.0">
<dataQuery>
<sqlStatement name="Q2">
<![CDATA[
SELECT Name
,Age
,Phone
FROM my_table
]]>
</sqlStatement>
</dataQuery>
<dataStructure>
<group name="G_my_table" source="Q2">
<element name="Name" value="Name" />
<element name="Age" value="Age" />
<element name="Phone" value="Phone" />
</group>
</dataStructure>
</dataTemplate>
And my Day 1, EXCEL output from RTF template should be like this.
Name Age Phone
Swapnill 23 12345
For Day 2 my XML file should be like this. With 2 new columns selected in SELECT clause.
<?xml version="1.0" encoding="UTF-8"?>
<dataTemplate name="XYZ" description="iExpenses Report" Version="1.0">
<dataQuery>
<sqlStatement name="Q2">
<![CDATA[
SELECT Name
,Age
,Phone
,Address
,Salary
FROM my_table
]]>
</sqlStatement>
</dataQuery>
<dataStructure>
<group name="G_my_table" source="Q2">
<element name="Name" value="Name" />
<element name="Age" value="Age" />
<element name="Phone" value="Phone" />
<element name="Address" value="Address" />
<element name="Salary" value="Salary" />
</group>
</dataStructure>
</dataTemplate>
And my Day 2, EXCEL output from RTF template should be like this.
Name Age Phone Address Salary
Swapnill 23 12345 Madrid 100000
Now, I dont know below things.
Make the XML dynamic as in on Day 1 there must be 3 columns in the SELECT statement and on Day 2, 5 columns. I want to create one dynamic XML which should not be required to be changed if new columns are added in my_table. I dont know how to create this query and also create their corresponding elements below.
Make the RTF template dyanamic as in Day1 there must 3 columns in EXCEL output and on Day 2, 5 columns. I want to create a Dynamic RTF template which would show all the columns selected in Dynamic XML.I dont know how the RTF will create new XML tags and how it will know where to place it in the report. Means, I can create RTF template on Day 1, by loading XML data for 3 columns and placing 3 XML tags in template. But how will it create and place tags for new columns on Day 2?
Hope, you got my requirement, its a challenging one. Please let me know how I can implement the required solution using RTF dynamically without any manual intervention.
Regards,
Swapnil K.
Message was edited by: SwapnilKHi All,
I am able to fulfil above requirement. Now I am stuck at below point. Need your help!
Is there any way to UPDATE the XML file attached to a Data Definition (XML Publisher > Data Definition) using a standard package or procedure call or may be an API from backend? I am creating an XML dynamically and I want to attach it to its Data Definition programmatically using SQL.
Please let me know if there is any oracle functionality to do this.
If not, please let me know the standard directories on application/database server where the XML files attached to Data Definitions are stored.
For eg, /$APPL_TOP/ar/1.0/sql or something.
Regards,
Swapnil K.
Maybe you are looking for
-
How to create public group in office 365 admin panel?
Dear Microsoft , I try to create group in office 365 admin panel but in that group when i add outsider mail id eg([email protected],[email protected]) is not created ...it's showing error.Can please help me to how i create public group in office 36
-
Slow after install/uninstall antivirus
My late 2013 iMac has been slow and unresponsive after install and uninstall Avira anti-virus (big mistake that was)! I tried re-installing Yosemite but that did not help. EtreCheck shows this in kernel extensions: /System/Library/Extensions [not lo
-
Please help me : I trying and check EVERYTHING suggested including uninstall Thanks JC
-
Mountain Lion Toolbar not displaying properly
Hi all, I'm running Mountain Lion 10.8.2 on an iMac with Preview 6.0.1 (765.4). In Preview, I cannot see the icons on the toolbar buttons. The toolbar buttons are there and functional, but their identifier icons are blank so I cannot tell which butto
-
Library file corrupts almost every time Itunes restarts
I have three issues which started around the time I upgraded to the latest new version: 1) Almost every time I shut itunes down and go back into it, it claims that the library file is corrupt, and starts re-importing it from the xml. If I restore the