Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9148

Re: Problem while appending

$
0
0

I resolved that problem.. But now Im facing new one regarding this.

I have given gjahr as 2013 in selection. I appended 1 rec from it_bsik1 to it_with_item(final table). For that record Bkpf_budat was showing wrong.

Following is my piece of code.

 

  1. SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS:s_bukrs FOR with_item-bukrs,
                   s_gjahr FOR bkpf-gjahr,
                   s_budat FOR sy-datum.
    SELECTION-SCREEN END OF BLOCK b1.

 

FORM get_data .
  CLEAR:it_with_item,it_bsik,it_bsik1,it_with_item1,it_lfa1,it_j_1imovend,it_bkpf.
  REFRESH:it_with_item,it_bsik,it_bsik1,it_with_item1,it_lfa1,it_j_1imovend,it_bkpf.
  SELECT bukrs belnr gjahr blart bldat budat xblnr awkey FROM bkpf INTO CORRESPONDING FIELDS OF TABLE it_bkpf
    WHERE bukrs IN s_bukrs AND gjahr IN s_gjahr AND budat IN s_budat.
  SELECT bukrs belnr gjahr buzei witht wt_withcd wt_qsshh wt_qbshh wt_acco j_1iintchln FROM with_item INTO CORRESPONDING FIELDS OF TABLE it_with_item
    FOR ALL ENTRIES IN it_bkpf
    WHERE bukrs IN s_bukrs AND gjahr IN s_gjahr AND wt_qbshh NE '0' AND j_1iintchln EQ '' AND belnr = it_bkpf-belnr.
  it_with_item1[] = it_with_item[].
  SORT:it_with_item1 BY wt_acco.
  DELETE ADJACENT DUPLICATES FROM it_with_item1 COMPARING wt_acco.
  SELECT bukrs lifnr umskz zuonr gjahr belnr ebeln FROM bsik INTO CORRESPONDING FIELDS OF TABLE it_bsik FOR ALL ENTRIES IN it_with_item
    WHERE belnr = it_with_item-belnr AND   bukrs = it_with_item-bukrs AND lifnr EQ it_with_item-wt_acco AND gjahr IN s_gjahr.
  SELECT bukrs lifnr umskz zuonr gjahr belnr ebeln FROM bsik INTO CORRESPONDING FIELDS OF TABLE it_bsik1 FOR ALL ENTRIES IN it_with_item1 WHERE
    bukrs = it_with_item1-bukrs AND lifnr EQ it_with_item1-wt_acco AND umskz = 'A' AND gjahr NOT IN s_gjahr.
  SORT:it_bsik BY gjahr belnr.
  DELETE ADJACENT DUPLICATES FROM it_bsik COMPARING gjahr belnr.
  SORT:it_bsik1 BY gjahr belnr.
  DELETE ADJACENT DUPLICATES FROM it_bsik1 COMPARING gjahr belnr.
  SELECT lifnr name1 FROM lfa1 INTO CORRESPONDING FIELDS OF TABLE it_lfa1 FOR ALL ENTRIES IN it_with_item WHERE lifnr = it_with_item-wt_acco.
  SELECT lifnr j_1ipanno FROM j_1imovend INTO CORRESPONDING FIELDS OF TABLE it_j_1imovend FOR ALL ENTRIES IN it_with_item
   WHERE lifnr = it_with_item-wt_acco.
  SELECT bukrs zuonr gjahr belnr buzei ebeln FROM bsak INTO  CORRESPONDING FIELDS OF TABLE it_bsak FOR ALL ENTRIES IN it_with_item
    WHERE belnr = it_with_item-belnr AND buzei = it_with_item-buzei AND bukrs EQ it_with_item-bukrs AND gjahr = it_with_item-gjahr.
ENDFORM.                    " GET_DATA

*----------------------------------------------------------------------*

FORM display_output .
  LOOP AT it_bsik1. "To append lines to with_item
    it_with_item-wt_acco = it_bsik1-lifnr.
    it_with_item-belnr = it_bsik1-belnr.
    SELECT SINGLE bukrs buzei gjahr witht wt_withcd wt_qsshh wt_qbshh j_1iintchln FROM with_item INTO
     (it_with_item-bukrs,it_with_item-buzei,it_with_item-gjahr ,it_with_item-witht ,it_with_item-wt_withcd ,it_with_item-wt_qsshh ,it_with_item-wt_qbshh ,it_with_item-j_1iintchln)
       WHERE bukrs IN s_bukrs AND wt_qbshh NE '0' AND j_1iintchln EQ '' AND belnr = it_bsik1-belnr.
    SELECT SINGLE budat xblnr bldat FROM bkpf INTO (it_with_item-budat,it_with_item-xblnr,it_with_item-bldat)
      WHERE bukrs IN s_bukrs AND gjahr IN s_gjahr AND budat IN s_budat.
    SELECT SINGLE ebeln FROM ekbe INTO it_with_item-ebeln WHERE gjahr = it_with_item-awkey+10(4) AND belnr = it_with_item-awkey(10).
    APPEND it_with_item TO it_with_item.
    CLEAR:it_with_item.
  ENDLOOP.
LOOP AT it_with_item.
   SELECT SINGLE text40 FROM t059u INTO it_with_item-text40 WHERE witht = it_with_item-witht AND spras = 'EN' AND land1 = 'IN'.
    MODIFY it_with_item TRANSPORTING:text40.
    SELECT SINGLE text40 FROM t059zt INTO it_with_item-text40 WHERE
        wt_withcd = it_with_item-wt_withcd AND witht = it_with_item-witht AND spras = 'EN' AND land1 = 'IN'.
    READ TABLE it_j_1imovend WITH KEY lifnr = it_with_item-wt_acco.
    IF sy-subrc = 0.
      it_with_item-j_1ipanno = it_j_1imovend-j_1ipanno.
      MODIFY it_with_item TRANSPORTING j_1ipanno.
    ENDIF.
    CLEAR:it_j_1imovend.
    READ TABLE it_lfa1 WITH KEY lifnr = it_with_item-wt_acco.
    IF sy-subrc = 0.
      it_with_item-name1 = it_lfa1-name1.
      MODIFY it_with_item TRANSPORTING name1.
    ENDIF.
    CLEAR:it_lfa1.
    READ TABLE it_bkpf WITH KEY belnr = it_with_item-belnr bukrs = it_with_item-bukrs gjahr = it_with_item-gjahr.
    IF sy-subrc = 0.
      it_with_item-budat = it_bkpf-budat.
      it_with_item-xblnr = it_bkpf-xblnr.
      it_with_item-bldat = it_bkpf-bldat.
      it_with_item-awkey = it_bkpf-awkey.
      it_with_item-blart = it_bkpf-blart.
      MODIFY it_with_item TRANSPORTING:budat,xblnr,bldat,blart,awkey.
    ENDIF.
    CLEAR:it_bkpf.
    len = strlen( it_with_item-awkey ).
    IF it_with_item-blart EQ 'RE'.
      SELECT SINGLE ebeln gjahr belnr
         FROM ekbe INTO (it_with_item-ebeln,it_with_item-gjahr1,it_with_item-belnr1)
      WHERE gjahr = it_with_item-awkey+10(4) AND belnr = it_with_item-awkey(10).
      MODIFY it_with_item TRANSPORTING:ebeln.
    ENDIF.
      READ TABLE it_bsik WITH KEY bukrs = it_with_item-bukrs belnr = it_with_item-belnr gjahr = it_with_item-gjahr.
      IF sy-subrc = 0.
        it_with_item-zuonr it_bsik-ebeln.
        MODIFY it_with_item TRANSPORTING:zuonr.
      ENDIF.
  ENDLOOP.
ENDFORM.                    " DISPLAY_OUTPUT

 

 

 

 


Viewing all articles
Browse latest Browse all 9148

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>