Internal table in OO

I have a requirement to create and implement Badi.
The following is code:
method IF_EX_NOTIF_EVENT_SAVE~CHANGE_DATA_AT_SAVE.
DATA: l_progname TYPE sy-repid,
      l_dynnum TYPE sy-dynnr.
types: BEGIN of itab.
INCLUDE dynpread.
types: END of itab.
data: dynpread_tab like table of itab.
l_progname = sy-repid.
l_dynnum = sy-dynnr.
CLEAR dynpread_tab.
REFRESH dynpread_tab.
dynpread_tab-fieldname = 'ZZACNUM'.
APPEND dynpread_tab.
CALL FUNCTION 'DYNP_VALUES_READ'
  EXPORTING
    DYNAME                               = l_progname
    DYNUMB                               = l_dynnum
  TRANSLATE_TO_UPPER                   = ' '
  REQUEST                              = ' '
  PERFORM_CONVERSION_EXITS             = ' '
  PERFORM_INPUT_CONVERSION             = ' '
  DETERMINE_LOOP_INDEX                 = ' '
  START_SEARCH_IN_CURRENT_SCREEN       = ' '
  START_SEARCH_IN_MAIN_SCREEN          = ' '
  START_SEARCH_IN_STACKED_SCREEN       = ' '
  START_SEARCH_ON_SCR_STACKPOS         = ' '
  SEARCH_OWN_SUBSCREENS_FIRST          = ' '
  SEARCHPATH_OF_SUBSCREEN_AREAS        = ' '
  TABLES
    DYNPFIELDS                           = dynpread_tab
EXCEPTIONS
  INVALID_ABAPWORKAREA                 = 1
  INVALID_DYNPROFIELD                  = 2
  INVALID_DYNPRONAME                   = 3
  INVALID_DYNPRONUMMER                 = 4
  INVALID_REQUEST                      = 5
  NO_FIELDDESCRIPTION                  = 6
  INVALID_PARAMETER                    = 7
  UNDEFIND_ERROR                       = 8
  DOUBLE_CONVERSION                    = 9
  STEPL_NOT_FOUND                      = 10
  OTHERS                               = 11
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.
  LOOP AT dynpread_tab.
  ENDLOOP.
ENDIF.
endmethod.
It is giving me error: INCLUDE report "DYNPREAD" not found.
Any idea?
Thanks in advance.

Hi
U should remember the internal table is without header line:
DATA: l_progname TYPE sy-repid,
          l_dynnum TYPE sy-dynnr.
*types: BEGIN of itab.
*INCLUDE dynpread.
*types: END of itab.
*data: dynpread_tab like table of itab.
DATA: dynpread_tab TYPE TABLE OF DYNPREAD.
DATA: dynpread_wa TYPE DYNPREAD.
*dynpread_tab-fieldname = 'ZZACNUM'.
*APPEND dynpread_tab.
dynpread_wa-fieldname = 'ZZACNUM'.
APPEND dynpread_wa to dynpread_tab.
CALL FUNCTION 'DYNP_VALUES_READ'
IF SY-SUBRC = 0.
* LOOP AT dynpread_tab.
*ENDLOOP.
LOOP AT dynpread_tab into .
ENDLOOP.

Similar Messages

  • Sy-tabix for internal table in smartform

    Hi friends,
    How to capture the sy-tabix value for the entries in an internal table which has been looped into the loop of table node of a smartform?? I need to print something immedaitely after the end of the table
    For every record the value of sy-tabix is showing 1 !!
    Advance Thanks
    Aadarsh

    Hi Aadarsh,
    Give ur sy-tabix at the end of the loop.
    loop at itab.
    //table node populations.
    endloop.
    give a seperate loop for this.
    loop at itab.
    sy-tabix.
    endloop
    get the total no and print it after the table.
    If u r using do loop then give sy-index.
    Hope tihs helps u,
    Regards,
    Nagarajan.
    Message was edited by: Nagarajan Kumarappan

  • Regarding Exporting and Importing internal table

    Hello Experts,
    I have two programs:
    1) Main program: It create batch jobs through open_job,submit and close job.Giving sub program as SUBMIT.
    I am using Export IT to memory id 'MID' to export internal table data to sap memory in the subprogram.
    The data will be processed in the subprogram and exporting data to sap memory.I need this data in the main program(And using import to get the data,but it is not working).
    Importing IT1 from memory id 'MID' to import the table data in the main program after completing the job(SUBMIT SUBPROGRAM AND RETURN).
    Importing is not getting data to internal table.
    Can you please suggest something to solve this issue.
    Thank you.
    Regards,
    Anand.

    Hi,
    This is the code i am using.
    DO g_f_packets TIMES.
    * Start Immediately
           IF NOT p_imm IS INITIAL .
             g_flg_start = 'X'.
           ENDIF.
           g_f_jobname = 'KZDO_INHERIT'.
           g_f_jobno = g_f_jobno + '001'.
           CONCATENATE g_f_jobname g_f_strtdate g_f_jobno INTO g_f_jobname
                                                  SEPARATED BY '_'.
           CONDENSE g_f_jobname NO-GAPS.
           p_psize1 = p_psize1 + p_psize.
           p_psize2 = p_psize1 - p_psize + 1.
           IF p_psize2 IS INITIAL.
             p_psize2  = 1.
           ENDIF.
           g_f_spname = 'MID'.
           g_f_spid = g_f_spid + '001'.
           CONDENSE g_f_spid NO-GAPS.
           CONCATENATE g_f_spname  g_f_spid INTO g_f_spname.
           CONDENSE g_f_spname NO-GAPS.
    * ... (1) Job creating...
           CALL FUNCTION 'JOB_OPEN'
             EXPORTING
               jobname          = g_f_jobname
             IMPORTING
               jobcount         = g_f_jobcount
             EXCEPTIONS
               cant_create_job  = 1
               invalid_job_data = 2
               jobname_missing  = 3
               OTHERS           = 4.
           IF sy-subrc <> 0.
             MESSAGE e469(9j) WITH g_f_jobname.
           ENDIF.
    * (2)Report start under job name
           SUBMIT (g_c_prog_kzdo)
                  WITH p_lgreg EQ p_lgreg
                  WITH s_grvsy IN s_grvsy
                  WITH s_prvsy IN s_prvsy
                  WITH s_prdat IN s_prdat
                  WITH s_datab IN s_datab
                  WITH p1      EQ p1
                  WITH p3      EQ p3
                  WITH p4      EQ p4
                  WITH p_mailid EQ g_f_mailid
                  WITH p_psize EQ p_psize
                  WITH p_psize1 EQ p_psize1
                  WITH p_psize2 EQ p_psize2
                  WITH spid     EQ g_f_spid
                  TO SAP-SPOOL WITHOUT SPOOL DYNPRO
                  VIA JOB g_f_jobname NUMBER g_f_jobcount AND RETURN.
    *(3)Job closed when starts Immediately
           IF NOT p_imm IS INITIAL.
             IF sy-index LE g_f_nojob.
               CALL FUNCTION 'JOB_CLOSE'
                 EXPORTING
                   jobcount             = g_f_jobcount
                   jobname              = g_f_jobname
                   strtimmed            = g_flg_start
                 EXCEPTIONS
                   cant_start_immediate = 1
                   invalid_startdate    = 2
                   jobname_missing      = 3
                   job_close_failed     = 4
                   job_nosteps          = 5
                   job_notex            = 6
                   lock_failed          = 7
                   OTHERS               = 8.
               gs_jobsts-jobcount = g_f_jobcount.
               gs_jobsts-jobname  = g_f_jobname.
               gs_jobsts-spname   = g_f_spname.
               APPEND gs_jobsts to gt_jobsts.
             ELSEIF sy-index GT g_f_nojob.
               CLEAR g_f_flg.
               DO.                         " Wiating untill any job completion
                 LOOP AT gt_jobsts into gs_jobsts.
                   CLEAR g_f_status.
                   CALL FUNCTION 'BP_JOB_STATUS_GET'
                     EXPORTING
                       JOBCOUNT                         = gs_jobsts-jobcount
                       JOBNAME                          = gs_jobsts-jobname
                    IMPORTING
                       STATUS                           = g_f_status
    *            HAS_CHILD                        =
    *          EXCEPTIONS
    *            JOB_DOESNT_EXIST                 = 1
    *            UNKNOWN_ERROR                    = 2
    *            PARENT_CHILD_INCONSISTENCY       = 3
    *            OTHERS                           = 4
                   g_f_mid = gs_jobsts-spname.
                   IF g_f_status = 'F'.
                     IMPORT gt_final FROM MEMORY ID g_f_mid .
                     FREE MEMORY ID gs_jobsts-spname.
                     APPEND LINES OF gt_final to gt_final1.
                     REFRESH gt_prlist.
                     CALL FUNCTION 'JOB_CLOSE'
                       EXPORTING
                         jobcount             = g_f_jobcount
                         jobname              = g_f_jobname
                         strtimmed            = g_flg_start
                       EXCEPTIONS
                         cant_start_immediate = 1
                         invalid_startdate    = 2
                         jobname_missing      = 3
                         job_close_failed     = 4
                         job_nosteps          = 5
                         job_notex            = 6
                         lock_failed          = 7
                         OTHERS               = 8.
                     IF sy-subrc = 0.
                       g_f_flg = 'X'.
                       gs_jobsts1-jobcount = g_f_jobcount.
                       gs_jobsts1-jobname  = g_f_jobname.
                       gs_jobsts1-spname   = g_f_spname.
                       APPEND gs_jobsts1 TO gt_jobsts.
                       DELETE TABLE gt_jobsts FROM gs_jobsts.
                       EXIT.
                     ENDIF.
                   ENDIF.
                 ENDLOOP.
                 IF g_f_flg = 'X'.
                   CLEAR g_f_flg.
                   EXIT.
                 ENDIF.
               ENDDO.
             ENDIF.
           ENDIF.
           IF sy-subrc <> 0.
             MESSAGE e539(scpr) WITH g_f_jobname.
           ENDIF.
           COMMIT WORK .
         ENDDO.

  • How to select the data from a Maintainance View into an internal table

    Hi All,
    Can anybody tell me how to select the data from a Maintainance View into an internal table.
    Thanks,
    srinivas.

    HI,
    You can not retrieve data from A mentenance view.
    For detail check this link,
    http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ed2d446011d189700000e8322d00/content.htm
    Regards,
    Anirban

  • Creating XML file from ABAP internal table data....

    Hello,
    I am fethcing data froma  custom table and I have to write data in XMl format. Following is the XML format in which I want data. Is there any function module iN SAP which will help me in writing data from internal table to XML file ?
    <batch>
      <invoice>
        <StatusCode>10</StatusCode>
        <paymentamount>122.00</paymentamount>
         <ReferenceNumber>70980934</ReferenceNumber>
      </invoice>
      <invoice>
         <StatusCode>90</StatusCode>
        <paymentamount>122.00</paymentamount>
         <ReferenceNumber>70980934</ReferenceNumber>
      </invoice>
      <control>
        <InvoiceCount>2</InvoiceCount>
      </control>
    </batch>
    Please help.
    Regards,
    Jainam.

    I suggest you look into "simple transformations". That's SAP's most recent technology for such purposes, as far as I know.
    http://help.sap.com/abapdocu_70/en/ABENABAP_ST.htm
    Thomas

  • Need suggestion in uploading dynamic excel file to corresponding columns of internal table

    Hi Friends,
    I have an excel file which doesn't have standard template. Just the users will key in their header (in row1 ) and followed by item details in excel and upload to internal table. Now by doing some internal developments in program I need to place the values in corresponding fields.
    Let me explain with some examples.
    1. I have an internal table
    data : begin of itab occurs 0,
                       f1,
                       f2,
                       f3,
                       f4,
                       f5,
              end of itab.
    2. I have excel file as below
    3 . Now i need to fill my internal table itab as below
    Need to be placed in corresponding fields.
    4. When I used GUI_UPLOAD FM it updates internal table as
    Please give me suggestion on how to achieve it.
    Thanks in advance.

    Hi Kumar,
    use a temporary table to get excel values and then parse them to a second table with the format you want.
    This is pretty basic.
    regards,
    Edgar

  • How to populate data in dynamic internal table

    Hi Expert,
    fyi. My dynamic internal table field is created base on data selected. Eg. select table qpcd has 5 records.  These 5 recods will become fieldname to my dynamic internal table. My dynamic internal table will be
    ...itab
          01
          02
          03
          04
          05
    The 5 records from qpcd is populated in another table call viqmel.  I need to find the occurance of each code in viqmel and populate the number of occurance in itab in each of column.  The final dynamic itab will be like this
    table itab
    01       02     03    04     05   -
    > field name
    2         0        1     0       1    -
    > data
    my source code like below
    Report ZPLYGRND2.
    TABLES: mara, makt.
    TYPE-POOLS: slis, sydes.
    DATA:it_fcat TYPE slis_t_fieldcat_alv,
         is_fcat LIKE LINE OF it_fcat,
         ls_layout TYPE slis_layout_alv.
    DATA: it_fieldcat TYPE lvc_t_fcat,
          is_fieldcat LIKE LINE OF it_fieldcat.
    DATA: new_table TYPE REF TO data,
          new_line TYPE REF TO data,
          ob_cont_alv TYPE REF TO cl_gui_custom_container,
          ob_alv TYPE REF TO cl_gui_alv_grid,
          vg_campos(255) TYPE c,
          i_campos LIKE TABLE OF vg_campos,
          vg_campo(30) TYPE c,
          vg_tables(60) TYPE c.
    types : begin of t_qpcd,
             codegruppe like qpcd-codegruppe,
             code like qpcd-code,
            end of t_qpcd.
    data:wa_qpcd type t_qpcd,
         i_qpcd type standard table of t_qpcd initial size 0.
    FIELD-SYMBOLS: <l_table> TYPE table,
                   <l_line> TYPE ANY,
                   <l_field> TYPE ANY.
    select * into corresponding fields of wa_qpcd from qpcd
    where katalogart = 'D'
    and   codegruppe = 'OOT01'.
    append wa_qpcd to i_qpcd.
    endselect.
    loop at i_qpcd into wa_qpcd.
      is_fcat-fieldname = wa_qpcd-code.
      APPEND is_fcat TO it_fcat.
    endloop.
    LOOP AT it_fcat INTO is_fcat.
        is_fieldcat-fieldname = is_fcat-fieldname.
        is_fieldcat-ref_field = is_fcat-ref_fieldname.
        is_fieldcat-ref_table = is_fcat-ref_tabname.
        APPEND is_fieldcat TO it_fieldcat.
    ENDLOOP.
    *... Create the dynamic internal table
    CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
            it_fieldcatalog = it_fieldcat
        IMPORTING
            ep_table = new_table.
    if sy-subrc = 0.
    endif.
    *... Create a new line
    ASSIGN new_table->* TO <l_table>.
    CREATE DATA new_line LIKE LINE OF <l_table>.
    ASSIGN new_line->* TO <l_line>.
    LOOP AT <l_table> INTO <l_line>.
    ENDLOOP.

    hello dear i m giving u a code in this a dynamic table is made on the basis of table in database , and u can download this data correct it , see it, or even change it....and upload in tht table help full if u dont know the table name...in advance.
    also the code to populate data in dynamic table is in this code like:
    SELECT * FROM (MTABLE_N)
    INTO CORRESPONDING FIELDS OF TABLE <FS_ITAB> .
    look at the whole program .hope this solve ur problem thanks.
    REPORT ZTESTA  MESSAGE-ID ZIMM    .
    TYPES : DATA_OBJECT TYPE REF TO DATA.
    DATA : MITAB TYPE REF TO DATA .
    TYPE-POOLS : SLIS .
    DATA : IT_FIELDCAT TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV
    WITH HEADER LINE .
    DATA : IT_FIELDCATALOG TYPE LVC_T_FCAT .
    DATA : WA_FIELDCATALOG TYPE LVC_S_FCAT .
    DATA : I_STRUCTURE_NAME LIKE DD02L-TABNAME .
    DATA : I_CALLBACK_PROGRAM LIKE SY-REPID .
    DATA : DYN_LINE TYPE DATA_OBJECT .
    FIELD-SYMBOLS : <FS_ITAB> TYPE STANDARD TABLE .
    DATA : TABLE_NAME_IS_VALID TYPE C .
    DATA : DYNAMIC_IT_INSTANTIATED TYPE C .
    CONSTANTS BUTTONSELECTED TYPE C VALUE 'X' .
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) T_TABL.
    PARAMETERS : MTABLE_N LIKE RSRD1-TBMA_VAL
    MATCHCODE OBJECT DD_DBTB_16 OBLIGATORY .
    DATA CHECKTABLED.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) T_FILE.
    PARAMETERS : MFILENAM LIKE RLGRAP-FILENAME .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) T_DOWN.
    PARAMETERS : P_DOWNLD RADIOBUTTON GROUP GRP1
    USER-COMMAND M_UCOMM .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) T_CHKF.
    PARAMETERS : P_CHKFIL RADIOBUTTON GROUP GRP1 .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) T_UPLD.
    PARAMETERS : P_UPLOAD RADIOBUTTON GROUP GRP1 .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) T_SHOW.
    PARAMETERS : P_SHOW_T RADIOBUTTON GROUP GRP1 .
    SELECTION-SCREEN END OF LINE.
    AT SELECTION-SCREEN OUTPUT .
      PERFORM CHECK_FILENAME .
    AT SELECTION-SCREEN.
      IF SY-UCOMM = 'ONLI'.
        CHECKTABLED = MTABLE_N+0(1).
        IF CHECKTABLED NE 'Z'.
          MESSAGE I017.
          LEAVE TO SCREEN 1000.
        ENDIF.
        IF SY-UNAME NE 'KAMESH.K'.
          MESSAGE I023 WITH SY-UNAME.
          LEAVE TO SCREEN 1000.
        ENDIF.
      ENDIF.
      IF SY-UCOMM = 'PRIN'.
        CHECKTABLED = MTABLE_N+0(1).
        IF CHECKTABLED NE 'Z'.
          MESSAGE I017.
          LEAVE TO SCREEN 1000.
        ENDIF.
        IF SY-UNAME NE 'KAMESH.K'.
          MESSAGE I023 WITH SY-UNAME.
          LEAVE TO SCREEN 1000.
        ENDIF.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR MFILENAM .
      PERFORM F4_FOR_FILENAME .
    INITIALIZATION .
      T_TABL = 'Table Name' .
      T_FILE = 'File Name' .
      T_DOWN = 'Download Table' .
      T_CHKF = 'Check File to Upload' .
      T_UPLD = 'Upload File' .
      T_SHOW = 'Show Table Contents' .
    START-OF-SELECTION .
      PERFORM CHECK_TABLE_NAME_IS_VALID .
    END-OF-SELECTION .
      IF TABLE_NAME_IS_VALID EQ ' ' .
        MESSAGE I398(00) WITH 'INVALID TABLE NAME' .
      ELSE .
        PERFORM INSTANTIATE_DYNAMIC_INTERNAL_T .
        CHECK DYNAMIC_IT_INSTANTIATED = 'X' .
        CASE BUTTONSELECTED .
          WHEN P_DOWNLD .
            PERFORM SELECT_AND_DOWNLOAD .
          WHEN P_CHKFIL .
            PERFORM CHECK_FILE_TO_UPLOAD .
          WHEN P_UPLOAD .
            PERFORM UPLOAD_FROM_FILE .
          WHEN P_SHOW_T .
            PERFORM SHOW_CONTENTS .
        ENDCASE .
      ENDIF .
    FORM CHECK_TABLE_NAME_IS_VALID.
      DATA MCOUNT TYPE I .
      TABLES DD02L .
      CLEAR TABLE_NAME_IS_VALID .
      SELECT COUNT(*) INTO MCOUNT FROM TADIR
      WHERE PGMID = 'R3TR'
      AND OBJECT = 'TABL'
      AND OBJ_NAME = MTABLE_N .
      IF MCOUNT EQ 1 .
        CLEAR DD02L .
        SELECT SINGLE * FROM DD02L WHERE TABNAME = MTABLE_N .
        IF SY-SUBRC EQ 0.
          IF DD02L-TABCLASS = 'TRANSP' .
            TABLE_NAME_IS_VALID = 'X' .
          ENDIF .
        ENDIF.
      ENDIF .
    ENDFORM. " CHECK_TABLE_NAME_IS_VALID
    FORM SELECT_AND_DOWNLOAD.
      CLEAR : <FS_ITAB> .
      SELECT * FROM (MTABLE_N)
      INTO CORRESPONDING FIELDS OF TABLE <FS_ITAB> .
      PERFORM CHECK_FILENAME.
      CALL FUNCTION 'WS_DOWNLOAD'
           EXPORTING
                FILENAME                = MFILENAM
                FILETYPE                = 'DAT'
           TABLES
                DATA_TAB                = <FS_ITAB>
           EXCEPTIONS
                FILE_OPEN_ERROR         = 1
                FILE_WRITE_ERROR        = 2
                INVALID_FILESIZE        = 3
                INVALID_TYPE            = 4
                NO_BATCH                = 5
                UNKNOWN_ERROR           = 6
                INVALID_TABLE_WIDTH     = 7
                GUI_REFUSE_FILETRANSFER = 8
                CUSTOMER_ERROR          = 9
                OTHERS                  = 10.
      IF SY-SUBRC EQ 0.
        MESSAGE I398(00) WITH 'Table' MTABLE_N
        'successfully downloaded to '
        MFILENAM .
      ENDIF.
    ENDFORM. " SELECT_AND_DOWNLOAD
    FORM UPLOAD_FROM_FILE.
      DATA : ANS TYPE C .
      DATA : LINES_OF_ITAB TYPE I .
      DATA : MSY_SUBRC TYPE I .
      CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
           EXPORTING
                TEXTLINE1 = 'Are you sure you wish to upload'
                TEXTLINE2 = 'data from ASCII File to DB table '
                TITEL     = 'Confirmation of Data Upload'
           IMPORTING
                ANSWER    = ANS.
      IF ANS = 'J' .
        PERFORM CHECK_FILENAME.
        CLEAR MSY_SUBRC .
        CALL FUNCTION 'WS_UPLOAD'
             EXPORTING
                  FILENAME                = MFILENAM
                  FILETYPE                = 'DAT'
             TABLES
                  DATA_TAB                = <FS_ITAB>
             EXCEPTIONS
                  CONVERSION_ERROR        = 1
                  FILE_OPEN_ERROR         = 2
                  FILE_READ_ERROR         = 3
                  INVALID_TYPE            = 4
                  NO_BATCH                = 5
                  UNKNOWN_ERROR           = 6
                  INVALID_TABLE_WIDTH     = 7
                  GUI_REFUSE_FILETRANSFER = 8
                  CUSTOMER_ERROR          = 9
                  OTHERS                  = 10.
        MSY_SUBRC = MSY_SUBRC + SY-SUBRC .
        IF SY-SUBRC EQ 0.
          DESCRIBE TABLE <FS_ITAB> LINES LINES_OF_ITAB .
          IF LINES_OF_ITAB GT 0 .
            MODIFY (MTABLE_N) FROM TABLE <FS_ITAB> .
            MSY_SUBRC = MSY_SUBRC + SY-SUBRC .
          ENDIF .
        ENDIF.
        IF MSY_SUBRC EQ 0 .
          MESSAGE I398(00) WITH LINES_OF_ITAB
          'Record(s) inserted in table'
          MTABLE_N .
        ELSE .
          MESSAGE I398(00) WITH
          'Errors occurred No Records inserted in table'
          MTABLE_N .
        ENDIF .
      ENDIF .
    ENDFORM. " UPLOAD_FROM_FILE
    FORM F4_FOR_FILENAME.
      CALL FUNCTION 'WS_FILENAME_GET'
           EXPORTING
                DEF_PATH         = 'C:\'
                MASK             = ',.,..'
                MODE             = '0'
           IMPORTING
                FILENAME         = MFILENAM
           EXCEPTIONS
                INV_WINSYS       = 1
                NO_BATCH         = 2
                SELECTION_CANCEL = 3
                SELECTION_ERROR  = 4
                OTHERS           = 5.
    ENDFORM. " F4_FOR_FILENAME
    FORM CHECK_FILENAME.
      IF MFILENAM IS INITIAL
      AND NOT ( MTABLE_N IS INITIAL )
      AND P_SHOW_T NE BUTTONSELECTED.
        CONCATENATE 'C:\'
        MTABLE_N '.TXT' INTO MFILENAM.
      ENDIF .
    ENDFORM. " CHECK_FILENAME
    FORM INSTANTIATE_DYNAMIC_INTERNAL_T.
      CLEAR DYNAMIC_IT_INSTANTIATED .
      I_STRUCTURE_NAME = MTABLE_N .
      CLEAR IT_FIELDCAT[] .
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                I_STRUCTURE_NAME       = I_STRUCTURE_NAME
           CHANGING
                CT_FIELDCAT            = IT_FIELDCAT[]
           EXCEPTIONS
                INCONSISTENT_INTERFACE = 1
                PROGRAM_ERROR          = 2
                OTHERS                 = 3.
      IF SY-SUBRC EQ 0.
        LOOP AT IT_FIELDCAT .
          CLEAR WA_FIELDCATALOG .
          MOVE-CORRESPONDING IT_FIELDCAT TO WA_FIELDCATALOG .
          WA_FIELDCATALOG-REF_FIELD = IT_FIELDCAT-FIELDNAME .
          WA_FIELDCATALOG-REF_TABLE = MTABLE_N .
          APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG .
        ENDLOOP .
        CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
        EXPORTING
        IT_FIELDCATALOG = IT_FIELDCATALOG
        IMPORTING
        EP_TABLE = MITAB .
        ASSIGN MITAB->* TO <FS_ITAB> .
        DYNAMIC_IT_INSTANTIATED = 'X' .
      ENDIF.
    ENDFORM. " INSTANTIATE_DYNAMIC_INTERNAL_T
    FORM SHOW_CONTENTS.
      CLEAR : <FS_ITAB> .
      SELECT * FROM (MTABLE_N)
      INTO CORRESPONDING FIELDS OF TABLE <FS_ITAB> .
      I_CALLBACK_PROGRAM = SY-REPID .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM = I_CALLBACK_PROGRAM
                IT_FIELDCAT        = IT_FIELDCAT[]
           TABLES
                T_OUTTAB           = <FS_ITAB>
           EXCEPTIONS
                PROGRAM_ERROR      = 1
                OTHERS             = 2.
    ENDFORM. " SHOW_CONTENTS
    FORM CHECK_FILE_TO_UPLOAD.
      PERFORM CHECK_FILENAME.
      CALL FUNCTION 'WS_UPLOAD'
           EXPORTING
                FILENAME                = MFILENAM
                FILETYPE                = 'DAT'
           TABLES
                DATA_TAB                = <FS_ITAB>
           EXCEPTIONS
                CONVERSION_ERROR        = 1
                FILE_OPEN_ERROR         = 2
                FILE_READ_ERROR         = 3
                INVALID_TYPE            = 4
                NO_BATCH                = 5
                UNKNOWN_ERROR           = 6
                INVALID_TABLE_WIDTH     = 7
                GUI_REFUSE_FILETRANSFER = 8
                CUSTOMER_ERROR          = 9
                OTHERS                  = 10.
      IF SY-SUBRC EQ 0.
        I_CALLBACK_PROGRAM = SY-REPID .
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
             EXPORTING
                  I_CALLBACK_PROGRAM = I_CALLBACK_PROGRAM
                  IT_FIELDCAT        = IT_FIELDCAT[]
             TABLES
                  T_OUTTAB           = <FS_ITAB>
             EXCEPTIONS
                  PROGRAM_ERROR      = 1
                  OTHERS             = 2.
      ENDIF .
    ENDFORM. " CHECK_FILE_TO_UPLOAD
    Message was edited by:
            SAURABH SINGH
            SENIOR EXECUTIVE
            SAMSUNG INDIA ELECTRONICS LTD.,NOIDA

  • How to upload a file in application server to an internal table

    Hi,
          I am asked to upload a file from application server to internal table. Can you please suggest me the ways to do it or the function module which helps to browse the application server file names.
      I have done a program. But its giving problem in searching the files from application server. I am pasting my code for ur review. Please tell me which part i have to correct or suggest me some other ways to do it.
    *& Report  ZUPLOAD1
    REPORT  ZUPLOAD1.
    type-pools: truxs.
    parameters: p_upl_ps radiobutton group g1 default 'X', "upload from pres. server
                 p_path type rlgrap-filename, 
                 p_upl_as radiobutton group g1,   "upload from appln server
                 <b>p_dir LIKE filepath-pathintern DEFAULT 'Y_ABAP', 
                 p_file LIKE filepath-pathintern lower case,</b>      
                 p_test as checkbox.
    constants: c_x value 'X',
               c_tab type c value cl_abap_char_utilities=>horizontal_tab.
    types: ty_data(1000) type c.    "structure to hold legacy data
    data: i_data type standard table of ty_data. "internal table of ty_data
    types: begin of stritab,
          land1 type v_t604-land1,  "structure of legacy file.
          stawn type v_t604-stawn,
          bemeh type v_t604-bemeh,
          impma type v_t604-impma,
          minol type v_t604-minol,
          end of stritab.
    data: gi_itab type standard table of stritab, "internal table of legacy file
          gw_itab type stritab.  "work area
    data: i_raw type truxs_t_text_data,
          v_fullpath type string.
    at selection-screen on value-request for p_path.
    if p_upl_ps = c_x. "if presentation server is selected
    perform get_file.
    else.            "if application server is selected
    perform set_file_path.      
    perform upload_from_server.
    perform split_data.
    endif.
    form get_file.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      PROGRAM_NAME        = SYST-CPROG
      DYNPRO_NUMBER       = SYST-DYNNR
      FIELD_NAME          = ' '
    IMPORTING
       FILE_NAME           = p_path.     "getting the file name of pres server
    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
      EXPORTING
      I_FIELD_SEPERATOR          =
        I_LINE_HEADER              = 'X'              "converting excel to sap and filling in
        I_TAB_RAW_DATA             = i_raw      "internal table
        I_FILENAME                 = p_path
      TABLES
        I_TAB_CONVERTED_DATA       = gi_itab
    EXCEPTIONS
       CONVERSION_FAILED          = 1
       OTHERS                     = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endform.
    form set_file_path.                 "Getting the file path of application server
    data: lv_file type p_file.
          lv_file = p_file.
          CALL FUNCTION 'FILE_GET_NAME_USING_PATH'
            EXPORTING
            CLIENT                           = SY-MANDT
              LOGICAL_PATH                     = p_dir
            OPERATING_SYSTEM                 = SY-OPSYS
            PARAMETER_1                      = ' '
            PARAMETER_2                      = ' '
            PARAMETER_3                      = ' '
            USE_BUFFER                       = ' '
              FILE_NAME                        = lv_file
            USE_PRESENTATION_SERVER          = ' '
            ELEMINATE_BLANKS                 = 'X'
           IMPORTING
             FILE_NAME_WITH_PATH              = v_fullpath
           EXCEPTIONS
             PATH_NOT_FOUND                   = 1
             MISSING_PARAMETER                = 2
             OPERATING_SYSTEM_NOT_FOUND       = 3
             FILE_SYSTEM_NOT_FOUND            = 4
             OTHERS                           = 5
          IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    endform.
    form upload_from_server.
    data: lv_msg type string,
          lw_data type ty_data.
    open dataset v_fullpath for input message lv_msg in text mode encoding default.
    if sy-subrc <> 0.
    message lv_msg type 'i'.
    stop.
    endif.
    do.
    read dataset v_fullpath into lw_data.
    if sy-subrc <> 0.
    write:/5 'Error in processign data set'.
    exit.
    endif.
    append lw_data to i_data.
    enddo.
    close dataset v_fullpath.
    if sy-subrc <> 0.
    write: /5 'Error closing dataset'.
    endif.
    endform.
    form split_data.
    data: lw_data type ty_data.
    data: lw_itab type stritab.
    data: begin of ty_itab,
          land1 type v_t604-land1,
          stawn type v_t604-stawn,
          bemeh type v_t604-bemeh,
          impma type v_t604-impma,
          minol type v_t604-minol,
          end of ty_itab.
    loop at i_data into lw_data.
    split lw_data at c_tab into
          ty_itab-land1
          ty_itab-stawn
          ty_itab-bemeh
          ty_itab-impma
          ty_itab-minol.
    lw_itab-land1 = ty_itab-land1.
    lw_itab-stawn = ty_itab-stawn.
    lw_itab-bemeh = ty_itab-bemeh.
    lw_itab-impma = ty_itab-impma.
    lw_itab-minol = ty_itab-minol.
    append lw_itab to gi_itab.
    endloop.
    endform.
    start-of-selection.
    loop at gi_itab into gw_itab.
    write: /5 'COUNTRY', 'IMPORT CODE', 'SUP UNIT', 'FIRST UOM', 'SECOND UOM',
           /5 gw_itab-land1, gw_itab-stawn,gw_itab-bemeh,gw_itab-impma,gw_itab-minol.
    endloop.
    end-of-selection.
    I hope problem must be in p_dir and p_file which are in bold.. Kindly help me out. Thanks in advance.

    see the following ex:
    *&      Form  SUB_GET_FILEPATH
          text
    -->  p1        text
    <--  p2        text
    FORM SUB_GET_FILEPATH .
        GFILE = 'D:\SAP_INT\INBOUND\INBOX'.  "Path
    ENDFORM.                    " SUB_GET_FILEPATH
    *&      Form  SUB_GET_FILE
          text
    -->  p1        text
    <--  p2        text
    FORM SUB_GET_FILE .
      DATA: P_FDIR(200) TYPE C.
      DATA: IT_FILEDIR1 TYPE STANDARD TABLE OF TY_FILEDIR WITH HEADER LINE.
      P_FDIR = GFILE.
      CALL FUNCTION 'RZL_READ_DIR_LOCAL'
        EXPORTING
          NAME     = P_FDIR
        TABLES
          FILE_TBL = IT_FILEDIR.
      REFRESH : IT_FILEDIR1.
      LOOP AT IT_FILEDIR.
        IF IT_FILEDIR-NAME(4) = 'ZINC' OR IT_FILEDIR-NAME(4) = 'zinc'.
          MOVE IT_FILEDIR-NAME TO IT_FILEDIR1-NAME.
          APPEND IT_FILEDIR1.
        ENDIF.
      ENDLOOP.
      IF IT_FILEDIR1[] IS INITIAL.
        STOP.
      ENDIF.
      LOOP AT IT_FILEDIR1.
        REFRESH: I_TAB.
        CLEAR: I_TAB.
        NAME = IT_FILEDIR1-NAME.
        CONCATENATE: GFILE '\' NAME INTO G_FILE.
        OPEN DATASET G_FILE FOR INPUT IN TEXT MODE
                                         ENCODING DEFAULT
                                         IGNORING CONVERSION ERRORS.
        IF SY-SUBRC EQ 0.
          CONCATENATE 'FILENAME  : ' G_FILE INTO I_MSG1.
          APPEND I_MSG1.
          DO.
            READ DATASET G_FILE INTO RECORD.
            IF SY-SUBRC = 0.
              SPLIT RECORD AT ',' INTO I_TAB-BUKRS  I_TAB-EBELN
                  I_TAB-BLDAT  I_TAB-XBLNR I_TAB-LIFNR I_TAB-AMOUNT
                  I_TAB-CURR  I_TAB-BUSAREA
                  I_TAB-BKTXT I_TAB-DMBTR I_TAB-MENGE I_TAB-SRNO.
              MOVE-CORRESPONDING I_TAB TO I_TAB1.
            ELSE.
              EXIT.
            ENDIF.
            APPEND I_TAB1.
            CLEAR: I_TAB, I_TAB1.
          ENDDO.
        ENDIF.
        CLOSE DATASET G_FILE.

  • Use 3 internal table in GUI_Download

    Hello expert,
    i have 3 internal table: gt_header, gt_body and gt_footer. how can i used all 3 in gui_download fm. here is my sample code:
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename              = gv_file_name
          filetype              = 'ASC'
        TABLES
          data_tab              = gt_header.
    here i can only pass one internal table.
    Help please?

    Hi Hassim,
    Maybe you can declare another internal table, with all fields is type C and length as you wanted.
    Loop those three itabs, append to this new itab. then call this FM download.
    regards,
    Archer

  • IMPORT Statement Issue (Internal Table)

    Hi All,
    I am using an IMPORT statement to get all the data from other report's internal table. Now whenever this (the other report's internal table) is changed (for field addition, etc), my report throws a dump. Hence, everytime I have to add these fields in my program as well.
    Is there any way by which I can include the whole internal table of that report in my program just like
    'INCLUDE STRUCTURE VBRK'.
    Thanks in advance

    Hi, CHeck this code related to your problem..This will helpful to you...
    I have done this program earlier..I hope it will helpful to u..
    This programa calling the other program to import the data..
    Check it out...
    *" Tables declarations.................................................
    TABLES:
      spfli.
    *" Type declarations...................................................
    Type declaration of the structure to hold data from table SPFLI     *
    TYPES:
      BEGIN OF type_s_spfli,
        carrid LIKE spfli-carrid,          " Carrier Id
        connid LIKE spfli-connid,          " Connection Number
        cityfrom LIKE spfli-cityfrom,      " City from
        cityto LIKE spfli-cityto,          " City to
        airpfrom LIKE spfli-airpfrom,      " Airport from
        airpto LIKE spfli-airpto,          " Airport to
        countryfr LIKE spfli-countryfr,    " Country from
        countryto LIKE spfli-countryto,    " Country to
      END OF type_s_spfli.
    Data Declaration...................................................*
         Field String To Hold Flight Details Record from SPFLI          *
    DATA
      fs_spfli TYPE type_s_spfli.
    Data Declaration...................................................*
         Internal Table To Hold Flight Details Records from SPFLI       *
    DATA
      t_spfli LIKE STANDARD TABLE OF fs_spfli.
    TYPES:
      BEGIN OF types_s_itab,
        carrid LIKE sflight-carrid,        " Carrier id
        connid LIKE sflight-connid,        " Connection number
        fldate LIKE sflight-fldate,        " Flight date
      END OF types_s_itab.
    Data Declaration...................................................*
         Field String To Hold Flight Details Record from SFLIGHT        *
    DATA
      fs_itab TYPE types_s_itab.
    Data Declaration...................................................*
         Internal Table To Hold Flight Details Records from SFLIGHT     *
    DATA
      t_itab LIKE STANDARD TABLE OF fs_itab.
    *" Type declarations...................................................
    Type declaration of the structure to hold data from table SBOOK     *
    TYPES:
    BEGIN OF type_s_sbook,
       carrid LIKE sbook-carrid,           " Carrier Id
       connid LIKE sbook-connid,           " Connection Number
       fldate LIKE sbook-fldate,           " Flight date
       bookid LIKE sbook-bookid,           " Booking number
       loccuram LIKE sbook-loccuram,       " Local currency
       loccurkey LIKE sbook-loccurkey,
       order_date LIKE sbook-order_date,   " Booking date
    END OF type_s_sbook.
    Data Declaration...................................................*
         Field String To Hold Flight Details Record from BOOK           *
    DATA
      fs_sbook TYPE type_s_sbook.
    Data Declaration...................................................*
         Internal Table To Hold Flight Details Records from SBOOK       *
    DATA
      t_sbook LIKE STANDARD TABLE OF fs_sbook.
    DATA
      w_checkbox.                          " Checkbox
    SELECT-OPTIONS:
      s_carr FOR spfli-carrid.             " Carrier id range
                          START-OF-SELECTION EVENT                      *
    START-OF-SELECTION.
      PERFORM selectq.
                          END-OF-SELECTION EVENT                        *
    END-OF-SELECTION.
      SET PF-STATUS 'YH1314_030502'.
      PERFORM display_basic.
    AT USER-COMMAND.
      PERFORM ucomm.
    *&    Form  selectq
        This subroutine retreive data from SPFLI table
      There are no interface parameters to be passed to this subroutine.
    FORM selectq .
      SELECT carrid                        " Carrier id
             connid                        " Connection number
             cityfrom                      " City from
             cityto                        " City to
             airpfrom                      " Airport from
             airpto                        " Airport to
             countryfr                     " Country from
             countryto                     " Country to
             INTO CORRESPONDING FIELDS OF TABLE t_spfli
             FROM spfli
             WHERE carrid IN s_carr.
    ENDFORM.                               " Selectq
    *&      Form  display_basic
        This subroutine displays data from internal table
      There are no interface parameters to be passed to this subroutine.
    FORM display_basic .
      LOOP AT t_spfli INTO fs_spfli.
        WRITE:
          / w_checkbox AS CHECKBOX,
            fs_spfli-carrid,
            fs_spfli-connid,
            fs_spfli-cityfrom,
            fs_spfli-cityto,
            fs_spfli-airpfrom,
            fs_spfli-airpto,
            fs_spfli-countryfr,
            fs_spfli-countryto.
      ENDLOOP.                             " LOOP AT T-SPFLI INTO...
    ENDFORM.                               " Display_basic
    *&      Form  UCOMM
      This subroutine for at user-command event
      There are no interface parameters to be passed to this subroutine.
    FORM ucomm .
      RANGES :
        r_carr FOR spfli-carrid,
        r_conn FOR spfli-connid,
        r_carrid FOR sflight-carrid,
        r_connid FOR sflight-connid,
        r_fldate FOR sflight-fldate.
      CASE sy-ucomm.
        WHEN 'DISPLAY'.
          DATA:
            lw_lines TYPE i,
            lw_lineno TYPE i VALUE 3.
          DESCRIBE TABLE t_spfli LINES lw_lines.
          DO lw_lines TIMES.
            READ LINE lw_lineno FIELD
                 VALUE w_checkbox   INTO w_checkbox
                       fs_spfli-carrid INTO  fs_spfli-carrid
                       fs_spfli-connid INTO  fs_spfli-connid.
            IF sy-subrc = 0.
              IF w_checkbox = 'X'.
                r_carr-sign = 'I'.
                r_carr-option = 'EQ'.
                r_carr-low = fs_spfli-carrid.
                APPEND r_carr.
                r_conn-sign = 'I'.
                r_conn-option = 'EQ'.
                r_conn-low = fs_spfli-connid.
                APPEND r_conn.
              ENDIF.                       " IF W_CHECKBOX = 'X'
            ENDIF.                         " IF SY-SUBRC = 0
            ADD 1 TO lw_lineno.
          ENDDO.                           " DO LW_LINES TIMES
          SUBMIT yh1314_030502_call
            WITH s_carr IN r_carr
            WITH s_conn IN r_conn
             AND RETURN.
          IMPORT t_itab FROM MEMORY ID 'YH1314'.
          LOOP AT t_itab INTO fs_itab.
            r_carrid-sign = 'I'.
            r_carrid-option = 'EQ'.
            r_carrid-low = fs_itab-carrid.
            APPEND r_carrid.
            r_connid-sign = 'I'.
            r_connid-option = 'EQ'.
            r_connid-low = fs_itab-connid.
            APPEND r_connid.
            r_fldate-sign = 'I'.
            r_fldate-option = 'EQ'.
            r_fldate-low = fs_itab-fldate.
            APPEND r_fldate.
          ENDLOOP.                         " LOOP AT T_ITAB INTO.....
          SELECT carrid                    " Carriee Id
                 connid                    " Connection number
                 fldate                    " Flight date
                 bookid                    " Booking number
                 loccuram                  " Local Currency
                 order_date                " Booking date
             INTO CORRESPONDING FIELDS OF TABLE t_sbook
             FROM sbook
             WHERE carrid IN r_carrid AND
                   connid IN r_connid AND
                   fldate IN r_fldate.
          IF SY-SUBRC NE 0.
            MESSAGE 'NO RECORDS FOUND'(006) TYPE 'S'.
          ENDIF.                           " IF SY-SUBRC NE 0
          LOOP AT t_sbook INTO fs_sbook.
            AT FIRST.
              WRITE: /5 'Carrier Id'(001),
                     20 'Conn Id'(002),
                     35 'Flight date'(003),
                     50 'Book Id'(004),
                     65 'Local Currency'(005).
            ENDAT.                         " AT FIRST
            WRITE: /5 fs_sbook-carrid,
                   20 fs_sbook-connid,
                   35 fs_sbook-fldate,
                   50 fs_sbook-bookid,
                   65 fs_sbook-loccuram CURRENCY fs_sbook-loccurkey.
          ENDLOOP.                         " LOOP AT T_SBOOK INTO.....
      ENDCASE.                             " CASE SY-UCOMM
    ENDFORM.                               " UCOMM
    Regards
    Kiran

  • Can not insert or update [TABLE] from internal table in method

    I've faced a problem with OO abap. I've tried to insert into [ TABLE ] from internal table, but i've got error msg after i compiled.
    "An explicit work area is necessary in the OO context. Use "INSERT wa INTO [TABLE] itab""
    After  i changed to loop in work area and INSERT INTO  [TABLE] VALUES gw_data., everything is fine, can compile and run.
    This is error code.
      METHOD set_data_to_table.
        REFRESH gi_data.
        CLEAR gi_data.
        IF gi_file[] IS NOT INITIAL.
    * Set data for modify table
          LOOP AT gi_file INTO gw_file.
            MOVE-CORRESPONDING gw_file TO gw_data.
            me->conversion_input( EXPORTING im_vendor = gw_data-vendor
                                  CHANGING  ch_vendor = gw_data-vendor ).
            APPEND gw_data TO gi_data.
          ENDLOOP.
          INSERT [TABLE] FROM TABLE gi_data.
    *      LOOP AT gi_data INTO gw_data.
    *        INSERT INTO  [TABLE] VALUES gw_data.
    *        IF sy-subrc = 0.
    *          COMMIT WORK.
    *        ELSE.
    *          ROLLBACK WORK.
    *        ENDIF.
    *      ENDLOOP.
        ELSE.
          MESSAGE 'No data found' TYPE 'I'.
        ENDIF.
      ENDMETHOD.                    "set_data_to_table

    Hi Matthew,
    I think there is no difference in database insert between OO and non-OO.
    The correct syntax according to ECC600 online documentation is
    [Inserting Several Lines|http://help.sap.com/saphelp_erp2005vp/helpdata/en/fc/eb3a6d358411d1829f0000e829fbfe/content.htm]
    To insert several lines into a database table, use the following:
    INSERT target FROM TABLE itab \[ACCEPTING DUPLICATE KEYS].
    This writes all lines of the internal table itabto the database table in one single operation. If one or more lines cannot be inserted because the database already contains a line with the same primary key, a runtime error occurs. You can prevent the runtime error occurring by using the addition ACCEPTING DUPLICATE KEYS.
    Whenever you want to insert more than one line into a database table, it is more efficient to work with an internal table than to insert the lines one by one.
    I think the syntax
    INSERT my_dbtable FROM TABLE gi_data.
    should work, your suggestion may lead to syntax error.
    Regards,
    Clemens

  • Update internal table data from table control

    Hi GURUS,
    I need help regarding one of my requirement.
    I need to display data from the internal table on the screen and when the user selects a record/multiple records from screen and clicks on approve button i need to update one of the field from N to Y in the corresponding Ztable. Once the record is updated from Ztable , that should no longer be visible for the user on the screen.
    I am using table control wizard to display data. I am able to update the Ztable, but that record is not refreshing from the user screen. Any suggestions would be approved.
    Also please let me know if table control is the best way to do this/ alv grid control??

    hi
       REFRESH CONTROL Control-Name FROM SCREEN '0100'  -> use this command to refresh the table control
    to know more, read into
    https://forums.sdn.sap.com/click.jspa?searchID=2934287&messageID=673474
    Re: URGENT HELP REQ IN TABLE CONTROL WIZARD
    if helpful, reward
    Sathish. R

  • Copy a certain row of data into the next row in a same internal table ??

    HI, guys.
    May i know how to copy a certain row of data into the next row in a same internal table ?? Bcz I plan to update a certain colum of data in the row just now into another value..
    For example:-
    *at first...
    ebeln1   ebelp1   xblnr1
    ebeln2   ebelp2   xblnr2
    ebeln3   ebelp3   xblnr3
    *after that, become...
    ebeln1   ebelp1   xblnr1
    ebeln2   ebelp2   xblnr2
    ebeln2   ebelp2   xblnr4
    ebeln2   ebelp2   xblnr5
    ebeln3   ebelp3   xblnr3
    Thanks in advance.

    hi,
    If you have this kind of requirement then you must be having 2 internal tables ,one existing data and 2nd from which you have to insert the records into 1st table.
    so in this case,
    loop at itab1.
      v_index = sy-tabix.
      loop at itab2 into wa where pri_key = itab1-pri_key.
      v_index = v_index + 1.
      insert  wa into itab index v_index.
      endloop.
    endloop.
    Using this code ,your data records similar to your 1st tables primary key records will get inserted into table.

  • Unable to Capture ALV output in an Internal Table, after CALL TRANSACTION

    Dear all,
    My requirement is to run multiple materials in T-code CK86_99 but as we know CK86_99 is only adequate to one material at a time.
    So, I want to capture the Output of the T-code in my Internal table with respect to all the Material Numbers I use in the Select-Options of my Z Program.
    Below is the Code I developed so far, but the Class
    cl_salv_bs_runtime_info=>get_data_ref(
            IMPORTING r_data = lf_ref ).
    is not capturing the Ouput...
    Please have a look and enlighten me how it could be solved.
    TABLES : mara.
    DATA : BEGIN OF wa_mara,
      matnr TYPE mara-matnr,
      END OF wa_mara.
    DATA: it_bdcdata TYPE TABLE OF bdcdata,
          wa_it_bdcdata LIKE LINE OF it_bdcdata,
          it_mara LIKE TABLE OF wa_mara.
    *      BELNR(10).
    FIELD-SYMBOLS:<fs_tab> TYPE ANY TABLE,
    <fs_line> TYPE any.
    DATA:lf_ref TYPE REF TO data,
         lf_ref1 TYPE REF TO data.
    SELECT-OPTIONS so_matnr FOR mara-matnr.
    PARAMETERS p_werks LIKE t001w-werks.
    *BELNR = 'Z92'. " Give Document Number here
    SELECT matnr FROM mara INTO TABLE it_mara WHERE matnr IN so_matnr.
    DATA opt TYPE ctu_params.
    LOOP AT it_mara INTO wa_mara.
      CLEAR wa_it_bdcdata.
    wa_it_bdcdata-program  = 'SAPMKKB0'.
    wa_it_bdcdata-dynpro   = '0300'.
    wa_it_bdcdata-dynbegin = 'X'.
      APPEND wa_it_bdcdata TO it_bdcdata.
      CLEAR wa_it_bdcdata.
    wa_it_bdcdata-fnam = 'BDC_CURSOR'.
    wa_it_bdcdata-fval = 'KKB0-MATNR'.
      APPEND wa_it_bdcdata TO it_bdcdata.
      CLEAR wa_it_bdcdata.
    wa_it_bdcdata-fnam = 'KKB0-MATNR'.
      wa_it_bdcdata-fval = wa_mara-matnr.
      APPEND wa_it_bdcdata TO it_bdcdata.
      CLEAR wa_it_bdcdata.
    wa_it_bdcdata-fnam = 'BDC_CURSOR'.
    wa_it_bdcdata-fval = 'KKB0-WERKS'.
      APPEND wa_it_bdcdata TO it_bdcdata.
      CLEAR wa_it_bdcdata.
      wa_it_bdcdata-fnam = 'KKB0-WERKS'.
    wa_it_bdcdata-fval = p_werks.
      APPEND wa_it_bdcdata TO it_bdcdata.
      CLEAR wa_it_bdcdata.
    wa_it_bdcdata-fnam = 'BDC_OKCODE'.
    wa_it_bdcdata-fval = 'OSNY'."'ONLI'."=CRET'.
      APPEND wa_it_bdcdata TO it_bdcdata.
    *  CLEAR wa_it_bdcdata.
    * wa_it_bdcdata-program  = 'SAPLKKRSOO'.
    * wa_it_bdcdata-dynpro   = '0100'.
    * wa_it_bdcdata-dynbegin = 'X'.
    *  APPEND wa_it_bdcdata TO it_bdcdata.
    *  CLEAR wa_it_bdcdata.
    * wa_it_bdcdata-fnam = 'BDC_OKCODE'.
    *  wa_it_bdcdata-fval = 'BACK'."=CRET'.
    *  APPEND wa_it_bdcdata TO it_bdcdata.
    *  CLEAR wa_it_bdcdata.
    * wa_it_bdcdata-program  = 'SAPMKKB0'.
    * wa_it_bdcdata-dynpro   = '0300'.
    * wa_it_bdcdata-dynbegin = 'X'.
    *  APPEND wa_it_bdcdata TO it_bdcdata.
    *  CLEAR wa_it_bdcdata.
    * wa_it_bdcdata-fnam = 'BDC_OKCODE'.
    * wa_it_bdcdata-fval = 'EXIT'."=CRET'.
    *  APPEND wa_it_bdcdata TO it_bdcdata.
      opt-dismode = 'N'.
    cl_salv_bs_runtime_info=>set(
        EXPORTING display  = abap_false
                  metadata = abap_true
    data     = abap_true ).
      CALL TRANSACTION 'CK86_99' USING it_bdcdata OPTIONS FROM opt.
      TRY.
    cl_salv_bs_runtime_info=>get_data_ref(
            IMPORTING r_data = lf_ref ).
          ASSIGN lf_ref->* TO <fs_tab>.
        CATCH cx_salv_bs_sc_runtime_info.
          MESSAGE 'Unable to retrieve ALV data' TYPE 'E'.
      ENDTRY.
    cl_salv_bs_runtime_info=>clear_all( ).
      IF <fs_tab> IS ASSIGNED.
        CREATE DATA lf_ref1 LIKE LINE OF <fs_tab>.
        ASSIGN lf_ref1->* TO <fs_line>.
      ENDIF.
    *LOOP AT <FS_TAB> ASSIGNING <FS_LINE>.
    *ENDLOOP.

    Hi Abhay,
          If you go to Transaction code SE93, enter the tcode "CK86_99" and click display, you may see the default value for transaction is "KKBB" and the screen field for P_SCREEN = 0300, P_TCODE = ck86_99.
          You may need to copy the transaction code "KKBB" and go to SE93 again, enter the tcode for "KKBB" then click display, now you may see the program name is "RKKB1000".
          Hope this answer your question.
    Thanks
    Hock Lin

  • How to find the number of columns in an internal table DYNAMICALLY ?

    Hi,
    How to find the number of columns in an internal table DYNAMICALLY ?
    Thanks and Regards,
    saleem.

    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

  • How to log the messages in an internal table n display

    Hello guys,
    This is my first post in SDN.
    I am uploading some data from application server. I am doing lot of varifications, based on that I have to display the messages.
    So I asked not to use the write statements to display the messages but asked me to create an internal table and display the messages afterwards..
    like I am using some BAPI to upload after the bapi call i have to log the result for each record into an internal table and show...
    can anyone guide me how to do it?

    Thanks for your info Azad,
    here I am posting my code... can u go through it once and lemme me whether i am in right track or not?
    FORM FORM_POST_DATA.
      IF X_POST = 'X'.
        CALL FUNCTION 'BAPI_ACC_BILLING_POST'
          EXPORTING
            DOCUMENTHEADER          = WA_DOCUMENTHEADER
           CUSTOMERCPD             = WA_CUSTOMERCPD
    IMPORTING
      OBJ_TYPE                =
      OBJ_KEY                 =
      OBJ_SYS                 =
          TABLES
            ACCOUNTRECEIVABLE       = IT_ACCOUNTRECEIVABLE
            ACCOUNTGL               = IT_ACCOUNTGL
            ACCOUNTTAX              = IT_ACCOUNTTAX
      CRITERIA                =
      VALUEFIELD              =
            CURRENCYAMOUNT          = IT_CURRENCYAMOUNT
            RETURN                  = IT_RETURN
      SALESORDER              =
      SALESAMOUNT             =
           EXTENSION1              = IT_EXTENSION1
        LOOP AT IT_RETURN.
          MOVE-CORRESPONDING IT_RETURN TO IT_MESSAGES.
        ENDLOOP.
      ENDIF.
    WRITE: / 'Result of Post:'.
      WRITE : / REF_TYPE,REF_KEY,REF_SYS.
      PERFORM FORM_SHOW_MESSAGES.
    ENDFORM.              "FORM_POST_DATA
    FORM FORM_SHOW_MESSAGES.
      IF IT_RETURN[] IS INITIAL.
        WRITE: / 'no messages'.
      ELSE.
        SKIP 1.
        LOOP AT IT_RETURN.
          WRITE: /    IT_RETURN-TYPE,
                 (2)  IT_RETURN-ID,
                      IT_RETURN-NUMBER,
                 (80) IT_RETURN-MESSAGE,
                    IT_RETURN-LOG_NO
                    IT_RETURN-LOG_MSG_NO
                    IT_RETURN-MESSAGE_V1
                    IT_RETURN-MESSAGE_V2
                    IT_RETURN-MESSAGE_V3
                    IT_RETURN-MESSAGE_V4
                 (20) IT_RETURN-PARAMETER,
                 (3)  IT_RETURN-ROW,
                      IT_RETURN-FIELD.
                    IT_RETURN-SYSTEM
        ENDLOOP.
      ENDIF.
      ULINE.
    ENDFORM.                               " Show_messages
    Nisha...

Maybe you are looking for