Problem populating an internal table

Hello,
I am having a problem with filling an internal table. I cannot seem to grasp this and I struggle with this in every program. I am attaching pieces of my program so that maybe someone can help me. I have a selection screen that I populate with dates. if the dates are populated, I want to use these dates for the selection. If the dates are initial, I want to read an entry from the TVARV table and populate the dates that will used in the selection. I tried various code statements and I cannot get it to work. i get messages like "is a table without a header line and therefore has no component "LOW" or other messages similar to this. I would like that if the s_udate is populated, I could fill the tvarv table and not have to call the form.
also if anyone has some documentation on working with internal tables without header lines (I think I read in here that internal tables without header lines is the way to go ), could you please include that as well so that I could try to understand how this suppose to work 
thanks in advance for the help
TYPES: BEGIN OF ty_tvarv_date,
        low     TYPE   tvarv_val,          "start date
        high    TYPE   tvarv_val,          "end date
       END OF ty_tvarv_date.
TYPES: ty_t_tvarv_date TYPE STANDARD TABLE OF ty_tvarv_date INITIAL SIZE 0,
DATA   it_tvarv_date TYPE STANDARD TABLE OF ty_tvarv_date INITIAL SIZE 0.
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(22) text-002.
SELECT-OPTIONS s_udate FOR sy-datlo.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK a.
PERFORM select_date_tvarv CHANGING it_tvarv_date.
PERFORM select_data643_mseg USING    it_tvarv_date
                                     it_zfi_gl_subcontrk[]
                              CHANGING it_mseg643.
<b>*******************************************************************</b>
FORM select_date_tvarv CHANGING p1_it_tvarv_date TYPE ty_t_tvarv_date.
IF s_udate IS INITIAL.
  SELECT low high
    FROM tvarv
    INTO  TABLE p1_it_tvarv_date
    WHERE name EQ  'Z_SUBCONTRK_DATES'.
  IF sy-subrc NE 0.
    IF sy-batch IS INITIAL.
      MESSAGE i899 WITH text-027.
      LEAVE LIST-PROCESSING.
    ELSE.
      MESSAGE e899 WITH text-027.
    ENDIF.
  ENDIF.
ELSE.
     MOVE s_udate to p1_it_tvarv_date.
     MOVE s_udate-low(8)  to p1_it_tvarv_date-low.
     MOVE s_udate-high(8) to p1_it_tvarv_date-high.
ENDIF.
ENDFORM. " FORM SELECT_DATE_TVARV
<b>*******************************************************************</b>
FORM select_data643_mseg USING p1_tvarv_date       TYPE ty_t_tvarv_date
                               p1_zfi_gl_subcontrk TYPE ty_t_zfi_gl_subcontrk
                      CHANGING p1_it_mseg          TYPE ty_t_mseg643.
  DATA: wa_tvarv_date type ty_tvarv_date.
  READ TABLE p1_tvarv_date INTO wa_tvarv_date INDEX 1.
  SELECT abukrs  awerks amatnr aerfmg a~erfme
         akostl abwart amblnr awempf acharg akzbew algort bbudat
    FROM mseg AS a INNER JOIN mkpf AS b ON amblnr EQ bmblnr
      AND b~budat <= wa_tvarv_date-high
      AND b~budat >= wa_tvarv_date-low
        INTO TABLE p1_it_mseg
        FOR ALL ENTRIES IN p1_zfi_gl_subcontrk
        WHERE a~bukrs   EQ p1_zfi_gl_subcontrk-bukrs_from
        AND   a~werks   EQ p1_zfi_gl_subcontrk-werks_from
        AND   a~wempf   EQ p1_zfi_gl_subcontrk-werks_to643
        AND   a~matnr   EQ p1_zfi_gl_subcontrk-matnr
        AND   a~bwart   EQ'643'.
  IF sy-subrc NE 0.
    IF sy-batch IS INITIAL.
      MESSAGE i899 WITH text-027.
      LEAVE LIST-PROCESSING.
    ELSE.
      MESSAGE e899 WITH text-027.
    ENDIF.
  ENDIF.
ENDFORM. " FORM SELECT_DATA643_MSEG

In tables with header line, you need not define an explicit work area.
System will create a so-called work area, which is called header line.
This header line is like any other work area. the difference is that it can be accessed using internal table name. A record will be by default read into header line in a READ statement.
For ex,
READ TABLE p1_tvarv_date INTO wa_tvarv_date INDEX 1.
Here you used to read the 1st record into wa_tvarv_date.
But after making it table with header line you can use
READ TABLE p1_tvarv_date INDEX 1.
This will move the data to header line and it can be accessed by name p1_tvarv_date.
See the code below.
TYPES: BEGIN OF ty_tvarv_date,
low TYPE tvarv_val, "start date
high TYPE tvarv_val, "end date
END OF ty_tvarv_date.
TYPES: ty_t_tvarv_date TYPE STANDARD TABLE OF ty_tvarv_date INITIAL SIZE 0,
DATA it_tvarv_date TYPE STANDARD TABLE OF ty_tvarv_date <b>WITH HEADER LINE INITIAL</b> SIZE 0.
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(22) text-002.
SELECT-OPTIONS s_udate FOR sy-datlo.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK a.
PERFORM select_date_tvarv CHANGING it_tvarv_date.
PERFORM select_data643_mseg USING it_tvarv_date
it_zfi_gl_subcontrk[]
CHANGING it_mseg643.
FORM select_date_tvarv CHANGING p1_it_tvarv_date TYPE ty_t_tvarv_date.
IF s_udate IS INITIAL.
SELECT low high
FROM tvarv
INTO TABLE p1_it_tvarv_date
WHERE name EQ 'Z_SUBCONTRK_DATES'.
IF sy-subrc NE 0.
IF sy-batch IS INITIAL.
MESSAGE i899 WITH text-027.
LEAVE LIST-PROCESSING.
ELSE.
MESSAGE e899 WITH text-027.
ENDIF.
ENDIF.
ELSE.
MOVE s_udate to p1_it_tvarv_date.
MOVE s_udate-low(8) to p1_it_tvarv_date-low.
MOVE s_udate-high(8) to p1_it_tvarv_date-high.
ENDIF.
ENDFORM. " FORM SELECT_DATE_TVARV
FORM select_data643_mseg USING p1_tvarv_date TYPE ty_t_tvarv_date
p1_zfi_gl_subcontrk TYPE ty_t_zfi_gl_subcontrk
CHANGING p1_it_mseg TYPE ty_t_mseg643.
<b>READ TABLE p1_tvarv_date INDEX 1.</b>
SELECT abukrs awerks amatnr aerfmg a~erfme
akostl abwart amblnr awempf acharg akzbew algort bbudat
FROM mseg AS a INNER JOIN mkpf AS b ON amblnr EQ bmblnr
<b>AND b~budat <= p1_tvarv_date-high
AND b~budat >= p1_tvarv_date-low</b>
INTO TABLE p1_it_mseg
FOR ALL ENTRIES IN p1_zfi_gl_subcontrk
WHERE a~bukrs EQ p1_zfi_gl_subcontrk-bukrs_from
AND a~werks EQ p1_zfi_gl_subcontrk-werks_from
AND a~wempf EQ p1_zfi_gl_subcontrk-werks_to643
AND a~matnr EQ p1_zfi_gl_subcontrk-matnr
AND a~bwart EQ'643'.
IF sy-subrc NE 0.
IF sy-batch IS INITIAL.
MESSAGE i899 WITH text-027.
LEAVE LIST-PROCESSING.
ELSE.
MESSAGE e899 WITH text-027.
ENDIF.
ENDIF.
ENDFORM. " FORM SELECT_DATA643_MSEG

Similar Messages

  • Problem in Passing internal table Function module

    Hi experts,
    I am new to creating function module and needed certain suggestions.
    I have created a type inside the FM
    types: begin of T1
    field A
    field  B
    end of T1.
    Now, i have populated the internal table of this type but how to send it through the tables tab of my FM.
    IN the parameter, i can write my internal table name but what should be associated type ...
    Please give some suggestions

    Hi,
      Not required.
    Table parameter will behave like type table of Z_sturcture. So just define the structure and use it in the TABLE parameter.It will convert that into internal table..
    Example :
    Parameter name         Typing                Associated type
    T_RETURN                  LIKE                   your Z_structure
    If you want to give table in the import parameter, then you need to create the table type for the structure.....

  • Problem in processing internal table

    Hi All,
    Im facing some problem with an internal table with header.
    This is Xvbkd with heaer line.
    Header     100     0000000049     000010                         EXW     China
    1     100     0000000049     000000                         CIF     HK
    2     100     0000000049     000010                         CIF     HK
    3     100     0000000049     000020                         CIF     HK
    Now I want modify the internal table of 2nd record. The data above has modified in the header.but not reflected in the body.
    Here is my code:
    SELECT SINGLE inco1 inco2
                            INTO (knvv-inco1, knvv-inco2)
                            FROM knvv
                            WHERE kunnr EQ w_shipto
                              AND vkorg EQ vbak-vkorg
                              AND vtweg EQ vbak-vtweg
                              AND spart EQ vbak-spart.
                        IF sy-subrc EQ 0 AND
                            knvv-inco1 NE space or
                            knvv-inco2 NE space.
                          MOVE: knvv-inco1 TO wa_xvbkd-inco1,
                                knvv-inco2 TO wa_xvbkd-inco2.
                         READ table xvbkd with key vbeln = xvbap-vbeln
                                                    posnr = xvbap-posnr.
                          IF sy-subrc = 0.
                          xvbkd-inco1 = wa_xvbkd-inco1.
                          xvbkd-inco2 = wa_xvbkd-inco2.
                          modify table xvbkd from wa_xvbkd transporting  inco1 inco2.
                         endif.
                        ENDIF.
    Requirement: is the 2nd record(item 10) in above internal table has to reflect the change with EXW and China.
    Pls help me with ur valuable suggestions.
    Regards,
    Priya

    try,
    SELECT SINGLE inco1 inco2
                            INTO (knvv-inco1, knvv-inco2)
                            FROM knvv
                            WHERE kunnr EQ w_shipto
                              AND vkorg EQ vbak-vkorg
                              AND vtweg EQ vbak-vtweg
                              AND spart EQ vbak-spart.
                        IF sy-subrc EQ 0 AND
                            knvv-inco1 NE space or
                            knvv-inco2 NE space.
                          MOVE: knvv-inco1 TO xvbkd-inco1,
                                knvv-inco2 TO xvbkd-inco2.
                         READ table xvbkd with key vbeln = xvbap-vbeln
                                                    posnr = xvbap-posnr.
                          IF sy-subrc = 0.
                          modify xvbkd index sy-tabix.
                         endif.
                        ENDIF.
    Regards,
    John
    Edited by: jvanpelt on Jul 16, 2010 9:36 AM

  • Problem in returning internal table from FM in ABAP Objects

    Hi All,
    I have to return an internal table from one of the FM i created in the controller class (_IMPL) of a view.
    The problem here is, the internal table i m getting here
    is of type to a structure!.
    but i have to return it as type ref to DATA, which cant be assigned directly.
    Now, my question is.. How can i convert ..
    internal table type structure
    to
    internal table type ref to DATA.
    Thanks and Regards,
    sudeep v d.

    Hi Sudeep.
    Can you see if something like this works for you?
    DATA: dref type ref to DATA.
    FIELD-SYMBOL: <fs> type ANY.
    LOOP AT <internaltable> INTO <structure>
    ASSIGN "<component_name>" component of <structure> TO <fs>
    CREATE DATA dref type <structure>.
    dref->* = <fs>.
    ENDLOOP.

  • Problem in displaying internal table contents to excel(color)

    Hello Gurus!!!!!
    The code is given below :-
    *& Module pool       ZDEMO_DOWNLD1
    PROGRAM  ZDEMO_DOWNLD1.
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
    DATA : f_name(120) type c,
           f_name1(120) type c.
    case sy-ucomm.
    when 'ATTACH'.
    CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
       DEF_FILENAME           = ' '
      DEF_PATH               = ' '
      MASK                   = ' '
      MODE                   = ' '
      TITLE                  = ' '
    IMPORTING
       FILENAME               = f_name
      RC                     =
    EXCEPTIONS
      INV_WINSYS             = 1
      NO_BATCH               = 2
      SELECTION_CANCEL       = 3
      SELECTION_ERROR        = 4
      OTHERS                 = 5
    *f_name = DEF_FILENAME.
    f_name1 = f_name.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endcase.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
    type-pools ole2.
    data: h_excel type ole2_object, " Excel object
    h_mapl type ole2_object, " list of workbooks
    h_map type ole2_object, " workbook
    h_zl type ole2_object, " cell
    h_f type ole2_object, " font
    h_interior type ole2_object. " Color
    *tables: spfli.
    DATA: ls_emp TYPE zpm_emp_det,
           lt_emp TYPE zpm_emp_det OCCURS 0,
           l_projectname TYPE zpm_emp_item_det-project_name,
           l_projectname_last TYPE zpm_emp_item_det-project_name,
           l_empid TYPE zpm_emp_item_det-empid,
           l_empid_last TYPE zpm_emp_item_det-empid.
    DATA: l_projectname_key TYPE lvc_nkey,
          l_role_of_emp_key TYPE lvc_nkey,
          l_last_key TYPE lvc_nkey.
    DATA :  lt_project_main TYPE TABLE OF zsach_pm ,
            ls_project_main TYPE zsach_pm,
            lt_project TYPE zsach_pm OCCURS 0,
            ls_project TYPE zsach_pm.
    internal table for excel headings
    DATA : BEGIN OF lt_project_ex OCCURS 0,
             line(50) TYPE c,
           END OF lt_project_ex.
    DATA: lt_project1 TYPE zsach_pm OCCURS 0,
          ls_project1 TYPE zsach_pm.
    DATA :   lt_project_temp TYPE zsach_pm OCCURS 0 ,
             ls_project_temp TYPE zsach_pm.
    DATA: lt_project2 TYPE zsach_pm OCCURS 0,
          ls_project2 TYPE zsach_pm.
    TYPES: BEGIN OF st_username,
           username TYPE zuser_names-username,
           END OF st_username.
    DATA: it_tab TYPE TABLE OF st_username,
          wa_tab TYPE st_username.
    data : lt_project_excel like zsach_pm occurs 0 with header line.
    *DATA: f_name TYPE string.
    data h type i.
    table of flights
    data: it_spfli like spfli occurs 10 with header line.
    *& Event START-OF-SELECTION
        SELECT empid
               project_name
               role_of_emp
               competancy
               manager
               price_category
               rate_per_hour
               first_day_pro
               last_day_pro
               ckey
         FROM zpm_emp_item_det
         INTO CORRESPONDING FIELDS OF TABLE lt_project.
        LOOP AT lt_project INTO ls_project.
        ENDLOOP.
        SELECT projectid project_name client begin_date end_date
          FROM zpm_project_det
          INTO CORRESPONDING FIELDS OF TABLE lt_project_temp FOR ALL ENTRIES IN lt_project
          WHERE project_name = lt_project-project_name.
        LOOP AT lt_project_temp INTO ls_project_temp.
          MODIFY lt_project FROM ls_project_temp TRANSPORTING
            projectid project_name client begin_date end_date
            WHERE project_name = ls_project_temp-project_name.
        ENDLOOP.
        SELECT empid
               employee_name
               designation
               employee_type
               date_of_joining
        FROM zpm_emp_head_det
        INTO CORRESPONDING FIELDS OF TABLE lt_project1 FOR ALL ENTRIES IN lt_project
        WHERE empid = lt_project-empid.
        LOOP AT lt_project1 INTO ls_project1.
          MODIFY lt_project FROM ls_project1 TRANSPORTING
                empid
                employee_name
                designation
                employee_type
                date_of_joining
             WHERE empid = ls_project1-empid.
        ENDLOOP.
    tell user what is going on
    call function 'SAPGUI_PROGRESS_INDICATOR'
    exporting
    PERCENTAGE = 0
    text = text-007
    exceptions
    others = 1.
    start Excel
    create object h_excel 'EXCEL.APPLICATION'.
    perform err_hdl.
    set property of h_excel 'Visible' = 1.
    perform err_hdl.
    tell user what is going on
    call function 'SAPGUI_PROGRESS_INDICATOR'
    exporting
    PERCENTAGE = 0
    text = text-008
    exceptions
    others = 1.
    get list of workbooks, initially empty
    call method of h_excel 'Workbooks' = h_mapl.
    perform err_hdl.
    add a new workbook
    call method of h_mapl 'Add' = h_map.
    perform err_hdl.
    tell user what is going on
    call function 'SAPGUI_PROGRESS_INDICATOR'
    exporting
    PERCENTAGE = 0
    text = text-009
    exceptions
    others = 1.
    output column headings to active Excel sheet
    perform fill_cell using 1 1 1 'Project ID'(001).
    perform fill_cell using 1 2 1 'Emp ID'(002).
    perform fill_cell using 1 3 1 'Project Name'(003).
    perform fill_cell using 1 4 1 'Client'(004).
    perform fill_cell using 1 5 1 'Begin Date'(005).
    perform fill_cell using 1 6 1 'End Date'(006).
    perform fill_cell using 1 7 1 'Role of Employee'(007).
    perform fill_cell using 1 8 1 'Module / Competancy'(008).
    perform fill_cell using 1 9 1 'Employee name'(009).
    perform fill_cell using 1 10 1 'Price Category'(010).
    perform fill_cell using 1 11 1 'Rate P/H'(011).
    perform fill_cell using 1 12 1 '1st day in project'(012).
    perform fill_cell using 1 13 1 'Last day in project'(013).
    perform fill_cell using 1 14 1 'Currency'(014).
    perform fill_cell using 1 15 1 'Manager'(015).
    perform fill_cell using 1 16 1 'Emp Type'(016).
    perform fill_cell using 1 17 1 'Designation'(017).
    perform fill_cell using 1 18 1 'Joining Date'(018).
    perform fill_cell using 1 19 1 'Last Date'(019).
    loop at lt_project into ls_project.
    *lt_project_excel[] = lt_project[].
    endloop.
    copy flights to active EXCEL sheet
    h = sy-tabix + 1.
    *perform fill_cell1 using h 1 0 ls_project-PROJECTID.
    *perform fill_cell1 using h 2 0 ls_project-EMPID.
    *perform fill_cell1 using h 3 0 ls_project-PROJECT_NAME.
    *perform fill_cell1 using h 4 0 ls_project-client.
    *perform fill_cell1 using h 5 0 ls_project-BEGIN_DATE.
    *perform fill_cell1 using h 6 0 ls_project-END_DATE.
    *perform fill_cell1 using h 7 0 ls_project-ROLE_OF_EMP.
    *perform fill_cell1 using h 8 0 ls_project-COMPETANCY.
    *perform fill_cell1 using h 9 0 ls_project-EMPLOYEE_NAME.
    *perform fill_cell1 using h 10 0 ls_project-PRICE_CATEGORY.
    *perform fill_cell1 using h 11 0 ls_project-RATE_PER_HOUR.
    *perform fill_cell1 using h 12 0 ls_project-FIRST_DAY_PRO.
    *perform fill_cell1 using h 13 0 ls_project-LAST_DAY_PRO.
    *perform fill_cell1 using h 14 0 ls_project-CKEY.
    *perform fill_cell1 using h 15 0 ls_project-MANAGER.
    *perform fill_cell1 using h 16 0 ls_project-EMPLOYEE_TYPE.
    *perform fill_cell1 using h 17 0 ls_project-DESIGNATION.
    *perform fill_cell1 using h 18 0 ls_project-DATE_OF_JOINING.
    *perform fill_cell1 using h 19 0 ls_project-LAST_WORKING_DAT.
    perform fill_cell1 using h 1 0 lt_project_excel-PROJECTID.
    perform fill_cell1 using h 2 0 lt_project_excel-EMPID.
    perform fill_cell1 using h 3 0 lt_project_excel-PROJECT_NAME.
    perform fill_cell1 using h 4 0 lt_project_excel-client.
    perform fill_cell1 using h 5 0 lt_project_excel-BEGIN_DATE.
    perform fill_cell1 using h 6 0 lt_project_excel-END_DATE.
    perform fill_cell1 using h 7 0 lt_project_excel-ROLE_OF_EMP.
    perform fill_cell1 using h 8 0 lt_project_excel-COMPETANCY.
    perform fill_cell1 using h 9 0 lt_project_excel-EMPLOYEE_NAME.
    perform fill_cell1 using h 10 0 lt_project_excel-PRICE_CATEGORY.
    perform fill_cell1 using h 11 0 lt_project_excel-RATE_PER_HOUR.
    perform fill_cell1 using h 12 0 lt_project_excel-FIRST_DAY_PRO.
    perform fill_cell1 using h 13 0 lt_project_excel-LAST_DAY_PRO.
    perform fill_cell1 using h 14 0 lt_project_excel-CKEY.
    perform fill_cell1 using h 15 0 lt_project_excel-MANAGER.
    perform fill_cell1 using h 16 0 lt_project_excel-EMPLOYEE_TYPE.
    perform fill_cell1 using h 17 0 lt_project_excel-DESIGNATION.
    perform fill_cell1 using h 18 0 lt_project_excel-DATE_OF_JOINING.
    perform fill_cell1 using h 19 0 lt_project_excel-LAST_WORKING_DAT.
    *endloop.
    disconnect from Excel
    *CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
    EXPORTING
       DOCUMENT_DATA                    =
      PUT_IN_OUTBOX                    = ' '
      SENDER_ADDRESS                   = SY-UNAME
      SENDER_ADDRESS_TYPE              = 'B'
      COMMIT_WORK                      = ' '
    IMPORTING
      SENT_TO_ALL                      =
      NEW_OBJECT_ID                    =
      SENDER_ID                        =
    TABLES
       PACKING_LIST                     =
      OBJECT_HEADER                    =
      CONTENTS_BIN                     =
      CONTENTS_TXT                     =
      CONTENTS_HEX                     =
      OBJECT_PARA                      =
      OBJECT_PARB                      =
       RECEIVERS                        =
    EXCEPTIONS
      TOO_MANY_RECEIVERS               = 1
      DOCUMENT_NOT_SENT                = 2
      DOCUMENT_TYPE_NOT_EXIST          = 3
      OPERATION_NO_AUTHORIZATION       = 4
      PARAMETER_ERROR                  = 5
      X_ERROR                          = 6
      ENQUEUE_ERROR                    = 7
      OTHERS                           = 8
    *IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    free object h_excel.
    perform err_hdl.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    FORM FILL_CELL *
    sets cell at coordinates i,j to value val boldtype bold *
    form fill_cell using i j bold val.
    call method of h_excel 'Cells' = h_zl exporting #1 = i #2 = j.
    perform err_hdl.
    set property of h_zl 'Value' = val .
    perform err_hdl.
    get property of h_zl 'Font' = h_f.
    perform err_hdl.
    set property of h_f 'Bold' = bold .
    perform err_hdl.
    SET PROPERTY OF h_f 'ColorIndex' = 11 .
    perform err_hdl.
    endform.
    *& Form fill_cell1
    text
    -->P_H text
    -->P_1 text
    -->P_0 text
    -->P_IT_SPFLI_CARRID text
    form fill_cell1 using i j bold val.
    call method of h_excel 'Cells' = h_zl exporting #1 = i #2 = j.
    perform err_hdl.
    set property of h_zl 'Value' = val .
    perform err_hdl.
    get property of h_zl 'Font' = h_f.
    perform err_hdl.
    set property of h_f 'Bold' = bold .
    perform err_hdl.
    SET PROPERTY OF h_f 'ColorIndex' = 14 .
    perform err_hdl.
    endform. " fill_cell1
    *& Form ERR_HDL
    outputs OLE error if any *
    --> p1 text
    <-- p2 text
    form err_hdl.
    if sy-subrc <> 0.
    write: / 'Error in OLE-Automation:'(010), sy-subrc.
    stop.
    endif.
    endform. " ERR_HDL
    Entire excel file is displayed ,but the problem is I want to display the excel file in one shot i.e not <b>line by line</b>
    Kindly suggest if there is any keyword or FM to display the contents in excel using internal table.
    It should not take much time. Just by executing code , the contents of internal table should be displayed.
    Helpful answers will be rewarded
    Thanks,
    Sachin

    Hi Kavitha,
    maybe it's not sophisticated enough for your requirement, but I found function XXL_FULL_API easy to use. This will give same functionality as 'download' button in ALV-Grid display.
    Regards,
    Christian

  • Problem while exporting internal table to memory id using EXPORT

    Hi friends,
    Iam facing a following problem.
    I have 4 line items in my va01 tcode.
    now when i give material number and quantity and hit enter the processing for that line item starts.
    iam moving that current line item to a internal table lt_vbap in userexit_check_vbap.
    now for the 2nd line item also i have to move to internal table lt_vbap.
    but my problem is that in internal table lt_vbap iam not getting all the line items.
    every time the current line item is being processed the the previous line items are being refreshed.
    from lt_vbap internal table.
    how can i export internal table.
    code
    move vbap to lt_vbap.
    append lt_vbap.
    export lt_vbap to memory id 'ZXYZ'.

    >
    Prakash Pandey wrote:
    > Hi Priyanka,
    >
    > The internal table lt_vbap will always be empty unless you import it from the Memory ID (in your case ZXYX).
    >
    > Use the code this way:
    >
    > IMPORT lt_vbap FROM MEMORY ID 'ZXYX'.
    >
    > move vbap to lt_vbap.
    >
    > append lt_vbap.
    >
    > export lt_vbap to memory id 'ZXYZ'.
    >
    > Regards,
    > Prakash Pandey
    The memory id shud be same in both cases

  • Data populated in internal Table its not diplay in result

    Hi ABAPers,
                         i have one doubt in internal table one field data is populated but in result its diplayed. can  any one tell me the solution for this
    regards,
    kishore.

    hi this is a simple report on internal table.
    REPORT  zvenkattest0.
    TABLES:pa0002,pa0008.
    data:begin of it_pa0002 occurs 0,
         pernr like pa0002-pernr,
         begda like pa0002-begda,
         endda like pa0002-endda,
         vorna like pa0002-vorna,
         nachn like pa0002-nachn,
         end of it_pa0002.
    SELECT-OPTIONS: S_pernr FOR pa0002-pernr.
    START-OF-SELECTION.
      SELECT pernr
             begda
             endda
             vorna
             nachn
             FROM pa0002
             INTO  TABLE IT_pa0002
             WHERE pernr IN S_pernr.
    sort it_pa0002 by pernr begda descending.
    loop at it_pa0002.
    write:/ it_pa0002-pernr,
            it_pa0002-begda,
            it_pa0002-endda,
            it_pa0002-vorna,
            it_pa0002-nachn.
    endloop.
    reward points if useful,
    venkat.

  • Problem in declaring internal table

    hai experts ,
    i am new to web dynpro abap .. my problem is i want to declare a internal table for a table using the web dynpro code wizard .. i found many threads regarding that .. but for mee its not working .. many of them posted that get_static_attributes_table method will solve the problem .. but i used the method in the wizard but it saying that method does not  exist ..pls solve the problem ..
    say where to enter the method in the wizard ..
    thanks & kind regards
    chinnaiya

    Hi Chinnaiya,
    Your post isnt that clear as to what you intend to do. Do you intend to just create an internal table declaration which would be able to hold your context nodes data or do you wish to use the get_static_attributes method to fetch all your tables data into this internal table?
    If you want to just declare an internal table which can hold the data then you would have to do it manually. You can't generate your internal table declaration using the code wizard. Suppose your context nodes name is SFLIGHT then you can use the below syntax to declare a table & work area respectively.
    DATA: lt_sflight TYPE wd_this->elements_sflight,  " Internal table
                wa_sflight TYPE wd_this->element_sflight.  " Work area
    For each node <node> of a controller context, a structure type element_<node> is implicitly generated in the interface IF_<ctrl>. The structure fields correspond to the attributes a node element consists of. Similarly for each node <node> of a controller context, a standard table type elements_<node> is implicitly generated in the interface IF_<ctrl>. The line type of this table is element_<node>. This constant can be used to
    type an internal table that can hold the attributes of multiple node elements. So as how said here you can even declare the work area and internal table like shown below in your MAIN view:
    DATA: lt_sflight TYPE if_main=>elements_sflight,  " internal table
               wa_sflight TYPE if_main=>element_sflight.  " work area
    But the disadvantage of this approach as how pointed out by Thomas in 1 of this earlier threads is that this coding works fine only for this particular view. If you copy the same code and try to use it in another view say VIEW1 then it wouldn't work as the interface name would have changed from if_main to if_view1. So its suggested to use the earlier approach.
    Regards,
    Uday

  • Problem in convering internal table to CSV file

    Hi,
    Iam converting internal table data to CSV format with the code given below.
    LOOP AT it_details_final INTO wa_details_final.
    CLEAR : t_attachment.
    CONSTANTS : c_sep TYPE c VALUE ','.
    CONCATENATE wa_details_final-wf_rectype
                             wa_details_final-wf_bankn
                             wa_details_final-wf_znme1
                             wa_details_final-wf_rzawe
                             wa_details_final-wf_lifnr
                             wa_details_final-wf_chect
                             wa_details_final-wf_rwbtr
                             wa_details_final-wf_chkladat
                        cl_abap_char_utilities=>newline
               INTO t_attachment SEPARATED BY c_sep.
    APPEND t_attachment.
        CLEAR t_attachment.
      ENDLOOP.
    Problem is ,data in one of the fields contain comma ( , ).
    So, data after comma is getting shifted to the adjacent cell.
    Please help me
    Thanks & Regards,
    Sravanthi

    Hello,
    Try this perform
    the ignorefields variable is used if you dont want a particular field in the output. You can ignore it for now
      DATA: p_ignoredfields(1024).
    CONSTANTS : const_sep TYPE c VALUE ','.
    * itab to store data ready to be sent to csv file
      DATA: BEGIN OF wa_csvdata,
        line(4096),
      END OF wa_csvdata.
      DATA: gt_csvdata LIKE TABLE OF wa_csvdata.
    *&      Form  CONVERT_TO_CSV
    *       text
    FORM convert_to_csv  TABLES   lt_datatab USING value(p_ignoredfields).
      FIELD-SYMBOLS: <wa_datatab> TYPE ANY.
      FIELD-SYMBOLS: <wa_field> TYPE ANY.
    * character variable incase table fields are of a diff type (ie: int)
      DATA: lv_data TYPE string.
    * set to X if the no data has been put into the csv workarea
      DATA: flag_firstcol TYPE xflag.
    * move the structure one character to the right since first char
    *  is position 0 in SAP
      SHIFT p_ignoredfields BY 1 PLACES RIGHT.
      REFRESH gt_csvdata.
      CLEAR wa_csvdata.
      LOOP AT lt_datatab ASSIGNING <wa_datatab>.
        flag_firstcol = 'X'.
        DO.
    *  one by one assign each position of the structure to the field
          ASSIGN COMPONENT sy-index OF STRUCTURE <wa_datatab> TO <wa_field>.
          IF sy-subrc <> 0.
            EXIT.
          ELSE.
    *  if the current field needs to be ignored then continue the do loop
            IF p_ignoredfields+sy-index(1) = '.'.
              CONTINUE.
            ENDIF.
    *  we use lv_data since concatenate fails for integer types
            lv_data = <wa_field>.
    *  remove commas in the data
            WHILE sy-subrc = 0.
              REPLACE const_sep WITH '' INTO lv_data.
            ENDWHILE.
    *       if this data belongs to the first non ignored column
            IF flag_firstcol = 'X'.
              wa_csvdata = lv_data.
              flag_firstcol = ''.
            ELSE.
              CONCATENATE wa_csvdata const_sep lv_data INTO wa_csvdata.
            ENDIF.
          ENDIF.
        ENDDO.
        APPEND wa_csvdata TO gt_csvdata.
        CLEAR wa_csvdata.
      ENDLOOP.
    ENDFORM.                    " CONVERT_TO_CSV

  • Populating one Internal table from two internal tables.

    Hello Gurus,
    iam having 3 internal table with same structure ,
    1st internal table having some records
    2nd internal table is also having some records
    what i need to do is to populate the records to the 3rd internal table which the common records in the 1st and 2nd internal table. (common means intersection).
    please explain how and using which concept and if possible code also...
    Regards,
    Ravi.

    hi ravi,
    look at the folowing code for reference
    *&--mard structure
    types: begin of struc_mard,
           matnr     type matnr,           "Material Number
           werks     type werks_d,           "Plant
           lgort     type lgort_d,           "Storage Location
           labst type labst,         "Valuated stock with unrestricted use
           end of struc_mard.
    *&--mara structure
    types: begin of struc_mara,
           matnr type matnr,         "material number
           meins type meins,         "unit of measurement
           mtart type mtart,         "material type
           ersda     type ersda,           "Creation date
           end of struc_mara.
    *&--maktx structure
    types: begin of struc_maktx,
           matnr type matnr,        "material number
           maktx type maktx,        "material description
           end of struc_maktx.
    *&--Final structure
    types: begin of struc_final,
           matnr     type matnr,           "Material Number
           werks     type werks_d,           "Plant
           lgort     type lgort_d,           "Storage Location
           labst type labst,         "Valuated stock with unrestricted use
           meins type meins,         "unit of measurement
           mtart type mtart,         "material type
           ersda     type ersda,           "Creation date
           maktx type maktx,         "material description
           v_box(1) type c,          "for checkbox field
           end of struc_final.
    *&---work  area for Internal Tables[population 1]
    data: wa_mard type struc_mard,
          wa_mara type struc_mara,
          wa_maktx type struc_maktx,
          wa_final type struc_final.
                     INTERNAL TABLES  DECLARATION                        *
    *&---Internal tables for storing data.[populaiton 1]
    data: i_mard  type standard table of struc_mard,
          i_mara  type standard table of struc_mara,
          i_maktx type standard table of struc_maktx,
          i_final type standard table of struc_final.
    *&--fetching the data from table for storage
      select  matnr
              werks
              lgort
              labst
              into table i_mard
              from mard
              where matnr in r_matnr and werks in r_werks and lgort in
              r_lgort
      if sy-subrc <> 0.  "if unsuccesful
        message e004.    "Error- Record does not exist
      endif.
    selection of material description
      if i_mard[] is not initial.
    *SELECT DISTINCT FOR UNIQUE ENTRIES ONLY
        select  distinct matnr
                         maktx
                         into table i_maktx
                         from makt
                         for all entries in i_mard
                         where matnr = i_mard-matnr and
                         spras = sy-langu.
        if sy-subrc <> 0.                    " if unsucessful
          wa_maktx-maktx = text-028.         "NO DESCRIPTION
        endif.
    *fetching information from material master
        select  distinct matnr
                         meins
                         mtart
                         ersda
                         into table i_mara
                         from mara for all entries in i_mard
                         where matnr = i_mard-matnr.
        if sy-subrc <> 0.
          message e003.
        endif.
    *&--sorting the tables
        sort: i_mard by matnr werks lgort,
              i_mara by matnr,
              i_maktx by matnr.
    *&--Clearing workareas.
        clear: wa_mard,
               wa_mara,
               wa_maktx,
               wa_final.
    *PROCESSING
        loop at i_mard into wa_mard.
    *moving values to final workarea
          wa_final = wa_mard.
          at new matnr.
            read table i_maktx into wa_maktx
            with key matnr = wa_mard-matnr binary search.
            read table i_mara into wa_mara
            with key matnr = wa_mard-matnr binary search.
          endat.
          if sy-subrc = 0.
            "if succesful then move to final workarea
            wa_final-maktx  = wa_maktx-maktx.
    *for mara values
            wa_final-meins  = wa_mara-meins.
            wa_final-mtart = wa_mara-mtart.
            wa_final-ersda  = wa_mara-ersda.
          endif.
    *append final workarea
          append wa_final to i_final.
        endloop.
    clearing and refreshing the table I_MARD
        refresh: i_mard.
        clear: wa_mard.
      endif.
    endform.                    "zf_populate_info
    this will move all the data into final table you have got, with the performnce tuned way
    reward point if useful
    Rohan malik

  • Problem in Importing Internal Table

    Dear All,
    I am exporting Internal table from Program1 as follows:
    REPORT  ZEXPORT_TEST                            .
    TYPES: BEGIN OF ITAB,
          MATNR TYPE MARA-MATNR,
          MATKL TYPE MARA-MATKL,
          END OF ITAB.
    DATA:IT TYPE TABLE OF ITAB .
    SELECT MATNR MATKL FROM MARA INTO TABLE IT UP TO 10 ROWS.
    EXPORT IT TO MEMORY ID 'EAI1'.
    WRITE:/'Exported Successfully'.
    And I am Importing same internal table into  program2
    REPORT  ZIMPORT_TEST  .
    TYPES: BEGIN OF ITAB,
          MATNR TYPE MARA-MATNR,
          MATKL TYPE MARA-MATKL,
          END OF ITAB.
    DATA:IT  TYPE TABLE OF ITAB,
         IT1 TYPE TABLE OF ITAB,
         WA TYPE ITAB.
    IMPORT IT1 FROM MEMORY ID 'EAI1'.
    IT[] = IT1[].
    LOOP AT IT INTO WA.
      WRITE:/ wa-matnr,
            / WA-MATKL.
    ENDLOOP.
    WRITE:/'Imported Successfully'.
    But progam1 exporting correctly the return code is 0 but program2 is not importing sucessfully return code is 4.
    Kindly help me to import.
    Thanks in Advance.

    Hi friend,
    When u use 'Export' and 'Import' statements, it refers local sap memory.
    So u need to use SUBMIT ZIMPORT_TEST AND RETURN  statement immediately after 'Export'.
    i.e.
    Report ZEXPORT_TEST.
    EXPORT IT TO MEMORY ID 'EAI1'.   < -
    Exported to common local sap memory
    SUBMIT ZIMPORT_TEST AND RETURN . <---- Controls goes to next program, within same session.
    Report ZIMPORT_TEST.
    IMPORT IT from MEMORY ID 'EAI1'.  <----
    Imports data from common local sap memory.
    If u want to run two independent reports one exporting, another importing, then u have to use
    'SET' and 'GET' parameter concept which refers global sap memory.
    Thanks..
    Edited by: Sap Fan on Feb 27, 2009 4:56 AM
    Edited by: Sap Fan on Feb 27, 2009 4:56 AM

  • 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 in printing internal table data in Sapscript!

    Hi All,
    Am trying to print internal table data into main window of sapscript.
    This is what I have written.
    loop at it_final INTO wa_final.
                  CALL FUNCTION 'WRITE_FORM'
                   EXPORTING
                     window   = 'MAIN'
                     ELEMENT  = '670'
                     TYPE     = 'BODY'
                     FUNCTION = 'APPEND'
                   EXCEPTIONS
                     window  = 1
                     element = 2.
                 IF sy-subrc <> 0.
                 ENDIF.
    ENDLOOP.
    IN Sapscript :
    /E   670
    IT     &wa_final-vbeln&,,&wa_final-vbelv&,,&wa_final-payment&
    =      &wa_final-rundate&,,&wa_final-waers&,,&wa_final-creditcard&
    =      &wa_final-augru&,,&wa_final-dmbtr&
    Pls let me know if am missing anything.
    Thanks & Regards
    Himayat

    Check if your Programm is called at the Sapscript level.
    Are you calling the programm from the Sapscript using the PERFORM command? or are these Programm and Sapscript set in customizing?
    Using SE16 check the Message Type and see if Sapscript and the programm are connected at all.

  • Problem in exporting internal table to memory

    Hi,
    I have to export two internal tables (thead and titem) from a report (RFTBCF00) to memory which i will import in my function module can anyone letme know hw it cud b done .
    Points will b assigned
    Thnx,

    You can take the help of this example:
    report  z_82235_test1                           .
    types: begin of tab1,
             a(1),
             b(1),
           end of tab1.
    types: begin of tab2,
             c(1),
             d(1),
           end of tab2.
    data: itab1 type table of tab1,
          wa1 like line of itab1,
          itab2 type table of tab2,
          wa2 like line of itab2.
    wa1-a = '1'.
    wa1-b = '2'.
    append wa1 to itab1.
    clear wa1.
    wa1-a = '3'.
    wa1-b = '4'.
    append wa1 to itab1.
    clear wa1.
    export itab1 to memory id '001'.
    export itab2 to memory id '002'.
    submit z_82235_test2 and return exporting list to memory .

  • Select statement not populating the internal table

    Hi,
    I have a requirement where I have to upload a file from C drive, the fields in this file are VBELN, description & date of creation.
    I am able to get this file into the internal table. After this i need to cross check the VBELN against VBRK-VBELN, if present then update a Z-table.... How do I do the cross check part ?...
    if not tw_zvatcn[] is initial,
      select * from vbrk
          into table tw_vbrk
          for all entries in tw_zvatcn
           where vbeln = tw_zvztcn-vbeln
                and vkorg = p_vkorg.
      if sy-subrc = 0.
       modify ztzb from lw_zvatcn.
      endif.
    endif.
    Internal table tw_vbrk is coming blank, which is not correct because I see the data in db tbl VBRK

    Is p_vkorg a parameter or select option.
    If it is parameter and is blank you will not get data in the table.
    In that case make a condition for that field also.
    if not tw_zvatcn[] is initial.
    if p_vkorg is not initial.
    select * from vbrk
    into table tw_vbrk
    for all entries in tw_zvatcn
    where vbeln = tw_zvztcn-vbeln
    and vkorg = p_vkorg.
    if sy-subrc = 0.
    modify ztzb from lw_zvatcn.
    endif.
    else.
    select * from vbrk
    into table tw_vbrk
    for all entries in tw_zvatcn
    where vbeln = tw_zvztcn-vbeln.
    if sy-subrc = 0.
    modify ztzb from lw_zvatcn.
    endif.
    endif.
    endif.

Maybe you are looking for

  • Unable to block line item in a schedule agreemnet using ME32L

    Hi Experts, When I am trying to block/delete one of the line items in a schedule agreement I am not able to do so. I am getting the error message "Document lines of document item (16) are in different fiscal years". Further the diagnosis message give

  • Help with ti4200 please!

    Ok my problem is my moniter goes into standby at random mainly playing games and i have to press reset on my pc sometimes it does it when not gameing but comes back on after a couple of seconds. I done a clean install of win xp pro and still does it

  • Problem with Starting Edit JTable after Enter Pressed

    Hi. Who knows what to do in such case: I have JTable. When I press ENTER on Cell - the editing process must begin, like it happens when I make Double Click on Cell.

  • Problem using external database link.

    Help: Here is th problem I am having. I have a workflow that reads and writes to external datasource using HS services. The workflow reads and then writes to the HS datasource in a function. After the function completes it needs to close the database

  • Create a Dual Wireless Network

    Right now, I'm using Airport Express to create a wireless network and I have my routers' wireless disabled. I get a transfer rate of about 130 on Apple TV and Macbook Pro and 54 on the iPhones. My set-up is: Gigaset SE567 W/Lan DSL4 port wired/wirele