Problem in dynamic internal table
hello experts,
i have developed a report the out put is as shown:
first screen: i will be entering one 'z' or 'y' table name dynamically.
second screen: a popup screen with checkboxes and the field names of above particular table entered.
when user selects the checkboxes or fieldnames.
only those fieldnames with data should be displayed in the next list.
for example:
when user enters table name: ZGEB_0X_FBIW_CSA
a pop-up screen displays as shown below:
fieldnames
checkbox1 mandt
checkbox2 sender
checkbox3 receiver (i hav done upto this )
when user selects checkbox1 & 2:
(but i am not getting how to get below screen after selecting the checkboxes)
only the data of mandt and sender should be displayed in the next list
i.e. mandt sender
710 ttttt
pls help me in this regard
thanx in advance
soham.p.
Hi Soham
In the secodn screen create two button BACK and Next.
When you click on Next it will take you to the third screen.
In the PBO of the third screen by defualt all the fields will be visible now
based on checkbox entry loop the next screen and modify the fields which you don`t want to display.
LOOP AT SCREEN.
CHECK screen-name = ZTAB-MATNR.
screen-input = '0'.
MODIFY SCREEN.
ENDLOOP.
Regards
Neha
Similar Messages
-
Problem with dynamic internal table updation
Hello Folks,
I created a dynamic internal table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = i_fieldcat
IMPORTING
ep_table = i_dyntab
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
ASSIGN i_dyntab->* TO <f_dyntable>.
and created a work area
CREATE DATA wg_f_split LIKE LINE OF <f_dyntable>.
ASSIGN wg_f_split->* TO <f_wg_dyntable>.
My requirement is that , i have to loop a normal internal table and append those records to the filed symbol internal table.
READ TABLE i_normal_itab INTO wg_split INDEX wl_rows-index.
IF sy-subrc EQ 0.
ASSIGN wg_split to <f_wg_dyntable>.
APPEND <f_wg_dyntable> to <f_dyntable>.
endif.
here i am geeting dump as "MOVE src TO dst" ... i can get the data in the work area FSymbol but cannot append it in Internal table Field Symbol.. Please help..
<Added code tags>
Edited by: Suhas Saha on Aug 3, 2011 10:52 AMHello Sandra,
Thanks for the reply..
First i tried appending the normal work area to the fieldsymbol internal table.
append wg_split to <f_dyntable>
This is hiting dump the same dump and so i created a fieldsymbol work area. ( <f_wg_dyntable>.)and tried to append the field symbol internal table with this work area. which is again giving the dump
APPEND <f_wg_dyntable> to <f_dyntable>. ( Again a Dump)
Edited by: Charan-SAP on Aug 2, 2011 9:40 PM
Edited by: Charan-SAP on Aug 2, 2011 9:42 PM -
Dynamic internal table problem in FM - HR_INFOTYPE_OPERATIONS
Dear All,
I have a problem when I use a Dynamic internal table in FM - HR_INFOTYPE_OPERTATION..
Please suggest me on the way to overcome this problem..
We wanted to have a dynamic Program for Info type operations which can be used for any info types as we are changing only BEGDA and the related actions
So in my program I have the parameters to accept
P_BEGDA - 01.10.2007
P_INFTY - P0008
P_ACTIO - COPY
I am able to create a dynamic table based on the parameters P_INFTY and able to read it also using the FM - HR_READ_INFOTYPE
BUT when I pass the dynamic internal table to a FM - HR_INFOTYPE_OPERTATION I am getting a DUMP
The DUMP is at the below statement from FM - HR_INFOTYPE_OPERTATION
ASSIGN record TO <record> CASTING TYPE (tabname). "XDP UniCode
It gives the below possiblities
"ASSIGN_BASE_TOO_SHORT" C
"SAPLHRMM" or "LHRMMU03"
"HR_INFOTYPE_OPERATION"
But If I use the below internal table
Data : g_t_0008 like P0008 occurs 0 with header line.
And If I use the internal table g_t_0008 instead of dynamic tables then it works. So I strongly feel it's due to not having a header in the dynamic table below see below the sample code on how I am generating a dynamic internal table
field-symbols: <dyn_table> type standard table.
data: dy_table type ref to data,
dy_line type ref to data,
xfc type lvc_s_fcat,
ifc type lvc_t_fcat.
to get the srurcute
perform get_structure using l_f_table.
perform create_dynamic_itab .
assign dy_table->* to <dyn_table>.
perform get_data tables <dyn_table01>
using pernr-pernr p_infty.
below are the forms routine .
form get_structure using p_table.
data : idetails type abap_compdescr_tab,
xdetails type abap_compdescr.
data : ref_table_des type ref to cl_abap_structdescr.
clear : ifc[], dy_table.
Get the structure of the table.
ref_table_des ?=
cl_abap_typedescr=>describe_by_name( p_table ).
idetails[] = ref_table_des->components[].
loop at idetails into xdetails.
clear xfc.
xfc-fieldname = xdetails-name .
xfc-datatype = xdetails-type_kind.
xfc-inttype = xdetails-type_kind.
xfc-intlen = xdetails-length.
xfc-decimals = xdetails-decimals.
append xfc to ifc.
endloop.
endform.
form create_dynamic_itab.
Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = ifc
importing
ep_table = dy_table.
endform.
*& Form get_data
form get_data tables p_table
using p_pernr
p_infty.
clear : p_table, p_table[].
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
PERNR = P_PERNR
INFTY = p_infty
BEGDA = p_datum
ENDDA = p_datum
TABLES
INFTY_TAB = p_table
EXCEPTIONS
INFTY_NOT_FOUND = 1
OTHERS = 2.
CHECK SY-SUBRC EQ 0.
IF lines( p_table ) GT 0.
*write :/'Record exist' , 'IT', p_infty.
clear p_table.
PERFORM hr_operation tables p_table
using g_t_t588d-actio g_t_t588d-INFTY
g_t_t588d-SUBTY.
else.
PERFORM append_status using g_t_itab-pernr p_infty ' '
'Error' 'No records'.
ENDIF.
endform. " get_data
form hr_operation tables p_table
using p_actio P_INFTY P_SUBTY.
data: l_f_return LIKE bapireturn1.
ASSIGN COMPONENT 'BEGDA' OF STRUCTURE p_table TO <l_field>.
<l_field> = p_begda.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = P_infty
number = G_T_ITAB-PERNR
subtype = P_subty
validityend = g_f_endda
validitybegin = P_datum
record = P_TABLE
operation = p_actio
IMPORTING
return = l_f_return.
IF sy-subrc NE 0.
ENDIF.
ENDFORM.try
using field symbol for a wrk area instead of Field symbol for a table
loop your inernal table (again a field symbol) assigning to <fs_wrkarea>
in loop call HR_INFO.._OP..
reward if helpful -
Dynamic Internal Table synatax Problem
Hi Experts.
I am creating the Dynamic Internal table by using the method:cl_alv_table_create=>create_dynamic_table.
we are using the 4.6 version.
it is showing an error that 'Statemant cl_alv_table_create=>create_dynamic_table ( is not defined, Please check your spelling.
but the same thing , working in ecc 6.0.
Thanks in advance,
Regards,Hello
Most likely there is just a problem with the writing of the method call:
DATA:
lt_fcat TYPE lvc_t_fcat,
ldo_itab TYPE REF TO data.
"... fill fieldcatalog
CALL METHOD cl_alv_table_create=>create_dynamic_table
IMPORTING
it_fieldcatalog = lt_fcat
EXPORTING
ep_table = ldo_itab.
This coding should be syntactically correct. Perhaps you just need to add the following statement to your report (at the beginning):
CLASS cl_alv_table_create DEFINITION LOAD.
On 4.6c the system is not always able to do this itself. You need to explicitly make the class known.
Regards
Uwe -
Problem creating an internal table dynamically
Hi,
I'm trying to create an internal table dynamically as i would be able to determine the structure of the table based on the user input.
I've used the sample code from this forum ...
REPORT ZRICH_0003 .
type-pools: slis.
field-symbols: <dyn_table> type standard table,
<dyn_wa>,
<dyn_field>.
data: alv_fldcat type slis_t_fieldcat_alv,
it_fldcat type lvc_t_fcat.
type-pools : abap.
data : it_details type abap_compdescr_tab,
wa_details type abap_compdescr.
data : ref_descr type ref to cl_abap_structdescr.
data: new_table type ref to data,
new_line type ref to data,
wa_it_fldcat type lvc_s_fcat.
selection-screen begin of block b1 with frame title text.
parameters: p_table(30) type c.
selection-screen end of block b1.
Get the structure of the table.
ref_descr ?= cl_abap_typedescr=>describe_by_name( p_table ).
it_details[] = ref_descr->components[].
loop at it_details into wa_details.
clear wa_it_fldcat.
wa_it_fldcat-fieldname = wa_details-name .
wa_it_fldcat-datatype = wa_details-type_kind.
wa_it_fldcat-inttype = wa_details-type_kind.
wa_it_fldcat-intlen = wa_details-length.
wa_it_fldcat-decimals = wa_details-decimals.
append wa_it_fldcat to it_fldcat .
endloop.
Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = it_fldcat
importing
ep_table = new_table.
assign new_table->* to <dyn_table>.
Create dynamic work area and assign to FS
create data new_line like line of <dyn_table>.
assign new_line->* to <dyn_wa>.
<b>* Select Data from table.
select * into table <dyn_table> from
(p_table).</b>
Write out data from table.
loop at <dyn_table> into <dyn_wa>.
do.
assign component sy-index of structure <dyn_wa> to <dyn_field>.
if sy-subrc <> 0.
exit.
endif.
if sy-index = 1.
write:/ <dyn_field>.
else.
write: <dyn_field>.
endif.
enddo.
endloop.
I'm able to get the structure of the table that i want, but when i'm trying to select data from the table into this internal table..as highlighted in the sample code above..i'm getting a short dump...saying that ' the database table is 600 bytes wide but the internal table is only 576 bytes wide.
The internal table is declared as
field-symbols: <dyn_table> type standard table..
Could anyone please tell me how to rectify this.
Thanks in advance,
Harsha.Hi Smitha,
I'm building the internal table by getting the structure using the method
cl_abap_typedescr=>describe_by_name( p_table ).
where p_table is the table name determined dynamically..
Now using this structure, i'm building an internal table by calling the method
call method cl_alv_table_create=>create_dynamic_table
I've checked all the fields after the internal table has been created .. and it contains all the fields of the table that i'm supplying initially..
But when i read data into that internal table, it gives me that dump..I've described it in this post earlier.
Any more suggestions would be very helpful.
Thanks,
Harsha -
Problem with grid display in ALV for dynamic internal tables
Hi,
I am using dynamic internal tables in my program. To display it in grid format after populating it, I have used the following class and method. Here Im getting sy-subrc = 0 but, the grid is not getting displayed. Can some one pls help me with this.,
DATA: W_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: w_tabname TYPE w_tabname.
CREATE OBJECT W_GRID
EXPORTING I_PARENT = CL_GUI_CONTAINER=>SCREEN0.
CALL METHOD W_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME = W_TABNAME
IS_VARIANT =
I_SAVE =
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 = <FS_1>
IT_FIELDCATALOG = LT_FIELDCATALOG2
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Here, <FS_1> is the field symbol of table type and it holds all my data. and LT_FIELDCATALOG2 is the structure of my fieldcatalog
Thanks and Regards,
AvinashHi Avinash,
Either use parameter
I_STRUCTURE_NAME = W_TABNAME
or
IT_FIELDCATALOG = LT_FIELDCATALOG2
Both are not required.
At the end of ur program simply use a write statement like below. Your program will work.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Write /. <----
Thanks,
Edited by: Sap Fan on Oct 6, 2009 7:17 AM -
Problem in creating dynamic internal table
Hi Experts,
I am trying creating a dynamic internal table.
But I am getting the error 'The field string "LT_GENTAB" contains no fields. 4 LT_GENTAB".
Can anybody tell me what is the error and how to solve it.
Thanks,
SudheerHi,
Please find the below code.
data : wa_fieldcat type slis_fieldcat_alv,
wa_fieldcat1 type slis_fieldcat_alv,
wa_fieldcat2 type LVC_S_FCAT,
it_fieldcat type slis_t_fieldcat_alv,
it_fieldcat1 type slis_t_fieldcat_alv,
it_fieldcat2 type LVC_T_FCAT,
V_LAYOUT TYPE SLIS_LAYOUT_ALV,
LS_LVC_FIELDCATALOGUE TYPE LVC_S_FCAT,
LT_LVC_FIELDCATALOGUE TYPE LVC_T_FCAT,
IT_EVENTS TYPE SLIS_T_EVENT,
WA_EVENTS TYPE SLIS_ALV_EVENT.
data : L_TABLE TYPE REF TO DATA.
FIELD-SYMBOLS : <IT_TABLE> TYPE STANDARD TABLE.
FIELD-SYMBOLS : <IT_ITEM1> TYPE STANDARD TABLE.
v_col = 1.
WA_FIELDCAT2-COL_POS = v_col.
WA_FIELDCAT2-FIELDNAME = 'PRUEFLOS'.
wa_fieldcat2-seltext = 'Inspection Lot'.
WA_FIELDCAT2-OUTPUTLEN = 20.
v_col = v_col + 1.
APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
CLEAR WA_FIELDCAT2.
WA_FIELDCAT2-COL_POS = v_col.
WA_FIELDCAT2-FIELDNAME = 'WERKS'.
wa_fieldcat2-seltext = 'Plant'.
WA_FIELDCAT2-OUTPUTLEN = 20.
v_col = v_col + 1.
APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
CLEAR WA_FIELDCAT2.
WA_FIELDCAT2-COL_POS = v_col.
WA_FIELDCAT2-FIELDNAME = 'ART'.
wa_fieldcat2-seltext = 'Inspection Type'.
WA_FIELDCAT2-OUTPUTLEN = 20.
v_col = v_col + 1.
APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
CLEAR WA_FIELDCAT2.
WA_FIELDCAT2-COL_POS = v_col.
WA_FIELDCAT2-FIELDNAME = 'HERKUNFT'.
wa_fieldcat2-seltext = 'Lot Origin'.
WA_FIELDCAT1-OUTPUTLEN = 20.
v_col = v_col + 1.
APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
CLEAR WA_FIELDCAT2.
WA_FIELDCAT2-COL_POS = v_col.
WA_FIELDCAT2-FIELDNAME = 'STAT35'.
wa_fieldcat2-seltext = 'Usage Decision Made'.
WA_FIELDCAT2-OUTPUTLEN = 20.
v_col = v_col + 1.
APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
CLEAR WA_FIELDCAT2.
WA_FIELDCAT2-COL_POS = v_col.
WA_FIELDCAT2-FIELDNAME = 'ENSTEHDAT'.
wa_fieldcat2-seltext = 'Lot created on'.
WA_FIELDCAT2-OUTPUTLEN = 20.
v_col = v_col + 1.
APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
CLEAR WA_FIELDCAT2.
WA_FIELDCAT2-COL_POS = v_col.
WA_FIELDCAT2-FIELDNAME = 'ERSTELLER'.
wa_fieldcat2-seltext = 'Created by'.
WA_FIELDCAT2-OUTPUTLEN = 20.
v_col = v_col + 1.
APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
CLEAR WA_FIELDCAT2.
WA_FIELDCAT2-COL_POS = v_col.
WA_FIELDCAT2-FIELDNAME = 'PASTRTERM'.
wa_fieldcat2-seltext = 'Insp. Start Date'.
WA_FIELDCAT2-OUTPUTLEN = 20.
v_col = v_col + 1.
APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
CLEAR WA_FIELDCAT2.
WA_FIELDCAT2-COL_POS = v_col.
WA_FIELDCAT2-FIELDNAME = 'PAENDTERM'.
wa_fieldcat2-seltext = 'End of Inspection'.
WA_FIELDCAT2-OUTPUTLEN = 20.
v_col = v_col + 1.
APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
CLEAR WA_FIELDCAT2.
WA_FIELDCAT2-COL_POS = v_col.
WA_FIELDCAT2-FIELDNAME = 'PLNTY'.
wa_fieldcat2-seltext = 'Task List Type'.
WA_FIELDCAT2-OUTPUTLEN = 20.
v_col = v_col + 1.
APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
CLEAR WA_FIELDCAT2.
WA_FIELDCAT2-COL_POS = v_col.
WA_FIELDCAT2-FIELDNAME = 'AUFNR'.
wa_fieldcat2-seltext = 'Order No.'.
WA_FIELDCAT2-OUTPUTLEN = 20.
v_col = v_col + 1.
APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
CLEAR WA_FIELDCAT2.
WA_FIELDCAT2-COL_POS = v_col.
WA_FIELDCAT2-FIELDNAME = 'KTEXTMAT'.
wa_fieldcat2-seltext = 'Object short text'.
WA_FIELDCAT2-OUTPUTLEN = 20.
v_col = v_col + 1.
APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
CLEAR WA_FIELDCAT2.
WA_FIELDCAT2-COL_POS = v_col.
WA_FIELDCAT2-FIELDNAME = 'KURZTEXT'.
wa_fieldcat2-seltext = 'Short Text for Code'.
WA_FIELDCAT2-OUTPUTLEN = 20.
v_col = v_col + 1.
APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
CLEAR WA_FIELDCAT2.
WA_FIELDCAT2-COL_POS = v_col.
WA_FIELDCAT2-FIELDNAME = 'KATALGART1'.
wa_fieldcat2-seltext = 'Catalog Type'.
WA_FIELDCAT2-OUTPUTLEN = 20.
v_col = v_col + 1.
APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
CLEAR WA_FIELDCAT2.
WA_FIELDCAT2-COL_POS = v_col.
WA_FIELDCAT2-FIELDNAME = 'GRUPPE1'.
wa_fieldcat2-seltext = 'Code Group'.
WA_FIELDCAT2-OUTPUTLEN = 20.
v_col = v_col + 1.
APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
CLEAR WA_FIELDCAT2.
WA_FIELDCAT2-COL_POS = v_col.
WA_FIELDCAT2-FIELDNAME = 'CODE1'.
wa_fieldcat2-seltext = 'Code'.
WA_FIELDCAT2-OUTPUTLEN = 20.
v_col = v_col + 1.
APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
CLEAR WA_FIELDCAT2.
*WA_FIELDCAT2-COL_POS = v_col.
*WA_FIELDCAT2-FIELDNAME = 'ORIGINAL_INPUT'.
*WA_FIELDCAT2-SELTEXT_M = 'Original Value'.
**WA_FIELDCAT2-OUTPUTLEN = 20.
*v_col = v_col + 1.
*APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
*CLEAR WA_FIELDCAT2.
loop at it_qamv1 into wa_qamv1.
read table it_qasr into wa_qasr with key wa_qamv1-prueflos.
WA_FIELDCAT2-COL_POS = v_col.
WA_FIELDCAT2-FIELDNAME = wa_qamv-kurztext.
wa_fieldcat2-seltext = wa_qasr-original_input.
WA_FIELDCAT2-OUTPUTLEN = 20.
v_col = v_col + 1.
APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
CLEAR WA_FIELDCAT2.
endloop.
WA_FIELDCAT2-COL_POS = v_col.
WA_FIELDCAT2-FIELDNAME = 'EQUNR'.
wa_fieldcat2-seltext = 'Equipment'.
WA_FIELDCAT2-OUTPUTLEN = 20.
v_col = v_col + 1.
APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
CLEAR WA_FIELDCAT2.
WA_FIELDCAT2-COL_POS = v_col.
WA_FIELDCAT2-FIELDNAME = 'TPLNR'.
wa_fieldcat2-seltext = 'Functional Location'.
WA_FIELDCAT2-OUTPUTLEN = 20.
v_col = v_col + 1.
APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
CLEAR WA_FIELDCAT2.
WA_FIELDCAT2-COL_POS = v_col.
WA_FIELDCAT2-FIELDNAME = 'TPLMA'.
wa_fieldcat2-seltext = 'Superior Funct Loc.'.
WA_FIELDCAT2-OUTPUTLEN = 20.
v_col = v_col + 1.
APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
CLEAR WA_FIELDCAT2.
WA_FIELDCAT2-COL_POS = v_col.
WA_FIELDCAT2-FIELDNAME = 'STATUS'.
wa_fieldcat2-seltext = 'Status'.
WA_FIELDCAT2-OUTPUTLEN = 20.
v_col = v_col + 1.
APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
CLEAR WA_FIELDCAT2.
WA_FIELDCAT2-COL_POS = v_col.
WA_FIELDCAT2-FIELDNAME = 'INACT'.
wa_fieldcat2-seltext = 'Status Inactive'.
WA_FIELDCAT2-OUTPUTLEN = 20.
v_col = v_col + 1.
APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
CLEAR WA_FIELDCAT2.
Create internal table dynamic
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = LT_LVC_FIELDCATALOGUE
IMPORTING
EP_TABLE = L_TABLE.
ASSIGN L_TABLE->* TO <IT_TABLE>.
I am getting the error when the method CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
is executed.
Please help me
Thanks,
Sudheer -
Dynamic internal table with problem
Hi,
I have developed a program to update standard table. I am using dynamic internal table creation concept. But my dynamic internal table is having width only 1200 bytes. But many standard tables have more than that width. Do you have any input create dynamic internal table with more than 1200 bytes width..
Have a look at the error.
[http://3.bp.blogspot.com/_O5f8iAlgdNQ/SjYXTBpO92I/AAAAAAAAErI/Fs996_APHbE/s1600-h/error-792463.JPG|http://3.bp.blogspot.com/_O5f8iAlgdNQ/SjYXTBpO92I/AAAAAAAAErI/Fs996_APHbE/s1600-h/error-792463.JPG]
Expecting reply
Thanks
VenkatHi,
DATA: IT_TABSTRUC TYPE STANDARD TABLE OF DFIES INITIAL SIZE 0,
V_REF TYPE REF TO DATA,
V_I_AVL_CAT TYPE TABLE OF LVC_S_FCAT.
FIELD-SYMBOLS : <F_FS_DATA> TYPE STANDARD TABLE.
SELECTION-SCREEN:BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001
NO INTERVALS.
PARAMETERS: P_TABNAM TYPE X_TABNAME.
SELECTION-SCREEN:END OF BLOCK B1.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
TABNAME = p_tabnam
LANGU = SY-LANGU
TABLES
DFIES_TAB = IT_TABSTRUC
EXCEPTIONS
NOT_FOUND = 1
INTERNAL_ERROR = 2
OTHERS = 3.
LOOP AT IT_TABSTRUC .
V_LS_AVL_CAT-FIELDNAME = IT_TABSTRUC -FIELDNAME.
V_LS_AVL_CAT-REF_TABLE = P_TABNAM.
V_LS_AVL_CAT-REF_FIELD = IT_TABSTRUC -FIELDNAME.
APPEND V_LS_AVL_CAT TO V_I_AVL_CAT.
ENDLOOP.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = V_I_AVL_CAT
IMPORTING
EP_TABLE = V_REF.
ASSIGN V_REF->* TO <F_FS_DATA>.
FREE V_REF.
SELECT * FROM (P_TABNAM) INTO CORRESPONDING
FIELDS OF TABLE <F_FS_DATA> .
Hope this resolves ur probs.... -
Problem disalying alv using dynamic internal table
Hi All,
I have 4 radiobutton for each radiobutton there is one internaltable to be displayed in alv.
My requirement is intead of calling the function module reuse_alv_grid_display everytime for
each of the internal table I want to create a dynamic internal tble for the function module.
My question is how to create a dynamic internal table which will hold the fields & data of
different interna table when diffrent radiobuttons are checked.
Areciate your time to help.
Thank you very much.Hi follow following logic:
field-symbols: <i_table> type standard table.
when rb1 is checked.
assign itab1 to <i_table>.
perform alv_disp using <i_table>
when rb2 is checked.
assign itab2 to <i_table>.
perform alv_disp using <i_table>
when rb3 is checked.
assign itab3 to <i_table>.
perform alv_disp using <i_table>
when rb4 is checked.
assign itab4 to <i_table>.
perform alv_disp using <i_table>
<<<<<<<<<<form alv_disp
form alv_disp using p_i_table type standard table.
perform create fieldcatelog changing i_fc
call the fm and pass the table p_i_table and i_fc
<<<<<<<<<< form create fieldcaelog
here create field catelog ..either by fm reuse_alv_fieldcatelog_merge ...in this just pass the structure name based on the radiobutton
hope its useful -
How to populate data in dynamic internal table
Hi Expert,
fyi. My dynamic internal table field is created base on data selected. Eg. select table qpcd has 5 records. These 5 recods will become fieldname to my dynamic internal table. My dynamic internal table will be
...itab
01
02
03
04
05
The 5 records from qpcd is populated in another table call viqmel. I need to find the occurance of each code in viqmel and populate the number of occurance in itab in each of column. The final dynamic itab will be like this
table itab
01 02 03 04 05 -
> field name
2 0 1 0 1 -
> data
my source code like below
Report ZPLYGRND2.
TABLES: mara, makt.
TYPE-POOLS: slis, sydes.
DATA:it_fcat TYPE slis_t_fieldcat_alv,
is_fcat LIKE LINE OF it_fcat,
ls_layout TYPE slis_layout_alv.
DATA: it_fieldcat TYPE lvc_t_fcat,
is_fieldcat LIKE LINE OF it_fieldcat.
DATA: new_table TYPE REF TO data,
new_line TYPE REF TO data,
ob_cont_alv TYPE REF TO cl_gui_custom_container,
ob_alv TYPE REF TO cl_gui_alv_grid,
vg_campos(255) TYPE c,
i_campos LIKE TABLE OF vg_campos,
vg_campo(30) TYPE c,
vg_tables(60) TYPE c.
types : begin of t_qpcd,
codegruppe like qpcd-codegruppe,
code like qpcd-code,
end of t_qpcd.
data:wa_qpcd type t_qpcd,
i_qpcd type standard table of t_qpcd initial size 0.
FIELD-SYMBOLS: <l_table> TYPE table,
<l_line> TYPE ANY,
<l_field> TYPE ANY.
select * into corresponding fields of wa_qpcd from qpcd
where katalogart = 'D'
and codegruppe = 'OOT01'.
append wa_qpcd to i_qpcd.
endselect.
loop at i_qpcd into wa_qpcd.
is_fcat-fieldname = wa_qpcd-code.
APPEND is_fcat TO it_fcat.
endloop.
LOOP AT it_fcat INTO is_fcat.
is_fieldcat-fieldname = is_fcat-fieldname.
is_fieldcat-ref_field = is_fcat-ref_fieldname.
is_fieldcat-ref_table = is_fcat-ref_tabname.
APPEND is_fieldcat TO it_fieldcat.
ENDLOOP.
*... Create the dynamic internal table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fieldcat
IMPORTING
ep_table = new_table.
if sy-subrc = 0.
endif.
*... Create a new line
ASSIGN new_table->* TO <l_table>.
CREATE DATA new_line LIKE LINE OF <l_table>.
ASSIGN new_line->* TO <l_line>.
LOOP AT <l_table> INTO <l_line>.
ENDLOOP.hello dear i m giving u a code in this a dynamic table is made on the basis of table in database , and u can download this data correct it , see it, or even change it....and upload in tht table help full if u dont know the table name...in advance.
also the code to populate data in dynamic table is in this code like:
SELECT * FROM (MTABLE_N)
INTO CORRESPONDING FIELDS OF TABLE <FS_ITAB> .
look at the whole program .hope this solve ur problem thanks.
REPORT ZTESTA MESSAGE-ID ZIMM .
TYPES : DATA_OBJECT TYPE REF TO DATA.
DATA : MITAB TYPE REF TO DATA .
TYPE-POOLS : SLIS .
DATA : IT_FIELDCAT TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV
WITH HEADER LINE .
DATA : IT_FIELDCATALOG TYPE LVC_T_FCAT .
DATA : WA_FIELDCATALOG TYPE LVC_S_FCAT .
DATA : I_STRUCTURE_NAME LIKE DD02L-TABNAME .
DATA : I_CALLBACK_PROGRAM LIKE SY-REPID .
DATA : DYN_LINE TYPE DATA_OBJECT .
FIELD-SYMBOLS : <FS_ITAB> TYPE STANDARD TABLE .
DATA : TABLE_NAME_IS_VALID TYPE C .
DATA : DYNAMIC_IT_INSTANTIATED TYPE C .
CONSTANTS BUTTONSELECTED TYPE C VALUE 'X' .
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(29) T_TABL.
PARAMETERS : MTABLE_N LIKE RSRD1-TBMA_VAL
MATCHCODE OBJECT DD_DBTB_16 OBLIGATORY .
DATA CHECKTABLED.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(29) T_FILE.
PARAMETERS : MFILENAM LIKE RLGRAP-FILENAME .
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(29) T_DOWN.
PARAMETERS : P_DOWNLD RADIOBUTTON GROUP GRP1
USER-COMMAND M_UCOMM .
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(29) T_CHKF.
PARAMETERS : P_CHKFIL RADIOBUTTON GROUP GRP1 .
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(29) T_UPLD.
PARAMETERS : P_UPLOAD RADIOBUTTON GROUP GRP1 .
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(29) T_SHOW.
PARAMETERS : P_SHOW_T RADIOBUTTON GROUP GRP1 .
SELECTION-SCREEN END OF LINE.
AT SELECTION-SCREEN OUTPUT .
PERFORM CHECK_FILENAME .
AT SELECTION-SCREEN.
IF SY-UCOMM = 'ONLI'.
CHECKTABLED = MTABLE_N+0(1).
IF CHECKTABLED NE 'Z'.
MESSAGE I017.
LEAVE TO SCREEN 1000.
ENDIF.
IF SY-UNAME NE 'KAMESH.K'.
MESSAGE I023 WITH SY-UNAME.
LEAVE TO SCREEN 1000.
ENDIF.
ENDIF.
IF SY-UCOMM = 'PRIN'.
CHECKTABLED = MTABLE_N+0(1).
IF CHECKTABLED NE 'Z'.
MESSAGE I017.
LEAVE TO SCREEN 1000.
ENDIF.
IF SY-UNAME NE 'KAMESH.K'.
MESSAGE I023 WITH SY-UNAME.
LEAVE TO SCREEN 1000.
ENDIF.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR MFILENAM .
PERFORM F4_FOR_FILENAME .
INITIALIZATION .
T_TABL = 'Table Name' .
T_FILE = 'File Name' .
T_DOWN = 'Download Table' .
T_CHKF = 'Check File to Upload' .
T_UPLD = 'Upload File' .
T_SHOW = 'Show Table Contents' .
START-OF-SELECTION .
PERFORM CHECK_TABLE_NAME_IS_VALID .
END-OF-SELECTION .
IF TABLE_NAME_IS_VALID EQ ' ' .
MESSAGE I398(00) WITH 'INVALID TABLE NAME' .
ELSE .
PERFORM INSTANTIATE_DYNAMIC_INTERNAL_T .
CHECK DYNAMIC_IT_INSTANTIATED = 'X' .
CASE BUTTONSELECTED .
WHEN P_DOWNLD .
PERFORM SELECT_AND_DOWNLOAD .
WHEN P_CHKFIL .
PERFORM CHECK_FILE_TO_UPLOAD .
WHEN P_UPLOAD .
PERFORM UPLOAD_FROM_FILE .
WHEN P_SHOW_T .
PERFORM SHOW_CONTENTS .
ENDCASE .
ENDIF .
FORM CHECK_TABLE_NAME_IS_VALID.
DATA MCOUNT TYPE I .
TABLES DD02L .
CLEAR TABLE_NAME_IS_VALID .
SELECT COUNT(*) INTO MCOUNT FROM TADIR
WHERE PGMID = 'R3TR'
AND OBJECT = 'TABL'
AND OBJ_NAME = MTABLE_N .
IF MCOUNT EQ 1 .
CLEAR DD02L .
SELECT SINGLE * FROM DD02L WHERE TABNAME = MTABLE_N .
IF SY-SUBRC EQ 0.
IF DD02L-TABCLASS = 'TRANSP' .
TABLE_NAME_IS_VALID = 'X' .
ENDIF .
ENDIF.
ENDIF .
ENDFORM. " CHECK_TABLE_NAME_IS_VALID
FORM SELECT_AND_DOWNLOAD.
CLEAR : <FS_ITAB> .
SELECT * FROM (MTABLE_N)
INTO CORRESPONDING FIELDS OF TABLE <FS_ITAB> .
PERFORM CHECK_FILENAME.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = MFILENAM
FILETYPE = 'DAT'
TABLES
DATA_TAB = <FS_ITAB>
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
IF SY-SUBRC EQ 0.
MESSAGE I398(00) WITH 'Table' MTABLE_N
'successfully downloaded to '
MFILENAM .
ENDIF.
ENDFORM. " SELECT_AND_DOWNLOAD
FORM UPLOAD_FROM_FILE.
DATA : ANS TYPE C .
DATA : LINES_OF_ITAB TYPE I .
DATA : MSY_SUBRC TYPE I .
CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
EXPORTING
TEXTLINE1 = 'Are you sure you wish to upload'
TEXTLINE2 = 'data from ASCII File to DB table '
TITEL = 'Confirmation of Data Upload'
IMPORTING
ANSWER = ANS.
IF ANS = 'J' .
PERFORM CHECK_FILENAME.
CLEAR MSY_SUBRC .
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = MFILENAM
FILETYPE = 'DAT'
TABLES
DATA_TAB = <FS_ITAB>
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
MSY_SUBRC = MSY_SUBRC + SY-SUBRC .
IF SY-SUBRC EQ 0.
DESCRIBE TABLE <FS_ITAB> LINES LINES_OF_ITAB .
IF LINES_OF_ITAB GT 0 .
MODIFY (MTABLE_N) FROM TABLE <FS_ITAB> .
MSY_SUBRC = MSY_SUBRC + SY-SUBRC .
ENDIF .
ENDIF.
IF MSY_SUBRC EQ 0 .
MESSAGE I398(00) WITH LINES_OF_ITAB
'Record(s) inserted in table'
MTABLE_N .
ELSE .
MESSAGE I398(00) WITH
'Errors occurred No Records inserted in table'
MTABLE_N .
ENDIF .
ENDIF .
ENDFORM. " UPLOAD_FROM_FILE
FORM F4_FOR_FILENAME.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_PATH = 'C:\'
MASK = ',.,..'
MODE = '0'
IMPORTING
FILENAME = MFILENAM
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 4
OTHERS = 5.
ENDFORM. " F4_FOR_FILENAME
FORM CHECK_FILENAME.
IF MFILENAM IS INITIAL
AND NOT ( MTABLE_N IS INITIAL )
AND P_SHOW_T NE BUTTONSELECTED.
CONCATENATE 'C:\'
MTABLE_N '.TXT' INTO MFILENAM.
ENDIF .
ENDFORM. " CHECK_FILENAME
FORM INSTANTIATE_DYNAMIC_INTERNAL_T.
CLEAR DYNAMIC_IT_INSTANTIATED .
I_STRUCTURE_NAME = MTABLE_N .
CLEAR IT_FIELDCAT[] .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_STRUCTURE_NAME = I_STRUCTURE_NAME
CHANGING
CT_FIELDCAT = IT_FIELDCAT[]
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC EQ 0.
LOOP AT IT_FIELDCAT .
CLEAR WA_FIELDCATALOG .
MOVE-CORRESPONDING IT_FIELDCAT TO WA_FIELDCATALOG .
WA_FIELDCATALOG-REF_FIELD = IT_FIELDCAT-FIELDNAME .
WA_FIELDCATALOG-REF_TABLE = MTABLE_N .
APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG .
ENDLOOP .
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = IT_FIELDCATALOG
IMPORTING
EP_TABLE = MITAB .
ASSIGN MITAB->* TO <FS_ITAB> .
DYNAMIC_IT_INSTANTIATED = 'X' .
ENDIF.
ENDFORM. " INSTANTIATE_DYNAMIC_INTERNAL_T
FORM SHOW_CONTENTS.
CLEAR : <FS_ITAB> .
SELECT * FROM (MTABLE_N)
INTO CORRESPONDING FIELDS OF TABLE <FS_ITAB> .
I_CALLBACK_PROGRAM = SY-REPID .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = I_CALLBACK_PROGRAM
IT_FIELDCAT = IT_FIELDCAT[]
TABLES
T_OUTTAB = <FS_ITAB>
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM. " SHOW_CONTENTS
FORM CHECK_FILE_TO_UPLOAD.
PERFORM CHECK_FILENAME.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = MFILENAM
FILETYPE = 'DAT'
TABLES
DATA_TAB = <FS_ITAB>
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
IF SY-SUBRC EQ 0.
I_CALLBACK_PROGRAM = SY-REPID .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = I_CALLBACK_PROGRAM
IT_FIELDCAT = IT_FIELDCAT[]
TABLES
T_OUTTAB = <FS_ITAB>
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDIF .
ENDFORM. " CHECK_FILE_TO_UPLOAD
Message was edited by:
SAURABH SINGH
SENIOR EXECUTIVE
SAMSUNG INDIA ELECTRONICS LTD.,NOIDA -
Error while creating a dynamic internal table refers to custom field
Hi all,
I am getting the exception TYPE_NOT_FOUND when I try to create a dynamic internal table using:-
DATA: gr_desc TYPE REF TO cl_abap_typedescr.
gr_desc = cl_abap_typedescr=>describe_by_name( p_field ).
The field p_field is a Z-field inside a DB table, (e.g. a user added field in MARA). The statement fails at that point and gives a runtime exception. Any suggestions to how I may solve this problem? Or any alternatives for the same? I guess we face this issue for all custom fields..has SAP released a note for this??
Thanks..that's just the wrong method, you should use DESCRIBE_BY_DATA
gr_desc = cl_abap_typedescr=>describe_by_data( p_field ).
Note: DESCRIBE_BY_NAME is to be used for referencing a DDIC type by its name. Example:
gr_desc = cl_abap_typedescr=>describe_by_name( 'MARA-ZZFIELD' ). -
Error while creating dynamic internal table.
Hello Expert,
While creating a dynamic internal table, it throw an run time error as :
" LOAD PROGRAM NOT FOUND
CX_SY_PROGRAM_NOT_FOUND"
i tried to debug the program, it found this error comes while calling
CALL METHOD cl_alv_table_create=>create_dynamic_table
please anyone help me out to resolve this problem.
what could be the reason of error? and how to avoid it?
<REMOVED BY MODERATOR>
thanks in advance.
~ shweta.
Edited by: Alvaro Tejada Galindo on Feb 28, 2008 2:41 PMHi,
Go through this program.
Report z_dynamic.
type-pools : abap.
field-symbols: <dyn_table> type standard table,
<dyn_wa>,
<dyn_field>.
data: dy_table type ref to data,
dy_line type ref to data,
xfc type lvc_s_fcat,
ifc type lvc_t_fcat.
selection-screen begin of block b1 with frame.
parameters: p_table(30) type c default 'T001'.
selection-screen end of block b1.
start-of-selection.
perform get_structure.
perform create_dynamic_itab.
perform get_data.
perform write_out.
form create_dynamic_itab.
Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = ifc
importing
ep_table = dy_table.
assign dy_table->* to <dyn_table>.
Create dynamic work area and assign to FS
create data dy_line like line of <dyn_table>.
assign dy_line->* to <dyn_wa>.
endform.
Regards, -
Creation of dynamic internal table is not synchronous
In my code following lines are used to create a dynamic table.
REFRESH : INCTABL .
CLEAR INCTABL .
INCTABL-LINE = 'data: begin of dyntab occurs 10,'. APPEND INCTABL.
INCTABL-LINE = 'zpltnamec like zvendplt-zpltnamec,'. APPEND INCTABL.
INCTABL-LINE = 'sourcing like zopsdwbom-sourcing,'. APPEND INCTABL.
INCTABL-LINE = 'zmatgrp like zrmrpmaterial-zmatgrp,'. APPEND INCTABL.
INCTABL-LINE = 'zcollection like zrmrpmaterial-zcollection,'.
APPEND INCTABL.
INCTABL-LINE = 'fiscintrodt like zrmrpmaterial-zfiscintrodt,'.
APPEND INCTABL.
INCTABL-LINE = 'bednr like ekpo-bednr,'. APPEND INCTABL.
INCTABL-LINE = 'revlv like ekpo-revlv,'. APPEND INCTABL.
INCTABL-LINE = 'ematn like ekpo-ematn,'. APPEND INCTABL.
INCTABL-LINE = 'menge like mara-eannr,'. APPEND INCTABL.
INCTABL-LINE = 'stprs like mara-eannr,'. APPEND INCTABL.
*inctabl-line = 'kbetr like cdred-f_new,'. append inctabl.
DATA : T_KBETR(72) .
DATA :CNT(2).
DO LIN TIMES .
CNT = SY-INDEX .
CONCATENATE 'kbetr' CNT ' like cdred-f_new,' INTO T_KBETR .
CONDENSE T_KBETR .
INCTABL-LINE = T_KBETR . APPEND INCTABL.
ENDDO .
INCTABL-LINE = 'end of dyntab. '. APPEND INCTABL.
INSERT REPORT 'zcrchangereport_3'(001) FROM INCTABL.
but during run time it is using the previously created dynamic internal table structure and then creating currently required internal table.
how to overcome this problem/
Thanks.Hello,
Instead of creating report, create subroutine pool. Like
INCTABL-LINE = 'report ztest.'. APPEND INCTABL.
INCTABL-LINE = 'form main'. APPEND INCTABL.
INCTABL-LINE = 'data: begin of dyntab occurs 10,'. APPEND INCTABL.
INCTABL-LINE = 'zpltnamec like zvendplt-zpltnamec.'. APPEND INCTABL.
INCTABL-LINE = 'data: end of dyntab.'. APPEND INCTABL.
CATCH SYSTEM-EXCEPTIONS GENERATE_SUBPOOL_DIR_FULL = 9.
GENERATE SUBROUTINE POOL inctabl NAME l_name
MESSAGE L_MESSAGE LINE L_LINE WORD L_WORD.
ENDCATCH.
IF L_MESSAGE IS INITIAL.
PERFORM (L_FORM) IN PROGRAM (L_NAME).
ELSE.
WRITE : L_MESSAGE, L_LINE.
ENDIF.
You can get the message in L_message variable, if any error occurs.
Regards,
Naimesh -
Dynamic internal table column issue
Hi
i have ALV report with dynamic internal table.after i build the internal table and fieldcatalog i have problem i.e. when grid is displayed then one of the column value is coming in the next column.i populated col_pos in field catalog also and in the debug mode data is populated correctly for respective columns in fieldcatalog and dynamic internal table. But when it is displayed i have this problem.
any inputs on this?Hi Moorthy,
Did you perform an ALV consistency check?
Check the below given links as well.
The Consistency Check - ALV Grid Control (BC-SRV-ALV) - SAP Library
SAP ALV Consistency Check
Regards,
Philip. -
Passing dynamic internal table into ALV
I have made one ALV report where i had created one button 'GENERATE'. ON CLICKING THIS BUTTON the data in the ALV report is downloaded to excel file.
i have used this:-
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
window_title = l_title
default_extension = 'XLS'
initial_directory = 'C:\'
CHANGING
filename = filename
path = path
fullpath = fullpath
user_action = user_action
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
IF sy-subrc <> 0.
EXIT.
ENDIF.
Check which button is pressed
IF user_action <> cl_gui_frontend_services=>action_ok.
EXIT.
ENDIF.
Download error data collected from the internal table
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = fullpath
filetype = 'ASC'
write_field_separator = '#'
codepage = '4103'
write_bom = c_true
CHANGING
data_tab = gi_final
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
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24.
If selection is successful
IF sy-subrc EQ 0.
MESSAGE s004 . " File created successfully
ELSE.
MESSAGE i005 . " File is not created successfully
ENDIF.
In the table i have passed the internal table . this is working fine.
<b>But,
The problem is if i want to display the data in diferent layout based on selection screen criteria the data downloaded are same as default layout.
how to pass a dynamic internal table in the
CALL METHOD cl_gui_frontend_services=>gui_download</b>Hi ,
here is the Program for Download
REPORT yrs_download_transport_request.
PARAMETERS:
p_reqest TYPE trkorr OBLIGATORY,
p_folder(255) TYPE c LOWER CASE, p_sepr OBLIGATORY.
DATA:
folder TYPE string,
retval LIKE TABLE OF ddshretval WITH HEADER LINE,
fldvalue LIKE help_info-fldvalue,
transdir TYPE text255,
filename(255),
trfile(20) TYPE c,
datatab TYPE TABLE OF text8192 WITH HEADER LINE,
len TYPE i,
flen TYPE i.
TYPE-POOLS: sabc, stms, trwbo.
INITIALIZATION.
CONCATENATE sy-sysid 'K*' INTO p_reqest.
IF sy-opsys = 'Windows NT'.
p_sepr = ''.
ELSE.
p_sepr = '/'.
ENDIF.
* CALL FUNCTION 'WSAF_BUILD_SEPARATOR'
* IMPORTING
* separator = p_sepr
* EXCEPTIONS
* separator_not_maintained = 1
* wrong_call = 2
* wsaf_config_not_maintained = 3
* OTHERS = 4.
* IF sy-subrc NE 0.
* MESSAGE s001(00)
* WITH
* 'Unable to find out the separator symbol for the system.'(011).
* ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_reqest.
DATA:
tt_system TYPE TABLE OF tmscsys WITH HEADER LINE,
es_selected_request TYPE trwbo_request_header,
es_selected_task TYPE trwbo_request_header,
iv_organizer_type TYPE trwbo_calling_organizer,
is_selection TYPE trwbo_selection.
iv_organizer_type = 'W'. is_selection-reqstatus = 'R'.
CALL FUNCTION 'TR_PRESENT_REQUESTS_SEL_POPUP'
EXPORTING
iv_organizer_type = iv_organizer_type
is_selection = is_selection
IMPORTING
es_selected_request = es_selected_request
es_selected_task = es_selected_task.
p_reqest = es_selected_request-trkorr.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_folder.
DATA: title TYPE string.
title = 'Select target folder'(005).
CALL METHOD cl_gui_frontend_services=>directory_browse
EXPORTING
window_title = title
CHANGING
selected_folder = folder
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
OTHERS = 3.
CALL FUNCTION 'CONTROL_FLUSH'
EXCEPTIONS
cntl_system_error = 1
cntl_error = 2
OTHERS = 3.
p_folder = folder.
AT SELECTION-SCREEN ON p_reqest.
DATA: request_info TYPE stms_wbo_request,
request_infos TYPE stms_wbo_requests.
REFRESH request_infos.
CALL FUNCTION 'TMS_MGR_READ_TRANSPORT_REQUEST'
EXPORTING
iv_request = p_reqest
iv_header_only = 'X'
IMPORTING
et_request_infos = request_infos
EXCEPTIONS
read_config_failed = 1
table_of_requests_is_empty = 2
system_not_available = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CLEAR request_info.
READ TABLE request_infos INTO request_info INDEX 1.
IF sy-subrc NE 0
OR request_info-e070-trkorr IS INITIAL.
MESSAGE e398(00) WITH 'Request'(006) p_reqest 'not found'(007).
ELSEIF request_info-e070-trstatus NE 'R'.
MESSAGE e398(00)
WITH 'You must release request'(008)
request_info-e070-trkorr
'before downloading'(009).
ENDIF.
START-OF-SELECTION.
folder = p_folder.
CONCATENATE p_reqest+3(7) '.' p_reqest(3) INTO trfile.
CALL FUNCTION 'RSPO_R_SAPGPARAM'
EXPORTING
name = 'DIR_TRANS'
IMPORTING
value = transdir
EXCEPTIONS
error = 0
OTHERS = 0.
PERFORM copy_file USING 'cofiles' trfile.
trfile(1) = 'R'.
PERFORM copy_file USING 'data' trfile.
trfile(1) = 'D'.
PERFORM copy_file USING 'data' trfile.
* FORM copy_file *
* --> SUBDIR * * --> FNAME *
FORM copy_file USING subdir fname.
DATA:
auth_filename TYPE authb-filename,
gui_filename TYPE string.
CONCATENATE transdir subdir fname
INTO filename
SEPARATED BY p_sepr.
REFRESH datatab.
CLEAR flen.
auth_filename = filename.
CALL FUNCTION 'AUTHORITY_CHECK_DATASET'
EXPORTING
activity = sabc_act_read
filename = auth_filename
EXCEPTIONS
no_authority = 1
activity_unknown = 2
OTHERS = 3.
IF sy-subrc <> 0.
FORMAT COLOR COL_NEGATIVE.
WRITE: / 'Read access denied. File'(001),
filename.
FORMAT COLOR OFF. EXIT.
ENDIF.
OPEN DATASET filename FOR INPUT IN BINARY MODE.
IF sy-subrc NE 0.
FORMAT COLOR COL_TOTAL.
WRITE: / 'File open error'(010), filename.
FORMAT COLOR OFF. EXIT.
ENDIF.
DO.
CLEAR len.
READ DATASET filename INTO datatab LENGTH len.
flen = flen + len.
IF len > 0. APPEND datatab. ENDIF.
IF sy-subrc NE 0.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET filename.
CONCATENATE p_folder '' fname INTO gui_filename.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize = flen
filename = gui_filename
filetype = 'BIN'
CHANGING
data_tab = datatab[]
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 = 24.
IF sy-subrc = 0.
WRITE: / 'File'(002), filename, 'downloaded. Length'(003), flen.
ELSE.
FORMAT COLOR COL_NEGATIVE.
WRITE: / 'File download error. Filename:'(004), filename.
FORMAT COLOR OFF.
ENDIF.
ENDFORM. "copy_file
Reward points if it is usefull....
Girish
Maybe you are looking for
-
"SOURCE_PACKAGE" is incompatible with "DATA_PACKAGE"
Hi All, While activating Transformation 2lis_13-vditm I am getting an error In PERFORM or CALL FUNCTION "ROUTINE_9998", the actual parameter "SOURCE_PACKAGE" is incompatible with the formal parameter "DATA_PACKAGE". Is there anyone who can solve this
-
How to upload data into IT0000 using ABAP-HR program
Hello, I'm required to upload data into multiple infotypes [IT000, 0001, 0002, etc] using single input text file. Can anyone able to guide me, how to upload data into IT0000 using ABAP program ? Thanks in advance. Regards Prabhakar. Message was edite
-
Navigation between the portals
Hi Gurus, I have a unique requirement. I have a obiee 10g portal with LDAP authentication. In one of the nagivation links, I have to go to OBIEE 11g page with the same username and password. When I go to OBIEE 11g, it should not ask me the username/p
-
Captivate 6 IMS Manifest validation error
I'm working for the first time with a Captivate template file created in 5.5 and developed further in Captivate 6. I'm getting the following IMS Manifest validation error when I try to upload it on our LMS. Does anyone have a lead for me to pursue th
-
My ipod touch would not connect to itunes. I was told to do a factory reset. After i had done this it said the ipod could not be restored and is now in recovery mode and unuseable. Anyone any suggestions?