<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: problem in the code in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-the-code/m-p/4798096#M1123607</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Please use an informative subject for your questions in future.  Also, surround your ABAP with  tags.  See how it suddenly becomes readable?&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 03 Dec 2008 12:57:02 GMT</pubDate>
    <dc:creator>matt</dc:creator>
    <dc:date>2008-12-03T12:57:02Z</dc:date>
    <item>
      <title>problem in the code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-the-code/m-p/4798094#M1123605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Moderator message: please use an informative subject for your questions in future&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had made this code which shows changes made to the Purchase Order,but 1 problem i am facing is that when i execute this program it get perfectly on the DEV Server but when i execute it in the PRD Server it give runtime error:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Exception condition "NOT_FOUND" raised.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I dont know why it is not executing on the PRD Server. Please provide me guidelines for solving this problem.  Following is the code for this program:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZNEW26
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*

REPORT  ZPO_CHANGES    no standard page heading line-size 350.

******************************************data declaration for the alv list****************************************************
TYPE-POOLS SLIS.   " FOR ALV.
DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
      WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
      WA_LAYOUT TYPE SLIS_LAYOUT_ALV.

******************************************end data declaration for the alv list****************************************************

TABLES: EKPO,CDHDR,CDPOS.


DATA: BEGIN OF ITSTPO OCCURS 0,
      EBELN LIKE EKPO-EBELN,
      MATNR LIKE EKPO-MATNR,
      WERKS LIKE EKPO-WERKS,
      MAKTX LIKE MAKT-MAKTX,
      objectid like cdhdr-objectid,
      changenr like cdhdr-changenr,
      udate like cdhdr-udate,
      TCODE LIKE CDHDR-TCODE,
      USERNAME LIKE CDHDR-USERNAME,
      NEW_VALUE LIKE CDPOS-VALUE_NEW,
      OLD_VALUE LIKE CDPOS-VALUE_OLD,
      FNAME LIKE CDPOS-FNAME,
      DDTEXT LIKE DD04V-DDTEXT,
      TABNAME LIKE CDPOS-TABNAME,
      END OF ITSTPO.

DATA: E_DD04V LIKE DD04V OCCURS 0 WITH HEADER LINE.
DATA: E_DD03L LIKE DD03L OCCURS 0 WITH HEADER LINE.


data: begin of itcdhdr occurs 0,
      objectid like cdhdr-objectid,
      changenr like cdhdr-changenr,
      udate like cdhdr-udate,
      TCODE LIKE CDHDR-TCODE,
      USERNAME LIKE CDHDR-USERNAME,
      end of itcdhdr.

DATA: BEGIN OF ITCDPOS OCCURS 0,
      OBJECTID LIKE CDPOS-OBJECTID,
      CHANGENR LIKE CDPOS-CHANGENR,
      NEW_VALUE LIKE CDPOS-VALUE_NEW,
      OLD_VALUE LIKE CDPOS-VALUE_OLD,
      FNAME LIKE CDPOS-FNAME,
      TABNAME LIKE CDPOS-TABNAME,
      END OF ITCDPOS.
*****************end of all internal table declarations*************************************************


selection-screen begin of block b1 with frame title text-001.
parameters: p_werks like EKPO-werks obligatory.
*            PO    LIKE CDHDR-objectid.
select-options: date for cdhdr-udate obligatory,
                PO_NAM FOR CDHDR-objectid.
*                PO_NAM FOR EKPO-EBELN.
selection-screen end of block b1.


select objectid changenr udate TCODE USERNAME into table itcdhdr from cdhdr
      where objectclas = 'EINKBELEG' AND UDATE IN DATE AND objectid IN PO_NAM AND  TCODE &amp;lt;&amp;gt; 'ME21N' .  "and ( tcode = 'ME22N' or tcode = 'ME29N' ).

if sy-subrc &amp;lt;&amp;gt; 0.
  message 'No Record Exist' type 'I'.
  EXIT.
endif.


DELETE ADJACENT DUPLICATES FROM ITCDHDR COMPARING CHANGENR.
SELECT OBJECTID CHANGENR VALUE_NEW VALUE_OLD FNAME TABNAME FROM CDPOS INTO TABLE ITCDPOS
  FOR ALL ENTRIES IN ITCDHDR WHERE OBJECTID = ITCDHDR-OBJECTID AND CHANGENR = ITCDHDR-CHANGENR AND FNAME NOT IN ('AENDERER', 'AEDAT', 'AEUZEIT','AENDERDAT','FRGKE','FRGZU','FRGSX','PROCSTAT').

 DATA V_PO LIKE EKPO-EBELN.

 LOOP AT ITCDPOS.

  CLEAR V_PO.
  V_PO = ITCDPOS-OBJECTID.

  READ TABLE ITCDHDR WITH KEY OBJECTID = ITCDPOS-OBJECTID CHANGENR = ITCDPOS-CHANGENR.
  SELECT SINGLE A~EBELN A~MATNR WERKS MAKTX FROM EKPO AS A
                INNER JOIN MAKT AS B ON B~MATNR = A~MATNR
  INTO ITSTPO
  WHERE EBELN = V_PO AND WERKS = P_WERKS.          "AND A~EBELN = PO_NAM.

  ITSTPO-OBJECTID = ITCDPOS-OBJECTID.
  ITSTPO-CHANGENR = ITCDPOS-CHANGENR.
  ITSTPO-NEW_VALUE = ITCDPOS-NEW_VALUE.
  ITSTPO-OLD_VALUE = ITCDPOS-OLD_VALUE.
  ITSTPO-UDATE = ITCDHDR-UDATE.
  ITSTPO-TCODE = ITCDHDR-TCODE.
  ITSTPO-USERNAME = ITCDHDR-USERNAME.
  ITSTPO-FNAME = ITCDPOS-FNAME.
  ITSTPO-TABNAME = ITCDPOS-TABNAME.

    IF ITCDPOS-FNAME &amp;lt;&amp;gt; 'KEY'.
**  clear e_dd04v.
    CALL FUNCTION 'GET_FIELDNAME_TEXT_1'
      EXPORTING
       I_AS4LOCAL                = 'A'
       I_AS4VERS                 = '0000'
       I_FIELDNAME               = ITCDPOS-FNAME
       I_TABNAME                 = ITCDPOS-TABNAME
       TABLES
       E_DD03L                   = E_DD03L
       E_DD04V                   = E_DD04V
*     EXCEPTIONS
*     ERROR_IN_PARAMETERS       = 1
*     NOT_FOUND                 = 2
*     OTHERS                    = 3
      .
  ENDIF.
  IF SY-SUBRC &amp;lt;&amp;gt; 0.
*  * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*  *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  CLEAR E_DD04V-DDTEXT.
ENDIF.

  IF ITCDPOS-FNAME = 'KEY'.
    ITSTPO-DDTEXT = 'New Entry Made'.
  ELSE.
    ITSTPO-DDTEXT = E_DD04V-DDTEXT.
  ENDIF.
  CLEAR E_DD04V.
  APPEND ITSTPO.
endloop.

SORT ITSTPO BY MATNR OBJECTID CHANGENR FNAME.
DELETE ADJACENT DUPLICATES FROM ITSTPO COMPARING MATNR OBJECTID CHANGENR FNAME.
DELETE ITSTPO WHERE MATNR EQ SPACE.


PERFORM f_layout.
PERFORM f_fieldcat.
PERFORM display.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  f_layout
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
FORM f_layout .
  WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
  WA_LAYOUT-NO_SUBCHOICE = 'X'.
  WA_LAYOUT-ZEBRA = 'X'.
ENDFORM.                    " f_layout
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  f_fieldcat
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
FORM f_fieldcat .
  DATA wa_col TYPE i VALUE 1.

  wa_fieldcat-col_pos = wa_col + 1.
  wa_fieldcat-seltext_l = 'PO No.'.
  wa_fieldcat-fieldname = 'EBELN'.
  wa_fieldcat-tabname = ITSTPO.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR wa_fieldcat.


  wa_fieldcat-col_pos = wa_col + 1.
  wa_fieldcat-seltext_l = 'ITEM ID'.
  wa_fieldcat-fieldname = 'MATNR'.
  wa_fieldcat-tabname = ITSTPO.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR wa_fieldcat.

  wa_fieldcat-col_pos = wa_col + 1.
  wa_fieldcat-seltext_l = 'DESC'.
  wa_fieldcat-fieldname = 'MAKTX'.
  wa_fieldcat-tabname = ITSTPO.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR wa_fieldcat.


  wa_fieldcat-col_pos = wa_col + 1.
  wa_fieldcat-seltext_l = 'CHNG DAT'.
  wa_fieldcat-fieldname = 'UDATE'.
  wa_fieldcat-tabname = ITSTPO.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR wa_fieldcat.

  wa_fieldcat-col_pos = wa_col + 1.
  wa_fieldcat-seltext_l = 'CHNG BY'.
  wa_fieldcat-fieldname = 'USERNAME'.
  wa_fieldcat-tabname = ITSTPO.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR wa_fieldcat.

  wa_fieldcat-col_pos = wa_col + 1.
  wa_fieldcat-seltext_l = 'TCODE USED'.
  wa_fieldcat-fieldname = 'TCODE'.
  wa_fieldcat-tabname = ITSTPO.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR wa_fieldcat.

  wa_fieldcat-col_pos = wa_col + 1.
  wa_fieldcat-seltext_l = 'NEW VALUE'.
  wa_fieldcat-fieldname = 'NEW_VALUE'.
  wa_fieldcat-tabname = ITSTPO.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR wa_fieldcat.

  wa_fieldcat-col_pos = wa_col + 1.
  wa_fieldcat-seltext_l = 'OLD VALUE'.
  wa_fieldcat-fieldname = 'OLD_VALUE'.
  wa_fieldcat-tabname = ITSTPO.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR wa_fieldcat.

  wa_fieldcat-col_pos = wa_col + 1.
  wa_fieldcat-seltext_l = 'CHANGED MADE TO'.
  wa_fieldcat-fieldname = 'DDTEXT'.
  wa_fieldcat-tabname = ITSTPO.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR wa_fieldcat.

*  wa_fieldcat-col_pos = wa_col + 1.
*  wa_fieldcat-seltext_l = 'FIELD'.
*  wa_fieldcat-fieldname = 'FNAME'.
*  wa_fieldcat-tabname = ITSTPO.
*  APPEND wa_fieldcat TO it_fieldcat.
*  CLEAR wa_fieldcat.


ENDFORM.                    " f_fieldcat
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  display
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
FORM display .
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program = sy-repid
      is_layout          = wa_layout
*      I_CALLBACK_USER_COMMAND  = 'HANDLE_USER_COMMAND'
      it_fieldcat        = it_fieldcat
    TABLES
      t_outtab           = ITSTPO.

ENDFORM.                    " display&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Moderator message: please surround any ABAP code in  tags in future&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Matt on Dec 3, 2008 1:55 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2008 12:51:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-the-code/m-p/4798094#M1123605</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-03T12:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: problem in the code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-the-code/m-p/4798095#M1123606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;and why don't you analyze the dump report on your own?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;on the other hand , the exception after the FM call :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXCEPTIONS &lt;/P&gt;&lt;P&gt;ERROR_IN_PARAMETERS = 1 &lt;/P&gt;&lt;P&gt;NOT_FOUND = 2 &lt;/P&gt;&lt;P&gt;OTHERS = 3 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is commented in your program, if you uncomment it, it might tun without dump&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2008 12:56:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-the-code/m-p/4798095#M1123606</guid>
      <dc:creator>JozsefSzikszai</dc:creator>
      <dc:date>2008-12-03T12:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: problem in the code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-the-code/m-p/4798096#M1123607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Please use an informative subject for your questions in future.  Also, surround your ABAP with  tags.  See how it suddenly becomes readable?&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2008 12:57:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-the-code/m-p/4798096#M1123607</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2008-12-03T12:57:02Z</dc:date>
    </item>
  </channel>
</rss>

