Dynamic Parameter Table definition?
This might have been asked before, but I don't think I saw an authoritative answer.
I'm using Crystal 2008 SP2 in a Visual Studio 2008 C# project. I need to build a WPF UI that prompts for the values of the report parameters. Nothing new there. For the most part I have the static parameters figured out. But when it comes to dynamic parameters, I need to know how to drill into the API to figure out what table and columns were setup as the source of values for a pick-list (i.e. a combobox/listbox) type parameters.
Any suggestions?
Ken.
Why not?
I really hate to post rants to a forum as usefull as this, and Ludek I know you always reply with very usefull info, but I think it's time that your developers get on the ball.
There are so many things missing in Crystal 2008:
I really need 64 bit support. And native WPF/Silverlight support. A truely efficient means to run reports in distributed applications. And there is always something in the API that throws up road blocks like this.
In this case I don't want Crystal to prompt my user because I have no control over the look and feel of the prompt screen. I'm using WPF and have a highly stylized user interface. If I let Crystal pop-up the parameter prompts it looks terrible. So I have to build the parameter prompts myself, but the lack of metadata about the prompts is a huge road block for me.
Ken.
Similar Messages
-
Dynamic internal table definition
Hi,
I need to define at runtime an internal table.
In particular let p_type the parameter to define the type for an internal table
DATA: itab TYPE STANDARD TABLE
OF p_type
WITH HEADER LINE.
This code doesn't work.
I have tryed to use a field-symbol but same result.
Any suggest?Hi,
Check this code.
DATA path LIKE ibipparms-path.
DATA: i_excel LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
data: i_fcat type LVC_T_FCAT,
wa_fcat type lvc_s_fcat.
data: fname(10),
I_PTABLE TYPE REF TO DATA.
SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE text-001.
PARAMETERS p_path LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b.
FIELD-SYMBOLS: <fs_final> TYPE ANY,
<I_TABLE> type table.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = path.
p_path = path.
START-OF-SELECTION.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_path
i_begin_col = 1
i_begin_row = 1
i_end_col = 256
i_end_row = 65536
TABLES
intern = i_excel.
loop at i_excel where row = '1'.
wa_fcat-ROW_POS = i_excel-row.
wa_fcat-col_pos = i_excel-col.
concatenate 'COL_' i_excel-col into fname.
wa_fcat-FIELDNAME = I_EXCEL-VALUE.
append wa_fcat to i_fcat.
endloop.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = I_FCAT
IMPORTING
EP_TABLE = I_PTABLE.
Assign i_ptable->* to <i_table>.
perform zf_assign.
End-of-selection.
LOOP AT I_FCAT INTO WA_FCAT .
WRITE: WA_FCAT-FIELDNAME(10).
ENDLOOP.
LOOP AT <I_TABLE> assigning <fs_final>.
WRITE:/ <fs_final>.
ENDLOOP.
*& Form zf_assign
text
--> p1 text
<-- p2 text
form zf_assign .
field-symbols: <ls_table>.
ASSIGN LOCAL COPY OF INITIAL LINE OF <I_TABLE> TO <LS_TABLE>.
LOOP AT i_excel WHERE ROW <> 1.
ASSIGN COMPONENT i_excel-col OF STRUCTURE <LS_TABLE> TO <fs_final>.
<fs_final> = i_excel-value.
AT END OF row.
APPEND <LS_TABLE> TO <i_table>.
ENDAT.
ENDLOOP.
unassign <ls_table>.
endform. " zf_assign
Regards,
Amit -
Dynamic parameter with unlinked table
Post Author: martinh
CA Forum: Data Connectivity and SQL
Hello,
I have 2 tables in my database. One table (table A) is for selecting the data (all kind of fields)
The other table (table B) is only to be used to have a parameter selection (table with name, value records). These tables have no link with eachother.
I need to have 8 parameter fields and each parameter field must pick a value from table B.
In my recordselection (on table A) I have tests to select records depending on parameters.
I have this working using 8 static parameters, but I have a list of 16 values.
So that means that for each of the 8 parameters I must enter those 16 values (and also in formula-fields I have make tests; total 8x16 lines of coding)
Therefore I wanted to use a table with the 16 values and link the 8 parameters to table B.
The problem is that CR says that there are 2 startpoints and also I see that the data is selected several times.
So how can I use table B only for the parameters without the need of linking this table B to table A, because there is no way to link this.
Hope anyone can help, because I didn't fond any documentation talking about this situation.
I'm using CR XI and CR 2008
Thanks for your reply!
MartinThe dynamic parameter does not have the functionality to 'type-ahead' and go to specific values in the list in that manner. The most you can do is go to values that start with a specific letter and scroll through them. This behavior is occurring by design.
By default, Crystal Reports will only return the first 1000 unique values for a dynamic parameter. This can be changed through a registry entry.
For information on changing the values retrieved for the dynamic parameter, you can refer to the following Business Objects Note.
- Go to this link
https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_ossnotes&query=&adv=true
- Search for the Note: 1218588
When using a dynamic parameter, the limit will be a combination of all the values return at each level to reach the total number of records returned. Also the more records that you return to the dynamic parameter, the longer it will take to retrieve the data from the database. -
Passing the Dynamic Internal Table as the Output Parameter of the FM...
Hi,
How can we pass the internal table as the output from the Function Module TABLES parameter.
SELECT * FROM TVRO BYPASSING BUFFER INTO TABLE <ltable>.
Now I need to pass the dynamic internal table <ltable> as the output in the function module.
Thanks!
Puneet.I can't use TVRO as the table type. The Table name is as the Input. This program will download the contents of the table and create an app server file. It can be for any database table.
so i want the output of this FM should be the data from that table. So what should be the TABLE type.
like in a program i will use:::
FIELD-SYMBOLS: <ltable> TYPE ANY TABLE,
<l_line> TYPE ANY,
<l_field> TYPE ANY.
SELECT * FROM (p_table) BYPASSING BUFFER INTO TABLE <ltable>.
That is my requirement. -
Dynamic parameter against table TVTWT
I currently have the table TVTWT linked in order to get the name description for the distribution channel.
For example, distribution channel 00 has two rows, one german and one english.
In my dynamic parameter for distribution channel, when I try to show the name description of the distribution channel in the drop down, I get only the german name description instead of the english description. When I look at the connection for the datasource, the language is set to EN. Is there anyway I can get around this issue?
thanks for any assistance.
RichardPlease re-post if this is still an issue to the Data Connectivity - Crystal Reports Forum or purchase a case and have a dedicated support engineer work with you directly
-
Dynamic export table parameter
Hi all
Currently im having this issue whereby i need a dynamic export table parameter in the function module. this is because there is a dynamic selection from the database and then i do not know what is the reference type for the exporting table. how to define a dynamic reference type. btw im developing on 4.6CIf you are using an RFC FM it would be different 'cause you always have to type all the parameters.
In case it's not an RFC, of course you can do it.
FUNCTION ZJMOTERO.
*"*"Interfase local
*" IMPORTING
*" REFERENCE(I_RUTA) TYPE ZJMOTERO3
*" TABLES
*" TABLE
field-symbols: <fs> type table.
data: a type ref to data.
data: tabla type table of pa0001.
select * into table tabla from pa0001 where pernr eq 1.
assign tabla to <fS>.
table[] = <fs>[].
ENDFUNCTION. -
Dynamic parameter list condition question.
CR2008
Let say I have a dynamic parameter based on EmployeeName field in Employee table. How can I limit a parameter drop down list only to employees from one specific department? I do not want to select department first, I want to "hardcode" it somehow. It seems that parameter setup window does not have any search criteria.
Thanks,
OlegTry to put the filter condition in business view manager. Once you publish the report to server by default it generates an LOV in repository. Now open the business view manger and select the LOV and click on the object definition icon to see related business view and data foundation. Now open the data foundation and in the field explorer try to insert a new filter and add the condition like ="department name" and apply this and save the datafoundation. Now right click on the filter edit rights and apply this to all the user groups. Now when you open the report and refresh the report you will be able to see only the list related to the department.
Regards,
Raghavendra.G -
Hi ,
plz check my below program and exaplain me how to make use of parameter table
CLASS cl_abap_objectdescr DEFINITION LOAD.
CLASS add DEFINITION.
PUBLIC SECTION.
METHODS add IMPORTING x TYPE i
y TYPE i
EXPORTING z TYPE i.
ENDCLASS. "add DEFINITION
CLASS add IMPLEMENTATION.
METHOD add.
z = x + y.
ENDMETHOD. "ADD
ENDCLASS. "ADD IMPLEMENTATION
TYPE-POOLS: abap.
START-OF-SELECTION.
DATA : x TYPE i VALUE 10,
y TYPE i VALUE 20,
z TYPE i.
DATA : it_ptab TYPE abap_parmbind_tab,
wa_ptab TYPE abap_parmbind.
DATA : obj TYPE REF TO add.
DATA : add TYPE string VALUE 'ADD'.
wa_ptab-name = 'X'.
wa_ptab-kind = cl_abap_objectdescr=>exporting.
GET REFERENCE OF X INTO wa_ptab-value.
INSERT wa_ptab INTO TABLE it_ptab.
wa_ptab-name = 'Y'.
wa_ptab-kind = cl_abap_objectdescr=>exporting.
GET REFERENCE OF Y INTO wa_ptab-value.
INSERT wa_ptab INTO TABLE it_ptab.
wa_ptab-name = 'Z'.
wa_ptab-kind = cl_abap_objectdescr=>importing.
GET REFERENCE OF Z INTO wa_ptab-value.
INSERT wa_ptab INTO TABLE it_ptab.
CREATE OBJECT obj
TYPE
(add)
PARAMETER-TABLE
it_ptab.
WRITE : z.
The dump analysis is as follows
Runtime Errors DYN_CALL_METH_PARAM_NOT_FOUND
Except. CX_SY_DYN_CALL_PARAM_NOT_FOUND
Date and Time 2008.07.28 02:10:02
Short text
Formal parameter not found during dynamic method call.
regardsHi,
Parameter table in Method call is Basically used when call method Dynamically and pass the actual parameter dynamically.
The error you have mentioned occured when the specified and actual parameter are different.
Just follow the procedure and criteria for using parameter table in case of method call in this link.Hope you will get to know the reason for the runtime error.
http://help.sap.com/saphelp_nw70/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
Regards,
Sujit -
How to delete data from dynamic internal table
Hi,
I have dynamic internal table and I have some slection screen fields , using these selection screen fields
(select -options), I have to filter the data? assigning will work with READ , but I have select options not the parametre,
and also delete will not work for dynamic table..
as we cannot use assigning with delete..
So how to do this?
and one more thing is , I cannot filter the data while selection( in select, I cannot filter the data-> as it's not coming directly from table, it's coming from buffer),
so now after selection of data, I need to filter the data from dynamic table.
Is there any way to do this?
Regards,
MrunalHi matt,
I tried with below code as you said. But I am getting dump. can you help?
here is my piece of code.
FIELD-SYMBOLS: <LS_DATA> type any,
<LT_DATA> TYPE table,
<L_FIELD> type any.
ASSIGN <l_buffer_entry>-dataptr->* TO <LS_DATA>.
ASSIGN <l_buffer_entry>-dataptr->* TO <LT_DATA>.
LOOP AT <LT_DATA> ASSIGNING <LS_DATA>.
ASSIGN COMPONENT 'BUKRS' OF STRUCTURE <LS_DATA> TO <L_FIELD>.
IF <L_FIELD> NOT IN SO_BUKRS.
DELETE <LT_DATA>.
ENDIF.
UNASSIGN <L_FIELD>.
ASSIGN COMPONENT 'BELNR' OF STRUCTURE <LS_DATA> TO <L_FIELD>.
IF <L_FIELD> NOT IN SO_BELNR.
DELETE <LT_DATA>.
ENDIF.
UNASSIGN <L_FIELD>.
ENDLOOP.
and here is the description of my dump:->>>
You attempted to access an unassigned field symbol
(data segment 32772).
This error may occur for any of the following reasons:
- You address a typed field symbol before it is set using ASSIGN
- You address a field symbol that points to a line in an internal table
that has been deleted
- You address a field symbol that had previously been reset using
UNASSIGN, or that pointed to a local field that no longer exists
- You address a global function interface parameter, even
though the relevant function module is not active,
that is it is not in the list of active calls. You can get the list
of active calls from the this short dump. -
CR2011 Dynamic Parameter does not show list at all
I am upgrading some Crystal Reports from CR 8.5 to 2011. Some would be better served by using a dynamic parameter to allow the user to select the data for the parameter from the database information. I have created a dynamic parameter on the Customer ID and set the description to be the customer name. I have set it to handle multiple values.
When I preview the report in the Crystal designer, I get a text box to type in but not a drop down. To be clear, I am not talking about the LOV 1000 limit here. There are only 50 customers in the sample file I am working with. I tried turning the static parameter into a dynamic one, I deleted the original parameter and created a new one.
In case it matters, the parameter is only used as part of the selection formula and if I enter a proper customer id, it will retrieve the data. This report has about 7 tables (no stored procedures or views) and a subreport of two tables that is linked to the main report on the customer id. The parameter is only used on the main report for record selection. The SQL statement in the main report and subreport did need to be reset when I first opened the report in CR2011 but I did that on both. I have verified the database and the option to verify on first refresh is checked. The original parameter did have an imported list of about 3000 customer names. I tried exporting the CR template to a new file and while the file size changed, the behaviour did not.
When I create a brand new report on two of the tables, including the same customer table, and create the parameter the same way, it shows me the list properly in a dropdown at the prompt stage.
I am not sure where to go here or what else to try. If anyone has any suggestions, I appreciate the help. TIA, rasincThank for the reply Dell,
I see the logic in adding the extra table and keeping it unlinked and I do know the crazy data that can come up if I use it linked to other tables or use the fields in other parts of the programming.
However, I've now tried it several times, creating the parameter on just the name alone, with the ID alone, etc. and I still only get a text box to type into.
I have made sure the original selection criteria
{customer.Id} = {?Customer}
if from the original table, not the new one, which I assume you expected me to do.
So I decided to run the same report through CR XIR2. When I update the Set Datasource Location, I am now getting the message
"Invalid Argument provided.
Details: The alias requested 'company', contains a combination of characters which is not considered to be valid"
Company is a table containing information about the main company, not the customers. The same message pops up for another table as well.
Then I get a message that says:
"Prompting failed with the following error message: 'List of Values failure: fail to get values. [Cause of error: The table company does not exist in the document.]'
Error source: prompt.dll Error code: 0x8004380D"
This appears to be a database access issue but I know the firewalls are not a problem because I can create a new report and get the LOV properly with the same database and same desktop computer. I can take that report created in CR2011 and use it in CRXI also and get the proper LOV. Is it possible I am dealing with template corruption because there were so many items imported into the static list before? -
Why Dynamic Parameter is not working, when i create report using stored procedure ?
Post Author: Shashi Kant
CA Forum: General
Hi all
Why Dynamic Parameter is not working, when i create report XI using stored procedure ?
Only i shaw those parameters which i used in my stored procedure, the parameter which i create dynamic using stored procedure
is not shown to me when i referesh the report for viewing the results.
I have used the same procedure which i mention below but can not seen the last screen which is shown in this .
============================================================================================
1. Select View > Field Explorer2. Right-click on Parameter Fields and select New from the right-click menu.3. Enter u201CCustomer Nameu201D as the name for your parameter4. Under u201CList of Valuesu201D select u201CDynamicu201D5. Under the Value column, click where is says u201Cclick here to add itemu201D and select Customer Name from the drop-down list. The dialog shown now look like the one shown below in Figure 1. Click OK to return to your report design.
Dynamic Parameter Setup6. Next, select Report > Select Expert, select the Customer Name field and click OK.7. Using the drop-down list beside select u201CIs Equal Tou201D and using the drop-down list, select your parameter field (it should be the first field). 8. Click OK to return to your report design and see the parameter dialog.The parameter dialog will appear and show you a dynamic list of values that is updated each time your run your report. It couldnu2019t be easier! In our next tutorial, we will be looking at how to use this feature to create cascading parameter fields, where the values are filtered by the preceding selection.
Dynamic Parameters in Action
My question is that whether dynamic parameter is working with storedprocedure or not.
When i added one table and try to fetch records using dyanmic prameters. after that i am not be able to find the dynamic parameter option when i referesh my report.
One more thing when i try the static parameter for my report, the option i see when i referesh the screen.
Please reply soon , it's urgent
Regards
shashi kantHi Kishore,
I have tested the issue step by step by following you description, while the first issue works well in my local environment. Based on my research, this can be caused by the lookup expression or it indeed return Male value based on the logic. If you use the
expression below, it will indeed only return the Male record. So please try to double-check the record in the two datasets and the expression in your environment:
=lookup(first(Fields!ProgramID.Value,"DataSet1"),Fields!ProgramID.Value,Fields!Gender.Value,"DataSet2")
As to the second issue, please try to use the following expression:
=Count(Lookup(fields!ProgramID.value,fields!ProgramID.value,fields!Gender.value,"DataSet2"))
Besides, if this issue still exist, in order to trouble shoot this issue more efficiently, could you please post both the .rdl file with all the size properties to us by the following E-mail address? It is benefit for us to do further analysis.
E-mail: [email protected]
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
DYNAMIC INTERNAL TABLE CREATION BASED ON THE CONTENT OF ANOTHER INTERNAL TA
Hi All
I need to create an internal table at runtime.
I have a selection screen parameter which is specific to country, Which can take values below
eg:- IT_AREA for Italy(IT)
FR_AREA for France(FR)
IE_AREA for Ireland(IE).....And similary for other countries
Based on the Above parameter, I need to create Internal Table as below
DATA: itab TYPE italy_data Occurs 0.
If I declare as above, Then itab has fields from italy_data. And this internal table i will be sending it to Function Module to get data into it.
My Requirement is to Create the Internal table itab during runtime for tables italy_data OR france_data OR ireland_data based on selection screen parameter. Tables on Country may have different number of fields in it.
Can anyone help me on this??Hi,
Here is a sample code to create a dynamic internal table.
REPORT ytrab03.
TABLES: mara, makt.
TYPE-POOLS: slis.
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.
DATA: e_params LIKE zutsvga_alv_01.
FIELD-SYMBOLS: <l_table> TYPE table,
<l_line> TYPE ANY,
<l_field> TYPE ANY.
PARAMETERS: p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
is_fcat-fieldname = 'COL01'.
is_fcat-ref_fieldname = 'MATNR'.
is_fcat-ref_tabname = 'MARA'.
APPEND is_fcat TO it_fcat.
is_fcat-fieldname = 'COL02'.
is_fcat-ref_fieldname = 'MAKTX'.
is_fcat-ref_tabname = 'MAKT'.
APPEND is_fcat TO it_fcat.
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.
CONCATENATE is_fieldcat-ref_table is_fieldcat-ref_field
INTO vg_campos SEPARATED BY '~'.
APPEND vg_campos TO i_campos.
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.
*... 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>.
SELECT (i_campos) FROM mara INNER JOIN makt
ON mara~matnr = makt~matnr
UP TO p_max ROWS
INTO TABLE <l_table>.
LOOP AT <l_table> INTO <l_line>.
LOOP AT it_fcat INTO is_fcat.
ASSIGN COMPONENT is_fcat-fieldname
OF STRUCTURE <l_line> TO <l_field>.
IF sy-tabix = 1.
WRITE: /2 <l_field>.
ELSE.
WRITE: <l_field>.
ENDIF.
ENDLOOP.
ENDLOOP.
Regards,
Karuna. -
Need information on Dynamic internal table
Hi All,
I need some information on dynamic internal table.
I want what are the field names and the values in dynamic internal table.
Is there any function module, which tells us the field names and values of corresponding fields from a dynamic internal table ?
Thank you very much in advance.Hi,
Program to display/edit database tables dynamically.
REPORT zdyn_table_display.
PARAMETERS: p_table TYPE tabname OBLIGATORY,
p_rows TYPE I.
* Creation of dynamic internal table
DATA: lv_dref TYPE REF TO data.
FIELD-SYMBOLS: <fs_table> TYPE STANDARD TABLE.
DATA: lv_table TYPE string.
START-OF-SELECTION.
* Dynamic internal table.
CREATE DATA lv_dref TYPE TABLE OF (p_table).
ASSIGN lv_dref->* TO <fs_table>.
IF sy-subrc EQ 0.
* EXIT.
ENDIF.
data i type i.
* Get the data
SELECT *
FROM (p_table)
UP TO p_rows ROWS
INTO TABLE <fs_table>.
CONCATENATE 'Table contents : ' p_table INTO lv_table.
* display the table control.
CALL FUNCTION 'STC1_FULLSCREEN_TABLE_CONTROL'
EXPORTING
header = lv_table
tabname = p_table
no_button = space
TABLES
table = <fs_table>
EXCEPTIONS
no_more_tables = 1
too_many_fields = 2
nametab_not_valid = 3
handle_not_valid = 4
OTHERS = 5.
IF sy-subrc EQ 0.
EXIT.
ENDIF.
Getting internal table definition
Try this...
DATA : l_descr_ref TYPE REF TO cl_abap_structdescr.
l_descr_ref ?= cl_abap_typedescr=>describe_by_data( itab ).
Now l_descr_ref->components holds the entire list of fields in itab.
Thanks & Regards,
ShreeMohan -
How 2 create dynamic internal table and can we pass it to gui_download FM
HI all,
How can we create a dynamic internal table?
I have a requirement where i have to create an internal table with the no. of fields depending on the selection screen values, i think tat can be possible though dynamic creation only.
How to solve this issue..?Pointers will be very much useful..
Thanks
Sunny.hi
Follow the code it will help you out....
REPORT YUSMM_TEXT2 .
*TABLES
TABLES: MARA, " General Material Data
MAKT, " Material Descriptions
T002. " Language Keys
* GLOBAL TYPE-POOL
TYPE-POOLS : SLIS.
* GLOBAL TYPES
TYPES: BEGIN OF TP_LANG ,
SPRAS LIKE T002-SPRAS,
LAISO LIKE T002-LAISO,
SRNO(3) TYPE N,
END OF TP_LANG.
TYPES: BEGIN OF TP_MATNR,
MATNR LIKE MARA-MATNR,
BEGRU LIKE MARA-BEGRU,
END OF TP_MATNR.
* DECLARATION FOR GLOBAL INTERNAL TABLES (WITH INCLUDE STRUCTURE)
DATA:GT_MAKT TYPE STANDARD TABLE OF MAKT, "Materialkurztexte,
GT_THEAD TYPE STANDARD TABLE OF THEAD, "SAPscript: Text-Header,
GT_LINETAB TYPE STANDARD TABLE OF TLINE, "SAPscript: Text-Zeilen,
GT_T002 TYPE STANDARD TABLE OF T002. "Language key
DATA: BEGIN OF GV_TEXT_OUTPUT_LINE,
MATNR LIKE MARA-MATNR,
BEGRU LIKE MARA-BEGRU,
MAKTX LIKE MAKT-MAKTX,
LTXT40(1250) TYPE C,
SRNO(3) TYPE N,
SPRAS LIKE T002-SPRAS,
END OF GV_TEXT_OUTPUT_LINE.
DATA: GT_MATNR TYPE STANDARD TABLE OF TP_MATNR,
WA_GT_MATNR TYPE TP_MATNR.
DATA: GT_LANG TYPE STANDARD TABLE OF TP_LANG,
WA_GT_LANG TYPE TP_LANG.
DATA: GT_TEXT_OUTPUT_LINE LIKE STANDARD TABLE OF GV_TEXT_OUTPUT_LINE,
GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
GV_FIELDCAT LIKE LINE OF GT_FIELDCAT,
CT_GT_FIELDCAT_IN LIKE GV_FIELDCAT,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
GV_REPID TYPE SY-REPID.
DATA: BEGIN OF GV,
FORMER_ERROR LIKE SY-MARKY, " Fehlermeldung bereits
FILE_OPEN(1), " Flag open file
REC_LENGTH TYPE I, " record length
MATNR TYPE MARA-MATNR, " material
REPID TYPE SYST-REPID,
RETCO TYPE SY-SUBRC,
END OF GV.
DATA: GV_MAKT TYPE MAKT,
GV_T002 TYPE T002,
GV_LANGU TYPE THEAD-TDSPRAS.
* DECLARATION FOR FIELD-SYMBOLS
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>.
DATA: IT_FLDCAT TYPE LVC_T_FCAT.
DATA: T_FLDCAT1 TYPE SLIS_T_FIELDCAT_ALV.
DATA: L_LT TYPE SLIS_LAYOUT_ALV.
DATA: WA_IT_FLDCAT TYPE LVC_S_FCAT.
DATA: WA_IT_FLDCAT1 TYPE SLIS_FIELDCAT_ALV.
DATA: GP_TABLE TYPE REF TO DATA.
DATA: WA_NEWLINE TYPE REF TO DATA.
*DECLARATION FOR CONSTANTS
CONSTANTS:
BEGIN OF GC,
TDID_GRUN TYPE THEAD-TDID VALUE 'GRUN',
TDOBJECT_MAT TYPE THEAD-TDOBJECT VALUE 'MATERIAL',
ON(01) TYPE C VALUE 'X',
YES(01) TYPE C VALUE 'X',
TXT(25) TYPE C VALUE 'MATERIAL DETAILS',
MAT(25) TYPE C VALUE 'MATERIAL NUMBER',
AUT(25) TYPE C VALUE 'AUTHORIZATION GROUP',
FOUND TYPE SY-SUBRC VALUE '00', " Return-Code
RC_OK TYPE SY-SUBRC VALUE '00', " Return-Code
OFF TYPE SY-SUBRC VALUE '00', " return code
FALSE TYPE SY-SUBRC VALUE '00', " boolean
TRUE TYPE SY-SUBRC VALUE '01', " boolean
END OF GC.
* DECLARATION FOR VARIABLES
DATA: V(3) TYPE N,
STR TYPE STRING,
STR1 TYPE STRING,
V_VAR(3) TYPE N,
V_VAR1(3) TYPE N,
V_FIELDNAME(15) TYPE C,
V_CHAR(15) TYPE C,
V_LINES(3) TYPE N,
MAKTEXT LIKE MAKT-MAKTX,
LT_DATA TYPE REF TO DATA,
LT_DATA1 TYPE REF TO DATA,
LWA_LINE TYPE REF TO DATA,
LWA_LINE1 TYPE REF TO DATA.
*SELECTION-SCREEN AND PARAMETERS
SELECTION-SCREEN: BEGIN OF BLOCK A1 WITH FRAME TITLE TEXT-002.
SELECT-OPTIONS:
S_MATNR FOR MARA-MATNR, "MATERIAL NUMBER
S_MTART FOR MARA-MTART, "MATERIAL TEXT
S_LANG FOR MAKT-SPRAS. "LANGUAGE
PARAMETER: GP_SIZE TYPE I DEFAULT 200. "DATA LENGTH
SELECTION-SCREEN: END OF BLOCK A1.
* 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.
* INITIALIZATION
INITIALIZATION.
GV-REPID = SY-REPID.
*START-OF-SELECTION
START-OF-SELECTION.
PERFORM GET_MARA_DATA
TABLES
GT_TEXT_OUTPUT_LINE
USING
S_MATNR[]
S_MTART[]
GP_SIZE
CHANGING
GV-RETCO
PERFORM GET_MAT_TEXT
TABLES
GT_MAKT
GT_TEXT_OUTPUT_LINE
GT_THEAD
GT_LINETAB
USING
GC
GV-RETCO
CHANGING
GV_TEXT_OUTPUT_LINE
GV_MAKT
PERFORM GET_LANG.
PERFORM DYNAMIC_TABLES.
PERFORM POPULATE_FINAL_TABLE.
PERFORM POPULATE_DYNAMIC_TABLE.
* END-OF-SELECTION
END-OF-SELECTION.
PERFORM DATA_OUTPUT.
*& Form get_mara_data
* Materialdaten lesen
* <->ct_gt_text_output_line Ausgabetabelle
* -->it_s_matnr Parameter Materialnummer
* -->it_s_mtart Parameter Materialart
* -->if_gp_size Parameter Anzahl Materialnummern
FORM GET_MARA_DATA TABLES CT_GT_TEXT_OUTPUT_LINE STRUCTURE
GV_TEXT_OUTPUT_LINE
USING IT_S_MATNR LIKE S_MATNR[]
IT_S_MTART LIKE S_MTART[]
IF_GP_SIZE
CHANGING IF_GV-RETCO. "#EC *
* MARA in die Übergabestruktur einlesen
SELECT MATNR BEGRU
FROM MARA UP TO IF_GP_SIZE ROWS
APPENDING CORRESPONDING FIELDS OF TABLE GT_MATNR
WHERE MATNR IN IT_S_MATNR
AND MTART IN IT_S_MTART.
IF_GV-RETCO = SY-SUBRC.
ENDFORM. " get_mara_data
*& Form get_mat_text
* Kurz- und Langtexte zum Material lesen
* <->ct_gt_makt Materialkurztexte
* <->ct_gt_text_output_line Ausgabetabelle
* <->ct_gt_thead Kopftabelle für ALV
* <->ct_gt_linetab Zeilentabelle für ALV
* -->if_gc Globale Konstanten
* <--cf_gv_text_output_line Struktur Ausgabetabelle
* <--cf_gv_makt Struktru Materialkurztexte
FORM GET_MAT_TEXT TABLES CT_GT_MAKT STRUCTURE MAKT
CT_GT_TEXT_OUTPUT_LINE STRUCTURE
GV_TEXT_OUTPUT_LINE
CT_GT_THEAD STRUCTURE THEAD
CT_GT_LINETAB STRUCTURE TLINE
USING
IF_GC LIKE GC
IF_GV-RETCO
CHANGING CF_GV_TEXT_OUTPUT_LINE LIKE
GV_TEXT_OUTPUT_LINE
CF_GV_MAKT LIKE GV_MAKT
DATA: STRG TYPE STRING,
STRG1(1255) TYPE C.
IF IF_GV-RETCO = IF_GC-FOUND.
* Materialkurztexte in alles Sprachen einlesen
SELECT * FROM MAKT APPENDING TABLE CT_GT_MAKT
FOR ALL ENTRIES IN GT_MATNR "ct_gt_text_output_line
WHERE MATNR = GT_MATNR-MATNR " ct_gt_text_output_line-matnr
* Kurztexte in die sprachabhängigen Felder bringen
LOOP AT GT_MATNR INTO WA_GT_MATNR.
LOOP AT CT_GT_MAKT INTO CF_GV_MAKT
WHERE MATNR = WA_GT_MATNR-MATNR.
CF_GV_TEXT_OUTPUT_LINE-MATNR = WA_GT_MATNR-MATNR.
CF_GV_TEXT_OUTPUT_LINE-BEGRU = WA_GT_MATNR-BEGRU.
CF_GV_TEXT_OUTPUT_LINE-MAKTX = CF_GV_MAKT-MAKTX.
CF_GV_TEXT_OUTPUT_LINE-SPRAS = CF_GV_MAKT-SPRAS.
* LANGTEXT
CLEAR CT_GT_THEAD[].
CT_GT_THEAD-TDOBJECT = IF_GC-TDOBJECT_MAT.
CT_GT_THEAD-TDNAME = WA_GT_MATNR-MATNR.
CT_GT_THEAD-TDID = IF_GC-TDID_GRUN.
CT_GT_THEAD-TDSPRAS = CF_GV_MAKT-SPRAS.
CALL FUNCTION 'TEXT_READ'
EXPORTING
I_HEADER = CT_GT_THEAD
I_READONLY = IF_GC-ON
IMPORTING
E_HEADER = CT_GT_THEAD
TABLES
T_LINES = CT_GT_LINETAB[]
EXCEPTIONS
NOTFOUND = 1.
IF SY-SUBRC = IF_GC-FOUND.
LOOP AT CT_GT_LINETAB.
STRG = CT_GT_LINETAB-TDLINE.
IF STRG1 <> ' '.
CONCATENATE STRG1 ';' STRG INTO STRG1.
ELSE.
STRG1 = STRG.
ENDIF.
ENDLOOP.
CF_GV_TEXT_OUTPUT_LINE-LTXT40 = STRG1.
APPEND CF_GV_TEXT_OUTPUT_LINE TO CT_GT_TEXT_OUTPUT_LINE.
CLEAR CF_GV_TEXT_OUTPUT_LINE.
STRG1 = ' '.
ELSE.
APPEND CF_GV_TEXT_OUTPUT_LINE TO CT_GT_TEXT_OUTPUT_LINE.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDIF.
ENDFORM. " get_mat_text
*& Form data_output
* Daten mit ALV ausgeben
* <->ct_GT_FIELDCAT Feldkatalog für ALV
* <->ct_gt_text_output_line Ausgabetabelle
* -->P_GS_LAYOUT Layout für ALV
* -->if_gc Globale Konstanten
* <--cf_GV_REPID Zur Zeit aufgerufener Reportname
* <--cf_gv_fieldcat Struktur Feldkatalog
* <--cf_gv Globale Variablen
FORM DATA_OUTPUT.
PERFORM FIELDCATBUILD.
PERFORM LAYOUT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = GV-REPID
I_CALLBACK_PF_STATUS_SET = 'EVENT_SET_STATUS_01'
I_CALLBACK_USER_COMMAND = 'EVENT_USER_COMMAND'
IS_LAYOUT = L_LT
IT_FIELDCAT = T_FLDCAT1[]
TABLES
T_OUTTAB = <FS_2>
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> GC-FOUND.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " data_output
*& Form fieldcatbuild
* text
* --> p1 text
* <-- p2 text
FORM FIELDCATBUILD. " TABLES ct_gt_fieldcat_in STRUCTURE gv_fieldcat.
LOOP AT IT_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-FIELDNAME.
APPEND WA_IT_FLDCAT1 TO T_FLDCAT1.
CLEAR : WA_IT_FLDCAT,WA_IT_FLDCAT1.
ENDLOOP.
ENDFORM. " fieldcatbuild
* Form event_set_status_01*
FORM EVENT_SET_STATUS_01 USING LT_EXCL TYPE SLIS_T_EXTAB.
SET PF-STATUS 'ABCD' .
ENDFORM. "EVENT_SET_STATUS_01
*& Form Name: event_user_command *
*& Form Desc: For Handling USER_COMMAND *
FORM EVENT_USER_COMMAND USING
IF_UCOMM TYPE SY-UCOMM
IS_SELFIELD TYPE SLIS_SELFIELD.
CASE IF_UCOMM.
WHEN 'DOWNLOAD'.
PERFORM POPULATE_DOWNLOAD_TABLE.
DATA: L_LENGHT TYPE I.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:data.xls'
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = 'X'
TRUNC_TRAILING_BLANKS = 'X'
DAT_MODE = 'X'
IMPORTING
FILELENGTH = L_LENGHT
TABLES
DATA_TAB = <FS_22>.
IF SY-SUBRC <> GC-FOUND.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF L_LENGHT NE GC-FOUND.
MESSAGE S398(00) WITH 'DATA downloaded to c:data.xls'.
ENDIF.
ENDCASE.
ENDFORM. "event_user_command
*& Form get_lang
* text
* --> p1 text
* <-- p2 text
FORM GET_LANG.
SELECT SPRAS
LAISO FROM T002 INTO CORRESPONDING FIELDS OF TABLE GT_LANG
WHERE SPRAS IN S_LANG.
DESCRIBE TABLE GT_LANG LINES V_LINES.
LOOP AT GT_LANG INTO WA_GT_LANG.
V = V + 1.
WA_GT_LANG-SRNO = V.
MODIFY GT_LANG FROM WA_GT_LANG TRANSPORTING SRNO.
ENDLOOP.
LOOP AT GT_LANG INTO WA_GT_LANG.
CONCATENATE 'MATEDESC-' WA_GT_LANG-LAISO INTO V_FIELDNAME.
CLEAR WA_IT_FLDCAT.
WA_IT_FLDCAT-FIELDNAME = V_FIELDNAME.
WA_IT_FLDCAT-SELTEXT = V_FIELDNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-INTLEN = 40.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
APPEND WA_IT_FLDCAT TO IT_FLDCAT .
CLEAR WA_GT_LANG.
ENDLOOP.
LOOP AT GT_LANG INTO WA_GT_LANG.
CONCATENATE 'BASDAT-' WA_GT_LANG-LAISO INTO V_FIELDNAME.
CLEAR WA_IT_FLDCAT.
WA_IT_FLDCAT-FIELDNAME = V_FIELDNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-INTLEN = 255.
WA_IT_FLDCAT-SELTEXT = V_FIELDNAME.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
APPEND WA_IT_FLDCAT TO IT_FLDCAT .
CLEAR WA_GT_LANG.
ENDLOOP.
V_FIELDNAME = 'MATNR'.
CLEAR WA_IT_FLDCAT.
WA_IT_FLDCAT-FIELDNAME = V_FIELDNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-SELTEXT = 'Matnr'.
WA_IT_FLDCAT-INTLEN = 18.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
INSERT WA_IT_FLDCAT INTO IT_FLDCAT INDEX 1.
V_FIELDNAME = 'BEGRU'.
CLEAR WA_IT_FLDCAT.
WA_IT_FLDCAT-FIELDNAME = V_FIELDNAME.
WA_IT_FLDCAT-DATATYPE = 'CHAR'.
WA_IT_FLDCAT-SELTEXT = 'BEGRU'.
WA_IT_FLDCAT-INTLEN = 4.
WA_IT_FLDCAT-TABNAME = '<FS_2>'.
INSERT WA_IT_FLDCAT INTO IT_FLDCAT INDEX 2.
ENDFORM. " get_lang
*& Form dynamic_tables
* text
* --> p1 text
* <-- p2 text
FORM DYNAMIC_TABLES.
ASSIGN LT_DATA TO <FS_DATA>.
* Creating the Dynamic Internal Table
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = IT_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>.
ENDFORM. " dynamic_tables
*& Form populate_final_table
* text
* --> p1 text
* <-- p2 text
FORM POPULATE_FINAL_TABLE.
LOOP AT GT_TEXT_OUTPUT_LINE INTO GV_TEXT_OUTPUT_LINE.
READ TABLE GT_LANG INTO WA_GT_LANG
WITH KEY SPRAS = GV_TEXT_OUTPUT_LINE-SPRAS.
IF SY-SUBRC EQ GC-FOUND.
GV_TEXT_OUTPUT_LINE-SRNO = WA_GT_LANG-SRNO.
ENDIF.
MODIFY GT_TEXT_OUTPUT_LINE FROM GV_TEXT_OUTPUT_LINE.
ENDLOOP.
ENDFORM. " populate_final_table
*& Form populate_dynamic_table
* text
* --> p1 text
* <-- p2 text
FORM POPULATE_DYNAMIC_TABLE.
DATA: INDX TYPE SY-TABIX.
LOOP AT GT_TEXT_OUTPUT_LINE INTO GV_TEXT_OUTPUT_LINE.
AT NEW MATNR.
INDX = SY-TABIX.
ASSIGN COMPONENT 1 OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = GV_TEXT_OUTPUT_LINE-MATNR.
ASSIGN COMPONENT 2 OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = GV_TEXT_OUTPUT_LINE-BEGRU.
ENDAT.
LOOP AT GT_LANG INTO WA_GT_LANG.
IF GV_TEXT_OUTPUT_LINE-SRNO = WA_GT_LANG-SRNO.
V_VAR = GV_TEXT_OUTPUT_LINE-SRNO + 2.
ASSIGN COMPONENT V_VAR OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = GV_TEXT_OUTPUT_LINE-MAKTX.
V_VAR = GV_TEXT_OUTPUT_LINE-SRNO + V_LINES + 2.
ASSIGN COMPONENT V_VAR OF STRUCTURE <LWA_LINE_WA> TO <F>.
<F> = GV_TEXT_OUTPUT_LINE-LTXT40.
ENDIF.
ENDLOOP.
AT END OF MATNR.
APPEND <LWA_LINE_WA> TO <FS_2>.
CLEAR <LWA_LINE_WA>.
ENDAT.
ENDLOOP.
ENDFORM. " populate_dynamic_table
*& Form LAYOUT
* text
* --> p1 text
* <-- p2 text
FORM LAYOUT.
CLEAR L_LT.
L_LT-ZEBRA = GC-YES.
L_LT-COLWIDTH_OPTIMIZE = 'X'.
L_LT-WINDOW_TITLEBAR = GC-TXT.
ENDFORM. " LAYOUT
*& Form populate_download_table
* text
* --> p1 text
* <-- p2 text
FORM POPULATE_DOWNLOAD_TABLE.
ASSIGN LT_DATA1 TO <FS_DATA1>.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = IT_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>.
DATA: STRN1 TYPE STRING,
STRN2 TYPE STRING,
INDX TYPE SY-TABIX.
ASSIGN COMPONENT 1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = GC-MAT.
ASSIGN COMPONENT 2 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = GC-AUT.
LOOP AT GT_LANG INTO WA_GT_LANG.
V_VAR1 = WA_GT_LANG-SRNO + 2.
CONCATENATE 'MATERIALDESCRIPTION-' WA_GT_LANG-LAISO INTO STRN1.
ASSIGN COMPONENT V_VAR1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = STRN1.
V_VAR1 = WA_GT_LANG-SRNO + V_LINES + 2.
CONCATENATE 'BASICDATA-' WA_GT_LANG-LAISO INTO STRN2.
ASSIGN COMPONENT V_VAR1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = STRN2.
ENDLOOP.
APPEND <LWA_LINE_WA1> TO <FS_22>.
CLEAR <LWA_LINE_WA1>.
APPEND <LWA_LINE_WA1> TO <FS_22>.
V_VAR1 = 0.
LOOP AT GT_TEXT_OUTPUT_LINE INTO GV_TEXT_OUTPUT_LINE.
AT NEW MATNR.
INDX = SY-TABIX.
ASSIGN COMPONENT 1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = GV_TEXT_OUTPUT_LINE-MATNR.
ASSIGN COMPONENT 2 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = GV_TEXT_OUTPUT_LINE-BEGRU.
ENDAT.
LOOP AT GT_LANG INTO WA_GT_LANG.
IF GV_TEXT_OUTPUT_LINE-SRNO EQ WA_GT_LANG-SRNO.
V_VAR1 = GV_TEXT_OUTPUT_LINE-SRNO + 2.
ASSIGN COMPONENT V_VAR1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
<FA> = GV_TEXT_OUTPUT_LINE-MAKTX.
V_VAR1 = GV_TEXT_OUTPUT_LINE-SRNO + V_LINES + 2.
ASSIGN COMPONENT V_VAR1 OF STRUCTURE <LWA_LINE_WA1> TO <FA>.
* STR = GV_TEXT_OUTPUT_LINE-LTXT40.
* SEARCH STR FOR ';'.
* DO.
* IF SY-SUBRC = 0.
* SPLIT STR AT ';' INTO STR1 STR.
* <FA> = STR1.
* APPEND <LWA_LINE_WA1> TO <FS_22>.
* SEARCH STR FOR ';'.
* CLEAR <LWA_LINE_WA1>.
* ELSE.
* EXIT.
* ENDIF.
* ENDDO.
* <FA> = STR.
* APPEND <LWA_LINE_WA1> TO <FS_22>.
<FA> = GV_TEXT_OUTPUT_LINE-LTXT40.
ENDIF.
ENDLOOP.
AT END OF MATNR.
APPEND <LWA_LINE_WA1> TO <FS_22>.
CLEAR <LWA_LINE_WA1>.
ENDAT.
ENDLOOP.
ENDFORM. " populate_download_table
thanks
Nitya -
Dynamic internal table in SAP 3.1I version
hi All,
i am new to this form and have the following question.
Currently i am working in SAP 3.1I version and i am required to create a dynamic internal table.
Basically the table name will be entered by the user on the selection screen and the dynamic internal table has to be of this type (entered by user on the selection screen).
Please let me know whether this is possible in 3.1I version and if its possible then how to achieve this.
Note: this requirement has to be done in 3.1I version hence OO concept (ie)
cl_alv_table_create=>create_dynamic_table doesn't work here.refer this demo code -
parameter p_table type tabname.
field-symbols <tab> type table.
field-symbols <tab1> type any.
types: begin of itab,
t_name type tabname,
t_ref type ref to data,
end of itab.
data itab1 type table of itab with non-unique key t_name.
perform fetch_data using p_table.
perform print_table using p_table.
*& Form fetch_data
text
-->P_P_TABLE text
FORM fetch_data USING P_TABLE1 type tabname.
data itab2 type itab.
itab2-t_name = p_table1.
create data itab2-t_ref type table of (itab2-t_name) .
assign itab2-t_ref->* to <tab>.
append itab2 to itab1.
select * from (p_table1) up to 25 rows into corresponding fields of table <tab>.
ENDFORM. " fetch_data
*& Form print_table
text
-->P_P_TABLE text
FORM print_table USING P_TABLE1 type tabname.
DATA t_ref1 TYPE REF TO data.
DATA itab2 TYPE itab.
FIELD-SYMBOLS <field> TYPE ANY.
READ TABLE itab1 INTO itab2 WITH KEY t_name = p_table1.
ASSIGN itab2-t_ref->* TO <tab>.
CREATE DATA t_ref1 LIKE LINE OF <tab>.
ASSIGN t_ref1->* TO <tab1>.
DO.
*READ TABLE <tab> ASSIGNING <tab1> INDEX 1.
READ TABLE <tab> ASSIGNING <tab1> INDEX SY-INDEX.
*WRITE:/ p_table1.
NEW-LINE.
IF sy-subrc <> 0.
EXIT.
ENDIF.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE <tab1> TO <field>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
WRITE: <field>,' '.
ENDDO.
ENDDO.
ENDFORM. " print_table
Maybe you are looking for
-
Itunes wont work after downloading mac os x lion
After I downloaded Mac OS X lion/10.7 and iTunes 10.4 iTunes wont open it pops up a window saying check with developer to make sure this version of Mac OS X supports iTunes. please help
-
Best Practice With Work Efficient in Report server
In SSAS cube I have two different roles: - Manager (about 10 people) - Salesman (about 43 people) Manager has full access to 4 report and salesman has access to 1 report. Totally, it is five report. I have the roles and its users in SSAS cube a
-
Change view order of characteristics in list and details view
Hello everybody I made some changes in the view order of most standard and own characteristics. Unfortunately the characteristic position changes I made are only partly applied! Example: Position Characteristic real pos. in list view 1
-
For some reason, all of a sudden, whenever I plug in my iPod to my computer, the computer crashes and quickly shows a blue screen of death before restarting. It has not done this before today. I haven't done anything out of the ordinary with the iPod
-
in sd module in t-code VA31 upoladoing the data in delivery data,order date ,rounded by and confirmed qty fill the data in all fields many times when come new data sheet so automatically fill the new data in these fields that s why which method