The following example code will get the version no. in PO
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
Serkan AKKAVAK Computer Engineer ABAP Developer & SAP MM SD Consultant Contact : serkurumsal@yandex.com
Social Plugin