ABAP Code Split at the decimal

Dear experts,
    I have a small requirement where in I need to split the qty at the decimal place and use the non decimal value as a character field.
Eg: WA_ITAB-LFIMG = 12.000
I want only 12 into one variable which has only capacity of 4 characters (Lfimg has 1313 characters).
I tried the following code, but it did not work.
I was able to successfully split the value and pass it onto the corresponsing entries but unable to pass the value into a variable of 4 characters,
Can some one please help me in this.
It_itab has lfimg
data : var(17) type c,
       qty(13) type c,
       qty_dec(3) type c,
       val(4) type c.
constants : ca(1) type c value '.'.
read table it_itab into wa_itab index 1.
var = wa_itab-lfimg.
split var at ca into qty qty_dec. " This worked
val = qty. " This did not work
Thanks
-Amit

Hi Amit,
use TRUNC function:
data :
  qty_dec(3) type c,
  val(4) type c.
val = trunc( WA_ITAB-LFIMG ).
qty_dec = ( WA_ITAB-LFIMG - trunc( WA_ITAB-LFIMG ) ) * 1000.
Regards,
Clemens

Similar Messages

  • Executing Abap Queries in Abap Code and processing the result

    Hi,
    I want to execute ABAP Queries (designed by sq01) in an abap report and processing the result in an internal table.
    How could it be work?
    Thanks a lot for your responses,
    with kind Regards
    Reinhold Strobl

    Hello,
    GO to SQ01 and select your query. Go to Menu QUERY-->More Functions->Display Report Name.
    You can then take that report name and go to SE38. Copy the code before END-OF_SELECTION and then modify as per your own requirements.
    Regrads
    Saket Sharma

  • Need help in ABAP code to Enhance the Extract Structure ?????

    Hi all,
        I want to enhance the extract structure to get KBETR & KBRUE fields of KONP table since it didn’t allow me to add those fields while creating the generic extractor because of currency key problems. I want to read all KONP records into internal table with KNUMH (Key). Next, I want to fill them into ZZKBETR & ZZKBRUE of Extract Structure ZOXUR40065 in loop.
    DATA:
      i_t_zrebate like ZOXUR40065 occurs 0 with header line,
      reb_tabix like sy-tabix.
    TABLES: KONP.
      Could you please help me in completing the ABAP code?
    Thanks,
    Venkat.

    Hello Manga,
        I have included the following code in ZXRSAU01:
    WHEN 'ZREBATE'.
    PERFORM ZREBATE_EXIT TABLES C_T_DATA.
    After Double click on ZREBATE_EXIT on perform statement, it created ZXRSAF01 include and the following code is added in it:
    FORM ZREBATE_EXIT TABLES FP_C_T_DATA STRUCTURE ZOXUR40065.
    DATA:
    i_t_zrebate like ZOXUR40065 occurs 0 with header line,
    reb_tabix like sy-tabix.
    FIELD-SYMBOLS: <l_c_t_data> TYPE ZOXUR40065.
    LOOP AT fp_c_t_data ASSIGNING <l_c_t_data>.
    reb_tabix = sy-tabix.
    select single KBETR KBRUE
    into (<l_c_t_data>-ZZKBETR,
    <l_c_t_data>-ZZKBRUE,
    from KONP
    where KNUMH eq <l_c_t_data>-KNUMH.
    if sy-subrc eq 0.
    MODIFY fp_c_t_data FROM <l_c_t_data> INDEX reb_tabix.
    endif.
    CLEAR:reb_tabix.
    ENDLOOP.
    ENDFORM.
    When I tried to Activate this ZXRSAF01 include, it fails with 'The FORM "ZREBATE_EXIT" does not exist'.
      Should it be FP_C_T  or P_C_T? I found P_C_T in ZXRSAF01 include.
      What is wrong with it, please ?
       Can't I add this whole code in main include ZXRSAU01itself?
      The Extractor ZREBATE is based on KONA, KONH & KONP tables. This Extractor and KONA table have the same 4000 records and KONP has 13000 records. I want to extract KBERT & KBRUE from KONP.
       Thanks in advance.
    Regards,
    Venkat

  • Need ABAP Code to enhance the 0PRODORDER_ATTR?

    I want to enhance the datasource 0PRODORDER_ATTR with the below JCDS Table fields like UDATE,STAT,OBJNR,INACT,CHGNR.
    Can anyone please let me know the ABAP Code need to be written in the CMOD to populate the data for the above fields in the 0PRODORDER_ATTR?

    Hi,
    You can use below code to enhancemnt .
    You need to change the table, structure and field names
    Below code you have to write in tocde CMOD if you are enhancing the master data. It applies for any master data, although, I have taken 0VENDOR_ATTR as the example. I assume that You have already added/appended  the fields in the extract structure of 0VENDOR_ATTR  i.e. to the structure BIW_LFA1_S. ( Check this link for how to enhance the DataSource : https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b0af763b-066e-2910-a784-dc6731660f46 )
    We have enhanced the datasorce for the following two fields from table LFA1:
    ERDAT- Date on which the Record Was Created
    KRAUS - Credit information number.
    We have also enhaced the structure for the following fields from table LFB1.
    MINDK - Minority Indicators
    ZTERM - Terms of payment key
    CERDT - Certification date.
    Now we will poulate these two fields in the code written in CMOD tcode. Here is the code:
    Go to the tcode CMOD in R3 and select the component EXIT_SAPLRSAP_002. Write this code in INCLUDE ZXLOFU01.
    data : l_t_data like biw_lfa1_s.
    data : l_tabix like sy-tabix.
    CASE i_datasource.
    WHEN '0VENDOR_ATTR'.
        LOOP AT  i_t_data INTO l_t_data.
          l_tabix = sy-tabix.
          CLEAR:  l_t_data-yyerdat,
                 l_t_data-yykraus.
          SELECT SINGLE  erdat kraus FROM lfa1 INTO
              ( l_t_data-yyerdat, l_t_data-yykraus)
                WHERE lifnr EQ l_t_data-lifnr.
          SELECT SINGLE mindk zterm cerdt FROM lfb1 INTO
                  (l_t_data-yymindk, l_t_data-yyzterm, l_t_data-yycerdt)
                  WHERE lifnr = l_t_data-lifnr.
          MODIFY i_t_data FROM l_t_data INDEX l_tabix.
          CLEAR: l_t_data, l_tabix.
        ENDLOOP.
    ENDCASE.
    Labels parameters

  • Abap code to replace the bank values of Date Field with 20990101

    Please correct my abap code I am just trying to replace the bank values of Dataefield to 20990101 but i am getting the error invalid dataformat '00000000 '. Please correct my IF statement so that I can get this resolved
    IF    SOURCE_FIELDS-DATETO = '00000000 '
          RESULT = '20990101'.
    ENDIF.
    Thanks'
    Soniya

    Hi Soniya,
    You can use one of the following:
    IF SOURCE_FIELDS-DATETO =  ' '.
    RESULT = '20990101'.
    ENDIF.
    or
    IF SOURCE_FIELDS-DATETO IS INITIAL.
    RESULT = '20990101'.
    ENDIF.
    or
    IF SOURCE_FIELDS-DATETO = '00000000'.
    " THERE WAS A SPACE IN YOUR CODE.
    RESULT = '20990101'.
    ENDIF.
    Regards,
    Satya

  • ABAP Store ABAP code locally  on the disk

    Hello
       I have a question, how download the Web dynpro ABAP code from the SAP System.
    Could You give me a hint how to save code locally on the disk?
    Regards
    Wojtek

    I started from http://code.google.com/p/saplink/ .
    Then in http://code.google.com/p/saplink/wiki/pluginList I found the plug-in for ABAP Web Dynpro.
    It still in ALPHA status and to be honest I got trouble installing it (in fact there is the note:  But WDA plugin requires SAPlink 0.1.3 or greater).
    You should get it running because I can see the nugg file.
    Eventually ask navigate to the http://code.google.com/p/saplink/issues/list and the other pages of http://code.google.com/p/saplink.
    Sergio

  • Abap Code to Repeat the field (3nos) Values for all the fields

    Hi Friends I have a Requirement to merge the Data for One of my BI - BCS model.
    I have fields in one table(/BIC/AZDBBCP_040) <b>business Num , PRCTR, REGION  and RELOCAT</b>  and Field ZAUD_TYP and Audit Year Zyear also in same table.
    But I want to reapeat this information Highlighted in Bold for all the Zaudtyp and ZYEAR. Please help me with the Code
    <b>Problem as below</b>
            BUSNUM  PRCTR  REGION  RELOCAT   ZAUD_TYP  ZYEAR
              101     22    ALAN      MN           
              101                                                                                GT(ZAUD_TYP)        1999(ZYEAR)
    101                                      BTE         2001
    102          25          CA        SFO          
               102                           LTE         2008
    Please help me with any Code to fix the problem so that the data repeat for PRCTR  REGION  RELOCAT  where Bus Num is same.
    Kindly Get me any ABAB Code . Will really be thankful to you
    Regards
    Soniya Kapoor
    soniya kapoor
    Message was edited by:
            soniya kapoor

    Hi Soniya,
    You can use one of the following:
    IF SOURCE_FIELDS-DATETO =  ' '.
    RESULT = '20990101'.
    ENDIF.
    or
    IF SOURCE_FIELDS-DATETO IS INITIAL.
    RESULT = '20990101'.
    ENDIF.
    or
    IF SOURCE_FIELDS-DATETO = '00000000'.
    " THERE WAS A SPACE IN YOUR CODE.
    RESULT = '20990101'.
    ENDIF.
    Regards,
    Satya

  • Virtual provider cube ABAP Code to read the Characteristics

    Hello Friends.  We have a virtual provider cube that is connected to the basic real cube for the GL. We want to populate three Characteristics in the virtual provider which are Material Codes, Code1 Code2 Code3 which change very frequently, every alternate day in ECC.
    I want to write the Code in Func Module of Virtual Prov Infocube
    that read the Mapping DSO for the Values of Material Codes, Code1 Code2 Code3 and Populate it in the Virtual Cube at RUNTIME of the execution of the Query built on the virtual provider.
    If you have implemented this functionality can you pls. provide the step by step details.
    Thanks
    Soniya

    Hi,
    I have used ABAP for hierarchy but it is in BPS. I have used some of the CLASS given by SAP.
    For your requirement, you can use the CLASS CL_RSR_HIERARCHY
    Rgds,
    Shailesh

  • Abap Code to Delete the Duplicate Entries in Datasource

    hI Friends I have a code that I am writing to delete the duplicate entries from CRM Custom Datasource  but it is throwing me error that INVERNO The specified type has no structure and therefore no component called INVERNO Should i define the structure please correct my code below so that it will work to delete the duplicate entries          
    Please help
    Data: l_s_ZOXD530051 like ZOXD530051. ***Extract Structure of Data source
    Case i_DATASOURCE.
    when 'ZZ_DS_CUSTOM_CRM_VALUES'.
    Sort C_T_DATA by INVERNO ZMKT_TYP.
    *write this Statement.
    DELETE ADJACENT DUPLICATES FROM C_T_DATA COMPARING INVERNO ZMKT_TYP.
    endcase.
    Thanks
    Soniya
    null

    Hi
    It means there's no field called INVERNO:
    Data: l_s_ZOXD530051 like ZOXD530051. ***Extract Structure of Data source
    Case i_DATASOURCE.
    when 'ZZ_DS_CUSTOM_CRM_VALUES'.
    <b>*Sort C_T_DATA by INVERNO ZMKT_TYP. <------</b>
    Sort C_T_DATA by INTRENO ZINS_TYP.
    *write this Statement.
    DELETE ADJACENT DUPLICATES FROM C_T_DATA COMPARING INTRENO ZINS_TYP.
    endcase.
    Max

  • ABAP Code for Backup the entire table data in the application server

    Hello Friends,
    I have to create the table data Backup and Store the entire table data in the application server and also be able to restore the data back if needed.
    this should be dynamic program for any table based on the table name given on the application server.. I have developed a program for this but its having problems with the Quantity, amount. Its not writing it correctly at the application level.
    ANy Suggestions on this.
    Below is the program for this.
    Thanks,
    Ster.
    * Report  YWMM_TABLE_DUMP                                             *
    REPORT ywmm_table_dump .
    TABLES :
            dd03l.
    * Type spool declaration
    TYPE-POOLS:
            abap, slis.
    DATA: i_table_data1  TYPE REF TO data.
    DATA : it_dd03l LIKE dd03l OCCURS 0 WITH HEADER LINE.
    *DATA : gt_fieldcat TYPE lvc_s_fcat.
    DATA : i_fcat      TYPE STANDARD TABLE OF lvc_s_fcat,
           l_dr_line         TYPE   REF TO data,
           l_v_as4vers       TYPE as4vers.
    FIELD-SYMBOLS: <f_table_data1>     TYPE STANDARD TABLE,
                   <f_wa_table_data1>  TYPE ANY.
    SELECTION-SCREEN: BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.
    PARAMETERS: rb_copy RADIOBUTTON GROUP map DEFAULT 'X',
                rb_rest RADIOBUTTON GROUP map.
    SELECTION-SCREEN: END   OF BLOCK bl1.
    SELECTION-SCREEN: BEGIN OF BLOCK bl2 WITH FRAME TITLE text-002.
    PARAMETERS: p_table  TYPE tabname OBLIGATORY,
                p_plfld TYPE dd03l-fieldname.
    SELECTION-SCREEN SKIP 1.
    PARAMETERS: p_bkfile TYPE localfile OBLIGATORY.
    SELECTION-SCREEN: END   OF BLOCK bl2.
    PERFORM get_data.
    IF rb_copy = 'X'.
      PERFORM backup.
    ELSEIF rb_rest = 'X'.
      PERFORM database_update.
    ENDIF.
    *&      Form  get_data
    FORM get_data.
      CLEAR   i_fcat.
      REFRESH i_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
           EXPORTING
                i_structure_name = p_table  " Table Name
           CHANGING
                ct_fieldcat      = i_fcat
           EXCEPTIONS
                OTHERS           = 1.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
      EXPORTING
        it_fieldcatalog = i_fcat
      IMPORTING
        ep_table        = i_table_data1.
      IF sy-subrc = 0.
        ASSIGN i_table_data1->* TO <f_table_data1>.
      ELSE.
        WRITE: 'Error creating internal table'.
      ENDIF.
      IF rb_copy = 'X'.
        SELECT  * FROM (p_table) INTO CORRESPONDING FIELDS OF
                  TABLE <f_table_data1> UP TO 20 ROWS.
      ELSEIF rb_rest = 'X'.
        CREATE DATA l_dr_line LIKE LINE OF <f_table_data1>.
        ASSIGN l_dr_line->* TO <f_wa_table_data1>.
    *Get Data from Application Server
    * Opening the dataset P_BKFILE given in the selection screen
        TRANSLATE p_bkfile TO LOWER CASE.
        OPEN DATASET p_bkfile FOR INPUT IN TEXT MODE." ENCODING DEFAULT.
        IF sy-subrc NE 0.
    *    MESSAGE:
        ELSE.
          DO.
    * Reading the file from application server
            READ DATASET p_bkfile INTO <f_wa_table_data1>.
            IF sy-subrc = 0.
              APPEND <f_wa_table_data1> TO <f_table_data1>.
            ELSE.
              EXIT.
            ENDIF.
          ENDDO.
    * Closing the dataset
          CLOSE DATASET p_bkfile.
        ENDIF.
      ENDIF.
    ENDFORM.                    " get_data
    *&      Form  backup
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM backup.
      TRANSLATE p_bkfile TO LOWER CASE.
      OPEN DATASET p_bkfile FOR OUTPUT IN TEXT MODE.
      IF sy-subrc NE 0.
        WRITE: text-017.
        STOP.
      ELSE.
        LOOP AT <f_table_data1> ASSIGNING <f_wa_table_data1>.
          TRANSFER <f_wa_table_data1> TO p_bkfile.
        ENDLOOP.
      ENDIF.
      CLOSE DATASET p_bkfile.
    ENDFORM.                    " backup
    *&      Form  database_update
    FORM database_update.
      DATA : i_mara_u TYPE STANDARD TABLE OF mara WITH HEADER LINE,
             i_ekpo_u TYPE STANDARD TABLE OF ekpo WITH HEADER LINE,
             i_eban_u TYPE STANDARD TABLE OF eban WITH HEADER LINE,
             i_resb_u TYPE STANDARD TABLE OF resb WITH HEADER LINE,
             i_plpo_u TYPE STANDARD TABLE OF plpo WITH HEADER LINE,
             i_stpo_u TYPE STANDARD TABLE OF stpo WITH HEADER LINE,
             i_vbap_u TYPE STANDARD TABLE OF vbap WITH HEADER LINE,
             i_vbrp_u TYPE STANDARD TABLE OF vbrp WITH HEADER LINE,
             i_lips_u TYPE STANDARD TABLE OF lips WITH HEADER LINE,
             i_afvc_u TYPE STANDARD TABLE OF afvc WITH HEADER LINE,
             i_asmd_u TYPE STANDARD TABLE OF asmd WITH HEADER LINE,
    *           i_cooi_u TYPE STANDARD TABLE OF cooi WITH HEADER LINE,
             i_qmel_u TYPE STANDARD TABLE OF qmel WITH HEADER LINE,
             i_cooi_u TYPE STANDARD TABLE OF cooi WITH HEADER LINE,
             i_esll_u TYPE STANDARD TABLE OF esll WITH HEADER LINE,
             i_t165_u  TYPE STANDARD TABLE OF t165 WITH HEADER LINE,
             i_t165e_u TYPE STANDARD TABLE OF t165e WITH HEADER LINE,
             i_twpko_u TYPE STANDARD TABLE OF twpko WITH HEADER LINE,
             i_tpext_u TYPE STANDARD TABLE OF tpext WITH HEADER LINE,
             i_ce4mxpa_u TYPE STANDARD TABLE OF ce4mxpa WITH HEADER LINE,
             i_ce4mxpa_acct_u TYPE STANDARD TABLE OF ce4mxpa_acct WITH
                                                             HEADER LINE,
             i_zaim_u  TYPE STANDARD TABLE OF zaim WITH HEADER LINE,
             i_s012_d TYPE STANDARD TABLE OF s012 WITH HEADER LINE,
             i_s012_i TYPE STANDARD TABLE OF s012 WITH HEADER LINE,
             i_dummy  TYPE STANDARD TABLE OF mara.
      CASE p_table.
        WHEN 'MARA'.
    *     Non-Key
          PERFORM move_to_table USING   <f_table_data1>
                                CHANGING i_mara_u[]
                                         i_mara_u.
          PERFORM update_table USING i_mara_u[].
      ENDCASE.
    ENDFORM.                    " database_update
    *&      Form  move_to_mara
    FORM move_to_table USING    p_tab_from TYPE STANDARD TABLE
                       CHANGING p_tab_to   TYPE STANDARD TABLE
                                p_w_table.
      DATA:  l_wa_fcat TYPE lvc_s_fcat.
      FIELD-SYMBOLS: <f_field_from> TYPE ANY,
                     <f_field_to>   TYPE ANY.
      LOOP AT p_tab_from ASSIGNING <f_wa_table_data1>.
        LOOP AT i_fcat INTO l_wa_fcat.
          ASSIGN COMPONENT l_wa_fcat-fieldname
         OF STRUCTURE <f_wa_table_data1> TO <f_field_from>.
          ASSIGN COMPONENT l_wa_fcat-fieldname
         OF STRUCTURE p_w_table TO <f_field_to>.
          <f_field_to> = <f_field_from>.
        ENDLOOP.
        APPEND p_w_table TO p_tab_to.
      ENDLOOP.
    ENDFORM.                    " move_to_mara
    *&      Form  update_table
    FORM update_table  USING p_table_update TYPE STANDARD TABLE.
      SELECT SINGLE *
        FROM dd03l
       WHERE fieldname = p_plfld
         AND tabname   = p_table
         AND keyflag   <> 'X'
         AND as4local = 'A'
         AND   as4vers = l_v_as4vers
         AND   ( comptype = 'E' OR comptype = space ).
      IF sy-subrc = 0.
    *   Do update
        IF NOT p_table_update IS INITIAL.
          UPDATE (p_table) FROM TABLE p_table_update.
          IF sy-subrc = 0.
            COMMIT WORK.
          ELSE.
            ROLLBACK WORK.
            WRITE: text-003.
            STOP.
          ENDIF.
        ENDIF.
      ELSE.
    *delete and insert.
        IF NOT p_table_update IS INITIAL.
    *      DELETE (p_table).
          IF sy-subrc = 0.
            INSERT (p_table) FROM TABLE p_table_update.
            IF sy-subrc = 0.
              COMMIT WORK.
            ELSE.
              ROLLBACK WORK.
              WRITE: text-018.
              STOP.
            ENDIF.
          ELSE.
            ROLLBACK WORK.
            WRITE: text-018.
            STOP.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDFORM.                    " update_table
    Edited by: Julius Bussche on Jul 18, 2008 1:43 PM
    Please use a meaningfull subject title!

    ARS,
    I am struggling a bit to get this.
    there is a syntax error,
    Field "FIELDS_INT-TYPE" is unknown. It is neither in one of thespecified tables nor defined by a "DATA" statement.     
    Again you have asked to move to a diffrent table. What is that table and how to build it.
        LOOP AT <f_table_data1> ASSIGNING <f_wa_table_data1>.
          LOOP AT i_fcat INTO l_fcat.
            IF l_fcat-inttype EQ 'P'.
              ASSIGN COMPONENT l_fcat-fieldname
                  OF STRUCTURE <f_wa_table_data1> TO <f_field>
                  TYPE     fields_int-type
                  DECIMALS fields_int-decimals.
            ELSE.
              ASSIGN COMPONENT l_fcat-fieldname
                  OF STRUCTURE <f_wa_table_data1> TO <f_field>
                  TYPE     fields_int-type.
            ENDIF.
            " Move <f_field> to a new table and use this table for download
          ENDLOOP.
          TRANSFER <f_wa_table_data1> TO p_bkfile.
        ENDLOOP.
    Ster

  • Abap Code populate only the entries withUser Input Posting Date =pstdate

    Requirement: I have Posting Date for all Objects Now i want to create the <b>Variable “PSTVAR”</b>such that the variable will populate <b>only the entries with
    User Input Posting Date(During Report Execution) >=greater than equal to Posting Date(OPSTDATE). .</b>
    <b>Example</b> POSTING DATE = 03032007
    POSTING DATE = 01012006
    IF USER INPUT DATE = 01012007
    Then only POSTING DATE = 03032007 will show up in report
    write the code in <b>customer exit cmod in BI</b> if CAN CORRECT THE CODE WOULD BE GREAT
    Data: l_s_var_range Type rrangeexit.
    L_d_PSTDATE Type /bio/oipstdate.
    L_d_PSTDATE Type /bio/oipstdate.
    IF I_STEP=2.
    READ TABLE I_t_var_range INTO l_s_var_range WITH KEY VNAM = ‘PSTVAR’.
    If L_d_PSTDATE >= PSTVAR’
    L_d_PSTDATE=l_s_var_range-low(0)
    Please help me modify the above code with logic or with some extra line of code to solve my requirement. Appreciate all of you for help in advance
    Thanks
    Soniya Kapoor

    You have to write the code (<b>in BI/BW</b>) in the transfer rule (<b>between Datasource transfer structure and infosource/info object</b>)
    There the FORM begin with
    [code]USING RECORD_NO LIKE SY-TABIX
        TRAN_STRUCTURE TYPE TRANSFER_STRUCTURE
        G_S_MINFO TYPE RSSM_S_MINFO
    CHANGING RESULT TYPE /BI0/OIPERSON
        G_T_ERRORLOG TYPE rssm_t_errorlog_int
        RETURNCODE LIKE SY-SUBRC
        ABORT LIKE SY-SUBRC. “set ABORT <> 0 to cancel datapackag[/code]
    GS_MIN_INFO structure RSSM_S_MINFO contains information on the request being processed.
    <i>G_S_MINFO. This passes technical information about the data load request,
    such as requesting user, request date and time, update mode, the handling of
    duplicate records, error handling flags, parallel processing flags, and what data
    targets to update.</i>
    If tou want to use start-routine for optimization reasons and fill an empty field in transfer structure, the structure G_S_MINFO is available too.
    [code]USING G_S_MINFO TYPE RSSM_S_MINFO
    CHANGING DATAPAK type TAB_TRANSTRU
        G_T_ERRORLOG TYPE rssm_t_errorlog_int
        ABORT LIKE SY-SUBRC. “set ABORT <> 0 to cancel datapackage[/code]
    And stay in FORM between limits :
    [code]$$ begin of routine
    $$ end of routine[/code]
    Update RESULT in first case, and field(s) of DATAPAK in second case.
    [code]RESULT = G_S_MINFO-LOGSYS.[/code] or
    [code]LOOP AT DATAPAK INTO l_s_datapak_line.
      l_s_datapak_line-zzsourcsys = G_S_MINFO-LOGSYS.
      MODIFY DATAPAK FROM l_s_datapak_line.
    ENDLOOP.[/code]
    Regards

  • ABAP code for caliculating the demand variability

    Hi gurus,
    I need to calculate the the demand variability for the requested raw material,
    Demand Variability for raw materials is calculated by taking the standard deviation of 52 data points, each point representing the total consumption in a week.
    The raw consumption data contains negative figures on many days, resulting from inventory adjustment transactions.  Aggregate consumption to a weekly bucket to keep variability from being artificially inflated by any negative figures from adjustments due to physicals, poor practices, or cycle counts.
    Calculation
    Calculate the consumption for every week based on MSEG-MENGE where MKPF-BUDAT falls within the week bucket from Sunday till Saturday. This is the value Xn.
    SUM all 52 Xn values for every week. This is Y.
    Divide the Y/52 = Z
    Calculate for that year the standard deviation
    SQRT (((Xn-Z)2)/n)
    Can you any one give the code for this condition.
    Thanks in advance.

    any help please...

  • ABAP Code for loading the flat files kept at FTP locations

    Hi all,
    I need to automate the process of data loading via flat files with the help of process chains , with respect to which I require following help:
    1. what steps should I follow to load the data with respect that whenever the new file comes in the directory of the ftp location start that process chain for data load.(Note : there is no fix time that when the new file will be coming)
    2. Every time the new file will be having differnt name , then in that case how we will be fetching the new file which is require for data loading?
    Thanks and Regards,
    Neha

    Hi Neha,
    I have not worked on this or made this code.
    Recently my onsite did it.
    Try to find more gyan on this functiona module...'DX_GET_PHYSICAL_FILENAME'
    Code is... write it in infopackge start routine.
    DATA: v_filename LIKE dxfile-filename.
    Below function module generates the filename with the complete path
    based on the app server attached to the Central Instance
    The logical mapping Z_INBOUND_EBIZ_PAYMENTS is maintained in the
    transaction - "FILE"
      CALL FUNCTION 'DX_GET_PHYSICAL_FILENAME'
        EXPORTING
          i_filename             = 'Z_INBOUND_EBIZ_PAYMENTS'
        IMPORTING
          o_filename             = v_filename
        EXCEPTIONS
          not_registered         = 1
          logical_filename_error = 2
          OTHERS                 = 3.
      IF sy-subrc = 0.
        p_filename = v_filename.
        p_subrc = 0.
      ELSE.
        p_subrc = 4.
      ENDIF.
    Regards,
    San!

  • How to Debug a ABAP code running the background in Portal

    How can I debug a ABAP code running in the background while executing a transaction code through portal.
    e.g Presently I have to incorporate some checks in the portal. For that I know the function module where i need to put though checks. Now I want to know, how does the code during runtime. What values do we get in the function module. For this I need to get into the debugging mode while executing the portal.
    So how can we do that???

    Namit,
    it doesnot matter whether it is a standard funtion module or a custom one .check whether you are debugging for proper user(portal user and backend user are same) and check debugging is activated

  • How to write the ABAP code for Datasource Enhancment

    Hi Team,
                  Can you please help me how to write the code for the enhancement i have made to the standard datasource
    i have added the fields ZZPayer and ZZPayer_access.
    I just wanted to know how to write the ABAP code to populate the data for these fields.
    Regards,
    Pradeep P.

    Hi
    From a performance point of view would like to suggest a few changes :
    WHEN '<DS name>'.
      select zzfields from <table> into itab
      for all entries in c_t_data where <condition>.
      If sy_subrc = 0.
    loop at c_t_data assiging f_c_t_data.
    read itab into wa_itab where key = f_c_t_data-key.
    f_c_t_data-zzfield = wa-itab-zzfield.
    endloop.
    refresh itab.
    regards,
    aparna
    endif.

Maybe you are looking for