<?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: SQL SY-SUBRC = 4 failed to get datas in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-sy-subrc-4-failed-to-get-datas/m-p/12340891#M1992125</link>
    <description>&lt;P&gt;SY-SUBRC = 4 means that no records was found in the database for those conditions. Please refer to &lt;A href="https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abapselect.htm"&gt;ABAP documentation&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;If that was your question... Or if you need help to figure out why there is nothing found, we need more information as the data in the transaction tables obviously is different in different systems. And we're not seeing your entire code.&lt;/P&gt;&lt;P&gt;I suggest you look for yourself in SE16N to see if the data is really there in the way you expect it. And minding the joins.&lt;/P&gt;</description>
    <pubDate>Tue, 19 Jan 2021 12:39:38 GMT</pubDate>
    <dc:creator>joltdx</dc:creator>
    <dc:date>2021-01-19T12:39:38Z</dc:date>
    <item>
      <title>SQL SY-SUBRC = 4 failed to get datas</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-sy-subrc-4-failed-to-get-datas/m-p/12340889#M1992123</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;TYPES:
  BEGIN OF GTS_VAL,
    BUKRS TYPE ZMM0011T-BUKRS,
    MATNR TYPE MARA-MATNR,
    MATNR_TMP TYPE MARC-MATNR,
    BWKEY TYPE T001W-BWKEY,
    WERKS TYPE T001W-WERKS,
  END OF GTS_VAL. 
GTT_VAL TYPE STANDARD TABLE OF GTS_VAL. 
Data:
   GDT_R_DATE type range of sy-datlo.
  GDT_STARTDAY TYPE MSEG-BUDAT_MKPT
  GDT_STARTDAY1 TYPE MSEG-BUDAT_MKPF.

  GDT_LASTDAY TYPE MSEG-BUDAT_MKPF. 
  LDT_VAL TYPE GTT_VAL. 
*First day of period
  CONCATENATE S_ZYEAR-LOW '01' INTO GDF_STARTDAY1.
  CONCATENATE S_ZYEAR-HIGH '01' INTO GDF_STARTDAY. 
*Last day of period
  Call function 'LAST_DAY_OF_MONTHS'. 
  EXPORTING
    DAY_IN = GDF_STARTDAY
  IMPORTING
    LAST_DAY_OF_MONTH = GDF_LASTDAY
  EXCEPTION
   ~

GDF_R_DATE = VALUE #( BASE GDF_R_DATE ( SIGN = 'I' OPTION = 'BT' LOW = GDF_STARTDAY1 HIGH = GDF_LASTDAY ) ).

SELECT ZMM0011T~EBELN,
       ZMM0011T~EBELP,
       ZMM0011T~MENGE_GR,
       ZMM0011T~DMBST_GR
  FROM ZMM0011T
 WHERE BUKRS = @P_BUKRS
INTO TABLE  = @GDT_ZMM0011T

SELECT MSEG~BWART,
       MSEG~DMBTR,
       MSEG~BNBTR,
       MSEG~SHKZG,
       MSEG~MENGE,
       MSEG~EBELN,
       MSEG~EBELP,
       EKPO~PSTYP,
       EKPO~MENGE,
       EKPO~KNTTP,
       T156~SHKZG,
       T156~XSTBW
  FROM MSEG
INNER JOIN EKPO
        ON EKPO~EBELN = MSEG~EBELN
       AND EKPO~EBELP = MSEG~EBELP
       AND EKPO~KNTTP = ' '
INNER JOIN T156
        ON T156~BWART = MSEG~BWART
  FOR ALL ENTRIES IN
           @LDT_VAL
     WHERE MSEG~MATNR = @LDT_VAL-MATNR  
       AND MSEG~WERKS = @LDT_VAL-WERKS
       AND MSEG~BUKRS = @P_BUKRS
INTO TABLE @GDT_MSEG. 
       


&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Jan 2021 11:46:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-sy-subrc-4-failed-to-get-datas/m-p/12340889#M1992123</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2021-01-19T11:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: SQL SY-SUBRC = 4 failed to get datas</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-sy-subrc-4-failed-to-get-datas/m-p/12340890#M1992124</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;I tested the SQL from MSEG , and SY-SUBRC = 4. I don't why. &lt;/P&gt;&lt;P&gt;Can anyone here help me?&lt;/P&gt;&lt;P&gt;Please. &lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2021 11:48:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-sy-subrc-4-failed-to-get-datas/m-p/12340890#M1992124</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2021-01-19T11:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: SQL SY-SUBRC = 4 failed to get datas</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-sy-subrc-4-failed-to-get-datas/m-p/12340891#M1992125</link>
      <description>&lt;P&gt;SY-SUBRC = 4 means that no records was found in the database for those conditions. Please refer to &lt;A href="https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abapselect.htm"&gt;ABAP documentation&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;If that was your question... Or if you need help to figure out why there is nothing found, we need more information as the data in the transaction tables obviously is different in different systems. And we're not seeing your entire code.&lt;/P&gt;&lt;P&gt;I suggest you look for yourself in SE16N to see if the data is really there in the way you expect it. And minding the joins.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2021 12:39:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-sy-subrc-4-failed-to-get-datas/m-p/12340891#M1992125</guid>
      <dc:creator>joltdx</dc:creator>
      <dc:date>2021-01-19T12:39:38Z</dc:date>
    </item>
  </channel>
</rss>

