Declare Internal Table in Code or in Data Dictionary...Opinions needed?

Is it better to define your internal table and all of its fields in a begin of/end of declaration stmt in your code's data definitions. Or, is it better to create a structure in the Data Dictionary, which means one line of code in your program? Why does one choose the method they prefer?
I am thinking it is best to declare in Data Dictionary, especially since ABAP is now leaning towrds objects. However, I am seeing a lot of field by field definitions in programs. I am very interested in how most programmers accomplish this and why.    
                 Thank-You

I would say that if the internal table is to be used in more than one program, then I would create a structure and/or table type in the ABAP dictionary.  If it is to be used in just one program, then I would define it locally.
Regards,
Rich Heilman

Similar Messages

  • Simple command to refresh data of all declared internal tables & variables!

    Hi All,
    I have declared many internal tables & variables in my program in declaration include.
    Is there any Simple command which can refresh data of all declared internal tables & variables!
    Instead of clearing & refreshing each i.table & variable i want to use single command to refresh data.
    Is this possible!
    Thanks in advance.
    Thanks,
    Deep.

    CLEAR: lv_field1,
                 lv_field2,
                 lt_itab1[],
                 lt_itab2[].
    ONE simple command (CLEAR), can initialize fields, workareas, field-symbols,.... and internal tables.

  • Problem in declaring internal table

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

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

  • Creation of internal table dynamically based on the Date Range entered

    Hi SAPgurus,
    I have been facing one issue i.e creation of internal table dynamically based on the date range entered in the selection screen. For example the date range I am giving as 06/2006 to 08/2006, it should display the Fieldcatelog dynamically, this part i have completed but the only issue I am facing is to populate the sales data into that fields.
    Right now my program is displaying the ALV like this.
    Ex:
    <b>CSR    District   06/2006  07/2006  08/2006  totals</b>      
    Shiva      New York                             10.00
    Shiva      new york                             30.00
    Shiva      new york                             40.00
    but it should display like this
    <b>CSR    District 06/2006 07/2006 08/2006 totals</b>
    Shiva  New York  10.00   30.00 40.00
    80.00                 
    Please help me in this scenario, how to acheive like this..
    Thanks & Regards,
    Sivaram Kandula

    Hi Sivaram,
                 I also got the same requirement . i saw rich and your code whatever you have uploaded.i have created dynamic internal table but i am facing the issue to populating the data to my dynamic internal table.
    Sivaram, can you please explain your code after this.
    *<dyn_table>
    *tab_item.
      LOOP AT tab_item.
        ASSIGN COMPONENT 1 OF STRUCTURE <dyn_wa> TO <dyn_table>.
        ASSIGN COMPONENT 2 OF STRUCTURE <dyn_wa> TO <dyn_table>.
    *    <dyn_wa> = tab_item-bztxt.
    *    <dyn_wa> = tab_item-total.
    *    APPEND <dyn_wa> TO <dyn_table>.
    **    <dyn_wa> = tab_item-total.
    **    ASSIGN tab_item-bezei  TO <dyn_wa>.
    *  APPEND <dyn_table>.
      ENDLOOP.
    how you are puting the loop at tab_item. but tab_item is already commented.
    can you send me the code after that.
    i am sending some part of my code.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
       EXPORTING
         it_fieldcatalog = gt_fCAT1
       IMPORTING
         ep_table        = new_table.
    ASSIGN new_table->* TO <dyn_table>.
       create data new_line like line of <dyn_table>.
       assign new_line->* to <dyn_wa>.
    select vbeln
            fkart
            vkorg
            vtweg
            fkdat
            spart
            fksto
            from vbrk
            client specified
            into table gt_vbrk
            where mandt = sy-mandt
            and fkart in ('ZF5','ZFR')
            and vkorg = '1100'
            and vtweg = '20'
            and fkdat in s_fkdat
            and spart = '06'
            and fksto = ' '.
       if gt_vbrk[] is not initial.
      select  vbeln
              fkimg
              prsdt
              netwr
              matnr
              arktx
              werks
              mwsbp
              from vbrp
              client specified
              into table gt_vbrp
              for all entries in gt_vbrk
              where vbeln = gt_vbrk-vbeln
              and werks in s_werks
              and matnr in s_matnr.
      endif.
    select mnr ltx spras from t247
    into table it_t247
    where spras = 'E'.
    data: lv_month1 type vbrp-prsdt,
           name1(3) type c,
           s_month type string,
            s_month1 type string,
             s_month2 type string.
    *      lv_netwr1 type vbrp-netwr,
    *          lv_mwsbp1 type vbrp-mwsbp.
          loop at gt_vbrp into gs_vbrp.
            gs_final2-matnr = gs_vbrp-matnr.
            gs_final2-arktx = gs_vbrp-arktx.
            gs_final2-fkimg = gs_vbrp-fkimg.
           lv_month1 = gs_vbrp-prsdt.
            read table it_t247 into wa_t247 with key mnr = lv_month1+4(2).
            if sy-subrc eq 0.
            name1 =  wa_t247-ltx.
            endif.
             concatenate  name1
                       lv_month1(4) into s_month SEPARATED BY '_' .
             CONCATENATE S_MONTH 'QTY' INTO S_MONTH1 SEPARATED BY ''.
              CONCATENATE S_MONTH 'VALUE' INTO S_MONTH2 SEPARATED BY ''.
             gs_final2-month = s_month.
              lv_netwr1 = gs_vbrp-netwr.
            lv_mwsbp1 = gs_vbrp-mwsbp.
            gs_final2-MONTH_QTY = S_MONTH1.
            GS_FINAL2-MONTH_VAL = S_MONTH2.
            gs_final2-value = lv_netwr1 + lv_mwsbp1.
           append gs_final2 to gt_final2.
           clear: gs_final2. "lv_name2.
           endloop.
           if gt_final2[] is not initial.
             sort gt_final2 by matnr month ascending .
             loop at gt_final2 into gs_final2.
            gs_final2_01 = gs_final2.
         collect gs_final2_01 into gt_final2_01.
        endloop.
           endif.
       ENDIF..
    Regards
    Ankur

  • Declaring internal tables

    why do we declare internal tables in this way
    TYPES: BEGIN OF ty_t501t,
           END OF ty_t501t.
    DATA: gt_list1 TYPE STANDARD TABLE OF ty_list1,
    why not this
    DATA: BEGIN OF ITAB OCCURS 0,
          END OF ITAB.

    Hi,
    Declaring internal table with a header line decreases performance.
    Its better to have internal table without header line and a work area to work with it.
    Its improves performance.
    Also wen u work with internal table with header line it creates confusion that whether ur working with the header line or body of the internal table.
    Also declaring internal table with header line is obsolete one.
    LOOP AT ITAB----
    >Working with header line.(Confusion whether ur referring header or body of internal table)
    LOOP AT ITAB INTO WA------>Working with internal table widout header line and an work area
    Regards,
    Lakshman.
    Edited by: Lakshman N on Aug 14, 2009 7:25 AM

  • HR abap :  how to declare internal table to fetch data from 0585 infotype

    Hi all ,
    I am able to fetch the data from pa0585 infotype for set of employee no , but the problem is as the fields in pa0585 (like Contr to ULIP , NSC , Medical Treatment,Contribution to Certain Pension Funds so on ..) will be changed dynamically and will be displayed based on the amount value in descending order iam not able to store the values of the fileds into internal table . I dont understand how to declare the internal table ..Please help in if u have solved this kind of problem.
    I shld get the output in this way ...
    Emp No     Name    Medical treatment       Contr to ULIP             ....... so on
    101          abc           10000                        150000                      .......so on
    102          xyz           12000                        150000                      .......so on
    My header shld be fixed and I shld display values in this way .... I can use write statement to display directly .
    Thanks ....

    Hi
    Decalre INFOTYPE
    Goto SE37 - Find FM -
    READINFOTYPE*

  • How to declare internal table in SMARTFORM

    Hi experts,
    I have an Internal table in my program and I want to declare in the smartform as well. How and where can I declare? Should I use global definitions and tpyes tab? How can I pass the content of the internal table to the smartform?

    Click Global Defiitions
    In TYPES :
    TYPES : BEGIN OF gty_add,
             name1      TYPE ad_name1,                          " name1
             city1      TYPE ad_city1,  " City
             country    TYPE adrc-country, "Coutnry
             post_code1 TYPE ad_pstcd1, " post code
             street     TYPE ad_street, " street
             house_num1 TYPE ad_hsnm1,  " house number
             tel_number TYPE ad_tlnmbr1," tele number
            END OF gty_add.
    In Global DATA
    GT_ADD     TYPE TABLE OF     GTY_ADD ( Internal table)
    WA_ADD     TYPE     GTY_ADD ( work area)

  • Structure of the context for declaring internal table

    Hi,
    Can we use the structure of the context for declaring the internal ?
    -Sid

    Hi Sid,
    You can use the above element_ & elements_ notation to define workarea & internal table similar to your context. But the disadvantage of this approach as how pointed out by Thomas in 1 of his earlier threads is that this coding would work fine only for that particular view. If you copy the same code from your view input_view and try to use it in another view say VIEW1 then it wouldn't work as the interface name would have changed from if_input_view to if_view1. So its suggested to use the below approach:
    DATA: lt_main TYPE wd_this->elements_node_vbak,  " Internal table
              wa_main TYPE wd_this->element_node_vbak.  " Work area
    Try go through this excellent [article|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/60730016-dbba-2a10-8f96-9754a865b814]. It would help you understand what all you need to know about working with the context & its attributes.
    Regards,
    Uday

  • Saving .csv into internal table - using dataset (',' comes between data)

    Hi experts,
    I need to save .csv from application server to internal table.
    i am using the below code.
    gt_raw and gwa_raw are dxrawdata format.
    OPEN DATASET gv_pfile FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    *--- Display error messages if any.
      IF sy-subrc NE 0.
        WRITE:/ 'FILE UPLOAD FAILED - ERROR NO. : ', sy-subrc.
        EXIT.
      ELSE.
        DO.
          READ DATASET gv_pfile INTO gwa_raw.
          IF sy-subrc NE 0.
            EXIT.
          ELSE.
            APPEND gwa_raw TO gt_raw.
            CLEAR gwa_raw.
          ENDIF.
        ENDDO.
    *--Close the Application server file (Mandatory).
        CLOSE DATASET gv_pfile.
      ENDIF.
      DELETE DATASET gv_pfile.
      LOOP AT gt_raw into gwa_raw.
        IF SY-TABIX > 1.
          SPLIT gwa_raw at ',' into gwa_cust-cust_code
                                    gwa_cust-cust_name
                                    gwa_cust-grp_name
          APPEND gwa_cust TO gt_cust.
          CLEAR: gwa_cust, gwa_raw.
        ENDIF.
      ENDLOOP.
    My program works fine.
    But when the gwa_cust-grp_name contains the value for eg. -> panasonic co., ltd.
    it takes till panasonic co., only
    and leaves ltd. as i am using SPLIT command.
    is there any other way to do this.
    plz help me to solve this issue.
    thanks.

    Hi,
    I notice you have marked the message as answered, but I just wanted to let you know there is a solution. The trick is to parse into an internal table and then to find and reassemble fields that were split because they contgain a comma. The ABAP program below is a commented example.
    Rgds,
    Mark
    REPORT  zcsv_parse.
    DATA:
      tokens       TYPE i.
    TYPES: BEGIN OF ty_result,
      company      TYPE char20,
      compnr       TYPE i,
      city         TYPE char30,
      country      TYPE char30,
    END OF ty_result.
    DATA:
      gt_rawtab    TYPE TABLE OF string,
      gw_rawtab    LIKE LINE OF gt_rawtab,
      gt_result    TYPE TABLE OF ty_result,
      gw_result    LIKE LINE OF gt_result,
      gt_parse     TYPE TABLE OF string,
      gw_parse     LIKE LINE OF gt_parse.
    DEFINE %csvline.
      gw_rawtab = &1.
      append gw_rawtab to gt_rawtab.
    END-OF-DEFINITION.
    START-OF-SELECTION.
    * Create CSV lines, some with a comma inside a token
      %csvline '"CompanyOne NV",500,"Antwerp","Belgium"'.
      %csvline '"CompanyTwo,Inc",600,"New York,NY","USA"'.
      %csvline '"CompanyThree,Ltd",700,"Sydney,NSW","Australia"'.
    * Parse the raw CSV
      LOOP AT gt_rawtab INTO gw_rawtab.
        REFRESH gt_parse.
        SPLIT gw_rawtab AT ',' INTO TABLE gt_parse.
        DESCRIBE TABLE gt_parse LINES tokens.
    *   If extra commas: token count higher than field count
        IF tokens > 4.
          PERFORM reassemble.
        ENDIF.
    *   At this point each entry in GT_PARSE contains exactly
    *   one result field => build the result table
        LOOP AT gt_parse INTO gw_parse.
    *     Strip quotes from text fields
          REPLACE ALL OCCURRENCES OF '"' IN gw_parse WITH ''.
          CASE sy-tabix.
            WHEN 1. gw_result-company = gw_parse.
            WHEN 2. gw_result-compnr = gw_parse.
            WHEN 3. gw_result-city = gw_parse.
            WHEN 4. gw_result-country = gw_parse.
          ENDCASE.
        ENDLOOP.
        APPEND gw_result TO gt_result.
      ENDLOOP.
    * Show the formatted result
      LOOP AT gt_result INTO gw_result.
        WRITE: / gw_result-company, gw_result-compnr,
                 gw_result-city, gw_result-country.
      ENDLOOP.
    *&      Form  reassemble
    *       Merges tokens that were split because they contain a comma
    FORM reassemble.
      DATA: lastpos    TYPE i,
            lastchar   TYPE c,
            currtoken  LIKE sy-tabix,
            nexttoken  LIKE sy-tabix,
            gw_next    LIKE gw_parse.
      LOOP AT gt_parse INTO gw_parse.
        lastpos  = STRLEN( gw_parse ) - 1.
        lastchar = gw_parse+lastpos(1).
    *   Token starts with quote but does not end with one =>
    *   must merge with the next token
        IF gw_parse+0(1) = '"' AND lastchar <> '"'.
          currtoken = sy-tabix.
          nexttoken = sy-tabix + 1.
          READ TABLE gt_parse INTO gw_next INDEX nexttoken.
          CONCATENATE gw_parse gw_next INTO gw_parse SEPARATED BY ','.
          MODIFY gt_parse FROM gw_parse INDEX currtoken.
          DELETE gt_parse INDEX nexttoken.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    "reassemble

  • Checking naming convention of internal tables in code inspector

    Can anyone please explain how in the code inspector can I check names of internal tables (like it_) that I use in a report program ? I know that I can specify it_ in Programming Convention -> Naming Convention->Program Global -> Data but this entry is not specific to internal tables as it also applies to variables and work areas. Apart from this is there any entry I can maintain in the Extended Naming Conventions for Programs(introduced in ECC 6.0)? Kindly reply at the earliest.

    Hi,
    Check these links for implementing the custom conventions in the code inspector
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/nw/how%20to%20build%20a%20new%20check%20for%20the%20code%20inspector
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/evaluating%20the%20quality%20of%20your%20abap%20programs%20and%20other%20repository%20objects%20with%20the%20code%20inspector
    hope it helps you.
    Thanks!

  • How to declare internal table in BADI with variable name beginning with 0..

    Gurus,
    How to declare an internal table within a BADI. I have to implement a BADI UC_TASK_CUSTOM for BCS to BW load and there i have to  declare an internal table like:
    TYPES:          BEGIN OF t_cube_data,
                    0cs_version       TYPE /bi0/oics_version,
                    0sem_cgcomp       TYPE /bi0/oisem_cgcomp,
                    bcs_vers          TYPE /bic/oibcs_vers,
                    bcs_lcus          TYPE /bic/oibcs_lcus,
                    bcs_ldch          TYPE /bic/oibcs_ldch,
                    bcs_invcom       TYPE /bi0/oibcs_invcom,
                    bcs_litem         TYPE /bic/oibcs_litem,
                    bcs_llob          TYPE /bic/oibcs_llob,
                    bcs_lmay          TYPE /bic/oibcs_lmay,
                    0move_type        TYPE /bi0/oimove_type,
                    pcompany         TYPE /bi0/oipcompany,
                    bcs_lprg          TYPE /bic/oibcs_lprg,
                    figlxref3         TYPE /bic/oifiglxref3,
                    fiscyear         TYPE /bi0/oifiscyear,
                    fiscper3         TYPE /bi0/oifiscper3,
                    fiscvarnt        TYPE /bi0/oifiscvarnt,
                    curkey_gc        TYPE /bi0/oicurkey_gc,
                    unit             TYPE /bi0/oiunit,
                    cs_trn_gc        TYPE /bi0/oics_trn_gc,
                    cs_trn_qty       TYPE /bi0/oics_trn_qty,
              END OF t_cube_data
    But with this declaration it gives a error saying that u cannot have a variable beginning with 0...like 0cs_version....
    but i have to do it for my functionality to wrk...
    Please help me do it....
    how can i declare a internal table that allows me to have variable names that start with 0....
    Please help....Its URGENT....
    Thanks
    Sam

    Murali,
    I need to have 0 before the variable name in the declaration of the internal table....how can i attain that....
    Please suggest...
    Thanks
    Sam

  • Internal table with vbao and vbap data.

    I am getting a sales order number from input and i need to fetch the data based on that to a table. so i have declared like below.
    one table itab1 for the final fields i need
    and itab2 for the item data fields. and then i am looping and updating it.
    So please suggest me mdoifications in this code  and  how to handle bukrs filed in the final table.
    TYPES : BEGIN OF titab1,
      bukrs like mseg-bukrs,
      vbeln  LIKE vbak-vbeln,
      erdat LIKE vbak-erdat,
      erzet LIKE vbak-erzet,
      vkorg LIKE vbak-vkorg,
      vtweg LIKE vbak-vtweg,
      bstnk LIKE vbak-bstnk,
      kunnr LIKE vbak-kunnr,
      posnr LIKE vbap-posnr,
      matnr LIKE vbap-matnr,
      zmeng LIKE vbap-zmeng,
      MATKL like vbap-matkl,
      ZIEME like vbap-zieme,
      END OF titab1.
    TYPES : BEGIN OF titab2,
      vbeln like vbap-vbeln,
      posnr LIKE vbap-posnr,
      matnr LIKE vbap-matnr,
      zmeng LIKE vbap-zmeng,
      MATKL like vbap-matkl,
      ZIEME like vbap-zieme,
      END OF titab2.
    DATA : iTab2 TYPE STANDARD TABLE OF Titab2.
    DATA : waitab2 TYPE titab2.
    DATA : itab1 TYPE STANDARD TABLE OF titab1.
    DATA : waitab1 TYPE titab1.
    FIELD-SYMBOLS : <field> type titab1.
    SELECT vbeln erdat erzet vkorg vtweg  bstnk kunnr
                        FROM vbak INTO TABLE itab1
                       WHERE
                        vbeln = p_vbeln.
    SELECT vbeln posnr
           matnr
           zmeng  MATKL  ZIEME FROM vbap INTO TABLE itab2
      WHERE vbeln = p_vbeln.
    LOOP AT itab1 ASSIGNING <field>.
    read table itab2 into waitab2 WITH  KEY vbeln = <field>-vbeln.
    <field>-bukrs = '5120'.
    <field>-posnr = waitba2-posnr.
    <field>-matnr = waitba2-matnr.
    <field>-zmeng = waitba2-zmeng.
    <field>-matkl = waitba2-matkl.
    <field>-zieme = waitba2-zieme.
    endloop.

    Hi,
    Then you can try using a inner join select statement to directly get the required fields in itab1
    SELECT a~vbeln a~erdat a~erzet a~vkorg a~vtweg a~bstnk a~kunnr
                 b~posnr b~matnr b~zmeng b~MATKL b~ZIEME
    into itab1
    from ( vbak as a inner join vbap as b
                           ON a~vbeln = b~vbeln)
    where a~vbeln = p_vbeln.
    Else use FOR ALL ENTRIES like this
    SELECT vbeln erdat erzet vkorg vtweg bstnk kunnr
    FROM vbak INTO TABLE itab1
    WHERE
    vbeln = p_vbeln.
    if sy-subrc = 0.
    SELECT vbeln posnr matnr zmeng MATKL ZIEME
    FROM vbap
    INTO TABLE itab2
    FOR ALL ENTRIES in itab1
    WHERE vbeln = itab1-vbeln.
    endif.
    loop at itab1.
    read table itab2 with key vbeln = itab1-vbeln.
    if sy-subrc = 0.
    itab1-posnr = itab2-posnr.
    itab1-matnr = itab2-matnr.
    itab1-zmeng = itab2-zmeng.
    itab1-matkl = itab2-matkl.
    itab1-zieme = itab2-zieme.
    modify itab1
    endif.
    endloop.
    Regards,
    Vik

  • Internal table field does not show data.

    hello experts,
    I am currently modifying a code in a report where it shows PO's and it amount, downpayment, Invoice, GR, payment and balance. Now the problem is, some of the PO amount(it gets the amount from ekpo-netwr) does not show on the report output. the field is t_amount-netwr. I really need help on this one guys. Thanks and take care!
    PERFORM process_with_budat.
    FORM process_with_budat.
      DELETE t_pohistory WHERE hist_type <> 'A'
                           AND hist_type <> 'E'
                           AND hist_type <> 'Q'.
      LOOP AT t_account.
        DELETE it_dtl WHERE ebeln = t_account-ebeln
                        AND psphi IS initial.
        DELETE t_ekpo WHERE ebeln = t_account-ebeln
                        AND ebelp = t_account-po_item.
        t_proj-ebelp = t_account-po_item.
        SELECT SINGLE psphi FROM prps INTO t_proj-psphi
              WHERE posid = t_account-wbs_elem_e.
        CHECK sy-subrc = 0.
        LOOP AT t_pohistory WHERE po_item = t_account-po_item
                              AND ebeln   = t_account-ebeln.
          t_amount-ebeln = t_account-ebeln.
          t_amount-psphi = t_proj-psphi.
          ON CHANGE OF t_pohistory-po_item.
            CLEAR v_netwr.
            SELECT SINGLE netwr FROM ekpo INTO v_netwr
                  WHERE ebeln = t_account-ebeln
                    AND ebelp = t_account-po_item.
            t_amount-netwr = v_netwr.
          ENDON.
          IF v_ebeln IS INITIAL AND v_ebelp IS INITIAL.
            CLEAR v_netwr.
            SELECT SINGLE netwr FROM ekpo INTO v_netwr
                  WHERE ebeln = t_account-ebeln
                    AND ebelp = t_account-po_item.
            t_amount-netwr = v_netwr.
            v_ebeln = t_account-ebeln.
            v_ebelp = t_account-po_item.
          ELSEIF v_ebeln <> t_account-ebeln AND
                 v_ebelp <> t_account-po_item.
            CLEAR v_netwr.
            SELECT SINGLE netwr FROM ekpo INTO v_netwr
                  WHERE ebeln = t_account-ebeln
                    AND ebelp = t_account-po_item.
            t_amount-netwr = v_netwr.
            v_ebeln = t_account-ebeln.
            v_ebelp = t_account-po_item.
          ELSEIF v_ebeln = t_account-ebeln AND
                 v_ebelp <> t_account-po_item.
            CLEAR v_netwr.
            SELECT SINGLE netwr FROM ekpo INTO v_netwr
                  WHERE ebeln = t_account-ebeln
                    AND ebelp = t_account-po_item.
            t_amount-netwr = v_netwr.
            v_ebeln = t_account-ebeln.
            v_ebelp = t_account-po_item.
          ENDIF.
          CHECK NOT t_amount-psphi IS INITIAL.
          if t_pohistory-pstng_date LE pa_augdt.
         IF t_pohistory-pstng_date IN so_augdt.
            IF t_pohistory-db_cr_ind = 'H'.
              t_pohistory-val_loccur = - t_pohistory-val_loccur.
              t_pohistory-val_forcur = - t_pohistory-val_forcur.
              t_pohistory-cl_val_loc = - t_pohistory-cl_val_loc.
            ENDIF.
            IF t_pohistory-hist_type = 'A'.
              IF t_pohistory-currency <> 'PHP'.
                t_amount-dpamt = t_amount-dpamt + t_pohistory-val_forcur.
              ELSE.
                t_amount-dpamt = t_amount-dpamt + t_pohistory-val_loccur.
              ENDIF.
            ELSEIF t_pohistory-hist_type = 'E'.
              IF t_pohistory-currency <> 'PHP'.
                t_amount-gramt = t_amount-gramt + t_pohistory-val_forcur.
              ELSE.
        t_amount-gramt = t_amount-gramt + t_pohistory-val_loccur.
              ENDIF.
            ELSEIF t_pohistory-hist_type = 'Q'.
              IF t_pohistory-currency <> 'PHP'.
           t_amount-iramt = t_amount-iramt + t_pohistory-val_forcur.
              ELSE.
                t_amount-iramt = t_amount-iramt + t_pohistory-val_loccur.
              ENDIF.
            ENDIF.
            IF t_pohistory-currency <> 'PHP'.
              IF t_pohistory-val_loccur = 0 OR
                 t_pohistory-val_forcur = 0.
                t_amount-tramt = t_amount-iramt.
               t_amount-tramt = t_amount-dpamt.
              ELSE.
                t_amount-tramt = t_amount-iramt.
              ENDIF.
            ELSE.
              t_amount-tramt = t_amount-iramt.
             t_amount-tramt = t_pohistory-cl_val_loc + t_amount-dpamt.
            ENDIF.
            IF NOT t_pohistory-cl_val_loc IS INITIAL.
              CONCATENATE t_pohistory-mat_doc t_pohistory-doc_year
                    INTO bkpf-awkey.
             SELECT SINGLE * FROM bkpf
                   WHERE awkey = bkpf-awkey.
    *AVH - removed wrbtr and dmbtr from selection
              SELECT augdt augbl shkzg FROM bsak
                    INTO (bsak-augdt,bsak-augbl,bsak-shkzg)
                    WHERE bukrs = bkpf-bukrs
                      AND gjahr = bkpf-gjahr
                      AND belnr = bkpf-belnr.
    *AVH
                if not bsak-augbl is initial.
                  select belnr gjahr from bsak
                   into (bsak-belnr, bsak-gjahr)
                    where bukrs = bkpf-bukrs
                     and belnr = bkpf-belnr
                     and gjahr = bkpf-gjahr.
                    select awkey from bkpf
                     into v_bkpf_aw
                     where bukrs = 'GLOB'
                       and belnr = bsak-belnr
                       and gjahr = bsak-gjahr.
                      w_len = strlen( v_bkpf_aw ).
                      w_off = w_len - 4.
                      v_awkey_1 = v_bkpf_aw+0(10).
                      v_awkey_2 = v_bkpf_aw+w_off(4).
                      select single dmbtr wrbtr from ekbe
                        into (ekbe-dmbtr, ekbe-wrbtr)
                       where belnr = v_awkey_1
                         and gjahr = v_awkey_2.
    *AVH - Changed all bsak-wrbtr to ekbe-wrbtr and dmbtr to ekbe-dmbtr.
                      IF bsak-shkzg = 'H'.
                        ekbe-dmbtr = - ekbe-dmbtr.
                        ekbe-wrbtr = - ekbe-wrbtr.
                      ENDIF.
                      IF t_pohistory-currency <> 'PHP'.
                        IF bsak-augdt GT pa_augdt.
                 IF bsak-augdt IN so_augdt.
                          t_amount-tramt = t_amount-tramt + ekbe-wrbtr.
                        ENDIF.
                      ELSE.
                        IF bsak-augdt GT pa_augdt.
                 IF bsak-augdt IN so_augdt.
                          t_amount-tramt = t_amount-tramt + ekbe-dmbtr.
                        ENDIF.
                      ENDIF.
                    endselect.
                   endselect.
                  endselect.
                endif.
              ENDSELECT.
            ENDIF.
            IF t_account-distr_perc <> 0.
              t_amount-dpamt = ( t_account-distr_perc *
                                 t_amount-dpamt ) / 100.
              t_amount-gramt = ( t_account-distr_perc *
                                 t_amount-gramt ) / 100.
              t_amount-iramt = ( t_account-distr_perc *
                                 t_amount-iramt ) / 100.
              t_amount-tramt = ( t_account-distr_perc *
                                 t_amount-tramt ) / 100.
            ENDIF.
          ENDIF.
          IF t_amount-tramt < 0.
            t_amount-tramt = 0.
          ENDIF.
          t_amount-tramt = t_amount-iramt.
          t_amount-blamt = t_amount-netwr - t_amount-tramt.
          COLLECT t_amount. CLEAR t_amount.
          APPEND t_proj.
        ENDLOOP.
        IF sy-subrc <> 0.
          CLEAR v_netwr.
          SELECT SINGLE netwr FROM ekpo INTO v_netwr
                WHERE ebeln = t_account-ebeln
                  AND ebelp = t_account-po_item.
          t_amount-ebeln = t_account-ebeln.
          t_amount-psphi = t_proj-psphi.
          t_amount-tramt = t_amount-iramt.
          t_amount-blamt = t_amount-netwr - t_amount-tramt.
          COLLECT t_amount. CLEAR t_amount.
          APPEND t_proj.
        ENDIF.
      ENDLOOP.
    endform.
    **This is where it transfers the data**
    LOOP AT t_amount.
        it_dtl-netwr = t_amount-netwr.
        it_dtl-dpamt = t_amount-dpamt.
        it_dtl-gramt = t_amount-gramt.
        it_dtl-iramt = t_amount-iramt.
        it_dtl-tramt = t_amount-tramt.
        it_dtl-blamt = t_amount-blamt.
        MODIFY it_dtl TRANSPORTING netwr dpamt gramt
                                   iramt tramt blamt
              WHERE ebeln = t_amount-ebeln
                AND psphi = t_amount-psphi.
        CLEAR it_dtl.
      ENDLOOP.

    hi ,
    just place the code and check for a particular po if its there inthe ekpo table then it has to get it for ur select single query .
    but ur logic is build on if --- endif.check this option first of all.
    if in the debugging u see the value then as u say in the report output u r not able to see the value then the problem will be space alignment also.
    check the value in debugging and let us know first of all . okay
    vijay.
    IF v_ebeln IS INITIAL AND v_ebelp IS INITIAL.
    CLEAR v_netwr.
    SELECT SINGLE netwr FROM ekpo INTO v_netwr
    WHERE ebeln = t_account-ebeln
    AND ebelp = t_account-po_item.
    break-point.
    t_amount-netwr = v_netwr.
    v_ebeln = t_account-ebeln.
    v_ebelp = t_account-po_item.
    ELSEIF v_ebeln <> t_account-ebeln AND
    v_ebelp <> t_account-po_item.
    CLEAR v_netwr.
    SELECT SINGLE netwr FROM ekpo INTO v_netwr
    WHERE ebeln = t_account-ebeln
    AND ebelp = t_account-po_item.
    break-point.
    t_amount-netwr = v_netwr.
    v_ebeln = t_account-ebeln.
    v_ebelp = t_account-po_item.
    ELSEIF v_ebeln = t_account-ebeln AND
    v_ebelp <> t_account-po_item.
    CLEAR v_netwr.
    SELECT SINGLE netwr FROM ekpo INTO v_netwr
    WHERE ebeln = t_account-ebeln
    AND ebelp = t_account-po_item.
    break-point.
    t_amount-netwr = v_netwr.

  • How to modify internal table with new value after data processing

    Hi,
    My code is as below:
    LOOP AT i_raw INTO wa_raw.
       IF  ( wa_raw-/BIC/ZOUASCLS = 'BA') OR ( wa_raw-/BIC/ZOUASCLS = 'CO' ) .
          LOOP AT i_crrs INTO wa_crrs.
            IF wa_raw-/BIC/ZOUIDCIF = wa_crrs-ZCBGCIFNO.
              wa_raw-/BIC/ZOUINDAP = '03'.
            ELSE.
              wa_raw-/BIC/ZOUINDAP = '02'.
            ENDIF.
          ENDLOOP.
        ENDIF.
      ENDLOOP.
    Initially column /BIC/ZOUINDAP is empty and I want to populate either value '02' or '03' as shown above.
    How do I insert those values into each i_raw records ?
    Pls help!

    Hello,
    try this code:
    IF ( i_raw-/BIC/ZOUASCLS = 'BA') OR ( i_raw-/BIC/ZOUASCLS = 'CO' ) .
    LOOP AT i_raw INTO wa_raw.
    WHERE wa_raw-/BIC/ZOUIDCIF = i_crrs-ZCBGCIFNO.
    IF SY-SUBRC = 0.
    wa_raw-/BIC/ZOUINDAP = '03'.
    ELSE.
    wa_raw-/BIC/ZOUINDAP = '02'.
    APPEND wa_raw INTO i_raw.
    ENDLOOP.
    ELSE.
    i_raw-/BIC/ZOUINDAP = ' '.
    ENDIF.
    Hope it helps.
    Best regards.
    Simone.

  • Query to obtain tables in SH schema using data-dictionary views/tables.

    Hi,
    I have just installed Oracle 10g Database. Logged on to SQL Plus by scott (changed the password as prompted).
    I want to see the tables in SH schema (which comes by default with Oracle 10g database).
    The problem, I am facing is:
    I can see the schema name: SH in the result of the below query:
    SELECT * FROM ALL_USERS
    but, nothing is returned in the result of the below query:
    SQL> SELECT OWNER FROM ALL_TABLES WHERE OWNER='SH';
    Result: no rows selected.
    Why is this happening?
    What will be the correct query to obtain tables present in SH schema ?
    Thanks in Advance & Regards,
    Deeba

    conn /as sysdba
    SQL> select table_name from dba_tables where owner='SH';
    I think the user SCOTT have no privilege to see SH schema tables through all_tables view.
    Thanks

Maybe you are looking for

  • How to share rented movies between devices

    I have just downloaded some rented movies on my iMac and would like to transfer them to Airbook for a trip away.  What is the best way of doing this?

  • How to generate doc/lit/wrapped services from existing wsdl?

    Hello, I am using workshop 10.1 to generate webservices from existing wsdl files from workshop 8.1. The existings webservices are based on an xmlbean utility project. When I generate the webservice from the existing wsdl file it generates automatical

  • I can´t install iCloud in Outlook 2010

    I reinstalled Outlook, Office completely an ICloud but the Message ist the same: Ihre Konfiguration konnte aufgrund eines unbekannten Fehlers nicht gestartet werden. Fehler: 0x80040604: Up/POST:Conflicts Fehler: 0x80040604: Up/HdlPOSTr[p05-caldav.icl

  • Mail receiver

    Hi, I have problem with Mail Receiver ComCh. When I set it up to use local SMTP server with user/pwd and CRAM-MD5, error is : failed to send mail: java.io.IOException: server not responding OK to AUTH; 535 5.7.0 authentication failed When I set Plain

  • School Project Help (StringTokenizer/JOptionPane/etc)

    Hey again guys, I've had great help in the past here and im hoping you guys will be able to aid me again. This is very similar to my last project where I created a program, thank God, with help from you guys and information online and in the textbook