<?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: code help in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1791004#M340316</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Linda,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I should have mentioned earlier that you can use this to choose your file.&lt;/P&gt;&lt;P&gt;Place it between your initialization and start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_OUTF.&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'F4_FILENAME'&lt;/P&gt;&lt;P&gt;       IMPORTING&lt;/P&gt;&lt;P&gt;            FILE_NAME = P_OUTF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 04 Dec 2006 19:57:02 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-12-04T19:57:02Z</dc:date>
    <item>
      <title>code help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1790992#M340304</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am asked to create a program to extract some material information from R/3 system. The information are from several fields of tables MARM, MARA, MAKT..&lt;/P&gt;&lt;P&gt;Anyone can give me a sample code? The fields include Unit of Measure, material names, etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What's the logic?&lt;/P&gt;&lt;P&gt;Do I need to create an internal table? Select all the fields from tables and put them into the internal table, loop the internal table, output it to external table? where to output? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for help,&lt;/P&gt;&lt;P&gt;Linda&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Linda Tseng&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Dec 2006 17:11:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1790992#M340304</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-04T17:11:24Z</dc:date>
    </item>
    <item>
      <title>Re: code help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1790993#M340305</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;create internal tables...get data from tbales...loop one table &amp;amp; read other tables with keys and get all required data into final internal table...Use this for eport output.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Dec 2006 17:16:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1790993#M340305</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-04T17:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: code help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1790994#M340306</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is a sample program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

REPORT ZRICH_0003 . 

* Tables. 
TABLES: MARA. 

* Global ALV Data Declarations 
TYPE-POOLS: SLIS. 

* Internal Tables 
DATA: BEGIN OF ITAB OCCURS 0, 
      MATNR TYPE MARA-MATNR, 
      MAKTX TYPE MAKT-MAKTX, 
      END OF ITAB. 

DATA: FIELDCAT  TYPE SLIS_T_FIELDCAT_ALV. 

* Selection Screen 
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-002 . 
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR. 
SELECTION-SCREEN END OF BLOCK B1. 

START-OF-SELECTION. 

  PERFORM GET_DATA. 
  PERFORM CALL_ALV. 

********************************************************************* 
*      Form  GET_DATA 
********************************************************************* 
FORM GET_DATA. 

  SELECT MARA~MATNR MAKT~MAKTX 
          INTO CORRESPONDING FIELDS OF TABLE ITAB 
               FROM MARA 
                 INNER JOIN MAKT 
                  ON MARA~MATNR = MAKT~MATNR 
                   WHERE MARA~MATNR IN S_MATNR 
                     AND MAKT~SPRAS = SY-LANGU. 

ENDFORM. 

************************************************************************ 
*  CALL_ALV 
************************************************************************ 
FORM CALL_ALV. 

  DATA: VARIANT TYPE  DISVARIANT. 

  VARIANT-REPORT = SY-REPID. 
  VARIANT-USERNAME = SY-UNAME. 

  PERFORM BUILD_FIELD_CATALOG. 

* Call ABAP List Viewer (ALV) 
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' 
       EXPORTING 
            IT_FIELDCAT = FIELDCAT 
            IS_VARIANT  = VARIANT 
            I_SAVE      = 'U' 
       TABLES 
            T_OUTTAB    = ITAB. 

ENDFORM. 

************************************************************************ 
* BUILD_FIELD_CATALOG 
************************************************************************ 
FORM BUILD_FIELD_CATALOG. 

  DATA: FC_TMP TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE. 
  DATA: LABEL(30) TYPE C. 

  CLEAR: FIELDCAT. REFRESH: FIELDCAT. 

  PERFORM UPDATE_CATALOG USING 'Material Number' 
                            'ITAB' 
                            'MATNR' 
                            '18' 
                            SPACE 
                            SPACE 
                            'L'. 

  PERFORM UPDATE_CATALOG USING 'Material Description' 
                            'ITAB' 
                            'MAKTX' 
                            '40' 
                            SPACE 
                            SPACE 
                            'L'. 


ENDFORM. 

************************************************************************ 
* UPDATE_CATALOG 
************************************************************************ 
FORM UPDATE_CATALOG USING COL_HEAD 
                          TABLE 
                          FIELD 
                          OUTPUTLEN 
                          DO_SUM 
                          NO_OUT 
                          JUST. 

  DATA: TMP_FC TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE. 

  TMP_FC-REPTEXT_DDIC = COL_HEAD. 
  TMP_FC-FIELDNAME    = FIELD. 
  TMP_FC-TABNAME      = TABLE. 
  TMP_FC-OUTPUTLEN    = OUTPUTLEN. 
  TMP_FC-JUST         = JUST. 
  TMP_FC-DECIMALS_OUT = 0. 
  TMP_FC-DO_SUM      = DO_SUM. 
  TMP_FC-NO_OUT      = NO_OUT. 
  APPEND TMP_FC TO FIELDCAT. 

ENDFORM.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Dec 2006 17:17:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1790994#M340306</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-12-04T17:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: code help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1790995#M340307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select all necessary info from MARA &amp;amp; MARM in one internal table joining matnr. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then update material description from makt  for  the same matnr in the same internal table .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;M in hurry so unable to give u details code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers...Bye&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Dec 2006 17:17:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1790995#M340307</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-04T17:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: code help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1790996#M340308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Linda,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could create an internal table that is comprised of all the fields you require. You need to determine from what tables the information is comming from and how to drill down to obtain the correct infomation.&lt;/P&gt;&lt;P&gt;logic: &lt;/P&gt;&lt;P&gt;select * (or single *) from MARM into table I_MARM where .....&lt;/P&gt;&lt;P&gt;select * (or single *) from MARA into table I_MARA where .....&lt;/P&gt;&lt;P&gt;select * (or single *) from MAKT into table I_MAKT where .....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;once you have your internal tables filled....&lt;/P&gt;&lt;P&gt;LOOP AT I_MARM WHERE ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE I_MARA WITH KEY&lt;/P&gt;&lt;P&gt;VARIABLE = I_MARM-VARIABLE.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC = 0.  &amp;lt;--IF A RECORD IS FOUND&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  READ TABLE I_MAKT WITH KEY&lt;/P&gt;&lt;P&gt;  VARIABLE = I_MARA-VARIABLE.&lt;/P&gt;&lt;P&gt;  IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;  MY_RESULTS-VAR1 = I_MARM-VARIABLE&lt;/P&gt;&lt;P&gt;  MY_RESULTS-VAR2 = I_MARA-VARIABLE&lt;/P&gt;&lt;P&gt;  MY_RESULTS-VAR3 = I_MAKT-VARIABLE&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Warren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Dec 2006 17:21:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1790996#M340308</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-04T17:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: code help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1790997#M340309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your quick responses. Let me try.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Linda&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Dec 2006 17:26:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1790997#M340309</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-04T17:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: code help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1790998#M340310</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One question.&lt;/P&gt;&lt;P&gt;Based on the code, I extract the data out from those tables into the internal table. How to export the data from the internal table to a file? Is there a function module I can use? Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Linda&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Dec 2006 17:50:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1790998#M340310</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-04T17:50:56Z</dc:date>
    </item>
    <item>
      <title>Re: code help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1790999#M340311</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, you can use the function module GUI_DOWNLOAD.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also maybe you can reward points for helpful answers.  You can do so by setting the radiobuttons next to each answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Dec 2006 18:03:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1790999#M340311</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-12-04T18:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: code help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1791000#M340312</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rich,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please explain what function module 'REUSE_ALV_GRID_DISPLAY'  does? Also what do BUILD_FIELD_CATALOG, UPDATE_CATALOG do in your sample code? Appreciate!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Linda&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Dec 2006 18:17:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1791000#M340312</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-04T18:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: code help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1791001#M340313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could also use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET P_OUTF FOR OUTPUT IN TEXT MODE.&lt;/P&gt;&lt;P&gt;    LOOP AT I_RESULTS.&lt;/P&gt;&lt;P&gt;      TRANSFER I_RESULTS TO P_OUTF.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;    CLOSE DATASET P_OUTF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**p_outf being the parameter for the output on your selection screen&lt;/P&gt;&lt;P&gt;**I_results being your internal table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Dec 2006 18:24:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1791001#M340313</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-04T18:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: code help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1791002#M340314</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The function module is the ALV grid function module which gives you the nice output screen, which allows for sorting, filtering, and other things., BUILD_FIELDCATALOG is a form routine that builds the FC,  which tells the ALV function  module what columns it should display, usually it is the same columns as in the internal table with the data.  UPDATE_CATALOG is actually just another form routine which abstracts the actually updating of the FC,  you don't have to use it this way, you can simply update directly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Dec 2006 18:56:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1791002#M340314</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-12-04T18:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: code help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1791003#M340315</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Linda&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Dec 2006 19:46:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1791003#M340315</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-04T19:46:54Z</dc:date>
    </item>
    <item>
      <title>Re: code help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1791004#M340316</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Linda,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I should have mentioned earlier that you can use this to choose your file.&lt;/P&gt;&lt;P&gt;Place it between your initialization and start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_OUTF.&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'F4_FILENAME'&lt;/P&gt;&lt;P&gt;       IMPORTING&lt;/P&gt;&lt;P&gt;            FILE_NAME = P_OUTF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Dec 2006 19:57:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1791004#M340316</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-04T19:57:02Z</dc:date>
    </item>
    <item>
      <title>Re: code help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1791005#M340317</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;my question is kind if late.&lt;/P&gt;&lt;P&gt;Is there a specific format of the file name I want to save data to? I tried this code, but I always got error of no authorization? Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Linda&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Dec 2006 18:43:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/1791005#M340317</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-18T18:43:21Z</dc:date>
    </item>
  </channel>
</rss>

