Field can vary in length from 1 to 4 characters

Good day to all,
I have a field that can vary in length from 1 to 4 characters.
So, if there is 1 Character I have to concatenate
"A000000" &X (X represents field lenght) if the field is 2 characters long I have to concatednate
"A00000"&XX (XX represents field lenght) and so on.
"A0000"&XXX
"A000"&XXXX
I understand I have to test for lenght, how do I do this?????
the name of the field {PV_ShipReq.ShipReqNum}
Thanks
David M.
Edited by: Don Williams on Sep 8, 2011 2:33 PM

I ended up doing something like this, but thanks for your input!!!
Kind Regards,
David M.
if len(Cstr({PV_ShipReq.ShipReqNum},"#")) = 1 then
"A0000000"&Cstr({PV_ShipReq.ShipReqNum},"#") else
if len(Cstr({PV_ShipReq.ShipReqNum},"#")) = 2 then
"A000000"&Cstr({PV_ShipReq.ShipReqNum},"#")  else
if len(Cstr({PV_ShipReq.ShipReqNum},"#")) = 3 then
"A00000"&Cstr({PV_ShipReq.ShipReqNum},"#") else
if len(Cstr({PV_ShipReq.ShipReqNum},"#")) = 4 then
    "A0000"&Cstr({PV_ShipReq.ShipReqNum},"#") else
if len(Cstr({PV_ShipReq.ShipReqNum},"#")) = 5 then
    "A000"&Cstr({PV_ShipReq.ShipReqNum},"#")  else
if len(Cstr({PV_ShipReq.ShipReqNum},"#")) = 6 then
     "A00"&Cstr({PV_ShipReq.ShipReqNum},"#")  else
if len(Cstr({PV_ShipReq.ShipReqNum},"#")) = 7 then
      "A0"&Cstr({PV_ShipReq.ShipReqNum},"#")  else
Cstr({PV_ShipReq.ShipReqNum},"#")

Similar Messages

  • Select distinct records in Mapping with no Key field (all fields can vary)

    Hi Experts,
    Let me take an example (not the actual requirement but same scenario) to explain the problem where I need your help to get best possible way to resolve. This has to be achieved in mapping, don't have other options as its part of complex end 2 end scenario.
    I have following input XML:
    <Employee>
       <Details>
          <Id>123</Id>
          <Name>ABC</Name>
         <Role>Manager</Role>
          <Area>Bangalore</Area>
        </Details>
        <Details>
           <Id>123</Id>
           <Name>ABC</Name>
            <Role>Manager</Role>
             <Area>Pune</Area>
         </Details>
          <Details>
           <Id>123</Id>
           <Name>ABC</Name>
            <Role>Advisor</Role>
             <Area>Bangalore</Area>
         </Details>
          <Details>
           <Id>123</Id>
           <Name>ABC</Name>
            <Role>Manager</Role>
             <Area>Bangalore</Area>
           <Details>
           <Id>143</Id>
           <Name>ABC</Name>
            <Role>Manager</Role>
             <Area>Bangalore</Area>
         </Details>
    </Employee>
    The output XML is:
    <Employee>
       <MainRec>
           <Id>123</Id>
            <Name>ABC</Name>
             <table name = 'Roles'>
                   <record>
                          <Id>123</Id>
                           <Role>Manager</Role>
                            <Area>Bangalore</Area>
                      </record>
                      <record>
                          <Id>123</Id>
                           <Role>Manager</Role>
                            <Area>Pune</Area>
                      </record>
                      <record>
                          <Id>123</Id>
                           <Role>Advisor</Role>
                            <Area>Bangalore</Area>
                      </record>
                  </table>
          </MainRec>
          <MainRec>
            <Id>123</Id>
            <Name>ABC</Name>
             <table name = 'Roles'>
                   <record>
                          <Id>143</Id>
                           <Role>Manager</Role>
                            <Area>Bangalore</Area>
                      </record>
                </table>
            </MainRec>
    </Employee>
    As you can see from the example above, here I want to populate only distinct records under table, but there is no key fiield to ditunguish. Any of the 3 fields (Id, Role,Area) can vary and between 2 records if all of these fields are same then its duplicate else select it. So in above XML just discard the 4th record from the source XML and populate all others. Each record has to be checked against all other records all 3 values (ID, Role, Area). Only when none of the records have exactly the same values, populate it.
    Also records with different ID come under different table node. Hope my requirement is clear, if not please let me know, i will try to explain better.
    I thought of creating a UDF to achieve this but not able to decide how to match it to the output message here.
    Best Regards,
    Pratik

    Hi,
    For the main record, I think you only need to check for each unique ID, e.g
    Id --> removeContext --> sort:ascending --> splitByValue:valueChanged --> collapseContext --> MainRec
    For the record, however, you need to create a UDF that will filter out the duplicate values. For this, the UDF sample mentioned here contained multipleResult lists
    Id --> removeContext --> concat: : --> concat: : --> UDF --> splitByValue:ValueChanged --> record
    role --> removeContext --> /          /                \ --> Id
    area --> removContext -------------> /                  \ --> role
                                                             \ --> area
    Context type UDF
    Arguments: input
    Result: IdResult
    Result: roleResult
    Result: areaResult
    Vector temp = new Vector();
    for(int a=0;a<input.length;a++){
       if(!temp.contains(input[a])
             temp.add(input[a]);
    for(int a=0;a<temp.size();a++){
       String tmp = (String) temp.get(a);
       /*split according to field */
       IdResult.addValue(tmp.substring(0,tmp.indexOf(":")));
       roleResult.addValue(tmp.substring(tmp.indexOf(":")+1,tmp.lastIndexOf(":")));
       areaResult.addValue(tmp.substring(tmp.lastIndexOf(":")+1,tmp.length()));
    note: Id and record will both be using the IdResult list.
    Hope this helps,
    Mark

  • How can I put emoji from the special characters from the edit menu on to a Pages document? They will go on an email but not on Pages.  Other special characters like divination symbols will go but not emoji, i.e., smiling faces.

     

    More info on sitemap.xml:
    http://www.adobekb.com/strategies_for_seo.html#understandingsitemap
    Note that you can also exclude a page from your sitemap.xml to prevent crawlers from crawling it. Usually you don't want to do this, but if you have a good reason to the setting for that is in the page properties dialog.
    You can assign heading tags using paragraph styles. More info here:
    http://www.adobekb.com/strategies_for_seo.html#usingparagraph
    I'm able to set alt text on thumbnail images. Are you sure you have the thumbnail image selected?
    You can create a placeholder page in your plan view, then mark the page menu options as 'include page without hyperlink'. Then your menu will contain an entry for this page, but no hyperlink. If you select the menu item, you can assign a hyperlink with the hyperlink control in the control strip.

  • If we can increase the length of the Short Text field in a purchase order?

    Hi Experts,
    Please suggest if we can increase the length of the Short Text field in a purchase order?
    If yes, How? and what will be the impact?
    Thanks
    Gavar

    Dear Arpit,
    You can use PO Text field for long description of the material.
    Regards,
    Manish Jain

  • I need help with event structure. I am trying to feed the index of the array, the index can vary from 0 to 7. Based on the logic ouput of a comparison, the index buffer should increment ?

    I need help with event structure.
    I am trying to feed the index of the array, the index number can vary from 0 to 7.
    Based on the logic ouput of a comparison, the index buffer should increment
    or decrement every time the output of comparsion changes(event change). I guess I need to use event structure?
    (My event code doesn't execute when there is an  event at its input /comparator changes its boolean state.
    Anyone coded on similar lines? Any ideas appreciated.
    Thanks in advance!

    You don't need an Event Structure, a simple State Machine would be more appropriate.
    There are many examples of State Machines within this forum.
    RayR

  • From which table and field can I get batch split indicator?

    Dear friends,
    There is batch split indicator at VL02N screen. From which table and field can I get this indicator?
    Thanks regards..

    Hi,
    I dont think there is anythign called batch split indicator.
    You can find that there is a batch split in a delivery if LIPS-UECHA field is updated for a particular delivery. If UECHA is filled, then the number means that for the item number mentioned in UECHA, those records are the split records.
    i.e. For example say for a line item 10, there are 2 split items in a delivery. In this case, there will be two line items with LIPS-POSNR = 90001 and 90002. These line items will have LIPS-UECHA = 10. This means that the items 90001 and 90002 are the child batch items for the parent line item 10 as mentioned in UECHA field.
    btw....u can check LIPS-CHSPL if this is what you are looking for.
    I hope this answers your question. If you have any doubt, pls lemme know

  • Maximum length that a database table field can hold

    Hello All,
    I am creating a database table to store different values corresponding to a particular feature coming under different countries. Some of the values have to hold more than 700characters, which is basically like a paragraph. I have found that the maximum length a table field can hold is 255characters.
    Is there any way by which i can enter more than 500 characters.
    Thanks In Advance,
    Shino

    Hi,
    If the Max length that is required is 700 characters then:
    1) Isn't it possible in your case to divide the same into mutiple Fields of having 255 length each.
    2) In sap there are some tables which store whole Code like table for storing Code for reports in SAP is
        REPOSRC  But the whole code is first stored in Hexadecimal format and not in terms of direct characters.
    May be on same lines you can change the CHARACTER format and then store it and again convertt he same for further use.
    You can have look into the Table REPOSRC . May be it helps.
    Regards,
    Vishal

  • Authorization Object: P_ORGXX - fields can be from a custom infotype ?

    I need to create a customer-Specific Authorization Object, but the documentation states that we can use any of the fields in IT0001, and also customer-specific additionald fields. But we need to know if those additional fields can be from a custom infotype.
    If it is not possible, we need to replicate the std P_ORGXX and the way it validates the field pa0001- SACHZ. But with fields from a custom infotype. Is there any way to do it?
    I hope you can help me with this.
    Regards,

    Hi,
    Try the link from SAP as reference for authorization object creation and how functionality for authorization object works w/ infotype.
    http://help.sap.com/saphelp_470/helpdata/en/9e/74ba3bd14a6a6ae10000000a114084/content.htm
    http://help.sap.com/saphelp_470/helpdata/en/16/b8b83b5b831f3be10000000a114084/content.htm
    Thanks,
    Ameet

  • Records with a picklist field with empty values can't be seen from a report

    Records with a picklist field with empty values can't be seen from a report. I've created a report that have a picklist as a column. When there is no values the record(s) associated to this picklist don't appear. Do you know what are the common causes for this event?
    Regards
    Arturo

    Hi samrat chakraborty ,
    go to SUIM > roles > roles by complexselection criteria>
    under the selection according to authorization values give the object's  form SU53 screen and press enter it will asks the values for given object pass the values as per the SU53 and execute it will give the list of roles.... capture the roles. The user gets access if you give the any one of the listed roles is assigned, assign the role as per your approval process.
    Check with the below link for more assistence:
    http://help.sap.com/saphelp_erp2004/helpdata/EN/71/8fba30840c6e4d90da3526971cc684/frameset.htm
    Regards,
    S.Manu.

  • I need below fields at my selection screen.From which table we can find the

    Sales Org > only one selection field
    Division > only one selection field
    Channel > from u2013 to fields
    Sales Office Channel > from u2013 to fields
    Sales Rep Channel > from u2013 to fields
    User ID of the CSR Channel > from u2013 to fields
    Customer Channel > from u2013 to fields
    Material Channel > from u2013 to fields
    Date: Channel > from u2013 to fields
    I need these fields at my selection screen.From which tables I find these things.I need this logic also.

    I need help

  • SAP report of field status variant, in 4.7

    Hello all,
    Is there a SAP report that lists a field status variant, its groups, the groups fields, and the entry properties of the fields?
    In customization, path  /Financial Accounting/Financial Accounting Global Settings/Document/Line Items/Controls/Maintain Field Status Variants - execute
    Gets you to the transaction where this is set up.  If you have access to this transaction, you can see all of that information, even capture it to a spool or presentation file.
    We want to give this information to users who don't have that access. 
    I am hoping that someone knows of a SAP report with that information, or someone has already created their own report and is willing to share some code.
    I started to look at function PREPARE_FIELD_SELECT_STRING, but got lost in the detail.  If that is only way to get what I want, well...
    Thanks
    Bruce

    This is my solution.  Simple code, once I finished debugging the function module PREPARE_FIELD_SELECT_STRING.
    tables: t004f,       " Field status definition groups
            tmodf,       " Groups in Field Selection Bar
            tmodg,       " Name of Groups in Field Selection Bar
            tmodo,       " Items in Field Selection Definitions
            tmodp.       " Name of Items in Field Selection Definitions
    data: w_t004f type t004f.
    data: i_t004f type table of t004f.
    data: begin of gruptab occurs 0,
            ggrup   like tmodo-ggrup,
            ftext   like tmodp-ftext,
            xhell   type c,
          end of gruptab.
    data: c500(500)    type c.
    data: incoming_string(200).
    data: fleng(4)     type n.
    data: w_string_position(3) type n.
    select-options: s_fstva for w_t004f-bukrs  default '0001'  obligatory.
    selection-screen skip 1.
    select-options: s_group for t004f-fstag default 'GT02'.
    start-of-selection.
      select * from t004f into table i_t004f   "
               where bukrs in s_fstva
                 and fstag in s_group.
      loop at i_t004f into w_t004f.          " field status groups (FSG)
        skip 1.
        write: / w_t004f-fstag.
        perform get_subgroup_list.
      endloop.                                                  " i_t004f
    end-of-selection.
    form get_subgroup_list .
      clear gruptab.  refresh gruptab.
      incoming_string        = w_t004f-faus1.
      incoming_string+90(50) = w_t004f-faus2.
      select * from tmodf where fauna = 'SKB1-FAUS1'.
        gruptab-ggrup = tmodf-ggrup.
        select single * from tmodg where spras = sy-langu
                                   and   fauna = tmodf-fauna
                                   and   ggrup = tmodf-ggrup.
        if sy-subrc = 0.
          gruptab-ftext = tmodg-ftext.
        else.
          gruptab-ftext = text-ngg.
        endif.
        append gruptab.
        skip 1.
        write: /5 gruptab-ftext,
               50 'Suppress',
               60 'Required',
               70 'Optional'.
        perform get_fields.
      endselect.  "  FROM tmodf
    endform.
    form get_fields .
    * ------- Read the item texts
      select * from tmodo where fauna = 'SKB1-FAUS1'
                            and ggrup = tmodf-ggrup.
        select single * from tmodp where spras = sy-langu
                                   and   fauna = tmodo-fauna
                                   and   modif = tmodo-modif.
        write: /10 tmodp-ftext.
    * get individual field options
        write tmodp-modif to w_string_position.
        w_string_position = w_string_position - 1.
        case incoming_string+w_string_position(1).
          when '+'.
            write: 60 'X'.             " obligatory
          when '.'.
            write: 70 'X'.             " optional.
          when '-'.
            write: 50 'X'.             " supress
        endcase.
      endselect.  " FROM tmodp
    endform.
    Edited by: Bruce Tjosvold on Jun 30, 2011 7:17 PM

  • ABEND RS_EXCEPTION (000): Part-field access (offset = 45, length = 45) ...

    Hi BI Experts,
    We are getting error below when run the query in BEx Broadcaster whereas the same query can be run without error in RSRT. One of the object used in the query is 0TCTBISBOBJ (BI Application Obj). When i remove this object from the query, i am able to execute the query in BEx Broadcaster. Please advice.
    Error: com.sap.ip.bi.base.application.exceptions.AbortMessageRuntimeException
    com.sap.ip.bi.base.exception.BIBaseRuntimeException ERROR
    com.sap.ip.bi.base.application.exceptions.AbortMessageRuntimeException
    Log ID: 00144F25CCDC303C0000010600005CBD00046ADC8504A84D
    Initial cause
    ABEND RS_EXCEPTION (000): Part-field access (offset = 45, length = 45) to a data object of the size 60 exceeds valid boundaries.
      MSGV1: Part-field access (offset = 45, length = 45) to a
      MSGV2: data object of the size 60 exceeds valid
      MSGV3: boundaries.
    Stack trace: com.sap.ip.bi.base.application.exceptions.AbortMessageRuntimeException: Termination message sent
    We have recently upgraded to SAP BI7.0 SP19.
    Thanks in advance.
    Best Regards,
    Pei Fung

    Can someone throw some light on this? Thanks.

  • Is it possible to Extend the Storage Bin Length from 10 Char to 25 Char

    Dear Experts,
    We have a Requirement for Extending the Storage Bin Length from 10 Character to 25 Character.
    Question 1:
    Is it possible to Extend or Not?
    Question 2:
    Even if we extend what will be Impact on the Current Storage Bin Numbers used now.
    Thanks for your support in Advance.

    No, you can't change length for storage bin field in standard and also it is not suggestable to client. If client forcing on requirement, You can suggest like below.
    create one more field for EXT.storage bin by using enhancement  and do one customized report for show as ,  storage bin number+EXT.storage bin = actual storage bin.
    For only client reference you do this report and in standard reports it will not show like this else tell to client ---> it is not possible, because it is replicating and using at different programmes.

  • Field type String (long length more than 1500)

    Hi All,
    we have requirement like one custom table with field string type(1500 length) should update through the report.
    problem is, it is not updating that many characters through the report.
    (till 255 chars only updating in the table)
    i have to update full string in the custom table.
    the code is below, please help me any one come accross the situation.
    thanks in advance.
    data: lv_test type string,
          lv_test1 type string,
          lv_num type i,
          it_test type table of ZFEILD_TEST,
          wa_test type zfeild_test.
    do 10 times.
    lv_test = 'thptjpojtgpeojygpeojhpoewjhpojwhjwpohjopsjhoptrjhopjwhopjwpojhpowjhopwjojwpojhpowjhpowjkahglfdglkaglkahklrhlfhslhkalklklhkalhalkhlahlkajljhlajhlajlajlkajlhjaljlajlhjaljhlajhlahpojwpohjwopjhojhwjhojopjwopjhwojhotjhwojwhojwpojhpwojhpowjophjwpojh'
    lv_test1 = lv_test.
    concatenate lv_test lv_test1 into lv_test1.
    clear: lv_test.
    enddo.
    lv_num = strlen( lv_test1 ).
    wa_test-STRIN = lv_test1.
    wa_test-znumber = '001'.
    append wa_test to it_test.
    loop at it_test into wa_test.
    write: / wa_TEST-strin.
    modify zfeild_test from wa_test.
    endloop.

    Hi,
    I assume you have chunks of the string and you need to concatenate it and put it to the table.
    You can try this.
    data : begin of w_string occurs 0,
             string type string,
             end of w_string.
    data  : w_char1(255) type c value 'BLAUGBUSSUSSF',
              w_char2(255) type c value 'GSIUHFSHF',
    w_string-string+0(255) = w_char1.
    w_string-straing+255(255) = w_char2.
    so on....
    append w_string.
    Regards,
    Pramod

  • Field status variant

    HI,
    in Tcode OBC5 what is field status variant - use of it
    where it is defined & assigned

    Hi,
    Field status variant is defined in tcode OBC4.
    It is the field group which defines which field should be suppressed, mandatory & optional to fill while creating a gl account.
    Field group 0001 is the by default from which you can copy for your company purpose & name it as per your requirement. You can also define the new field in the copied field group for your purpose. You can make changes in the copied group by double clicking on them, then it shows the select the group, then double click on anyone you like. It will show the fields from there you can change the setting & highlight the field as per your requirements.
    Please let me know if anymore help u need.
    Regards,
    Prafful Kansal

Maybe you are looking for