Get Fields of internal table

Hi experts,
I have a small problem:
I call form this way:
PERFORM export_data USING 'T_WARE'
                          gt_ware
                          gs_ware
                 CHANGING gt_exp_ware.
The Form looks like this
FORM export_data USING struktur TYPE string
                       tabname  TYPE STANDARD TABLE
                       zeile    TYPE any
              CHANGING exp_table TYPE STANDARD TABLE.
Now I need a variant of the same type as gt_exp_ware (which is this type: DATA: gt_exp_ware TYPE TABLE OF char100).
I just need a variant of type char100. How do I get this type in my perform?
I tried
  ref_table  ?= cl_abap_tabledescr=>describe_by_name( exp_table )...
Nothing is correct.

Hi,
Please make sure for  PERFORM subroutines TABLES first and USING after.
PERFORM EXPORT_DATA TABLES  GT_WARE   GT_EXP_WARE
                                          USING   u2018T_WAREu2019    GS_WARE.
In the Form:
FORM EXPORT_DATA TABLES TABNAME TYPE STANDARD TABLE
                                                  EXP_TABLE TYPE STANDARD TABLE
                                                 USING   STRUKTUR    ZEILE.
Hope this will help you.
Regards,
Smart Varghese

Similar Messages

  • OTF to PDF - Getting blank PDF Internal table with CONVERT_OTF func module

    All
    i've captured OTF from smartforms and tried converting to PDF through 'CONVERT_OTF_2_PDF' FUNCTIOn module and after emailing to external email id, i found logo is completely disturbed (characters in logo got mixed up)..... later i tried converting with ''CONVERT_OTF' function module, but here i'm getting blank PDF internal table....
    what am i missing in both ?
    my intention is converting otf to pdf and emailing...though there are thousands of similar threads are available , none of them are related to my exact problem, which is logo is getting mixed up or disturbed.... any suggestions ?
    Thanks in advance

    Hi,
    You need to use the function module SX_OBJECT_CONVERT_OTF_PDF to create the PDF from OTF ..
    Here is an example program
    report ZPDFPRNT no standard page heading.
    TABLES: TST05.
    DATA: BEGIN OF ITAB OCCURS 0,
       TLINE(255),
    END OF ITAB.
    DATA: BEGIN OF ITAB2 OCCURS 0,
      TLINE(255),
    END OF ITAB2.
    DATA: BEGIN OF ITAB3 OCCURS 0,
      TLINE(255),
    END OF ITAB3.
    DATA: BEGIN OF OTF_TAB OCCURS 0,
      TLINE(255),
    END OF OTF_TAB.
    DATA: LEN_OUT LIKE SOOD-OBJLEN.
    DATA: LEN_IN LIKE SOOD-OBJLEN.
    DATA: BEGIN OF DATA_SET OCCURS 200,
      DATA_LENGTH(5),
      PRECOL(1),
      DATA_LINE(1000),
    END OF DATA_SET.
    DATA: BEGIN OF OTF_PAGE OCCURS 200.
      INCLUDE STRUCTURE ITCOO.
    DATA: END OF OTF_PAGE,
    OTF_PAGES TYPE P,
    OTF_MAX_PAGES TYPE P VALUE 10.
    DATA: BEGIN OF OTF_CONTROL.
      INCLUDE STRUCTURE ITCPP.
    DATA: END OF OTF_CONTROL,
    FORCE_RAW_OTF VALUE ' ',
    L100_EXCLUDE(4) VALUE 'OTFJ',
    BEGIN OF OTF_PAGE_INDEX OCCURS 20,
      LINE_NUM TYPE P,
    END OF OTF_PAGE_INDEX,
    CUR_OTF_PAGE VALUE 1.
    DATA: DATA_SET_LINECOUNT TYPE P,
    DATA_SET_MAX_LINES TYPE P VALUE 100000,
    DATA_SET_VALID TYPE C VALUE ' ',
    DATA_SET_IS_OTF TYPE C VALUE ' ',
    DATA_SET_LENGTH(5) TYPE C,
    LINE_SPECIAL LIKE DATA_SET-DATA_LINE,
    NEED_LINE_SPECIAL TYPE C,
    DSN_TYPE(8) TYPE C.
    DATA: FCODE(4) TYPE C,
    DATE TYPE D,
    TIME TYPE T,
    RC(10) TYPE C,
    ERRMSG(100) TYPE C,
    PRINTJOB_CREATED(1) TYPE C,
    PRINTJOB_CLEARED(1) TYPE C,
    PRINTJOB_LIST(1) TYPE C,
    DISPLAY_MODE(1) TYPE C,
    LINE_MAX TYPE P VALUE '100000',
    NEW_SCREEN_300(1) TYPE C,
    MULTI_PRINT_300(1) TYPE C,
    PRINT_ALL_300(1) TYPE C,
    PRINT_COUNT_300 TYPE I,
    SHOW_USER_100 TYPE C VALUE ' ',
    ERROR_DISPLAY_LEVEL TYPE C VALUE '9',
    NEXT_ERROR_DISPLAY_LEVEL TYPE C,
    PREV_ERROR_DISPLAY_LEVEL TYPE C,
    START_300(5) TYPE C, END_300(5) TYPE C,
    SEP LIKE SY-VLINE,
    DEFAULT_PRI,
    TSP01_BUF LIKE TSP01,
    TSP01_CURLINE LIKE SY-STARO,
    TSP01_CURCOL LIKE SY-CUCOL,
    TSP01_CURROW LIKE SY-CUROW.
    DATA: BEGIN OF DATA_SET_LINE,
      DATA_LENGTH(5),
      PRECOL(1),
    DATA_LINE(1000),
    END OF DATA_SET_LINE.
    DATA: STATUS LIKE SY-SUBRC.
    DATA: WGF_MESSAGE(80).
    DATA: H_PATH(20) TYPE C.
    DATA: H_MASK(20) TYPE C VALUE ',.pdf ,.pdf. '.
    DATA: FILE_NAME(20).
    DATA: FILENAME LIKE RLGRAP-FILENAME.
    DATA: IMPORT(132).
    PARAMETERS: IDENT(5) TYPE C.
    PERFORM GET_OTF_TAB.
    LOOP AT OTF_PAGE.
       OTF_TAB-TLINE = OTF_PAGE.
       APPEND OTF_TAB.
    ENDLOOP.
    CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
    EXPORTING
      FORMAT_SRC = 'OTF'
      FORMAT_DST = 'PDF'
      DEVTYPE = 'ASCIIPRI'
      LEN_IN = LEN_IN
    IMPORTING
      LEN_OUT = LEN_OUT
    TABLES
      CONTENT_IN = OTF_TAB
      CONTENT_OUT = ITAB2
    EXCEPTIONS
      ERR_CONV_FAILED = 1
      OTHERS = 2.
    PERFORM GET_PATH USING 'PDF_FILE'.
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
      FILENAME = FILENAME
      FILETYPE = 'BIN'
      BIN_FILESIZE = LEN_OUT
    TABLES
      DATA_TAB = ITAB2
    EXCEPTIONS
      FILE_OPEN_ERROR = 1
      FILE_WRITE_ERROR = 2
      INVALID_FILESIZE = 3
      INVALID_TABLE_WIDTH = 4
      INVALID_TYPE = 5
      NO_BATCH = 6
      UNKNOWN_ERROR = 7
      OTHERS = 8.
    *& Form GET_OTF_TAB
    FORM GET_OTF_TAB.
    DATA: PART(4) VALUE '0001',
    BEGIN OF MSG,
      A(40),
      B(40),
      C(40),
    END OF MSG.
    REFRESH DATA_SET.
    DATA_SET_LINECOUNT = 0.
    DATA_SET_IS_OTF = ' '.
    OTF_PAGES = 0.
    REFRESH OTF_PAGE_INDEX.
    CALL 'RSPOACSD'.
    SELECT * FROM TST05 WHERE DTHREAD = 'X'.
    CALL 'RSPOAOSD'
    ID 'ID' FIELD IDENT
    ID 'TYPE' FIELD TST05-DTYPE
    ID 'RECTYP' FIELD 'VYL----'
    ID 'RC' FIELD RC
    ID 'ERRMSG' FIELD ERRMSG.
    STATUS = SY-SUBRC.
    IF STATUS = 0.
      DSN_TYPE = TST05-DTYPE.
      IF DSN_TYPE(3) = 'OTF'.
        DATA_SET_IS_OTF = 'X'.
      ENDIF.
    ENDIF.
    IF STATUS <> 24. EXIT. ENDIF.
    ENDSELECT.
    DATA_SET_VALID = 'X'.
    DATA_SET_MAX_LINES = ( LINE_MAX * '1.1' ) + 100.
    DO.
    CLEAR: DATA_SET_LINE, DATA_SET_LENGTH.
    CALL 'RSPOARSD'
    ID 'BUFF' FIELD DATA_SET_LINE+5
    ID 'DATALEN' FIELD DATA_SET_LENGTH
    ID 'RC' FIELD RC
    ID 'ERRMSG' FIELD ERRMSG.
    STATUS = SY-SUBRC.
    IF STATUS = 36.
    WHILE STATUS = 36.
    CALL 'RSPOACSD'
    ID 'RC' FIELD RC
    ID 'ERRMSG' FIELD ERRMSG.
    ADD 1 TO PART.
    IF DATA_SET_IS_OTF = ' '.
    CALL 'RSPOAOSD'
    ID 'ID' FIELD IDENT
    ID 'TYPE' FIELD DSN_TYPE
    ID 'PART' FIELD PART
    ID 'RECTYP' FIELD 'VYL----'
    ID 'RC' FIELD RC
    ID 'ERRMSG' FIELD ERRMSG.
    ELSE.
    CALL 'RSPOAOSD'
    ID 'ID' FIELD IDENT
    ID 'PART' FIELD PART
    ID 'TYPE' FIELD DSN_TYPE
    ID 'RECTYP' FIELD 'VYL----'
    ID 'RC' FIELD RC
    ID 'ERRMSG' FIELD ERRMSG.
    ENDIF.
    IF SY-SUBRC NE 0. EXIT. ENDIF.
    CLEAR: DATA_SET_LINE, DATA_SET_LENGTH.
    CALL 'RSPOARSD'
    ID 'BUFF' FIELD DATA_SET_LINE+5
    ID 'DATALEN' FIELD DATA_SET_LENGTH
    ID 'RC' FIELD RC
    ID 'ERRMSG' FIELD ERRMSG.
    STATUS = SY-SUBRC.
    ENDWHILE.
    ENDIF.
    IF STATUS <> 0 AND STATUS <> 40. EXIT. ENDIF.
    DATA_SET = DATA_SET_LINE.
    IF NOT ( DATA_SET_LENGTH IS INITIAL ).
    DATA_SET-DATA_LENGTH = DATA_SET_LENGTH - 1.
    ENDIF.
    APPEND DATA_SET.
    ADD 1 TO DATA_SET_LINECOUNT.
    IF DATA_SET_IS_OTF = ' '.
    IF DATA_SET_LINECOUNT >= DATA_SET_MAX_LINES.
    CLEAR DATA_SET.
    APPEND DATA_SET.
    MOVE '----
    ' TO DATA_SET-DATA_LINE.
    APPEND DATA_SET.
    CLEAR DATA_SET.
    APPEND DATA_SET.
    WRITE: 'Abbruch nach'(029) TO MSG-A.
    WRITE: DATA_SET_MAX_LINES TO MSG-B.
    WRITE: 'Zeilen.'(030) TO MSG-C.
    CONDENSE MSG.
    DATA_SET-DATA_LINE = MSG.
    APPEND DATA_SET.
    EXIT.
    ENDIF.
    ELSE.
    MOVE DATA_SET_LINE-DATA_LINE TO OTF_PAGE.
    APPEND OTF_PAGE.
    IF OTF_PAGE(2) = 'EP'.
      ADD 1 TO OTF_PAGES.
      IF OTF_PAGES >= OTF_MAX_PAGES.
        MESSAGE S229(PO) WITH OTF_MAX_PAGES.
        EXIT.
      ENDIF.
    ELSEIF OTF_PAGE(2) = 'OP'.
      OTF_PAGE_INDEX-LINE_NUM = DATA_SET_LINECOUNT.
      APPEND OTF_PAGE_INDEX.
    ENDIF.
    ENDIF.
    ENDDO.
    IF STATUS <> 0 AND STATUS <> 12.
      CALL 'RSPOACSD'.
      MESSAGE E112(PO) WITH STATUS RC ERRMSG.
    ENDIF.
    CALL 'RSPOACSD'.
    STATUS = SY-SUBRC.
    IF STATUS <> 0.
      MESSAGE E112(PO) WITH STATUS RC ERRMSG.
    ENDIF.
    ENDFORM. " GET_OTF_TAB
    *& Form GET_PATH
    FORM GET_PATH USING P_FILENAME.
    CLEAR: H_PATH, FILE_NAME.
    FILE_NAME = P_FILENAME.
    CALL FUNCTION 'WS_QUERY'
    EXPORTING
    QUERY = 'CD' "// Current Directory
    IMPORTING
    RETURN = H_PATH.
    CONCATENATE FILE_NAME '.pdf' INTO FILE_NAME.
    CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
      DEF_FILENAME = FILE_NAME
      DEF_PATH = H_PATH
      MASK = H_MASK
      MODE = 'O'
    IMPORTING
      FILENAME = FILENAME"dbname
    EXCEPTIONS
      INV_WINSYS = 1
      NO_BATCH = 2
      SELECTION_CANCEL = 3
      SELECTION_ERROR = 4
      OTHERS = 5.
    ENDFORM. " GET_PATH
    Regards
    Sudheer

  • How to handle field symbols internal table values?

    HI all,
              I declared field string as below.The below code is working fine.
    Data : ITAB TYPE STANDARD TABLE OF YAPOPLN, (Custom table).
              wa_itab like line of ITAB.
    field-symbol : <fs> type ITAB.
    ASSIGN PARAM TO <FS>
    LOOP AT <FS> INTO WA_ITAB.
    WRITE:/ 'ABC'.
    ENDLOOP.
    But my requirement is that I dont want all the fields of the table YAPOPLN.My output contains only 2 fields of the table YAPOPLN,which contains total 4 fields.According to my requirement only 2 fields will be getting into one parameter PARAM(this is function module parameter,which is from ALV classes) from the user entered output,which contains only 2 fields.So the above code is not working properly because wa_itab contains 4 fields and giving short dump.
    If I am declaring the internal table with the required fields(only 2 fields) and referring that internal table to field symbol <FS>
    Data : BEGIN OF ITAB1 OCCURS 0,
             FIELD1 LIKE YAPOPLN-FIELD1,
             FIELD2 LIKE YAPOPLN-FIELD2,
             END OF ITAB1.
    field-symbol : <fs> LIKE ITAB1 OR  <FS> TYPE ANY.
    DATA :WA_ITAB1 LIKE LINE OF ITAB1.
    ASSIGN PARAM TO <FS>
    LOOP AT <FS> INTO WA_ITAB.
    WRITE:/ 'ABC'.
    ENDLOOP.
    But when I am compiling this code i am getting the below error.I am gettting the same below error when even <FS> is also declared as <FS> TYPE ANY.
    .'FS' is not an internal table or defined in TABLES.
    Can anyone help me in this regard?
    Thanks,
    Balaji

    Hello,
    Try this way:
    If both the type of internal tables are same then you can directly assign dynamic internal table to static internal table.
    itab = <itab>.
    Suppose you have field symbol internal table <itab> which is different in structure from ITAB.
    Now, you can create <wa> as follow:
    FIELD-SYMBOLS <wa>.
    DATA wa TYPE REF TO DATA.
    CREATE DATA wa TYPE LINE OF <itab>.
    ASSIGN wa->* to <wa>.
    This way your work area is read.
    Using [ASSIGN COMPONENT|http://help.sap.com/saphelp_nw04/helpdata/EN/fc/eb3923358411d1829f0000e829fbfe/content.htm] syntax you can read required component of <wa>.
    Finally you can use that value to load static internal table.
    You can also refer to my thread on [Dynamic table|Re: Creating Dynamic table].
    Hope this helps!
    Thanks,
    Augustin.
    Edited by: Augustarian on Aug 20, 2009 10:06 AM

  • I am getting problem with internal table & work area declaration.

    I am working with 'makt' table ..with the table makt i need to work with styles attributes ..so i declared like this
    TYPES : BEGIN OF ty_makt,
             matnr TYPE makt-matnr,
             spras TYPE makt-spras,
             maktx TYPE makt-maktx,
             maktg TYPE makt-maktg,
             celltab TYPE lvc_t_styl,
           END OF ty_makt.
    DATA : i_makt TYPE TABLE OF ty_makt.
    DATA : wa_makt TYPE ty_makt .
        But end of program i need to update dbtable "makt"...i am getting problem with internal table & work area declaration.
    i think makt table fields mapping and internal table/work area mapping is not correct. so please help me to get out from this.

    Hi Nagasankar,
    TYPES : BEGIN OF TY_MATNR,
                  MATNR TYPE MAKT-MATNR,
                  SPRAS TYPE MAKT-SPRAS,
                  MAKTX TYPE MAKT-MAKTX,
                  MAKTX TYPE MAKT-MAKTG,
                  CELLTAB TYPE LVC_T_STYL,  " Its Working perfectly fine..
                 END OF TY_MAKT.
    DATA: IT_MAKT TYPE STANDARD TABLE OF TY_MAKT,
              WA_MAKT TYPE TY_MAKT.
    Its working perfectly fine. if still you are facing any issue post your complete code.
    Thanks,
    Sandeep

  • How to add the contents of a field of internal table.

    Hello Everybody,
    How to sum up the individual field from a internal table. Like i have a internal table that has menge field , I need to sum up the menge field for each matnr..
    exm : for each matnr there are 5 menge entries, I need to add all the menge fields and shud be put against the matnr .
    Thanks,

    Hi Khaleel,
    One more option is using the "collect" statement.....
    imagine in the internal table itab..we have 2 fields only..
    MATNR,MENGE,
    we have 2 internal tables itab1 and itab2...
    loop at itab1.
    collect itab1 to itab2.
    endloop.
    Action performed is ...for the same MATNR...menge gets added and saved as a single record...When matnr changes...new record is Appended
    another case is we have 3 fields in internal table
    MATNR,UNIT,MENGE
    imagine we hane the records
    Material1 KG  100
    Material1 LT   20
    Material1 LT   200
    MAterial2 KG 100
    in this case...the output will be
    Material1 KG 100
    Material1 LT  220
    MAterial2 KG 100
    Reason is that the fields before the addable value is checked for similarity..
    here field UNIT is also checked and also MATNR before adding up....
    Hope it gave you some alternative idea to proceed with....
    Reward if helpful
    Regards
    Byju

  • Read contents of changing fields from internal table

    Hi Folks,
    Please help me in my query below:
    Consider there is a Z-table with two fields TABNAM and FIELD having values KNA1 and NAME1 respectively.
    In my report I have fetched entries for customers from KNA1. Now based on the field from Z-table I want to populate a variable suppose V_FREE_VAR with the value from KNA1 table.
    Here V_FREE_VAR is of CHAR200 so that it accomodate all types of values from KNA1.
    The value of Z-table FIELD can change daily i.e next day the value may be PSTLZ.
    So how can I read the particular field from internal table as the field to be read is dynamic.
    Note: using case is not feasible.
    Thanks in advance.
    Regards,
    Shardul

    @Hartmut P
    As Rob said i want to get the value of the field from internal table. the code is something like this.
    I_KNA1 contains records for customers.
    Suppose values of Z-table are in internal table I_TEMP_TABLE.
    Entries in I_TEMP_TABLE are as follows
    TABNAME      FIELDNAME
    KNA1                 NAME1
    The value of FIELNAME in Z-table can be changed
    Loop at I_TEMP_TABLE into WA_TEMP_TABLE.
    Read I_KNA1 into WA_KNA1 with key KUNNR = '0001002234'.
    IF SY-SUBRC EQ 0.
       CASE WA_TEMP_TABLE-FIELDNAME.
            WHEN 'NAME1'.
                 V_VAR = WA_KNA1-NAME1.
             WHEN 'PSTLZ'
                  V_VAR = WA_KNA1-PSTLZ.
    ENDIF.
    But using case is not appropriate as KNA1 contains 176 fields.

  • GET statement and internal table

    Hi community,
    I use the GET statement and I want to use some older code segments.
    I read somewhere that I can use the result of GET like an internal table.
    So I tried to get the content of bsid into my internal table it_bsid. But that doesn't seem to work.
    Do you have any advice in this?
    I wanted to do the following:
    TABLES:
            KNA1,
            BSID,
            BKPF.
    DATA:
          it_bsid TYPE TABLE OF bsid WITH HEADER LINE,
          is_bsid LIKE LINE OF it_bsid,
    GET bsid.
    LOOP AT bsid.
      APPEND it_bsid.
    ENDLOOP.
    -or-
    GET bsid.
    LOOP AT bsid INTO is_bsid.
      APPEND is_bsid TO it_bsid.
    ENDLOOP.
    But in both cases I get an error.
    ' "VERSION ... ." expected after "BSID" '
    Do you know what is the reason for that?
    Regards
    Tobias
    Edited by: Tobias Oelschlaeger on Feb 29, 2008 4:18 PM

    Hi Tobias,
    first you have to assign a logical database which has BSID to your program (in program attributes).
    Then GET is the event triggered by the next BSID record according to your selection. You can not LOOP here but you may append to an internal table. This table may be processed using LOOP in the END-OF-SELECTION event.
    Read some documentation about LDB [Logical Databases|http://help.sap.com/erp2005_ehp_01/helpdata/en/f0/ca4584260211d28a430000e829fbbd/content.htm] - it may help to understand the concept of this obsolete technique.
    Regards,
    Clemens

  • How to move field symbol internal table to internal table with header line?

    Dear all,
    hi...hereby i would like to ask how i can move field symbol internal table to a internal table?
    as i know field symbol internal table is without header line..
    so, may i know how to do this....to move field symbol internal table to internal table which consist of header line and field and record will same as field symbol internal table...in additional, my field symbol internal table is dynamic table mean everytime will have flexible columns..?
    Please advise...
    Thanks
    Regard,
    ToToRo.
    Edited by: @ToToRo@ on Aug 20, 2009 6:16 AM

    Hello,
    Try this way:
    If both the type of internal tables are same then you can directly assign dynamic internal table to static internal table.
    itab = <itab>.
    Suppose you have field symbol internal table <itab> which is different in structure from ITAB.
    Now, you can create <wa> as follow:
    FIELD-SYMBOLS <wa>.
    DATA wa TYPE REF TO DATA.
    CREATE DATA wa TYPE LINE OF <itab>.
    ASSIGN wa->* to <wa>.
    This way your work area is read.
    Using [ASSIGN COMPONENT|http://help.sap.com/saphelp_nw04/helpdata/EN/fc/eb3923358411d1829f0000e829fbfe/content.htm] syntax you can read required component of <wa>.
    Finally you can use that value to load static internal table.
    You can also refer to my thread on [Dynamic table|Re: Creating Dynamic table].
    Hope this helps!
    Thanks,
    Augustin.
    Edited by: Augustarian on Aug 20, 2009 10:06 AM

  • How To select maximum Value in a specifieid field in internal table.

    How To select maximum Value in a specifieid field in internal table?

    Step : 1
    Sort itab by <Field1> descending.
    Just sort the internal table by the field.
    STEP: 2
    Then read the table at index 1.
    Read table itab index 1.               
    ITAB-FIELD = MAX .                  " Max field will come in the first row of the internal table.
    Regards,
    Gurpreet

  • Assign function code to a field in internal table

    Hi all,
    Can we assign a function code to one field in internal table so that we can use it as an user command in list display.
    For ex:
    data : begin of itab occurs 0,
              check(1) type C,
              num type I,
             end of itab.
    I am preparing a list display using WRITE statements.
    I'ld like to update the checked value of check box as soon as the user selects a  check box. So I would like to assign a function code to this check box. Then I can use AT user-command.

    Hi,
    dinesh's apporach is not bad, but
    1. the structure' name cannot be part of the component
    2. you need to make sure the component-name always is in upper case.
    Try adapting the following code:
    data: begin of wa_test,
              field01 type string,
              field02 type string,
              field03 type string,
           end of wa_test.
    data:  l_fieldname  type string,
           l_counter    type string.
    field-symbols: <testc> type string.
    do 3 times.
      l_counter = sy-index.
      concatenate 'field0' l_counter into l_fieldname.
      translate l_fieldname to upper case.
      assign component l_fieldname of structure wa_test to <testc>.
      if <testc> is assigned.
        <testc> = 'any value'.
      endif.
    enddo.
    write / wa_test-field01.
    best regards

  • How to get the final internal table after the ALV is modified?

    Dear experts,
    My WebDynpro application allows users to delete row, sort the column. After all this modification, I need to get the final internal table of ALV to generate a csv.file. Are there any methods to get the final interal table content of ALV?
    Many thanks!
    meer

    Hi Friend  ,
    Please see this  link for wiki of  WDA Alv Hierarchy : [http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/c060fcb4-2c62-2b10-d2b2-f32407a5cc6f&overridelayout=true]
    Regards,

  • Getting the final internal table of a transaction VA05

    Hi,
    Can anyone help me in getting the final internal table of a transaction VA05 when called from a program. I need to use to this internal table for further processing.
    Thanks in advance,
    Vinay.

    Hi,
    Not quite sure what you are after but the following may help.
    For a start VA05 uses FM RV_SALES_DOCUMENT_VIEW_3 to select it's data.  Your program could simply call this.  However, if you are doing a CALL TRANSACTION from your program to VA05 and you want to get the results back then you could utilise some 'old style' userexits available in VA05.
    Two choices here:
    1. At the end of FM RV_SALES_DOCUMENT_VIEW_3 there is a form END_MODIFICATION or
    2. When VA05 calls RV_SALES_DOCUMENT_VIEW_3 it performs a user sort MV75AFZ1(MV75AFZ1)
    Both of these belong to package VMOD which means you can modify them by simply registering the object in OSS (these are 'old style' exits before SMOD/CMOD and are prevelant in SD)
    From either of these you could EXPORT to memory for when control is returned back to your program.
    Thanks,
    Pete

  • Fields in internal table

    Hi,
      How to get number of fields in an internal table?
      Please send a solution.
    Thanks & Regards,
    Vani.

    Hi,
    you can find the number of columns and their order using
    the <b>'REUSE_ALV_FIELDCATALOG_MERGE'</b>
    call function 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               = sy-repid
       I_INTERNAL_TABNAME           = 'ITAB'
       I_INCLNAME                   = sy-repid
      changing
        ct_fieldcat                  = IT_FIELDCAT
    EXCEPTIONS
       INCONSISTENT_INTERFACE       = 1
       PROGRAM_ERROR                = 2
       OTHERS                       = 3
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif
    now describe your fieldcat . and find no of columns.
    and their order also..
    Regards
    vijay

  • Function module to get data into internal table from Excel file sheets

    Hi,
    I have to upload customers from excel file.
    we are donloading customer data excel file sheets.
    Customer data in 1 sheet, tax data the other sheet of same excel file, Customer master-Credit data in other sheet of same excel file.
    so i have 3-4 sheet in one excel file.
    now my requirement is to get the data from excel file into internal table.
    is there any function module.
    Thanks & Regards

    I am sending you the idea with an example how you can upload data from an EXCEL file into an internal table. I am not sure if you can take data from different sheet in the same EXCEL file. I think that this is not possible (try it )
    Upload the data into an internal table, like the way that I am describing in the above:
      DATA: L_MAX_COL_NB TYPE I.
      DATA: l_file_name LIKE RLGRAP-FILENAME.
    Just to be sure that is the correct type for the FM.
      l_file_name = P_FILE_NAME.
      L_MAX_COL_NB = 58.  "Maximum nb of colums that the FM can read.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           EXPORTING
                FILENAME                = l_file_name
                I_BEGIN_COL             = 1
                I_BEGIN_ROW             = 2
                I_END_COL               = L_MAX_COL_NB
                I_END_ROW               = 9999
           TABLES
                INTERN                  = PT_EXCEL
           EXCEPTIONS
                INCONSISTENT_PARAMETERS = 1
                UPLOAD_OLE              = 2
                OTHERS                  = 3.
      IF SY-SUBRC <> 0.
      ENDIF.
    Now you should upload the data into your own itab. The Function Module will return to you all the an itab
    from all fields and columns. Define the structure of the uploading file into SE11 - Data Dictionary. Then read the fieldcatalog of this structure. In the code that I am sending to you, I am insearting an empty line into the internal table and then I am assigning this line into a corresponding field-symbol. Then I am able to change the working area - so and the line of the itab. Propably you could you the statement APPEND INITIAL LINE TO (your_table_name) ASSIGNING <your_field_symbol>, but the example was written in an old SAP version.
      FIELD-SYMBOLS:
                     <F_REC> LIKE WA_UPLOAD_FILE,      "working are of the uploading file
                     <F_FIELD> TYPE ANY.
      DATA: COLUMN_INT TYPE I,
            C_FIELDNAME(30) TYPE C.
      PERFORM GET_FIELDCATOLG TABLES FIELDCAT
                               USING 'ZECO_CHARALAMBOUS_FILE'.
      LOOP AT PT_EXCEL.
        AT NEW ROW.
          ASSIGN WA_UPLOAD_FILE TO <F_REC>.
        ENDAT.
        COLUMN_INT = PT_EXCEL-COL.
        READ TABLE FIELDCAT INTO WA_FIELDCAT INDEX COLUMN_INT.
        CONCATENATE '<F_REC>-' WA_FIELDCAT-FIELDNAME INTO C_FIELDNAME.
        ASSIGN (C_FIELDNAME) TO <F_FIELD>.
        <F_FIELD> = PT_EXCEL-VALUE.
        AT END OF ROW.
          APPEND WA_UPLOAD_FILE TO GT_UPLOAD_FILE.
          CLEAR WA_UPLOAD_FILE.
        ENDAT.
      ENDLOOP.
    With Regards
    George
    Edited by: giorgos michaelaris on Mar 4, 2010 3:44 PM

  • Getting data into internal table wa_final

    Hi Guys
    I have change the logic for this program , I have created 2 workareas and internal table now I need help to place the data into
         wa_final-max_date = wa_data-idate.
             wa_final-min_date  = wa_data-idate.
             wa_final-max_km  = wa_data-recdv.
             wa_final-min_km  = wa_data-recdv.
             wa_final-max_hR   = wa_data-recdv.
             wa_final-min_hR   = wa_data-recdv.
             wa_final-max_lit  = wa_data-recdv.
             wa_final-min_lit  = wa_data-recdv.
             wa_final-t_max_min_km   = wa_data-recdv.  " min_km - max_km
             wa_final-t_max_min_hr  = wa_data-recdv.   " min_hr - max_hr
             wa_final-t_max_min_lit  = wa_data-recdv.  " min_lit - max_lit.
    so how can I put the logic to the value please correct my program.seeing my program can anyone give some idea ?
    REPORT Z_FUEL_MONTHLY_QTY LINE-SIZE  260 LINE-COUNT 75
             NO STANDARD PAGE HEADING.
    TABLES : equi,
             equz,
             imptt,
             imrg,
             eqkt,
             iloa.
    Type Declaration
    *DATA: BEGIN OF ty_equi occurs 0,
         equnr type equi-equnr,
         END OF ty_equi.
    *DATA: BEGIN of ty_eqkt occurs 0,
         equnr type eqkt-equnr,
         eqktx type eqkt-eqktx,
         END OF ty_eqkt.
    *DATA: BEGIN of ty_iloa occurs 0,
         iloan type iloa-iloan,
         eqfnr type iloa-eqfnr,
         END OF ty_iloa.
    *DATA: BEGIN of ty_imptt occurs 0,
         mpobj type imptt-mpobj,
         END of ty_imptt.
    *DATA: BEGIN of ty_imrg occurs 0,
         idate type imrg-idate,
         recdv type imrg-recdv,
         recdu type imrg-recdu,
         END of ty_imrg.
    TYPES:  BEGIN OF ty_data  ,
             equnr      type equnr,         " Euipment no
             eqktx      type eqkt-eqktx,    " Equipment Text
             eqfnr       type iloa-eqfnr,     " Equipment Sort field
             idate      type imrg-idate,    " Measuring Date
             recdu      type imrg-recdu,    " Unit of measuring ='KM','L','H'
             recdv      type imrg-recdv,    " Counter reading data
           END OF ty_data.
    TYPES: BEGIN OF ty_final,
             equnr           type equnr,            "  Equipment no
             eqktx           type eqkt-eqktx,       "  Equipment Text
             eqfnr           type iloa-eqfnr,       "  Equipment Sort field
             min_date        type imrg-idate,       "  Min Date
             min_km          type p decimals 2,     "  Max Km
             max_km          type p decimals 2,     "  Min km
             t_max_min_km    type i,                "  Total min_km-max_km
             max_date        type imrg-idate,       "  Max Date
             min_hr          type imrg-recdv,       "  Max hr
             max_hr          type imrg-recdv,       "  Min hr
             t_max_min_hr    type i,                "  Total min_hr-max_hr
             min_lit         type imrg-recdv,       "  Max lit
             max_lit         type imrg-recdv,       "  Min lit
             t_max_min_lit   type i,                "  Total min_lit-max_lit
             fuel_con        type p decimals 2,     "  Total_hrs / t_max_min_hr
             km_l            type p decimals 2,     "  km / L
             lit_per_hr      type i           ,     "  fuel comsumed / t_max_min_hr
           END OF ty_final.
    DATA: i_data TYPE TABLE OF ty_data, " internal table
    wa_data TYPE ty_data, " work area
    i_final TYPE TABLE OF ty_final, " internal table
    wa_final TYPE ty_final. " work area
    DATA :  max_date type date ,
             min_date type date,
             max_km TYPE p DECIMALS 2,
             min_km TYPE p DECIMALS 2,
             max_hr TYPE p DECIMALS 2,
             min_hr TYPE p DECIMALS 2,
             max_lit TYPE p DECIMALS 2,
             min_lit TYPE p DECIMALS 2,
             t_max_min_km  TYPE p DECIMALS 2,
             t_max_min_hr TYPE p DECIMALS 2,
             t_max_min_lit TYPE p DECIMALS 2.
    SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME.
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: p_equnr FOR equi-equnr, "no-extension no intervals,
                    p_idate FOR imrg-idate.  "NO-EXTENSION NO INTERVALS OBLIGATORY,
                    "p_recdu FOR imrg-recdu NO-EXTENSION NO INTERVALS ."default 'M3'" OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
    SELECTION-SCREEN END OF BLOCK blk2.
    SELECTION-SCREEN END OF BLOCK blk.
    TOP-OF-PAGE.
      FORMAT INTENSIFIED ON.
      WRITE:/1(40) ' INVESTMENT LIMITED  '.
      WRITE:/50(40) ' FUEL CONSUMPTION REPORT ' CENTERED   ,
              2 'Page', sy-pagno.
      FORMAT INTENSIFIED OFF.
      WRITE:/50(40) '----
    ' CENTERED .
      FORMAT INTENSIFIED ON.
      WRITE:/2 sy-datum COLOR 3, sy-uzeit .
      "WRITE:/1 S903-SPMON ."p_yearf.
      ULINE.
      "CENTERED.
      write: /2 'Date From     :'.
      write: /2 'Equipment No  :'.
      write: /2 'Unit          :'.
      SKIP.
      ULINE.
      WRITE:/1 sy-vline,
        2   'EQUIP NO',              10 sy-vline,
        11  'NAME',                  40 sy-vline,
        41  'SORT',                  60 sy-vline,
        61  'MIN DATE',              74 sy-vline,
        75  'MAX DATE',              87 sy-vline,
        88  'MIN KM',                100 sy-vline,
        101  'MAX KM' ,              113 sy-vline,
        114 'TOTALK',                126 sy-vline,
        127  'MIN HR',               139 sy-vline,
        140 'MAX HR',                152 sy-vline,
        153 'TOTALH' ,               167 sy-vline,
        168 'MIN LIT',               180 sy-vline,
        181 'MAX LIT',               193 sy-vline,
        194 'TOTALL',                206 sy-vline,
        207 'FUEL CON',              219 sy-vline,
        220 'KM L',                  232 sy-vline,
        233 'LIT PER KM',            246 sy-vline.
      FORMAT COLOR 3 ON.
      ULINE.
    END-OF-PAGE.
    START-OF-SELECTION.
    select a~equnr d~eqktx f~eqfnr e~idate e~recdu e~recdv
    into table i_data
    from equi AS a
    inner join equz as b
    on a~equnr = b~equnr
    inner join iloa as f
    on b~iloan = f~iloan
    inner join imptt as c
    on a~objnr = c~mpobj
    inner join eqkt as d
    on a~equnr = d~equnr
    inner join imrg as e
    on e~point = c~point
    where a~equnr in p_equnr
    and
    e~idate in p_idate.
    loop  at i_data into wa_data.
    CLEAR: wa_final.
      READ TABLE i_final into wa_final
               with key equnr = wa_data-equnr.
        if sy-subrc EQ 0.
          PERFORM prepare_final_rec USING'M'. " Modify Existing Record
         ElSE.
          PERFORM prepare_final_rec USING'A'. " Append New Record.
        ENDIF.
        ENDLOOP.
        LOOP AT i_final into wa_final.
        WRITE:/1 sy-vline,
    2  wa_final-equnr                                                 , 10 sy-vline,
    11 wa_final-eqktx                                                 , 40 sy-vline,
    41 wa_final-eqfnr                                                 , 60 sy-vline,
    61 wa_final-min_date                                              , 74 sy-vline,
    75 wa_final-max_date                                              , 87 sy-vline,
    88 wa_final-min_km EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED           , 100 sy-vline,
    101 wa_final-max_km EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED          , 113 sy-vline,
    114 wa_final-t_max_min_km EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED    , 126 sy-vline,
    127 wa_final-min_hr EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED          , 139 sy-vline,
    140 wa_final-max_hr EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED          , 152 sy-vline,
    153 wa_final-t_max_min_hr EXPONENT 0 DECIMALS 2  LEFT-JUSTIFIED   , 167 sy-vline,
    168 wa_final-min_lit EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED         , 180 sy-vline,
    181 wa_final-max_lit EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED         , 193 sy-vline,
    194 wa_final-t_max_min_lit EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED   , 206 sy-vline,
    207 wa_final-fuel_con EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED        , 219 sy-vline,
    220 wa_final-km_l EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED            , 232 sy-vline,
    233 wa_final-lit_per_hr EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED      , 246 sy-vline.
    ULINE.
    endloop.
    FORM prepare_final_rec  USING    p_mode TYPE char1.
    SORT i_data BY equnr idate descending .
            if wa_data-recdu = 'KM'.
            max_km = wa_data-recdv.
            min_km = wa_data-recdv.
            endif.
            if wa_data-recdu ='H'.
            max_hr = wa_data-recdv.
            min_hr = wa_data-recdv.
            endif.
            if wa_data-recdu ='L'.
            max_lit = wa_data-recdv.
            min_lit = wa_data-recdv.
           endif.
       at new equnr.
           read table i_final into wa_final index sy-tabix.
           write:/ wa_final-equnr, wa_final-eqktx ,wa_final-eqfnr ,wa_final-idate ,
           'Min KM',min_km EXPONENT 0 DECIMALS 2 color 7 ,
            'Min H',min_hr EXPONENT 0 DECIMALS 2 color 7 ,
             'Min L',min_lit EXPONENT 0 DECIMALS 2 color 7.
       endat.
    *at end of equnr.
           read table i_data into wa_data index sy-tabix.
           write:/ wa_final-equnr, wa_final-eqktx ,wa_final-eqfnr ,wa_final-idate ,
           'Max KM', max_km EXPONENT 0 DECIMALS 2 color 7,
           'Max H', max_hr EXPONENT 0 DECIMALS 2 color 7,
           'Max L', max_lit EXPONENT 0 DECIMALS 2 color 7.
    *endat.
             wa_final-max_date = wa_data-idate.
             wa_final-min_date  = wa_data-idate.
             wa_final-max_km  = wa_data-recdv.
             wa_final-min_km  = wa_data-recdv.
             wa_final-max_hR   = wa_data-recdv.
             wa_final-min_hR   = wa_data-recdv.
             wa_final-max_lit  = wa_data-recdv.
             wa_final-min_lit  = wa_data-recdv.
             wa_final-t_max_min_km   = wa_data-recdv.  " min_km - max_km
             wa_final-t_max_min_hr  = wa_data-recdv.   " min_hr - max_hr
             wa_final-t_max_min_lit  = wa_data-recdv.  " min_lit - max_lit.
      IF p_mode = 'A'.
        wa_final-equnr = wa_data-equnr.
        wa_final-eqktx = wa_data-eqktx.
        wa_final-eqfnr = wa_data-eqfnr.
        APPEND wa_final TO i_final.
      ELSE.
        MODIFY i_final FROM wa_final
          TRANSPORTING
              max_date
              min_date
              max_km
              min_km
              max_hr
              min_hr
              max_lit
              min_lit
              t_max_min_km
              t_max_min_hr
              where equnr = wa_data-equnr.
      ENDIF.
    ENDFORM.                    " PREPARE_FINAL_REC
    regards;

    Hi
    Thanks , where to use the loop and endloop.
    I want individual data to go into wa_final but confused how to start to get
    min date..max..date..minkm_value..maxkm_value...total min-max,
    min_hr,max_hr,total diff , min_lit,max_lit, total as in the program but how the data will go according to the values in wa_final
    regards
    Piroz

Maybe you are looking for

  • My dream waver has been uninstalled. How to install again?

    my dream waver has been uninstalled. How to install again?

  • Music won't fit

    I have about 300 songs on my 2Gb Nano, syncd from a playlist called "Paul's". I have another playlist that only has 17 songs, 3 to 6 minutes long. I try to sync this playlist as well and I keep getting a message that there is no room for the files. H

  • Resolve internet address from IF_RECIPIENT_BCS?

    Hello, i use the CL_BCS=>SHORT_MESSAGE function for sending an object linked to a mail. Afterwards I have to resolve and to document the recipient adresses in plain text. There are several types of adresses like user names and internet adresses. I am

  • RMI Binding Error

    When I am trying to run my code, the following error is being displayed Starting Sever... Binding... Error: java.rmi.ConnectException: Connection refused to host: 169.254.135.47; nested exception is: java.net.ConnectException: Connection refused: con

  • Creating wave files

    Trying to use Sound File Open, Sund File Write,and Sound File close vi on MyRIO, and received an error message indicating these are not supported by the target. Is that indeed the case and if so is there an alternative wave to create wave files with