To pass the value to final internal table

hi all,
in the report i have a select query has below
SELECT SINGLE belnr
          INTO (l_belnr)
          FROM bkpf
          WHERE bukrs = ls_bseg-bukrs
           AND gjahr = ls_bseg-gjahr.
i have an internal table gt_values , in this almost i have 1500 entries.
with field  has BELNR.
now i need to check l_belnr exists in GT_VALUES-BELNR OR NOT.
IF EXISTS i need to pass the belnr to GV_BELNR.
do we need to use LOOP and ENDLOOP or we have any other option.
PLEASE help me how to proceed in writing code for this.

Use read table statement.
Read table GT_VALUES with key belnr = l_belnr.
if sy-subrc = 0.
move l_belnr to GV_BELNR.
endif.

Similar Messages

  • Problem in move the data to final internal table.

    hi,
    iam having 3 internal table.
    1. g_t_vbrk  (having data for vbrk table)
    2. g_t_vbak (having data for vbak table)
    3. g_t_likp   (having data for likp table.)
    actually i have written the loop like below .
    LOOP AT g_t_vbrk.
        READ TABLE g_t_vbfa WITH KEY vbeln = g_t_vbrk-vbeln.
        IF sy-subrc = 0.
          MOVE : g_t_vbrk-vbeln TO g_t_output_raw_header_data-vbeln,
                 g_t_vbrk-taxk1 TO g_t_output_raw_header_data-taxk1,
                 g_t_vbrk-taxk4 TO g_t_output_raw_header_data-taxk4,
                 g_t_vbrk-fkart TO g_t_output_raw_header_data-fkart,
                 g_t_vbrk-inco1 TO g_t_output_raw_header_data-inco1,
                 g_t_vbrk-inco2 TO g_t_output_raw_header_data-inco2,
                 g_t_vbrk-zterm TO g_t_output_raw_header_data-zterm,
                 g_t_vbrk-kunag TO g_t_output_raw_header_data-kunag.
          READ TABLE g_t_vbak WITH KEY vbeln = g_t_vbfa-vbelv.
          IF sy-subrc = 0.
            MOVE : g_t_vbak-vkorg TO g_t_output_raw_header_data-vkorg,
                   g_t_vbak-auart TO g_t_output_raw_header_data-auart,
                   g_t_vbak-spart TO g_t_output_raw_header_data-spart,
                   g_t_vbak-vtweg TO g_t_output_raw_header_data-vtweg.
          ENDIF.
          APPEND  g_t_output_raw_header_data.
    endloop.
    my question is i want to move likp table lfdat field to that final internal table with same loop.
    i want to write move statement with same loop.
    pls help with coding wise.
    thanks
    santhosh

    Hi
    In the loop.
    SELECT VBELN FROM VBFA
                  INTO V_VBELN
                  WHERE VBELV = G_I_VBRK-VBELN
                   AND VBTYP_N = 'M'
                   AND VBTYP_V = 'J'.
    Now READ from your LIKP internal table.
    READ TABLE G_I_LIKP WITH KEY VBELN = V_VBELN.
    Write your MOVE statements here.
    Regards
    Surya.

  • Need to move the data to final internal Table

    Hi all,
    TYPES: BEGIN OF TY_MARA,
           MATNR       TYPE  MATNR,         " Material Number
           ZZBASE_CODE TYPE  ZBASE_CODE,    " Base Code
           END OF TY_MARA,
           BEGIN OF TY_MAKT,
           MAKTX       TYPE  MAKTX,         " Material Description
           END OF TY_MAKT,
           BEGIN OF TY_MARC,
           WERKS       TYPE  WERKS_D,      " Plant
           END OF TY_MARC,
           BEGIN OF TY_QMAT,
           ART           TYPE  QPART,         " Inspection Type
           END OF TY_QMAT,
           BEGIN OF TY_MAPL,
           MATNR        TYPE  MATNR,        " Material
           PLNTY        TYPE  PLNTY,        " Task List Type
           END OF TY_MAPL,
           BEGIN OF TY_PLKO,
           VERWE             TYPE     PLN_VERWE,     "     Task list usage
           END OF TY_PLKO,
          BEGIN OF TY_FINAL,
           MATNR          TYPE    MATNR,          " Material Number
           MAKTX          TYPE    MAKTX,          " Material Description
           ZZBASE_CODE    TYPE    ZBASE_CODE,     " Base Code
           WERKS          TYPE    WERKS_D,        " Plant
           CLASS          TYPE    KLASSE_D,       "     Class Number
           ART             TYPE    QPART,           " Inspection Type
           VERWE             TYPE    PLN_VERWE,       " Task list usage
         END OF TY_FINAL.
    DATA: I_MARA  TYPE  STANDARD TABLE OF TY_MARA  ,
          I_MAKT  TYPE  STANDARD TABLE OF TY_MAKT  ,
          I_MARC  TYPE  STANDARD TABLE OF TY_MARC  ,
          I_QMAT  TYPE  STANDARD TABLE OF TY_QMAT  ,
          I_MAPL  TYPE  STANDARD TABLE OF TY_MAPL  ,
          I_PLKO  TYPE  STANDARD TABLE OF TY_PLKO  ,
          I_KLAH  TYPE  STANDARD TABLE OF TY_KLAH  ,
          I_FINAL TYPE  STANDARD TABLE OF TY_FINAL ,
          WA_MARA  TYPE  TY_MARA,
          WA_MAKT  TYPE  TY_MAKT,
          WA_MARC  TYPE  TY_MARC,
          WA_QMAT  TYPE  TY_QMAT,
          WA_MAPL  TYPE  TY_MAPL,
          WA_PLKO  TYPE  TY_PLKO,
          WA_KLAH  TYPE  TY_KLAH,
         WA_FINAL TYPE  TY_FINAL.
    data: v_mtart         type    mara-mtart,
          v_matnr         type    mara-matnr,
          v_zzbase_code   type    mara-zzbase_code,
          v_werks         type    t001w-werks,
          v_beskz         type    marc-beskz.
    selection-screen skip 1.
    selection-screen begin of block b1 with frame title text-001.
    select-options: s_mtart    for v_mtart default 'halb' to 'zraw',
                    s_matnr    for v_matnr,
                    s_zzbase   for v_zzbase_code,
                    s_werks    for v_werks obligatory,
                    s_beskz    for v_beskz.
    selection-screen end of block b1.
    start-of-selection.
    select matnr
           zzbase_code
           from  mara into table i_mara
           where mtart in s_mtart       "Material Type
           and   matnr in s_matnr        "Material
           and   zzbase_code in s_zzbase."Base Code
    select maktx
           from makt into table i_makt for all entries in i_mara
           where matnr = i_mara-matnr.
    select werks
           from marc into table i_marc for all entries in i_mara
           where matnr = i_mara-matnr
           and werks in s_werks "plant
           and beskz in s_beskz."Procurement Type
    select art
           from qmat into table i_qmat for all entries in i_mara
           where matnr = i_mara-matnr
           and werks in s_werks.
    select matnr
           plnty from mapl into table i_mapl for all entries in i_mara
           where matnr = i_mara-matnr.
    select verwe
           from plko into table i_plko for all entries in i_mapl
           where plnty = i_mapl-plnty.
    this is my logic . i need to move this to final internal table i_final. how can do it. will anybody tell me with coding.
    Thanks,

    Hi,
    Include matnr field in all your type declaration and plnty in the ty_plko,  type declaration.
    loop at the internal table i_mara.
    read the other tables with read statement.
    assign the the required fields to the work area wa_final. Append it to i_final.
    start-of-selection.
      select matnr  zzbase_code
        from mara   into table i_mara
       where mtart in s_mtart "Material Type   and matnr in s_matnr "Material  and zzbase_code in s_zzbase. "Base Code
      select matnr  maktx        
        from makt   into table i_makt
         for all entries in i_mara   where matnr = i_mara-matnr.
      select matnr  werks
        from marc  into table i_marc
         for all entries in i_mara  where matnr = i_mara-matnr   and werks in s_werks "plant   and beskz in s_beskz."Procurement Type
      select matnr  art
        from qmat  into table i_qmat
         for all entries in i_mara where matnr = i_mara-matnr   and werks in s_werks.
      select matnr plnty
        from mapl into table i_mapl
        for all entries in i_mara  where matnr = i_mara-matnr.
      select plnty verwe
        from plko  into table i_plko
         for all entries in i_mapl  where plnty = i_mapl-plnty.
    Loop at i_mara into wa_mara.
    read table i_makt into wa_makt with key matnr = wa_mara-matnr.
    (do this for all the internal tables.)
    read table i_plko into wa_plko with key plnty = wa_mapl-plnty.
    wa_final-MATNR = wa_mara-matnr.
    wa_final-MAKTX = wa_makt-maktx.
    wa_final-ZZBASE_CODE = wa_mara-ZZBASE_CODE.
    wa_final-WERKS = wa_marc-werks.
    wa_final-ART = wa_qmat-art.
    wa_final-VERWE = wa_plko-verve.
    append i_final from wa_final.
    endloop.
    Hope this helps.
    Regards,
    Dhasarathy. K

  • Moving the fields to final internal table

    hi experts,
       i have a single field in an internal table and i want to move it to final internal table.
    i tried this code but its not working.
      IF NOT it_ymmessr IS INITIAL.
        LOOP AT it_ymmessr into it_final..
          move it_ymmessr-srvpos to it_final-srvpos.
        ENDLOOP.
      ENDIF.
    there is dat in the it_ymmessr.
    i have five to six similar internal tables with 1 to 3 records and i have to move them to final internal table.
    regards,
    vinay

    Hi,
    IF NOT it_ymmessr IS INITIAL.
    LOOP AT it_ymmessr into it_final..
    <b>Have one more firld which is the common field for both the tables into it_ymmessr so that u can fill the record correctly.</b>
    READ TABLE it_ymmessr WITH key XXXX = it_final-XXXX.
    IF sy-subrc = 0.
    it_final-srvpos = it_ymmessr-srvpos.
    <b>MODIFY it_final.</b>
    ENDIF.
    CLAER it_final.
    ENDLOOP.
    ENDIF.

  • Problem in moving the data into final internal table

    Hello all,
    I am stuck in apeculair situation.
    I have a internal table having header record and a internal table having its line items.
    Header record ::    90006103  A   20080110   ALBERTA    3456
    Detail   record ::    90006103  D2  2219CR1710441
                               90006103  D2  2219M11710443
                               90006103  D2  2219M21710442
                               90006103  A    20080115   ALBERTA    3456
                               90006103  D2  2219CR1710441
                               90006103  D2  2219M11710443
                               90006103  D2  2219M21710442
    I collected the header record in one internal table and another internal table having all the line items.But the problem is when i am moving the values to the final inernal table i am getting the same payment date
    20080110 (Date field in first record of header internal table) for all the line items .
    But my requirement is that date should be 20080110 for the first 3 line items of first header record and similarly date should be 20080115 for all the line items of the next header record.
    Kindly suggest.
    Regards,
    Arun

    assumption: some mistake in ur posting that, How belnr and date r same for both header records, so i guess, either one is different.
    try with AT NEW - ENDAT.
    AT NEW belnr.
    here use looping, READing of ur itabs.---> so, u need to build couple of itabs to move forth and back.
    ENDAT.
    pls. note that, when u use this AT NEW all the CHAR fileds of itab wuld show as STARS **.....so, this is the necessity behind building new itabs.
    thanq
    Edited by: SAP ABAPer on Dec 30, 2008 6:24 PM

  • How to pass the contents of an internal table to the IDoc FIDCC2?

    Hi,
    I have an internal table. Using its contents, I have to create an Idoc and do GL posting.
    I have to use FIDCC2 Idoc and the function module IDOC_INPUT_FIDCC2.
    Can u please let me know how to pass the contents of the internal table into the idoc FIDCC2 and do the GL posting?
    Regards,
    Balaji. R

    Hi balaji,
    use function IDOC_INBOUND_FROM_FILE. This will do half the process.
    Documentation is missing, but program RSEINB00 explains something,
    also some links
    [http://help.sap.com/saphelp_nw70/helpdata/EN/dc/6b7f1543d711d1893e0000e8323c4f/frameset.htm]
    [RSEINB00 does not work in background]
    [RSEINB00 flat file to idoc uploading in XI]
    [Loading flat idoc via report RSEINB00 into integration server fails]
    Hope it helps.
    Regards,
    Clemens

  • Script- problem in printing the values in from internal table

    Hi all,
    I have a requiremnt that i for a particular document no there are number of invoices are there. i.e for a single document no there are 20 invoices in that. i shoudl display the invoice number , invoice date, invoice amount , number of days of intrest , start date of interest, end date of interest and intrest amount.
    The problem is i should take the invoice number, invoice date, number of days  from TABLE <b>BSEG</b> and  inovice amount and start date, end date from table<b> INTITIT</b>.  for a particular document number there are diffent invoce numbers in both the table.
    i can display everthing but the prob is with invoice amount. it is repating only one values is displying in the ouput. The invoice number in INTITIT Is not changing. I have to write the syntax for that .Please help me The value in Bseg is chaing as per given syntax shown below.
    data:   begin of hbseg occurs 10.
            include structure hsortp.
            include structure bseg.
    data:   end of hbseg.
    data: begin of hsortp,
            sortp1 like sortp1,
            sortp2 like sortp2,
            sortp3 like sortp3,
            sortp4 like sortp4,
            sortp5 like sortp5,
            EKVBD  LIKE KNB1-EKVBD,
          end   of hsortp.
    loop at hbseg.
            WHERE BUKRS = SAVE_BUKRS.
              save_bukrs  = hbseg-bukrs.
              if  ( hbseg-kunnr = save_kunnr
              and   not save_kunnr is initial )
              or  ( hbseg-lifnr = save_lifnr
              and   not save_lifnr is initial ).
               clear bseg.
                move-corresponding hbseg to bseg.
                 *bseg = bseg.
                if bkpf-waers ne *bkpf-waers.
                  perform curr_document_convert_bseg
                              using
                                 bkpf-budat
                                 *bkpf-waers
                                 *bkpf-hwaer
                                 bkpf-waers
                              changing
                                 bseg.
                  if not bseg-pycur is initial.
                    alw_waers = bseg-pycur.
                    perform currency_get_subsequent
                                using
                                   save_repid
                                   bkpf-budat
                                   bkpf-bukrs
                                changing
                                   alw_waers.
                    if alw_waers ne bseg-pycur.
                      bseg-pycur = alw_waers.
                      perform convert_foreign_to_foreign_cur
                                  using
                                     bkpf-budat
                                     *bkpf-waers
                                     *bkpf-hwaer
                                     bseg-pycur
                                  changing
                                     bseg-pyamt.
                    endif.
                  endif.
                endif.
                perform fill_waehrungsfelder_bseg.
                perform fill_waehrungsfelder_bseg_2.
                if bseg-sgtxt(1) ne '*'.
                  bseg-sgtxt = space.
                else.
                  bseg-sgtxt = bseg-sgtxt+1.
                endif.
                clear save_bschl.
                clear save_umskz.
                clear tbslt.
                save_bschl = bseg-bschl.
                save_umskz = bseg-umskz.
                perform read_tbslt.
    ADDING VARIBLE V_GSALDF BY SUNIL 5.11.07******
               v_gsaldf = rf140-gsaldf + rf140-wrshb.
               rf140-gsaldf = v_gsaldf.
               clear v_gsaldf.
    SUNIL *********************
                 *rf140-gsaldf = *rf140-gsaldf + *rf140-wrshb.
                if  xmultk is initial
                and xactiv is initial
                and linecnt = '1'
                and not      xumsst is initial
                and not save_xumstn is initial.
                  if bkpf-bstat = 'V'.
                    perform read_vbset.
                  else.
                    perform read_bset.
                  endif.
                  describe table hbset lines linecnt.
                  if linecnt = '1'.
                    loop at hbset.
                      move-corresponding hbset to bset.
                       *bset = bset.
                      if bkpf-waers ne *bkpf-waers.
                        perform curr_document_convert_bset
                                    using
                                       bkpf-budat
                                       *bkpf-waers
                                       *bkpf-hwaer
                                       bkpf-waers
                                    changing
                                       bset.
                      endif.
                      clear rf140-msatz.
                      clear rf140-vtext.
                      save_ktosl = bset-ktosl.
                      perform read_t687t.
                      rf140-msatz = bset-kbetr / 10.
                       *rf140-msatz = rf140-msatz.
                      rf140-vtext = save_vtext.
                       *rf140-vtext = rf140-vtext.
                      if bset-shkzg = 'H'.
                        rf140-mwshb = bset-fwste.
                         *rf140-mwshb = *bset-fwste.
                        rf140-mdshb = bset-hwste.
                         *rf140-mdshb = *bset-hwste.
                      else.
                        rf140-mwshb = 0 - bset-fwste.
                         *rf140-mwshb = 0 - *bset-fwste.
                        rf140-mdshb = 0 - bset-hwste.
                         *rf140-mdshb = 0 - *bset-hwste.
                      endif.
                      exit.
                    endloop.
                    rf140-wrshb = rf140-wrshb - rf140-mwshb.
                     *rf140-wrshb = *rf140-wrshb - *rf140-mwshb.
                    rf140-dmshb = rf140-dmshb - rf140-mdshb.
                     *rf140-dmshb = *rf140-dmshb - *rf140-mdshb.
                  endif.
                endif.
    *****************Begin of Change by Karthikeyan J********************
                i_count = i_count + 1.
                clear rf140-element.
                clear: it_bseg, i_wrbtr,i_totday,i_tempday,i_day,i_bday.
    comparing with fields belnr AND SELECT * FROM INTITIT added by sunil 3.11.07*********
                select single * from bseg into
                corresponding fields of it_bseg where belnr = bseg-rebzg  anD GJAHR = BSEG-GJAHR.
                select single * from intitit into corresponding fields of  it_intitit where gjahr = bseg-gjahr and belnr_to = bseg-belnr and buzei = '2' OR BELNR = INTITIT-BELNR .
    added by Jayshree on 09/01/2007
                MOVE ' ' TO it_kna1-name1.
                SELECT SINGLE name1
                INTO CORRESPONDING FIELDS OF it_kna1
                FROM ( vbpa AS a INNER JOIN kna1 AS b ON akunnr = bkunnr )
                WHERE a~vbeln = it_bseg-vbeln
                  AND a~parvw = 'zd'.
                SELECT SINGLE fkdat
                INTO CORRESPONDING FIELDS OF it_kna1
                FROM vbrk
                WHERE vbrk~vbeln = it_bseg-vbeln.
    added by Jayshree on 01/02/2007
              CONCATENATE  it_kna1-fkdat6(2) it_kna1-fkdat4(2) it_kna1-fkdat+2(2)
                INTO vfkdat SEPARATED BY '.'.
              CONCATENATE  it_bseg-augdt6(2) it_bseg-augdt4(2) it_bseg-augdt+2(2)
                INTO vaugdt SEPARATED BY '.'.
                i_wrbtr = i_wrbtr + it_bseg-wrbtr.
    added as on 29.06.2007 by jayshree again transport  on 21.07.2007
                tot_wrbtr = tot_wrbtr + i_wrbtr.
                i_totday = it_bseg-zbd1t + it_bseg-zbd2t + it_bseg-zbd3t.
                CALL FUNCTION 'fima_date_create'
                  EXPORTING
                    i_date                        = it_bseg-zfbdt
                 I_FLG_END_OF_MONTH            = ' '
                 I_YEARS                       = 0
                 I_MONTHS                      = 0
                   i_days                        = i_totday
                 I_CALENDAR_DAYS               = 0
                 I_SET_LAST_DAY_OF_MONTH       = ' '
                 IMPORTING
                   e_date                        = i_bday
                 E_FLG_END_OF_MONTH            =
                 E_DAYS_OF_I_DATE              =
    added by JAYSHREE 01.02.2007
                CONCATENATE  i_bday6(2) i_bday4(2) i_bday+2(2)
                INTO vbday SEPARATED BY '.'.
                i_day = it_bseg-augdt - i_bday.
            CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'
              EXPORTING
                date1                         = it_bseg-zfbdt
                date2                         = it_bseg-augdt
               OUTPUT_FORMAT                 = '01'
             IMPORTING
               YEARS                         =
               MONTHS                        =
               DAYS                          = i_day
             EXCEPTIONS
               INVALID_DATES_SPECIFIED       = 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.
    *added by sunil 5.11.07 ***********
    *read table it_intitit with key BELNR_TO = BSEG-BELNR  .
    *LOOP AT IT_INTITIT.
                rf140-element = '521'.
                CALL FUNCTION 'write_form'
                  EXPORTING
                    window  = 'main'
                    element = '521'
                  EXCEPTIONS
                    window  = 1
                    element = 2.
                IF sy-subrc = 1.
                  window = 'main'.
                  PERFORM message_window.
                ENDIF.
                IF sy-subrc = 2.
                  window = 'main'.
                  ereignis = '521'.
                  PERFORM message_element.
                ENDIF.
                IF save_xumstn IS INITIAL.
    *-------Umsatzsteuer -
                  IF xactiv IS INITIAL.
                    save_waers = rf140-waers.
                    PERFORM tax_data.
                    CLEAR taxlines.
                    DESCRIBE TABLE atax LINES taxlines.
                    IF NOT taxlines IS INITIAL.
                      LOOP AT atax.
                        CLEAR ereignis.
                        CLEAR rf140-msatz.
                        CLEAR rf140-vtext.
                        rf140-msatz = atax-msatz.
                         *rf140-msatz = atax-msatz.
                        rf140-vtext = atax-vtext.
                         *rf140-vtext = atax-vtext.
    *******begin of change by karthikeyan on 10.03.06*********************
                        IF sy-tabix = '1'.
                          ereignis = '522'.
                          v_stax = rf140-msatz * rf140-gsaldf / 100.
                        ELSE.
                          ereignis = '523'.
                          v_ecs = rf140-msatz * v_stax / 100.
                          v_total = rf140-gsaldf + v_stax + v_ecs.
                        ENDIF.
                        CALL FUNCTION 'hr_in_chg_inr_wrds'
                          EXPORTING
                            amt_in_num               = v_total
                          IMPORTING
                            amt_in_words             = v_spell
                        EXCEPTIONS
                          DATA_TYPE_MISMATCH       = 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.
    ***************************end of change******************************
                        CLEAR rf140-element.
                        rf140-element = ereignis.
                        IF NOT ereignis IS INITIAL.
                          CALL FUNCTION 'write_form'
                            EXPORTING
                              window  = 'main'
                              element = ereignis
                            EXCEPTIONS
                              window  = 1
                              element = 2.
                          IF sy-subrc = 1.
                            window = 'main'.
                            PERFORM message_window.
                          ENDIF.
                          IF sy-subrc = 2.
                            window = 'main'.
                            PERFORM message_element.
                          ENDIF.
                        ENDIF.
                      ENDLOOP.
                    ENDIF.
                  ENDIF.
                ENDIF.
               ENDLOOP.
              ENDIF.
            ENDLOOP.
    '521' is the element name in the main  window where i should display the values. before select qurey the values are coming in the bseg but not in table INTITIT.  Belnr is the document no with ref to that
    there are number  of invoices nos. so in both the tables it is selecting single value and displaying but in bseg the invoice number is getting refreshed and new number is coming in that place i.e in field bseg-rebzg but in INTITIT  in belnr only it is taking single value it is not getting refreshed.
       move-corresponding hbseg to bseg.
                 *bseg = bseg.
                if bkpf-waers ne *bkpf-waers.
    this is the syntax whr the values in bseg are getting refresh and new invoice number is selecting.
    How to write the syntax for INTITIT? As per invoice number it is giving new values.
    The invoice number in Bseg is different campare to in table INTITIT. in output is shoud show the fields as follows
    it_besg-rebzg(invoice number of besg) it_besg-zuonr(invoice date) INTITIT-INT_BASAMT(base amount) i_day (no of days ) INTITIT-INT_BEGIN (INTREST START DATE) INTITIT-INT_end(INTREST END DATE)  rf140-wrshb(INTREST AMOUNT).
    THE VALUE OF IT_BESG-REBZG IS CHANGING  BUT THE VALUE IN INTITIT-BELNR ( INVOICE NUMBER) IS NOT CHANGING THAT IS WHY IT IS SHOWING
    ONLY SINGLE RECORD.
    for both the table documet no is same. in besg-belnr is the document no. in intitit-BELNR_TO is the document no.
    here in bseg-rebzg is chaning but in INTITIT-BELNR IS  not changing.
    If i take loop at INTITIT. ALL the values are repating so i am unable to take loop. so i want to write
    a syntax such that intitit-belnr should be refreshed and also for every loop it shoud take new invoice no.
    Please help me out it is very urgent.
    <b>USEFUL ANSWERS WILL BE REWARDED.</b>
    regards,
    Sunil kumar.

    assumption: some mistake in ur posting that, How belnr and date r same for both header records, so i guess, either one is different.
    try with AT NEW - ENDAT.
    AT NEW belnr.
    here use looping, READing of ur itabs.---> so, u need to build couple of itabs to move forth and back.
    ENDAT.
    pls. note that, when u use this AT NEW all the CHAR fileds of itab wuld show as STARS **.....so, this is the necessity behind building new itabs.
    thanq
    Edited by: SAP ABAPer on Dec 30, 2008 6:24 PM

  • REUSE_ALV_GRID_DISPLAY , how to pass the 'tick' button to internal table

    hi all i have coded:
    DATA: BEGIN OF itab OCCURS 0,
          vbeln LIKE vbak-vbeln,
          posnr LIKE vbap-posnr,
          chk(1),
         END OF itab.
    SELECT vbeln
           posnr
           FROM vbap
           UP TO 20 ROWS
           INTO TABLE itab.
    x_fieldcat-fieldname = 'CHK'.
    x_fieldcat-tabname = 'ITAB'.
    x_fieldcat-col_pos = 1.
    x_fieldcat-input = 'X'.
    x_fieldcat-edit = 'X'.
    x_fieldcat-checkbox = 'X'.
    APPEND x_fieldcat TO it_fieldcat.
    CLEAR x_fieldcat.
    x_fieldcat-fieldname = 'VBELN'.
    x_fieldcat-seltext_l = 'VBELN'.
    x_fieldcat-tabname = 'ITAB'.
    x_fieldcat-col_pos = 2.
    APPEND x_fieldcat TO it_fieldcat.
    CLEAR x_fieldcat.
    x_fieldcat-fieldname = 'POSNR'.
    x_fieldcat-seltext_l = 'POSNR'.
    x_fieldcat-tabname = 'ITAB'.
    x_fieldcat-col_pos = 3.
    APPEND x_fieldcat TO it_fieldcat.
    CLEAR x_fieldcat.
    l_layout-window_titlebar = 'Popup window'.
    x_events-name = slis_ev_end_of_page.
    x_events-form = 'END_OF_PAGE'.
    APPEND x_events  TO it_events.
    CLEAR x_events .
    x_events-name = slis_ev_top_of_page.
    x_events-form = 'TOP_OF_PAGE'.
    APPEND x_events  TO it_events.
    CLEAR x_events .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program       = sy-repid
        is_layout                = l_layout
        i_callback_pf_status_set = 'STATUS'
        i_callback_user_command  = 'USER_COMMAND'
        it_fieldcat              = it_fieldcat
        it_events                = it_events
       I_SCREEN_START_COLUMN    = 10
       I_SCREEN_START_LINE      = 1
       I_SCREEN_END_COLUMN      = 50
       I_SCREEN_END_LINE        = 20
      TABLES
        t_outtab                 = itab
      EXCEPTIONS
        program_error            = 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.
    itab-chk is a check button, after execute for the second time, i need to get this ticked button to perform upload transaction..how to pass the ticked button inside itab ?

    just loop at itab and pass X to chk
    loop at itab into wa_itab.
       wa_itab-chk = 'X'.
       modify itab from wa_itab.
    endloop.

  • Problem in Summing the value in one internal table. Its very urgent.

    Hi Experts,
    I have 10 fields in one internal table and based on the 8th field changing, I have to sum the 3rd field.
    I am unable to use AT END OF <FIELD8>, because any of the fields from 1 to 7 are changing, then this control break statement triggering.
    Could any body tell me, how I have to do this.
    Thanks,
    bsv.

    Hi,
    I think it could be as simple as below.
    DATA: l_field8 TYPE bla bla.
    READ TABLE itab
         INTO wa_itab
         INDEX 1.
    l_field8 = wa_itab-field8.
    LOOP AT itab INTO wa_itab.
         IF l_field8 NE wa_itab-field8.
              "Do the sum here
         ENDIF.
    ENDLOOP.
    Regards,
    Teddy
    Edited by: Teddy Kurniawan on Jan 25, 2008 8:38 AM

  • How to download values in an internal table into an excel file

    is there any fn module to download the values in an internal table into an excel file..

    hi
    the function module "GUI_DOWNLOAD"  downloads the data from
    an internal table into a file (can be xl, dat ,doc etc) .
    Plz follow the usage below ;
    Parameters : pa_pfile LIKE rlgrap-filename OBLIGATORY.
    Data : lv_filename TYPE STRING.
    lv_filename = pa_pfile.
    CALL FUNCTION 'GUI_DOWNLOAD'
       EXPORTING
       BIN_FILESIZE                  =
         FILENAME                      = lv_filename
         FILETYPE                      = 'ASC'
       APPEND                        = ' '
        WRITE_FIELD_SEPARATOR         = 'X'
       HEADER                        = '00'
       TRUNC_TRAILING_BLANKS         = ' '
       WRITE_LF                      = 'X'
       COL_SELECT                    = ' '
       COL_SELECT_MASK               = ' '
       DAT_MODE                      = ' '
       CONFIRM_OVERWRITE             = ' '
       NO_AUTH_CHECK                 = ' '
    IMPORTING
       FILELENGTH                    =
       TABLES
         DATA_TAB                      = tb_download         " table data to b downlaoded
      EXCEPTIONS
        FILE_WRITE_ERROR              = 1
        NO_BATCH                      = 2
        GUI_REFUSE_FILETRANSFER       = 3
        INVALID_TYPE                  = 4
        NO_AUTHORITY                  = 5
        UNKNOWN_ERROR                 = 6
        HEADER_NOT_ALLOWED            = 7
        SEPARATOR_NOT_ALLOWED         = 8
        FILESIZE_NOT_ALLOWED          = 9
        HEADER_TOO_LONG               = 10
        DP_ERROR_CREATE               = 11
        DP_ERROR_SEND                 = 12
        DP_ERROR_WRITE                = 13
        UNKNOWN_DP_ERROR              = 14
        ACCESS_DENIED                 = 15
        DP_OUT_OF_MEMORY              = 16
        DISK_FULL                     = 17
        DP_TIMEOUT                    = 18
        FILE_NOT_FOUND                = 19
        DATAPROVIDER_EXCEPTION        = 20
        CONTROL_FLUSH_ERROR           = 21
        OTHERS                        = 22
    IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Regards
    Pankaj

  • How to check a field value within an Internal table

    Hi Friends,
    My requirement is:
    I have a line item of PO records, in that each line item of Plant field should not diffe with other line items. If it differs or say the records have different plant values line items, then I have to throw an error message.
    Below example for better understanding.
    lineitem Plant
    010       ABC
    020       ABC
    030       XYZ
    040       LKG
    So, my report will throw an error like "All line items must be identical'.
    How to do proceed it.Please advise.
    Thanks & Regards
    Sankar.

    Hi Sankar
    first you need to fetch all the values in one internal table from your PO.
    After that create an internal table with only plant field and move all the plan values in this table.
    let assume ITAB is a table with all the values. and ITAB1 with plant only.
    wa_itab is the work area for ITAB and wa_itab1 is WA for ITAB1.
    ITAB has all the values and ITAB1 has all the values only for plant.
    delete adjacent duplicate from itab1 compairing plant.
    loop at itab1 into wa_itab1. " this will fetch all the plant values in workarea.
    read table itab into wa_itab where wa_itab-plant = wa_itab1-plant.  " this will fetch only the values matching to the table itab1
    if su-subrc <> 0.       
    message 'plants are not similar' TYPE 'E'.
    elseif sy-subrc = 0.
    write your code*.
    endif.
    endloop.
    hope this will help you.
    Thanks
    Lalit Gupta

  • Reg : Passing two internal table values in to final internal table

    Dear Experts,
    My first internal table looks like this,
                   Customer      Name         O/S
                   A                 Anu             5000
                   B                 Beema         2000
                   C                 Chitu            3000
    My Second Internal table looks like this,
                 Customer      InvNo    InvDate   Due
                  A                 001       1/1/09      500
                  A                 002       2/2/09      100
                  B                 004       4/4/09       50
                  B                 003       4/5/09       100
    My final Internal table should be,
              Customer    Name      O/s            InvNo      InvDate       Due
                A              Anu         5000        001          1/1/09          500
                                                                002           2/2/09         100
                B              Beema     2000        004          4/4/09          50
                                                                003           4/5/09         100
    Please help me with the code...

    Hai,
    Thanks...
    I need to get the O/P like this,
    Customer     Name       O/S       InvNo         Inv Date          Due
    A                  Anu        3000       001          1/11/09            50
                                                      002           2/2/09             100
                                                      003           3/3/09              30
    Plz help

  • Problem in filling the final internal table

    Hi,
    I am working on a code in which i have to fill up the final internal table which will store the values coming form different internal tables.Here's the code which i am trying to do but it is not giving the execat functionality.In this code ITOUTPUT is the final itab which is storing the values of all other internal tables.
    Here's the code:-
    loop at itab1.
      select single maktx into v_item from makt where matnr = itab1-matnr.
          ITOUTPUT-banfn = ITab1-banfn.
          ITOUTPUT-badat = ITab1-badat.
          ITOUTPUT-meins = ITab1-meins.
          ITOUTPUT-menge = ITab1-menge.
          ITOUTPUT-lfdat = ITab1-lfdat.
      IF ITAB1-MEINS = 'KG'.
        V_TOTREQ = V_TOTREQ + ITAB1-MENGE.
      ELSEIF ITAB1-MEINS = 'TO'.
        V_TOTREQ = V_TOTREQ + ( ITAB1-MENGE * 1000 ).
      ELSEIF ITAB1-MEINS = 'G'.
        V_TOTREQ = V_TOTREQ + ( ITAB1-MENGE / 1000 ).
      ENDIF.
      v_tpo = 0.
      v_por = 0.
      LOOP AT ITPO WHERE BANFN = ITAB1-BANFN AND bnfpo = ITAB1-bnfpo.
        if v_por <> '0'.
          write : / '  '.
        endif.
          ITOUTPUT-ebeln = ITPO-ebeln.
          ITOUTPUT-aedat = ITPO-aedat.
          ITOUTPUT-lifnr = ITPO-lifnr.
          ITOUTPUT-menge = ITPO-menge.
          ITOUTPUT-EINDT = ITPO-EINDT.
        IF ITAB1-MEINS = 'KG'.
          V_TOTPO = V_TOTPO + ITPO-MENGE.
        ELSEIF ITPO-MEINS = 'TO'.
          V_TOTPO = V_TOTPO + ( ITPO-MENGE * 1000 ).
        ELSEIF ITPO-MEINS = 'G'.
          V_TOTPO = V_TOTPO + ( ITPO-MENGE / 1000 ).
        ENDIF.
        v_tpo = v_tpo + itpo-menge.
        v_tgr = 0.
        v_por = 1.
        v_grr = 0.
        loop at itmrn where ebeln = itpo-ebeln and ebelp = itpo-ebelp.
          if v_grr <> '0'.
            write : / '  '.
          endif.
          select single budat from mkpf into v_grdate where MBLNR = itmrn-MBLNR.
          write: 143 Itmrn-menge,v_grdate .
            itoutput-PMENGE = itmrn-menge.
          v_tgr = v_tgr + itmrn-menge.
          v_grr = 1.
        endloop.
        p_po = itpo-menge - v_tgr.
       write: 173 p_po.
      ENDLOOP.
      p_req = itab1-menge - v_tpo.
      write :  195 p_req.
    endloop.
    loop at itoutput.
      write:/ itoutput-banfn,12 itoutput-badat,24 v_item,50 itoutput-meins,53 itoutput-menge,itoutput-lfdat,
              89 ITPO-ebeln,100 ITPO-aedat,111 ITPO-lifnr,(10) itpo-menge, ITPO-eindt.
      MODIFY itoutput.
    endloop.

    Hi,
    Ok,i ha d checked my code by using your logic and giving the run time error ......
    i had debugged my code (orignal onementioned in above thread with little modification) in which  i am able to see that finaloutput (intrenal table) is getting filled properly and the  problem arises when  the cursor comes to the write statement ... it is repeating some of the values when output is displayed where as before displaying output this iternal table is having the correct data. i am using the following code :-
    append itoutput.
      ENDLOOP.
      p_req = itab1-menge - v_tpo.
      write :  195 p_req.
      append itoutput.          ,<---  added this
      clear itoutput.               <--- added this
    endloop.
    loop at itoutput.
      write:/ itoutput-banfn,12 itoutput-badat,24 v_item,50 itoutput-meins,53 itoutput-menge,itoutput-lfdat,
              89 ITPO-ebeln,100 ITPO-aedat,111 ITPO-lifnr,(10) itpo-menge, ITPO-eindt.
      MODIFY itoutput.         <------ not removed
    endloop.

  • Passing '**********' to screen field value instead of internal table value

    Hi All,
    I have written BDC, in which when i pass value for second screen "Description type field"  it's passing '*************************' instead of internal table value.
    It's picking correct value for first internal table value. Could anyone please give an idea why it's happening?
    Please find the code:
    LOOP AT it_record.
    header data for BDC
       AT NEW CLASS.
        IF sy-tabix <> 1.
            perform bdc_dynpro      using 'SAPLCLMO' '7777'.
            perform bdc_field       using 'BDC_OKCODE'
                                    '=SAVE'.
            CALL TRANSACTION 'CLWM' USING bdcdata
                          MODE p_mode
                          UPDATE 'S'
                          MESSAGES INTO messtab.
            clear : bdcdata[],bdcdata.
        ENDIF.
        perform bdc_dynpro      using 'SAPLCLMO' '0200'.
        perform bdc_field       using 'BDC_CURSOR'
                                      'RMCLM-CLASS'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '/00'.
        perform bdc_field       using 'RMCLM-CLASS'
                                      it_record-class.
        perform bdc_dynpro      using 'SAPLCLMO' '7777'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '/00'.
        perform bdc_field       using 'BDC_CURSOR'
                                      'RMCLM-KLBEZ'.
        perform bdc_field       using 'RMCLM-KLBEZ'
                                      it_record-klbez.
        perform bdc_field       using 'RMCLM-STATU'
                                      '1'.
        perform bdc_dynpro      using 'SAPLCLMO' '7777'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '=MERK'.
        perform bdc_field       using 'BDC_CURSOR'
                                      'RMCLM-KLBEZ'.
        perform bdc_field       using 'RMCLM-KLBEZ'
                                      it_record-klbez.
        perform bdc_field       using 'RMCLM-STATU'
                                      '1'.
        MOVE 1 TO IDX.
        ENDAT.
    line item data for BDC
            perform bdc_dynpro      using 'SAPLCLMO' '7777'.
            perform bdc_field       using 'BDC_OKCODE'
                                       '/00'.
            perform bdc_field       using 'BDC_CURSOR'
                                        'RMCLM-RELEV(02)'.
            CONCATENATE 'RMCLM-MERKMA(' IDX ')' INTO FNAM.
            perform bdc_field       using FNAM
                                        it_record-merkma.
            CONCATENATE 'RMCLM-RELEV(' IDX ')' INTO FNAM.
            perform bdc_field       using   FNAM
                                       it_record-relev.
            IDX = IDX + 1.
      ENDLOOP.
    Thanks,
    Ujjwal

    Hi Ujjwal
    The reason behind this is that you are using AT NEW.... ENDAT block in your coding.
    When you use AT NEW field statements, the fields in the work area after the field get converted into ********.
    Check values in your work area I_RECORD in debugging inside AT NEW statement and you will understand what I am saying.
    In your case all the fields from header line of I_RECORDS which come after field CLASS are getting converted into *******,
    hence the error.
    Try using a temporary work area, say w_record. Pass value of I_record to w_record before AT NEW statement.
    And use w_record-fields instead of I_record-fields. And your program should work.

  • To eliminate the duplicate entries while looping into final internal table

    Hi friends,
    IAam facing the follwoing problem.
    Get Shipment for the Delivery number
          SELECT tknum
                 vbeln
                 INTO TABLE lt_vttp
                 FROM vttp
                 FOR ALL ENTRIES IN lt_vbfa
                 WHERE vbeln = lt_vbfa-vbelv.
        IF sy-subrc EQ 0.
          SELECT vbeln kunnr
                 FROM likp
                 INTO TABLE lt_likp
                 FOR ALL ENTRIES IN lt_vttp
                 WHERE vbeln = lt_vttp-vbeln.
      endif.
    now iam my internal table lt_vttp i have following values
       shipment             delivery
          1000                  2000
          1000                 2001
    in my internal table lt_likp i have the follwoing values
          delivery              shipto
           2000                  ABC
           2001                  ABC
    now iam looping those values in a final internal table.
      LOOP AT lt_likp INTO ls_likp.
        CHECK sy-subrc EQ 0.
         READ TABLE lt_vttp INTO ls_vttp WITH KEY vbeln = ls_likp-vbeln BINARY SEARCH.
        CHECK sy-subrc EQ 0.
             SELECT SINGLE * FROM vttk INTO ls_vttk
                    WHERE tknum = ls_vttp-tknum.
                  CHECK sy-subrc EQ 0.
                APPEND ls_vttk TO lt_vttk.
       endloop.
    Now my problem is if the shipment is same and the shipto is same then need to eliminate the duplicate records.
            in internal table iam getting 2records with same shipment and shipto combination.
           but instead if both the shipment and shipto are same then i should elimate the duplicate entries.
    and for the same shipment if i have differnt shipto then i neeed those 2 value.
    can any body tell me how can i get that.
    Regards
    Priyanka.

    Hi Priyanka,
    In your code you are using seelct statement inside the loop which will affect the performance.
    So, declare a another internal table which contains your both shipment and shipto elements with other required fields, say the name is lt_new.
    sort lt_new by shipment shipto.
    delete adjacent duplicates from lt_new comparing shipment shipto.
    "then use for all entries to choose values from VTTK.
    Hope this helps you.
    Regards,
    Manoj Kumar P

Maybe you are looking for