SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Get the Version Value When I Print the PO



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ММ
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Wed Oct 24, 2007 8:56 pm    Post subject: Get the Version Value When I Print the PO Reply with quote

How to Get the Version Value When I Print the PO

Need to display the Version of PO in the printout. But the table ekko or erev doesn't contain the version value at runtime.

The following example code will get the version no. in PO

Code:
referesh : erevitem.
clear : erevlines.

  SELECT SINGLE * FROM cdpos
  WHERE objectid = ebeln AND
        value_old = 'G' AND
        value_new = 'B'.

  IF sy-subrc EQ 0.

    erevlines = erevlines + 1.

  ELSE.

    erevlines = 0.

  ENDIF.

SELECT * FROM nast
  INTO CORRESPONDING FIELDS OF TABLE itab_nast
  WHERE objky = ebeln AND
        vstat NE '0'.

  CLEAR itab_nast.
  SORT itab_nast DESCENDING BY erdat eruhr.

  READ TABLE itab_nast INDEX 1.

  IF sy-subrc EQ 0.
    IF itab_nast-vstat NE '0'.

      LOOP AT l_doc-xekpo INTO tekpo.

        CALL FUNCTION 'ME_CHANGEDOC_SELECT'
          EXPORTING
            i_document_category      = pekko-bstyp
            i_document_number        = ebeln
            i_document_item          = tekpo-ebelp
*  I_DATE_START              =
*  I_TIME_START              =
*  I_DATE_END                =
*  I_TIME_END                =
*  I_USERNAME                =
*  I_ALL_ITEMS              =
*  I_GRIDHANDLE              =
*  I_REVISIONLIST            =
*  I_ARCHIVE_HANDLE          =
        IMPORTING
*  E_LINES                  =
          e_outtab                  = imecdgrid.


        it_mecdgrid[] = imecdgrid[].

        LOOP AT it_mecdgrid INTO wa_mecdgrid WHERE tabkey+13(5) = tekpo-ebelp.


          IF wa_mecdgrid-fname = 'MENGE'.

            itab_po_change-matnr = tekpo-matnr.
            itab_po_change-text = '***** Quantity Change ******'.
            erevlines = erevlines + 1.


            APPEND itab_po_change.

          ENDIF.

          IF wa_mecdgrid-fname = 'NETWR'.

            itab_po_change-matnr = tekpo-matnr.
            itab_po_change-text = '***** Price Change ******'.
            erevlines = erevlines + 1.


            APPEND itab_po_change.


          ENDIF.


        ENDLOOP.


      ENDLOOP.

      SORT itab_po_change BY matnr text.

      LOOP AT itab_po_change.

        DELETE ADJACENT DUPLICATES FROM itab_po_change COMPARING matnr text.

      ENDLOOP.


    ENDIF.
  ENDIF.


  SELECT * FROM erev INTO CORRESPONDING FIELDS OF TABLE erev WHERE edokn = pekko-ebeln.

  SORT erev BY revno DESCENDING.



  LOOP AT erev.
    MOVE-CORRESPONDING erev TO erevitem.
    APPEND erevitem.
  ENDLOOP.

  DESCRIBE TABLE erevitem LINES erevlines.
  IF erevlines = 1.
    CLEAR erevitem[].
    erevlines = 0.
  ENDIF.
*
**  erevlines = erevlines - 1.
*
  DELETE erevitem WHERE revno = 0.
  CLEAR erevlines.
  DESCRIBE TABLE erevitem LINES erevlines.

call function fm_name
exporting
  erevlines  = erevlines

tables
  erev      = erevitem
endform.


IN SSF :

loop at erev into wa_erev where erevlines > '0'.


wa_erevlines-revno(.0)  for version no.
wa_erevlines-txz01 for version text

ABAP Tips by : Ashu gupta
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ММ All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.