Itab creation on runtime

Hi friends,
Have run into to trouble trying to create a dynamic structure as follows
"Material Land Nov.09 Dez.09 Jan.10 Feb.10 Mar.10 TotalCount"
The dates are created dynamically with regard to the time period entered in the select options.
The first 2 fields("Material","Land" and the last field "TotalCount") will always be there.The date fields have to change according to the dates entered.
Runtime error - "Load_PROGRAM_NOT_FOUND"
Exception - CX_SY_PROGRAM_NOT_FOUND
on calling
CALL METHOD cl_alv_table_create=>create_dynamic_table
  EXPORTING
    it_fieldcatalog = ifc
  IMPORTING
    ep_table        = dy_table.
Have filled by field catalog as follows:
xfc-fieldname = 'Material'.
xfc-datatype = 'CHAR'.
xfc-intlen = '15'.
APPEND xfc TO ifc.
CLEAR xfc.
xfc-fieldname = 'Opco'.
xfc-datatype = 'CHAR'.
xfc-intlen = '15'.
APPEND xfc TO ifc.
CLEAR xfc.
LOOP AT gt_monthcalc INTO gs_monthcalc.
  xfc-fieldname = gs_monthcalc-month.
  xfc-datatype = 'CHAR'.
  xfc-intlen = '10'.
  APPEND xfc TO ifc.
  CLEAR xfc.
ENDLOOP.
xfc-fieldname = 'Totalcount'.
xfc-datatype = 'CHAR'.
xfc-intlen = '15'.
APPEND xfc TO ifc.
CLEAR xfc.
Please advice what iam doing wrong.
->If the dynamic itab is created ,how to fill it with values.
For example.- I want to access specifically the field names like itab-dez.09 or itab-Feb.10 to put values in it.Is it possible?
->If I write this itab using "Write" statement - Will the field names be written
For example - the following field names.
"Material Land Nov.09 Dez.09 Jan.10 Feb.10 Mar.10 TotalCount"
Thanks
P

Hi
I thought my sample was clear:
The "GT_MONTHCALC" itab we dont need anymore,as It was used only to fill in the fieldcatalog with months.
If I rember a your requisition is to create the name of the month concatening the short name and the year, something like this:
NOV09 DEC09 GEN10 FEB10 MAR10 APR10 ..........
In this case the fieldname of month of your dynamic table doesn't corrispond to value in  gs_tab-month as here you have stored the short name of the month only.
I suppose if gs_tab-month is nov, the quantity has to move in the field called NOV09, if it's so it needs to get a link in order to know the real name of the moth field of dynamic table.
This link can be in GT_MONTHCALC only, because you've used it to create dynamic table.
Now I've create a routine to transfer the value from GS_TAN to <FS_WA>:
FORM MOVE_VALUE  USING    P_FIELD
                          P_VALUE.
  ASSIGN COMPONENT P_FIELD OF STRUCTURE <FS_WA> TO <FS_VAL>.
  MOVE P_VALUE TO <FS_VAL>.
ENDFORM.
P_FIELD is the name of dynamic table field
P_VALUE is the value to be transfered
Now I want to
copy the contents of the field "matnummer" to "mat" in fS_itab
copy the contents of the field "soldto" to "OPCO" in fS_itab
This requirement is easy because the name of the dynamic table are constant:
loop gt_tab into gs_tab.
    CLEAR <FS_WA>.
* Move material code
    PERFORM MOVE_VALUE USING 'MAT' GS_TAB-MATNUMMER.
*  Move soldto
   PERFORM MOVE_VALUE USING 'OPCO' GS_TAB-SOLDTO.
copy the contents of the field "dqty" to "NOV" in fS_itab
In this case you need to move the value to FS_ITAB-NOV09, so:
Found the name of dynamic table:
TRANSLATE FS_ITAB-MONTH TO UPPER CASE.
LOOP AT GT_MONTHCALC INTO GS_MONTHCALC.
   IF GS_MONTHCALC-MONTH(3) = FS_ITAB-MONTH.
* I found the right name
     EXIT.
  ENDIF.
ENDLOOP.
* Move qty
PERFORM MOVE_VALUE USING GS_MONTHCALC-MONTH GS_TAB-DQTY.
I hope it's clear now
Max

Similar Messages

  • Dynamic Tray creation at runtime

    hi experts,
    we have a requirement where we are showing employee details in the tray UI element.
    we have 1 tray at design time showing employee details obtained from a Bapi.
    Now we need to display spouse details(if available) and children details(their number can be any~known at runtime) in seperate trays. eg each tray for 1 person..so if there are 6 children, there are 8 trays including one for employee and spouse...
    Now what I need is the source code  or method to dynamically generate tray at runtime along with the labels and textviews they contain..
    thanks in advance

    HI,
    solved the problem....
    i was doing some search here and there and finally got the code to do it. when i came back to the thread i found Ramesh suggested the same stuff which i had used.
    thanks gurus.
    I am writing my code here for other people looking for the same thing:
    IWDTransparentContainer container =(IWDTransparentContainer)view.getElement("RootUIElementContainer");
         wdContext.currentContextElement().setIpvalue("Demo Name");   //this is my context attribute.
    for(int i=1;i<3;i++)
         IWDTray tray=(IWDTray)view.createElement(IWDTray.class,null);
                   tray.setExpanded(false);
                   tray.setWidth("700px");
                   IWDLabel label=(IWDLabel)view.createElement(IWDLabel.class,null);
                   label.setText("your name is");
              IWDTextView textview1=(IWDTextView)view.createElement(IWDTextView.class,null);
              textview1.setText(wdContext.currentContextElement().getIpvalue());
              IWDLabel label1=(IWDLabel)view.createElement(IWDLabel.class,null);
              label1.setText("Employee age");
         IWDCaption caption =(IWDCaption)view.createElement(IWDCaption.class,null);
         caption.setText("WElcome to employee information");
                   tray.setHeader(caption);
         IWDLayout layout=(IWDLayout)tray.createLayout(IWDMatrixLayout.class); //setting tray layout to matrix
         IWDLayoutData layout1=(IWDLayoutData)label1.createLayoutData(IWDMatrixHeadData.class);
         tray.addChild(label);
         tray.addChild(textview1);
         tray.addChild(label1);
                   container.addChild(tray);
    P.S. Awarding points to Ramesh.

  • Dynamic Report Creation At Runtime

    I am trying to create a dynamic crystal report at run time from Visual Studio 2013 using C#.  My back end database is SQL Server 2005.  The source for my crystal report is a SQL Server stored procedure which takes two parameters, a year (smallint) and a quarter (tinyint).  The stored procedure uses dynamic SQL and creates a dynamic temp table.  It returns the result set from a select on the temp table.  The number of columns in the result set will be determined at run time.  Right now it returns 40 columns.  It can return additional columns in multiples of 6.  All of these columns will need to be displayed on the crystal report at run time.  The C# application will run on 64 bit Windows 7 machines and the SQL Server database is on a 32 bit server.
    I have been successful in designing a crystal report within the Visual Studio IDE using this stored procedure and running it and displaying it in the crystal reports viewer from within the C# application.  So when the appropriate application's menu item is clicked, the form with the crystal viewer on it opens and displays the report.  So I know that I can connect to the database and display the report.  However as stated in the preceding paragraph, I need to create the crystal report at run time as the number of columns on the report will be variable.
    I have looked at the CrystalDecisions SDK and API and tried without success to do this.  I am getting errors when trying to connect to the DB through the API and am not able to retrieve the data.  I have played with the code for about a week with no success.  I have tried the code in the discussion forums without success.  The documentation for the SDK API's does not provide the level of detail that I need.  The CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo class has an attributes property that needs to be set.  I don't know what the proper settings should be.
    I prefer to use the OLE DB native client for SQL Server.
    Any help would be greatly appreciated.
    Martin

    Hi Ludek,
    I have made some small progress.  I can now login from work as well as get to links.  But it seems I am still blocked for zip files.
    I also have the utility working.  But whenever I try to add my dummy crystal report (dummyreport.rpt) to the project, visual studio 2013 hangs up and I have to kill VS.
    I added the following code to my form and ran it but I get the following error:
    System.Runtime.InteropServices.COMException was unhandled
      HResult=-2147352565
      Message=Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))
      Source=CrystalDecisions.ReportAppServer.DataDefModel
      ErrorCode=-2147352565
      StackTrace:
           at CrystalDecisions.ReportAppServer.DataDefModel.TablesClass.get_Item(Int32 Index)
           at Retail_Incentive_Plan.ReportForm3..ctor() in u:\Incentive\Front_End\Visual_Studio_2013\Projects\Retail_Incentive_Plan - Copy\Retail_Incentive_Plan\ReportForm3.cs:line 123
           at Retail_Incentive_Plan.MDIParent.ShowNewForm(Object sender, EventArgs e) in u:\Incentive\Front_End\Visual_Studio_2013\Projects\Retail_Incentive_Plan - Copy\Retail_Incentive_Plan\MDIParent.cs:line 27
           at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
           at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
           at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
           at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
           at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
           at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
           at System.Windows.Forms.Control.WndProc(Message& m)
           at System.Windows.Forms.ToolStrip.WndProc(Message& m)
           at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
           at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
           at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
           at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
           at Retail_Incentive_Plan.Program.Main() in u:\Incentive\Front_End\Visual_Studio_2013\Projects\Retail_Incentive_Plan - Copy\Retail_Incentive_Plan\Program.cs:line 18
      InnerException:
    The error occurs at this line of code:
    boReportDocument.ReportClientDocument.DatabaseController.SetTableLocation(boTables[0], boTable);
    I'm sure it must be something with the attributes that I am setting.  But I'm not sure of what the correct values for some of these attributes should be.  By the way, I am using the RCAPI approach rather than the formulas approach (for now).
    Here is my code that is in the form:
    public ReportForm3()
    //**************************   ChangeConnectionInfo   ******************************************************************************************************************
    ReportDocument boReportDocument = new ReportDocument();
    //**EDIT** Change the path and report name to the report you want to change.
    boReportDocument.Load(@"c:\Retail_Incentive_Plan\DummyReport.rpt", OpenReportMethod.OpenReportByTempCopy);
    //Create a new Command Table to replace the reports current table.
    CrystalDecisions.ReportAppServer.DataDefModel.CommandTable boTable =
    new CrystalDecisions.ReportAppServer.DataDefModel.CommandTable();
    //boMainPropertyBag: These hold the attributes of the tables ConnectionInfo object
    PropertyBag boMainPropertyBag = new PropertyBag();
    //boInnerPropertyBag: These hold the attributes for the QE_LogonProperties
    //In the main property bag (boMainPropertyBag)
    PropertyBag boInnerPropertyBag = new PropertyBag();
    //Set the attributes for the boInnerPropertyBag
    boInnerPropertyBag.Add("Auto Translate", "-1");
    boInnerPropertyBag.Add("Server", "MyServerName");
    boInnerPropertyBag.Add("Connect Timeout", "15");
    boInnerPropertyBag.Add("Data Source", "vancsdb02");
    boInnerPropertyBag.Add("General Timeout", "0");
    boInnerPropertyBag.Add("Initial Catalog", "Retail_Incentive_Plan");
    boInnerPropertyBag.Add("Integrated Security", "True");
    boInnerPropertyBag.Add("Locale Identifier", "1033");
    boInnerPropertyBag.Add("OLE DB Services", "-5");
    boInnerPropertyBag.Add("Provider", "SQLOLEDB");
    boInnerPropertyBag.Add("Tag with column collation when possible", "0");
    boInnerPropertyBag.Add("Use DSN Default Properties", "False");
    boInnerPropertyBag.Add("Use Encryption for Data", "0");
    //Set the attributes for the boMainPropertyBag
    boMainPropertyBag.Add("Database DLL", "crdb_ado.dll");
    boMainPropertyBag.Add("QE_DatabaseName", "Initial Catalog=Retail_Incentive_Plan");
    boMainPropertyBag.Add("QE_DatabaseType", "OLE DB (ADO)");
    //Add the QE_LogonProperties we set in the boInnerPropertyBag Object
    boMainPropertyBag.Add("QE_LogonProperties", boInnerPropertyBag);
    boMainPropertyBag.Add("QE_ServerDescription", "MyServerName");
    boMainPropertyBag.Add("QE_SQLDB", "True");
    boMainPropertyBag.Add("SSO Enabled", "False");
    //Create a new ConnectionInfo object
    CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo boConnectionInfo =
    new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo();
    //Pass the database properties to a connection info object
    boConnectionInfo.Attributes = boMainPropertyBag;
    //Set the connection kind
    boConnectionInfo.Kind = CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;
    //**EDIT** Set the User Name and Password if required.
    boConnectionInfo.UserName = "myUserName";
    boConnectionInfo.Password = "MyPassword";
    //Pass the connection information to the table
    boTable.ConnectionInfo = boConnectionInfo;
    //Get the Database Tables Collection for your report
    CrystalDecisions.ReportAppServer.DataDefModel.Tables boTables;
    boTables = boReportDocument.ReportClientDocument.DatabaseController.Database.Tables;
    //For each table in the report:
    // - Set the Table Name properties.
    // - Set the Command table's command text.
    // - Set the table location in the report to use the new modified table
    boTable.Name = "Command";
    boTable.QualifiedName = "Command";
    boTable.Alias = "Command";
    //boTable.CommandText = "select country, region, city from customer where country='usa'";
    boTable.CommandText = "exec get_branch_ranking_data, 2015, 1";
    boReportDocument.ReportClientDocument.DatabaseController.SetTableLocation(boTables[0], boTable);
    //Verify the database after adding substituting the new table.
    //To ensure that the table updates properly when adding Command tables or Stored Procedures.
    boReportDocument.VerifyDatabase();
    //return boReportDocument;
    //**************************   End ChangeConnectionInfo   ***************************************************************************************************************
    I'm sure that "vancsdb02" is incorrect in the Data Source in the code above but I'm not sure what goes there.
    All of my assemblies are set in my project as well as in the top of my code.  I just didn't show it here for brevity.
    Will pick up again with this on Monday.
    Martin

  • Class creation at Runtime?

    Hi,
    How can I create a class at Runtime? I want to create multiple classes having structure (say):
    public class MyClass{
       public void myMethod(){
            System.out.println("Some Text")
    }Now I want to create multiple classes at runtime having name "MyClass1.class", "MyClass2.class", ......
    Please Help.
    Thanks,
    Sumit

    Actually, I want those multiple classes
    ("Myclass1.class", "Myclass2.class".....) to be
    present physically on the machine. As some other
    program then going to load those classes later on.
    Any Solution?How about defining a single class, whose instances can be described with a standard set of data. Say, that data could be represented by java.util.Properties object, and this class will have a constructor that takes a Properties as an argument.
    Then this other program will load files in the format used by Properties, then it will use Properties.load() to load the data from these files, and then instantiate the class. Rather than loading lots of different classes.
    Or not. It's up to you.

  • Dynamic itab creation

    Hi friends,
    Have run into to trouble trying to create a dynamic structure as follows
    "Material Land Nov.09 Dez.09 Jan.10 Feb.10 Mar.10 TotalCount"
    The dates are created dynamically with regard to the time period entered in the select options.
    The first 2 fields("Material","Land" and the last field "TotalCount") will always be there.The date fields have to change according to the dates entered.
    The code Iam attaching is a compilable code with which Iam trying for this purpose.
    Would be helpful and I would really appreciate it if someone could change the code I attached and show it how it works....
    Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code, butr search before posting - locked
    The code gives a dump at the call
    "CALL METHOD cl_alv_table_create=>create_dynamic_table"
    Please advice what iam doing wrong.
    ->If the dynamic itab is created ,how to fill it with values.
    For example.- I want to access specifically the field names like itab-dez.09 or itab-Feb.10 to put values in it.Is it possible?
    ->If I write this itab using "Write" statement - Will the field names be written
    For example - the following field names.
    "Material Land Nov.09 Dez.09 Jan.10 Feb.10 Mar.10 TotalCount"
    Thanks
    P
    Edited by: pazzuzu on Mar 16, 2010 1:43 PM
    Edited by: pazzuzu on Mar 16, 2010 1:44 PM
    Edited by: pazzuzu on Mar 16, 2010 1:44 PM
    Edited by: pazzuzu on Mar 16, 2010 1:45 PM
    Edited by: Rob Burbank on Mar 16, 2010 9:14 AM

    Edited by: kk.adhvaryu on Mar 16, 2010 1:54 PM

  • Slow socket creation at runtime

    Im writing a program to send a form via http secure socket to a web sever. My code works, but the problem is, once it executes, it take about 40 seconds for the 1st line of code to complete. Is there anything I can do to speed this up?
    Im running j2sdk1.4.0-beta3 (windows98 on PIII 450, 300megs ram, 56k)
    public static boolean login() {
    try
    SSLSocketFactory sslsocketfactory = (SSLSocketFactory)SSLSocketFactory.getDefault();
    System.out.println("1");
    SSLSocket sslsocket = (SSLSocket)sslsocketfactory.createSocket("blah.blah.com", 443);
    System.out.println("sockets created");

    Problem solved.. if anyone cares, this was my final code
    java.security.SecureRandom x = new java.security.SecureRandom();
    x.setSeed(1);
    SSLContext sc = SSLContext.getInstance("SSL");
    sc.init(null,null, x);
    SSLSocketFactory sf1 = sc.getSocketFactory();
    SSLSocket sslsocket = (SSLSocket)sf1.createSocket("blah.blah.com", 443);
    i had a unique situation, i was forced to connect to a secure socket to exchange non secretive info, so security was the least of my worries and speed was most important. Using this, it creates a socket as fast as regular non SSL socket, but it basically lets u connect to a SSL socket with no/very little security. It cut a good 40 sec off the socket creation time.
    thanks for yalls help

  • Visual attribute creation at runtime.

    hi all,
    can i create a visual attribute attribute and set its properties at run time.
    please help me.
    thanks
    Muhammad Nadeem
    [email protected]

    As per my knowledge we can’t create any object at runtime, but object properties can be changed anytime
    Mr. Francois is right you can create some visual attributes at design time and set its property at runtime using SET_VA_PROPERTY built_in
    Good luck
    Ayaz.

  • Configurable Products : Errors in creation of runtime version of the KBs

    Hi All,
    While creating run-time versions for the knowledge base objects, I'm encountering several warnings/errors. A few of those are:
    1. Config. profile invalid because it is maintained for single-level BOM explosion which is not supported in SCE. Any workaround for this apart from changing the single-level BOM option in config. profile?
    2. Object Characteristic XXX not supported in any IPC scenario.
    3. Object characteristic Z_VBAK_VBELN supported in IPC scenarios 1,5
    4. Characteristic Z_NO_INPUT: SCREEN_DEP-NO_INPUT only supported as of IPC 3.0
    5. Characteristic XXX not assigned to a class.
    6. Procedure XXX to characteristic YYY is not supported.
    7. No Config. Profile exists for material XXX (appl:YYY, class type:ZZZ) - Although the profile has been mainatained.
    8. Action XXX to characteristic YYY - value not supported. Where are the actions assigned to characteristcs or characteristic values?
    Please suggest the resolution for these errors/warnings. If there is any comprehensive guide or help for these issues, do let me know.
    Thanks in advance,
    Vishal

    Hi Saurabh,
    the only resolution is to change the configuration profile to multi-level explosion.
    Michael

  • Creation of Runtime version for Knowledge base

    We are using a Configurable material (CM1) with profile (P1) assigned to it. The profile assigned has the following details (in tx cu42):
       . a. Config parameters – Sales order
       . b. BOM explosion – Single level
    As per SAP “<i><u>The Single-Level BOM Explosion setting is not supported</u></i>” when configuration Engine is used. <i><u>But in our R/3 system, the configuration profile used has a setting for ‘Single level BOM explosion’</u></i> (point b written above).
    So while creating the Run time version for the KB (for material CM1), an error message comes  “Configuration profile P1 for material CM1 is invalid for Cause 1 - The setting is Single level BOM explosion”
    Please help how can the issue be resolved?

    Hi Saurabh,
    the only resolution is to change the configuration profile to multi-level explosion.
    Michael

  • CU34 Creation of runtime version

    Hi,
    I want to know how CU34 transaction works properly?
    I am trying to create a run time version using this transaction using a knowledge base object and a version.
    Material BOM having configurable material and within BOM we have nested BOMs.
    I execute with status = 1(released) and plant along with BOM application PP01.
    Also some of the material having Spceial procurement production key which is actually does work when you see that in run time version log in CU43 tcode.
    Any clue is apprecited,
    Regards,
    Dipak

    Hi Saurabh,
    the only resolution is to change the configuration profile to multi-level explosion.
    Michael

  • How to add a checkbox to dynamic itab  so that i can select some records

    How to add a checkbox to dynamic itab  so that i can select some records in the alv and can display them in another alv using a button
    I have requirement where i have to display the dynamic itab records in an alv ....Some records from this alv output has to be selected through checkbox  provided in the first column .( I will get to know the structure of the itab only at runtime ,so iam using dynamic itab)

    Hi,
       I tried and finally i got it , Just try for it.
    type-pools : slis.
    PARAMETERS : p_tab type dd02l-tabname.
    data : ref_tabletype  type REF TO cl_abap_tabledescr,
           ref_rowtype TYPE REF TO cl_abap_structdescr.
    field-symbols  : <lt_table>  type   standard TABLE ,
           <fwa> type any,
           <field> type abap_compdescr.
    data : lt_fcat type lvc_t_fcat,
           ls_fcat type lvc_s_fcat,
           lt_fldcat type SLIS_T_FIELDCAT_ALV,
           ls_fldcat like line of lt_fldcat.
    data : ref_data type REF TO data,
            ref_wa type ref to  data.
    ref_rowtype ?= cl_abap_typedescr=>DESCRIBE_BY_name( p_name = p_tab ).
    TRY.
    CALL METHOD cl_abap_tabledescr=>create
      EXPORTING
        p_line_type  = ref_rowtype
      receiving
        p_result     = ref_tabletype.
    CATCH cx_sy_table_creation .
    write : / 'Object Not Found'.
    ENDTRY.
    *creating object.
    create data ref_data type handle ref_tabletype.
    create data ref_wa type handle ref_rowtype.
    *value assignment.
    ASSIGN ref_data->* to <lt_table>.
    assign ref_wa->* to <fwa>.
    loop at ref_rowtype->components ASSIGNING <field>.
      ls_fcat-fieldname = <field>-name.
      ls_fcat-ref_table = p_tab.
      append ls_fcat to lt_fcat.
    if lt_fldcat[] is  INITIAL.
        ls_fldcat-fieldname = 'CHECKBOX'.
        ls_fldcat-checkbox = 'X'.
        ls_fldcat-edit = 'X'.
        ls_fldcat-seltext_m = 'Checkbox'.
        append ls_fldcat to lt_fldcat.
      endif.
      clear ls_fldcat.
      ls_fldcat-fieldname = <field>-name.
      ls_fldcat-ref_tabname = p_tab.
      append ls_fldcat to lt_fldcat.
    endloop.
    loop at lt_fldcat into ls_fldcat.
      if sy-tabix = 1.
        ls_fldcat-checkbox = 'X'.
        ls_fldcat-edit = 'X'.
    modify lt_fldcat FROM ls_fldcat
        TRANSPORTING checkbox edit.
    endif.
    endloop.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
      EXPORTING
        it_fieldcatalog           = lt_fcat[]
      IMPORTING
        ep_table                  = ref_data.
    assign ref_data->* to <lt_table>.
    select * FROM (p_tab) into table <lt_table>.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       IT_FIELDCAT                       = lt_fldcat[]
      TABLES
        t_outtab                          = <lt_table>.
    Thanks & Regards,
    Raghunadh .K

  • Dynamic Internal Table creation and population

    Hi gurus !
    my issue refers to the slide 10 provided in this slideshow : https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b332e090-0201-0010-bdbd-b735e96fe0ae
    My example is gonna sound dumb, but anyway: I want to dynamically select from a table into a dynamically created itab.
    Letu2019s use only EKPO, and only field MENGE.
    For this, I use Classes cl_abap_elemdescr, cl_sql_result_set and the Data Ref for table creation. But while fetching the resultset, program dumps when fields like MENGE, WRBTR are accessed. Obviously their type are not correctly taken into account by my program.
    Here it comes:
    DATA: element_ref             TYPE REF TO cl_abap_elemdescr,
          vl_fieldname               TYPE string,
                 tl_components         TYPE abap_component_tab,
                 sl_components         LIKE LINE OF tl_components_alv,
    linetype_lcl               TYPE REF TO cl_abap_structdescr,
    ty_table_type            TYPE REF TO cl_abap_tabledescr,
    g_resultset             TYPE REF TO cl_sql_result_set
    u2026
    CONCATENATE sg_columns-table_name '-' sg_columns-column_name INTO vl_fieldname.
    * sg_columns-table_name contains 'EKPO'
    * sg_columns-column_name contains 'MENGE'
    * getting the element as a component
    element_ref ?= cl_abap_elemdescr=>describe_by_name( vl_fieldname ).
    sl_components-name  = sg_columns-column_name.
    sl_components-type ?= element_ref.
    APPEND sl_components TO tl_components.
    * dynamic creation of internal table
    linetype_lcl = cl_abap_structdescr=>create( tl_components ).
    ty_table_type = cl_abap_tabledescr=>create(
                      p_line_type = linetype_lcl ).
    u2026
    * Then I will create my field symbol table and line. Code has been cut here.
    CREATE DATA dy_line LIKE LINE OF <dyn_table>.
    u2026
    * Then I will execute my query. Here itu2019s: Select MENGE From EKPO Where Rownum = 1.
      g_resultset = g_stmt_ref->execute_query( stmt_str ).
    * Then structure for the Resultset is set
      CALL METHOD g_resultset->set_param_struct
        EXPORTING
          struct_ref = dy_line.
    * Fetching the lines of the resultset  => Dumpu2026
      WHILE g_resultset->next( ) > 0.
        ASSIGN dy_line->* TO <dyn_wa>.
        APPEND <dyn_wa> TO <dyn_table>.
      ENDWHILE.
    Anyone has any clue to how prevent my Dump ??
    The component for MENGE seems to be described as a P7 with 2 decimals. And the resultset wanna use a QUAN type... or something like that !

    Hello
    I have expanded your sample coding for selecting three fields out of EKPO:
    *& Report  ZUS_SDN_SQL_RESULT_SET
    *& Thread: Dynamic Internal Table creation and population
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1375510"></a>
    *& NOTE: Coding for dynamic structure / itab creation taken from:
    *& Creating Flat and Complex Internal Tables Dynamically using RTTI
    *& https://wiki.sdn.sap.com/wiki/display/Snippets/Creating+Flat+and+
    *& Complex+Internal+Tables+Dynamically+using+RTTI
    REPORT  zus_sdn_sql_result_set.
    TYPE-POOLS: abap.
    DATA:
    go_sql_stmt       TYPE REF TO cl_sql_statement,
    go_resultset      TYPE REF TO cl_sql_result_set,
    gd_sql_clause     TYPE string.
    DATA:
      gd_tabfield      TYPE string,
      go_table         TYPE REF TO cl_salv_table,
      go_sdescr_new    TYPE REF TO cl_abap_structdescr,
      go_tdescr        TYPE REF TO cl_abap_tabledescr,
      gdo_handle       TYPE REF TO data,
      gdo_record       TYPE REF TO data,
      gs_comp          TYPE abap_componentdescr,
      gt_components    TYPE abap_component_tab.
    FIELD-SYMBOLS:
      <gs_record>   TYPE ANY,
      <gt_itab>     TYPE STANDARD TABLE.
    START-OF-SELECTION.
    continued.

  • Creation of archiving objects in AFX_WB

    Hi,
    I am trying to create an archiving object in AFX_WB.
    I assigned a custom package which I created to the archiving object.
    The transaction generates the programs for the archiving object by itself with the inputs given.
    In one of the steps, I am getting an error " SAP Object cannot be assigned to the custom package".
    When I tried with a standard package, I got error in another step saying "custom object cannot be assigned to standard package".
    Is there an appropriate package which I can assign the archiving object ( as it has got a combination of custom and SAP standard object) ?
    What is the purpose of including package in package hierarchy and defining user access for them?
    Thanks and regards,
    Lakshmi Reghuvaran

    Hi,
    What is your Apex version?
    Is your Apex instance runtime environment or can you login to INTERNAL workspace?
    See this for Apex 4. Document do not say how disable demonstration app creation on runtime environment.
    http://download.oracle.com/docs/cd/E17556_01/doc/admin.40/e15521/adm_mg_service_set.htm#sthref255
    Regards,
    Jari

  • How to determine runtime of SNP optimizer

    Hi Experts,
    I am new to SNP optimizer, i would like to know the factors that determine the runtime of SNP optimizer,
    for example if i have 100 product-loc combination, what should be my runtime?
    Thanks in Advance
    Raja kiran R

    Hello Raja
    Following details are based on my recent experience/learning's while working Optimizer runtime(it was a nightmare)
    SNP Optimizer varies regardless of number of location products or demands.
    SNP Optimizer runtime is split into following 3 main steps -
    Runtime 1. Reading input data
    Runtime 2. Solution Calculation and
    Runtime 3. Order Creation.
    Runtime 2 is usually varies depends on degree of problem complexity and number of iteration optimizer has to go through before finding cost effective/optimal solution.
    Analyzing the optimizer logs/trace file and collect various statistics/facts for couple of weeks can give you some idea on optimizer runtimes.  Use below Tcodes - /SAPAPO/OPT11 and /SAPAPO/SNPOPLOG for collection such statistics on following criteria's -
    Please keep a watch on inputs like - Number of products, locations, location products, transportation lanes and demands.
    and Output like Total Fulfilled Demands, Total Un-Filled Demands and Total number of stock transfers.
    and Result Indicators like how many ProdDeco iteration,  Solution Quality/ Cost iterations and what is the Service Level achieved.
    Besides, you can control the Optimizer runtime by setting up the Maximum Runtime(in Minutes) in Optimizer profile. Also use Parallel profile process for improving the performance of the optimizer run.
    Also ask you basis team to watch system performance when it is reading data from livecache, solving the problem or creating orders in livecache, if there are any memory issue etc.
    Hope this will help.
    Thank you
    Satish Waghmare

  • Need help to check my code !

    I am not ble to fetch all the data .
    Where is the problem !
    please help me to  modify the select statement
    REPORT YINTERACTIVEPROGRAM01.
    *CREATED BY:JYOTIRMOY DEB                                            *
    *DATE OF CREATION :                                                  *
    *TABLE DECLARATION
    TABLES:VBAK,  "Sales Document: Header Data
           VBKD,  "Sales Document: Business Data
           VBPA,  "Sales Document: Partner
           VBAP,  "Sales Document: Item Data
           ADRC,  "Addresses (central address admin.)
           T178T, "Conditions: Groups for Materials:text
           T188T, "Pricing groups for customers
           TVM1,
           TVM1T,  "Material pricing group 1: Description
           TVM2,
           TVM2T,  "Material Pricing Group 2: Description
           TVM3,
           TVM3T,  "Material Pricing Group 3: Description
           TVM4,
           TVM4T,  "Material Pricing Group 4: Description
           TVM5,
           TVM5T,  "Material Pricing Group 5: Description
           SZA1_D0100,
           TVLV ,   "Check table for release orders: Usage ID
           TVLVT,
           TVKGG,   "Customer Condition Groups (Customer Master)
           TVKGGT,
           TPAR,   "Business Partner: Functions
           TPART,
           TVAUT.  "Sales Documents: Order Reasons: Texts
    *SELECT OPTIONS
    Select-options S_VBELN for vbak-vbeln.
    *CREATING INTERNAL TABLES
    TYPES:BEGIN OF TY_TAB,
             VBELN LIKE VBAK-VBELN,
             VKORG LIKE VBAK-VKORG,
             ERDAT LIKE VBAK-ERDAT,
             AUGRU LIKE VBAK-AUGRU,
             BEZEI LIKE TVAUT-BEZEI,
             BSTDK LIKE VBKD-BSTDK,
             BSTDK_E LIKE VBKD-BSTDK_E,
             BSTKD LIKE VBKD-BSTKD,
             KDKG2 LIKE VBKD-KDKG2,
             KONDA LIKE VBKD-KONDA,
             MATNR LIKE VBAP-MATNR,
             SPART LIKE VBAP-SPART,
             KONDM LIKE VBAP-KONDM,
             WAERK LIKE VBAP-WAERK,
             NETWR LIKE VBAP-NETWR,
             KWMENG LIKE VBAP-KWMENG,
             VKAUS LIKE VBAP-VKAUS,
             MVGR1 LIKE VBAP-MVGR1,
             MVGR2 LIKE VBAP-MVGR2,
             MVGR3 LIKE VBAP-MVGR3,
             MVGR4 LIKE VBAP-MVGR4,
             MVGR5 LIKE VBAP-MVGR5,
             KUNNR LIKE VBPA-KUNNR,
             POSTCODE1 LIKE ADRC-POST_CODE1,
             POBOX LIKE ADRC-PO_BOX,
             NAME1 LIKE ADRC-NAME1,
             NAME2 LIKE ADRC-NAME2,
             CITY1 LIKE ADRC-CITY1,
             CITY2 LIKE ADRC-CITY2,
             COUNTRY LIKE ADRC-COUNTRY,
             STREET LIKE ADRC-STREET,
             STRSUPPL1 LIKE ADRC-STR_SUPPL1,
             STRSUPPL2 LIKE ADRC-STR_SUPPL2,
             STRSUPPL3 LIKE ADRC-STR_SUPPL3,
             NRART LIKE TPAR-NRART,
             VTEXT1 LIKE TPART-VTEXT,
             PARVW LIKE TPART-PARVW,
             BEZE_I LIKE TVLVT-BEZEI,
             VTEXT LIKE V_T178-VTEXT,
             V_TEXT like V_T188-VTEXT,
             BEZEI1 LIKE TVM1T-BEZEI,
             BEZEI2 LIKE TVM2T-BEZEI,
             BEZEI3 LIKE TVM3T-BEZEI,
             BEZEI4 LIKE TVM4T-BEZEI,
             BEZEI5 LIKE TVM5T-BEZEI,
             VTEXT2 LIKE TVKGGT-VTEXT,
             SMTP_ADDR LIKE ADR6-SMTP_ADDR,
         END OF TY_TAB.
    DATA: ITAB TYPE STANDARD TABLE OF TY_TAB WITH HEADER LINE.
    *WRITING THE QUERY
    SELECT A1~VBELN
           A1~VKORG
           A1~ERDAT
           A1~AUGRU
           A2~BSTDK
           A2~BSTDK_E
           A2~BSTDK
           A2~KONDA
           A2~KDKG2
           A3~MATNR
           A3~SPART
           A3~KONDM
           A3~WAERK
           A3~NETWR
           A3~KWMENG
           A3~VKAUS
           A3~MVGR1
           A3~MVGR2
           A3~MVGR3
           A3~MVGR4
           A3~MVGR5
           A4~POST_CODE1
           A4~PO_BOX
           A4~NAME1
           A4~NAME2
           A4~CITY1
           A4~CITY2
           A4~COUNTRY
           A4~STREET
           A4~STR_SUPPL1
           A4~STR_SUPPL2
           A4~STR_SUPPL3
           A5~BEZEI
           A6~KUNNR
           A7~NRART
           A8~VTEXT
           A9~PARVW
           A10~BEZEI
           A11~VTEXT
           A12~VTEXT
           A13~BEZEI
           A14~BEZEI
           A15~BEZEI
           A16~BEZEI
           A17~BEZEI
           A18~VTEXT
         A20~SMTP_ADDR
    INTO CORRESPONDING FIELDS OF TABLE ITAB
    FROM VBAK AS A1
    JOIN VBKD AS A2
    ON A1VBELN = A2VBELN
    JOIN VBAP AS A3
    ON A1VBELN = A3VBELN
    LEFT OUTER JOIN VBPA AS A6
    ON A2VBELN = A6VBELN
    AND A2POSNR = A6POSNR
    *JOIN ADR6 AS A20
    *ON A6ADRNR = A20ADDRNUMBER
    JOIN ADRC AS A4
    ON A6ADRNR = A4ADDRNUMBER
    LEFT OUTER JOIN TVM1T AS A13
    ON A3MVGR1 = A13MVGR1
    LEFT OUTER JOIN TVM2T AS A14
    ON A3MVGR2 = A14MVGR2
    LEFT OUTER JOIN TVM3T AS A15
    ON A3MVGR3 = A15MVGR3
    LEFT OUTER JOIN TVM4T AS A16
    ON A3MVGR4 = A16MVGR4
    LEFT OUTER JOIN TVM5T AS A17
    ON A3MVGR5 = A17MVGR5
    JOIN TPAR AS A7
    ON A7PARVW = A6PARVW
    JOIN TPART AS A8
    ON A8PARVW = A6PARVW
    LEFT OUTER JOIN T178T AS A11
    ON A3KONDM =  A11KONDM
    AND A11~SPRAS = SY-LANGU
    LEFT OUTER JOIN T188T as A12
    ON A2KONDA = A12KONDA
    AND A12~SPRAS = SY-LANGU
    JOIN  TPART AS  A9
    ON A6PARVW = A9PARVW
    LEFT OUTER JOIN TVLVT AS  A10
    ON A1ABRVW = A10ABRVW
    AND A10~SPRAS = SY-LANGU
    LEFT OUTER JOIN TVAUT AS  A5
    ON A1AUGRU = A5AUGRU
    AND A5~SPRAS = SY-LANGU
    LEFT OUTER JOIN TVKGGT AS A18
    ON A8SPRAS = A18SPRAS
    UP TO 100 ROWS
    WHERE A1~VBELN IN S_VBELN.
    *PRINTING THE OUTPUT
    loop AT ITAB.
    WRITE :
    /(30) 'Order No                    :', itab-VBELN,
    /(30) 'Sales Org                   :', itab-VKORG,
    /(30) 'Order Date                    :', itab-ERDAT,
    /(30) 'Purchase Order #           :', itab-BSTKD,
    /(30) 'Purchase Order Date           :', itab-BSTDK,
    /(30) 'Order Reason code            :', itab-AUGRU,
    /(30) 'Order Reason description      :', itab-BEZEI,
    /(30) 'Partner Type                :', itab-NRART,
    /(30) 'Partner Type description      :', itab-VTEXT,
    /(30) 'Partner no                :', itab-KUNNR,
    /(30) 'Partner Name1                :', itab-NAME1,
    /(30) 'Partner Name2                :', itab-NAME2,
    /(30) 'Partner Address 1           :', itab-STREET,
    /(30) 'Partner Address 2           :', itab-STRSUPPL1,
    /(30) 'Partner Address 3           :', itab-STRSUPPL2,
    /(30) 'Partner Address 4           :', itab-STRSUPPL3,
    /(30) 'City                     :', itab-CITY1,
    /(30) 'DISTRICT                :', itab-CITY2,
    /(30) 'Country                 :', itab-COUNTRY,
    /(30) 'Post Code                 :', itab-POSTCODE1,
    /(30) 'PO BOX                     :', itab-POBOX,
    /(30) 'Partner email                :', itab-SMTP_ADDR,
    /(30) 'Material no                :', itab-MATNR,
    /(30) 'Material  Division           :', itab-SPART,
    /(30) 'Product Line and Edition code:', itab-MVGR1,
    /(30) 'Product Line and Edition Desc:', itab-BEZEI1,
    /(30) 'Product Name code           :', itab-MVGR2,
    /(30) 'ProductName Desc           :', itab-BEZEI2,
    /(30) 'Product Version Code           :', itab-MVGR3,
    /(30) 'Product Version Desc           :', itab-BEZEI3,
    /(30) 'Product Platform Code      :', itab-MVGR4,
    /(30) 'Product Platform Desc      :', itab-BEZEI4,
    /(30) 'Product App Server Code      :', itab-MVGR5,
    /(30) 'Product App Server Desc      :', itab-BEZEI5,
    /(30) 'Compiler Code                :', itab-KONDM,
    /(30) 'Compiler Desc                :', itab-VTEXT,
    /(30) 'LanguageCode                :', itab-KONDA,
    /(30) 'LanguageDesc                :', itab-V_TEXT,
    /(30) 'Runtime Band Code           :', itab-VKAUS,
    /(30) 'Runtime Band description      :', itab-BEZE_I,
    /(30) 'Support Start Date           :', itab-BSTDK,
    /(30) 'Support End Date           :', itab-BSTDK_E,
    /(30) 'Support Level Code           :', itab-KDKG2,
    /(30) 'Support Level Desc           :', itab-VTEXT2,
    /(30) 'Order Quantity           :', itab-KWMENG,
    /(30) 'Net Price                :', itab-NETWR,
    /(30) 'Currency                :', itab-WAERK.
    uline.
    ENDLOOP.
    if sy-subrc <> 0.
      write : / 'No data found'.
    endif.

    Hi  Jyotirmoy Deb,
    Last time might be,you are the one that asking about using join statement on 3 tables.
    Now what are you doing in your code. use are joining almost 18 tables.this will not work anyone, and it will slow down the processing time of the report.
    First of all analysis the report what exactly you want and then
    first read the header data as in your case you using the Sale Document Header data.
    On the basis of Header data fetch the line item data.
    Don't processes all the tables at a time using the join clause.Because it decrease the efficiency of the program.
    Reward points,if useful.
    Regards,
    Manoj Kumar

Maybe you are looking for