Range type in ABAP OO.

Hi,
Having problem in ABAP OO.
I have defined a working range. (r_vkorg)
But what kind of associated type should I use for this in my method.
In other words: what type should "vkorg_in" be ?
DATA r_vkorg TYPE RANGE OF A004-vkorg.
data: wa_vkorg like line of r_vkorg.
case werks_in.
  when 3100.
  wa_vkorg-sign = 'I'.
  wa_vkorg-option = 'EQ'.
  wa_vkorg-low = '2000'.
  append wa_vkorg to r_vkorg.
  wa_vkorg-sign = 'I'.
  wa_vkorg-option = 'EQ'.
  wa_vkorg-low = '3000'.
  append wa_vkorg to r_vkorg.
  when 4100.
  wa_vkorg-sign = 'I'.
  wa_vkorg-option = 'EQ'.
  wa_vkorg-low = '4000'.
  append wa_vkorg to r_vkorg.
  when others.
  exit.
endcase.
call method me->getpricecondition
  exporting
    vkorg_in    = r_vkorg   ' PROBLEM
    date_in     = sy-datum
  changing
    price_inout = i_PriceTab.
//Martin

Hello Martin,
Obviously, R_VKORG is an internal table. So VKORG_IN should be an internal table too.
The line type can be something like : VORG_RANGE or VKO_RANGE.
You can also refer it to a table type defined in the ABAP Dictionary like, GDS_SELRANGE_VKORG_TAB.
Finallly, you can have a local types declaration for the class, with the suitable structure.
Regards,
Anand Mandalika.

Similar Messages

  • How to count the days between Date Range using OO ABAP?

    hi experts,
            i want to count the days between Date Range using OO ABAP for that  which class and method  can i use?.
    Thanks,
    Mahesh.

    Not sure I understand the requirement for it to be OO, but you could always write your own (i.e. use this):
    REPORT zz_date_diff.
    CLASS date_diff DEFINITION.
      PUBLIC SECTION.
        METHODS diff IMPORTING     i_date_fm TYPE d
                                   i_date_to TYPE d
                     EXPORTING     e_days    TYPE i.
    ENDCLASS."
    CLASS date_diff IMPLEMENTATION.
      METHOD diff.
        e_days = i_date_to - i_date_fm.
      ENDMETHOD."
    ENDCLASS."
    DATA: g_ref TYPE REF TO date_diff,
          g_days  TYPE i,
          g_date_fm  TYPE d VALUE '20080101',
          g_date_to  TYPE d VALUE '20090101'.
    START-OF-SELECTION.
      CREATE OBJECT g_ref.
      CALL METHOD g_ref->diff
        EXPORTING
          i_date_fm = g_date_fm
          i_date_to = g_date_to
        IMPORTING
          e_days    = g_days.
      WRITE g_days.

  • XSD Data Type to ABAP Proxy Tech. Type

    I am working with an ABAP development team who is creating PROXYs from the Service Interfaces I have setup in the ESR (PI 7.11). I have been asked to set the type of a numeric field by the ABAP developer as this:
    "Yeah we can convert from string to currency but sap internally stores currency with 3 decimals so we may got to do some multiplications and divisions based on how many decimals sender passes. If you could create a numeric with 3 decimals that is ideal."
    The XSD type as xsd:decimal, but in the proxy it seems to create Tech. Type = STRING.
    I can apply formatting rules in the message mapping, but developer is convinced that the Service Interface can have the correct ABAP Tech. Type. I do not find any messages in this forum, so not sure what to do.
    Thank you for your time.

    Internal ABAP types like packed or float cannot be created by ABAP proxy.
    I recommend to use String for any type. Inside XML you will have a String representation anyway, but you will encounter less issues in converting from XML to ABAP internal types.
    I work a lot with currency fields, it is no problem at all. Inside ABAP you mave currency field to string field, the decimals are correct.
    If course, in mapping you have to create a decimal field, but this would not be any change, if you had a decimal type in ABAP.

  • Error in ABAP Mapping (type SAP-ABAP, kernel error ID UNCAUGHT_EXCEPTION)

    Hi ,
      Scenario:  Manually Purchase Order is created, automatically Sales Order should be created in the Target System through PI,
                       I have used Message Mapping which is working fine for single Customer and Vendor,
                       For Multiple Customers and Vendors i am using one ZTABLE, Only Message Mapping is not  sufficient to my requirement.
                      Now i am using both Message Mapping and   ABAP Mapping  at a time in Interface Mapping. I created the class and                done  the   development., whene  i run the scenario i am getting the error as below,
    *<SAP:Stack>Error in mapping program ZCL_SD_IDTO_POSO (type SAP-ABAP, kernel error ID UNCAUGHT_EXCEPTION) An exception with the type CX_SY_REF_IS_INITIAL occurred, but was neither handled locally, nor declared in a RAISING clause Dereferencing of the NULL reference</SAP:Stack>*
      *<SAP:Retry>M</SAP:Retry>*
      *</SAP:Error>* 
    Please let me know.
    Best Regards
    Vamsi

    Have u seen the ABAP mapping guide?
    Refer this series to the ABAP mapping section.https:///people/sravya.talanki2/blog/2006/12/26/aspirant-to-learn-sap-xiyou-won-the-jackpot-if-you-read-this-part-ii
    It will be very handy and useful.

  • Null Pointer Exception in CO of type Webdynpro ABAP

    Hi Friends,
    I am getting an Error in creating a callable object of type Webdynpro ABAP,
    The ABAP webdynpro application is working fine individually, but while creating a callable object of the same type, I get the following error,
    (This happens when I click on <b>'Search'</b> button after putting the wd app name)
    <i><b>The initial exception that caused the request to fail, was:
       com.sap.mw.jco.JCO$Exception: (127) JCO_ERROR_FIELD_NOT_FOUND: Field LANGU not a member of INPUT
        at com.sap.mw.jco.JCO$MetaData.indexOf(JCO.java:9372)
        at com.sap.mw.jco.JCO$Record.setValue(JCO.java:14778)
        at com.sap.caf.eu.gp.model.connect.rfc.abapwd.impl.ABAPWDAppManager.getAppInfo(ABAPWDAppManager.java:54)
        at com.sap.caf.eu.gp.ui.co.config.abapwd.VSelect.getApplicationData(VSelect.java:493)
        at com.sap.caf.eu.gp.ui.co.config.abapwd.VSelect.onActionSearch(VSelect.java:438)</b></i>
    Do somebody has any idea about the problem?
    Thanks in advance,
    Deepak.

    Please send us the CreateEmployees.java. It seem the problem is in the way you using the generated java classes.

  • DATA TYPE IN ABAP CORRESPONDING TO TYPE REAL IN MDM

    Hi all,
    I am working on a code to fetch data from MDM, using the  *MDM ABAP APIs*_._ I could retrieve almost all the Fields except for one, which has data type REAL in MDM. I need to find the type in ABAP, corresponding to the type REAL in MDM. I need to define this field in the structure but I am not sure as to which data type to put against it. I have already tried float, decimal, string, char... nothing works!!
    Kindly let me know if anybody has come across the same issue and resolved it.
    Thanks and regards,
    Aastha

    Hello,
    We're getting the same problem too.
    Have you deleted your Real fields and u've created them as a measurement field?
    Is it really necessary to create the fields with type 'measurement'?
    Or do you maintain in MDM your field with type Real and you treat it as type 'mesurement' into your ABAP API with measure 'none', while in SAP ECC it's created as a numeric with decimals.
    Thanks for your feedback!
    Carlos Santamaría.

  • Defining complex types in ABAP

    Hi Folks,
    I am new to the ABAP world and has started programming in it for about two weeks now (therefore, two weeks of experience so far ). I have a question regarding definition of complex types in ABAP. Basically what I want to achieve is to define a type which is either mytype1 or mytype2. During the runtime, it should be decided whether complextype is of mytype1 or of mytype2. Maybe to put some more concrete context: I will call a method with an object of type "complextype". Depending how I set this object, this will be of mytype1 or mytype2. Please see the code schema below.
    TYPES BEGIN OF mytype1.
        TYPES:
        TYPES END OF mytype1.
    TYPES BEGIN OF mytype2.
        TYPES:
        TYPES END OF mytype2.
    TYPES BEGIN OF complextype.
        TYPES:
              mytype_name TYPE mytype1,
              mytype_name TYPE mytype2.
        TYPES END OF complextype.
    Is this a correct way to approach? If yes, how can I express this (either mytype1 or mytype2 but only one of them at a certain time) in ABAP types correctly?
    I will appreciate any kind of help.
    Thanks a million,
    Boldbaatar
    Edited by: Boldbaatar Tsend-Ayush on Apr 6, 2011 8:24 PM

    Hi,
    I think you should use the dynamic data reference .
    TYPES BEGIN OF mytype1.
        TYPES:
        TYPES END OF mytype1.
    TYPES BEGIN OF mytype2.
        TYPES:
        TYPES END OF mytype2.
    data: dref_complex type ref to data.
    field-sumbols:<fs_any> type any.
    if type eq mytype1.
    l_type = 'MY_TYPE1'.
    elseif type eq mytype2.
    l_type = 'MY_TYPE2'.
    endif.
    create data dref_complex type (l_type).
    "In order to access the components of  dref_complex , you should assign the same to field symbol
    assing dref->*  to <fs_any>.
    "then u can use  ASSIGN COMPONENT to get individual components
    Regards
    Arshad

  • How can we relate c and x  types in ABAP

    hi all,
    I would like to know how we could relate c type and x type in ABAP.
    In terms of size specification.
    Thank you all
    prasad.

    Hi Prasad,
    Consider the following code snippet -
    data : char type c,
           hexa type x.
    Now, both these variables are of 1 byte each. However, they store different kinds of data, so we have -
    hexa = '41'.
    write : hexa to char.
    write: char , hexa.
    hexa is going to store the hexadecimal number 41. (the decimal equivalent is 65). The first write statement does the automatic type conversion. so we get the 65th ASCII character in the character variable (which is the capital A).
    Hope that helps.
    Regards,
    Anand MAndalika.

  • How to know system inst type. (ABAP or APAP+J2EE)

    Hi all,
    i have R/3 ent system in Hp-ux (oracle 9i), i want know my system  installation type
    is ABAP system ? or ABAP+J2EE system ?
    Please reply me
    Regards,
    satish k

    Hi,
    there are various way to check that
    - check \usr\sap\SID\DVEBMGS<instance number>\ j2ee folder exists or not
    - check your default profile using RZ10 and search for paramater j2ee/*
    -SMICM->goto->http server->display data
    regards,
    kaushal

  • How to convert the Ranges statment in  ABAP program ?

    Dear All,
    I need to remove the ranges statements in my ABAP program. Becaz I found the Ranges statements are obsolete from SLIN results.
    thanks,
    Arunachalam S

    Hi Arun,
    Use SELECT-OPTIONS with the addition NO-DISPLAY , then you can use it same as RANGES.
    Refer to the sample code.
    REPORT  zztest_select.
    DATA : g_matnr TYPE  mara-matnr.
    *-- NO-DISPLAY makes SELECT-OPTION not to be dispalyed and
    *-- you can use the SELECT-OPTION as RANGES
    SELECT-OPTIONS : s_matnr FOR  g_matnr NO-DISPLAY.
    CLEAR : s_matnr,
            s_matnr[]
    s_matnr-sign   = 'I'.
    s_matnr-option = 'BT'.
    s_matnr-low    = 'MATERIAL10'.
    s_matnr-high   = 'MATERIAL99'.
    APPEND s_matnr.
    <b>AS</b>

  • Triggering output type using ABAP code

    Dear Friends,
    I am trying to trigger an output type by submitting RSNAST00 with all the required input in one of my ABAP program and I am getting error messages. See the code which I have written below and help me to resolve this issue. Also, suggest me if we have any alternate methods to do it:
          ranges: range_kappl for nast-kappl,
                  range_objky for nast-objky,
                  range_kschl for nase-kschl,
                  range_nacha for nast-nacha.
          move: 'I'         to  range_objky-sign,
                'EQ'        to  range_objky-option,
                vttk-tknum  to  range_objky-low.
          append range_objky.
          move: 'I'         to  range_kappl-sign,
                'EQ'        to  range_kappl-option,
                'V7'        to  range_kappl-low.
          append range_kappl.
          move: 'I'         to  range_kschl-sign,
                'EQ'        to  range_kschl-option,
                'ZNM7'      to  range_kschl-low.
          append range_kschl.
          move: 'I'         to  range_nacha-sign,
                'EQ'        to  range_nacha-option,
                '2'         to  range_nacha-low.
          append range_nacha.
          submit rsnast00
            with s_kappl in range_kappl
            with s_objky in range_objky
            with s_kschl in range_kschl
            with s_nacha in range_nacha
            and return.
    Thanks & regards,
    Mallikarjuna M

    Use below subroutine.
    Fill nast structure with whatever data you have.
           PERFORM einzelnachricht_dialog(rsnast00) USING lv_rcode.
    Advantages of using this are
    1. If Output already exists and it waiting it will not submit new one.
    2. You can control user name,date,time in nast entries.

  • Date range selection in abap code in infopackage

    Hi!
    I have a field called "OPEN_DATE".
    When the infopackage is runned, I need the abap code to fint the current date, and from that, make a date range from the first day of current month to the last day of current month
    Ex:
    Current date = 12.12.2008
    Abap code should extract 01.12.2008 - 31.12.2008
    Thanks!

    Hi helge,
    Data: l_idx like sy-tabix.
    Data: date_low like sy-datum,
             date_high like sy-datum.
    Date_low = sy-datum.
    date_low+6(2) = '01'.
    CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
      EXPORTING
        DAY_IN                  = Date_low
    IMPORTING
       LAST_DAY_OF_MONTH       = date_high
    read table l_t_range with key
    fieldname = 'OPEN_DATE'.
    l_idx = sy-tabix.
    Pass Range values to L_T_Range Table.
    Move date_low to L_T_Range -Low.
    Move date_high to L_T_Range -High.
    L_T_Range -Sign = u2018Iu2019. *****(Here: I u2013 Include, E u2013 Exclude)
    L_T_Range -Option = u2018BTu2019.****( Here: BT u2013 Between )
    modify l_t_range index l_idx.
    p_subrc = 0.
    Regards,

  • PI in ECC 6.0, usage type AS ABAP

    Dear all,
    Is there any restriction on the functionalities of PI/XI in ECC 6.0 (with ABAP only)?
    Can I have full XI functionalities if when I install ECC 6.0, I also check AS Java?
    Giang

    Hi Giang
    SAP NetWeaver 7.0 - uage type PI corresponds to product version instance SAP ERP 6.0 - SAP NW - Process Integration.
    PI requires AS ABAP and AS Java as prerequisites in the same system. Optionally, it can be combined with other usage types in one system.
    Regarding installation with ECC on one server, see the following recommendation from the SAP ERP Master Guide, already mentioned:
    "We recommend that you identify a dedicated PI system. For PI, no other system in your system landscape may have a higher release than the PI system. For exceptions to this rule, see SAP Note 1043047.  "
    regards,
    Andreas R

  • Declaring deep types in ABAP code

    I am struggling with the declaration of local types in an ABAP program. When I declare a structure that contains a component which I reference to a previously declared table type, the system gives a compile error.
    The following code gives an error on the highlighted line:
        types: begin of ts_docprop,
                 key type string,
                 value type string,
               end of ts_docprop.
        types: tt_docprop type standard table of ts_docprop.
        types: begin of ts_document,
                 document_id type string,
                 document_type type string,
                 properties type tt_docprop, "<<<<< Error here
               end of ts_document.    
    This results in the following error:
    "TT_DOCPROP" has a generic type. Use of this type is only possible for typing field symbols and formal parameters
    However, I am sure it must be possible to declare a deep type this way.
    Instead, I have to resort to proxying declarations via data, which seems totally unnecessary:
    types: begin of ts_docprop,
              key type string,
              value type string,
            end of ts_docprop.
    data: ls_docprop type ts_docprop.
    types: tt_docprop like standard table of ls_docprop.
    data: lt_docprop type tt_docprop.
    types: begin of ts_document,
              document_id type string,
              document_type type string,
              properties like lt_docprop,
            end of ts_document.
    The first method above would be analogous to declaring structures and table types in the DDIC and should work. What have I missed?

    Hi,
    Try:
    TYPES: BEGIN OF ts_docprop,
                 key TYPE string,
                 value TYPE string,
               END OF ts_docprop.
      TYPES: tt_docprop TYPE STANDARD TABLE OF ts_docprop WITH NON-UNIQUE DEFAULT KEY .
      TYPES: BEGIN OF ts_document,
               document_id TYPE string,
               document_type TYPE string,
               properties TYPE tt_docprop, "<<<<< Error here
             END OF ts_document.

  • Problem with numeric types in Abap Proxy

    Hello,
    We are having problems with some abap proxy calls. When a numeric type is filled with 0 the node it´s automatically removed and no value it's recived in XI. The only way I have found to avoid this problem it's to define the field with type string or change the cardinality to 1..1 instead of 0..1. It's there any way to maintain the type and the cardinality?? Maybe with a pattern??
    Regards,
    Alberto Pla.

    Hi Alberto
    I had this problem, and I decided to use xsd:string instead of xsd:integer. This will solve the issue.
    Anyway.. check this note:
    [Note 1242795 - Mapping of XSD default values by ABAP Proxy Generation|https://service.sap.com/sap/support/notes/1242795]
    Regards
    Francesco

Maybe you are looking for