Multiple idoc segment values to field fixed length FCC
Friends,
I need help to resolve a mapping issue. here is the brief about the scenario.
Scenario: IDoc to Flat file Fixed length fields
Issue: Idocs has values in multiple segments. i need to check condition for each segment occurrence if value exists then pass value if not then pass constant (i have to pass constant so that i can get the actual column width after FCC)
Iam using the following logic.
If condition then value1 -> remove contexts -> split by value -> target
My scenario works fine for the above mapping however when i try introduction a constant in "if then else" then all my contexts in the target structure messes up.
Thanks for your help.
Regards,
Pavan
Did you tried MapWithDefault before Remove Contexts? To give more perfect solution , we would like to see a sample structure.
raj.
Similar Messages
-
Generate multiple Idoc segments
Hi all,
I have a Flat file to Idoc Scenario.
I need to generate no. of multiple Idoc Segments based on the source field value.
For Eg: if Field1 starts with 5 or 6 then E1 segment should be created 5 times,
similarly if Field1 starts with 4 then E1 segment is created 6 times
And as many times E1 is created that many times the corresponding other E2,E3 segments are created
i.e E2 E3 has 1-1 relationship with E1
Can this be done graphically ?
Working on PI 7.0 Environment
I would appreciate your Inputs.
Regards,
Varun
Edited by: Varun Reddy on Oct 5, 2010 8:21 AMIm pretty sure that if you duplicate the target segment the max number of times (6) but you only map to 4 of them, only 4 will be created in the target structure. Let the Mapping/Data drive how many segments actually get created in your target structure.
I could be wrong but Im pretty sure thats how Ive handled repeating segments before. -
To Update the IDOC segment values through report program
My requirement is to update the Idoc segment through the report program. Any SAP provided standard function module is available to update the Idoc segment values. Please help needed.
DATA: LT_EDIDD TYPE STANDARD TABLE OF EDIDD."Local Table to Hold EDIDD
LT_EDIDD = I_EDIDD. "table should have the data
*-- Opening the IDoc for Edit
CALL FUNCTION 'EDI_DOCUMENT_OPEN_FOR_EDIT'
EXPORTING
DOCUMENT_NUMBER = X_EDIDC-DOCNUM
TABLES
IDOC_DATA = IT_EDIDD
EXCEPTIONS
DOCUMENT_FOREIGN_LOCK = 1
DOCUMENT_NOT_EXIST = 2
DOCUMENT_NOT_OPEN = 3
STATUS_IS_UNABLE_FOR_CHANGING = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*-- Editing the IDoc
CALL FUNCTION 'EDI_CHANGE_DATA_SEGMENTS'
TABLES
IDOC_CHANGED_DATA_RANGE = LT_EDIDD
EXCEPTIONS
IDOC_NOT_OPEN = 1
DATA_RECORD_NOT_EXIST = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*-- Closing the IDoc after Edit
CALL FUNCTION 'EDI_DOCUMENT_CLOSE_EDIT'
EXPORTING
DOCUMENT_NUMBER = X_EDIDC-DOCNUM
DO_COMMIT = 'X'
DO_UPDATE = 'X'
WRITE_ALL_STATUS = 'X'
EXCEPTIONS
IDOC_NOT_OPEN = 1
DB_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
thanks
vijay -
Java value objects to fixed-length flat file?
I am searching for framework or third party API, which can convert a java bean to fixed length record.
I want to automate this solution, using some mapping files. (Like hibernate API for java <----> xml conversions)
if anybody can give me any url or suggest ways, i would appreciate that...
thanks
ashishBut as business requirements change or new
integration happens.. it is possible, You can count on it.
java beans get
more data elements.. so i want solution which is
flexible easy to change or experiment ..during
development and after being deployed. I would create two classes for representing the copybook layout. One for the whole thing and another for each element. Each field will have the length type and any special formatting rules. i.e. you will have mutiple types of field classes implementing the Field interface. Then put these in a LinkedHashMap and as you are adding them set another field which will be the offset from the beiginning of the record. The Record class will hold these Fields and other Records.
Then create a schema text file format and load that in on startup. Then you buld the data like a you would a DOM model in your application.
I wish someone had done that in our code instead of copying, pasting and editing this:
int length = 10;
int offset = 500;a bazillion times. That's real fun when you want to add fields. The damn methods aren't even in consecutive order. -
Mapping Items in XML string to multiple IDOC segments
I would like to map an XML tag <Text>Line1Line2Line3Line4</Text>
to an IDOC segment E1ED1TEXT . Defined as occurring 0 to 999999.
I would like to map each item separated by a tilde into a separate occurence of the IDOC text segment. Is ther anyway to repeat the mapping without duplicating the subtree.
E1ED1TEXT
Text_Id - "ZTXT"
Text_Line = Line1
E1ED1TEXT
Text_Id - "ZTXT"
Text_Line = Line2
E1ED1TEXT
Text_Id - "ZTXT"
Text_Line = Line3Hello,
This is only possible using UDF
mapping is like this:
Text -> UDF -> splitByValue:eachValue -> Text_Id
UDF is of context type
argument is input
String temp[] = input[0].split("~");
for(int a=0;a<temp.length;a++){
result.addValue(temp[a]);
Hope this helps,
Mark -
Concatenating texts from multiple IDoc segments
Hi everybody!
I have to concatenate log texts supplied via IDoc segments into one string. There can be zero or more segments, each with one line of the long text. The result should be one single string field filled with all the lines concatenated.
What's the easiest way to achieve this result? Do I need a user-defined function or can I code this using standard built-in funtions (this solution would be preferred)?
Regards,
JoergUse the UDF with the following logic.
Take the input type as Queue of the Segments
Concatenate the temp = temp + a<i> in the loop
return the temp.
<b>UDF as follows:</b>
String temp = " ";
for(int i=0; i< a.lenght; i++)
temp = temp + a<i>
return temp;
Your probelm will solve with the above UDF.
Warm Regards,
Vijay -
SQL Query - Multiple records from value of field
I have a table that has the following lay out
ID
AreaUnitServes
Filter1Quantity
Filter1Size
Filter2Quantity
Filter2Size
And I’m trying to convert it to
FkPSAUnitsID
Size
Location
I’ve got the following query started but I’m stuck on how to INSERT INTO multiple records by the value of Filter1Quantity. I also have to query for Filter2Quantity.
INSERT
INTO RapidServ.dbo.PSAFilters
(FkPSAUnitsID,Size,Location)
SELECT ID
AS FkPSAUnitsID,Filter1Size
AS Size,
AreaUnitServes
AS Location
FROM RapidServ.dbo.PSA
Thanks,
why767Please follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI/ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying temporal data. We need
to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI/ISO Standard SQL. And you probably need to read and download the PDF for:
https://www.simple-talk.com/books/sql-books/119-sql-code-smells/
>> I have a table that has the following lay out <<
How nice for you! Why did you draw ASCII pictures? It has all kinds of magical names. The table is nameless because it is forbidden by a wizard to speak its name? There are generic, universal “size” and “location”of nothing in particular. Is the “fk-”
prefix a meta data design error for “foreign key”? We never do that in RDBMS; name a data element for what it is by its nature, not for how it was used in one place in one schema. This is why we have no magical “id” in a valid schema. Data elements do not
change names from table to table.
You seem to have inherited a pile of garbage with a repeated group in it. Look up First Normal Form (1NF). You also do not know why row is not a record and why fields are not columns. Did you notice that “area_unit_serves” is a sentence and not
a name?
>> I’ve got the following query started but I’m stuck on how to INSERT INTO multiple records [sic] by the value of Filter1Quantity. I also have to query for Filter2Quantity. <<
My guess until I get a usable business rules and DDL is that you can use a UNION something like this skeleton:
INSERT INTO PSA_Filters (psa_units_id, filter_size, area_service_unit)
SELECT psa_units_id, filter_1_size, area_service_unit
FROM Magic_Nameless_Stuff
UNION ALL
SELECT psa_units_id, filter_2_size, area_service_unit
FROM Magic_Nameless_Stuff;
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
Multiple idoc segments from single flat file
hi,
I want to upload data throught LSMW, in a single row i have many item. can anyone give me idea, how to proceed.
2. i have to show a custom error report linked to lsmw.. how to do it..
waiting for your reply
Thanks & Regards
DineshWhat object do you need to load?
What exactly is in the file (what kind of data) ?
If it is a simple file with few fields, then i think a recording is the fastest methods. It does give you a detailed error log.
But all this depends on the file you have -
Hi All,
Please help me out..
Where are IDOC segment values are stored.
Segment is a structure.... which is the corresponding tables where segments values are stored.
Kindly if any one have some sample code regarding this...hlep give me....
Also let me know the segment tables.
In my previous thread, I got replies from friends, that for data records, we can use the EDID4-SDATA...
How to pull the values from this field...
Please help me out....
Thanks in advance.
Jaffer Ali.SSay you have an IDoc segment E1EDKA1 you would do this.
DATA: W_E1EDKA1 TYPE E1EDKA1.
MOVE EDID4-SDATA to W_E1EDKA1.
Then you can access the fileds of this structure. -
How to assign idoc segment at runtime ??
Hi ,
I have a ztable which is maintained via sm30.
The field1 is a key field and other fields are idocsegment name , idoc field , field value .
Field1 = key field
idoc segment name (field2)
idoc field (field3)
field value(field4)
How do i update idoc segment and particular field with field4 at runtime .
segment name , field and value changes with the matching key field.
loop at it_edidd into wa_edidd
where segnam = wa_ztable-idoc_segment.
wa_seg = wa_edidd-sdata.
how to assign the field at runtime ?????????????????????????
how to change the value of field ?????????????????????????
update edid4 set sdata = wa_seg
where docnum = wa_edidd-docnum
and segnum = wa_edidd-segnum
and segnam = wa_edidd-segnam.
if sy-subrc <> 0 .
rollback work .
write: / wa_edidd-docnum .
else.
commit work.
endif.
endloop.
Please help me with the above code .
Regards,
RachelHello Rachel
You could do this the following way:
DATA: ls_edidd TYPE edidd,
ld_idx TYPE i.
FIELD-SYMBOLS:
<ls_segment> TYPE any,
<ld_field> TYPE any.
LOOP AT it_edidd INTO ls_eddid
WHERE ( segnam = wa_ztable-idoc_segment ).
ld_idx = syst-tabix.
ASSIGN ls_edidd-sdata TO <ls_segment> CASTING TYPE (ls_edidd-segnam). " <<<
ASSIGN COMPONENT wa_ztable-field3 OF STRUCTURE <ls_segment>
TO <ld_field>.
<ld_field> = wa_ztable-field4.
MODIFY it_edidd FROM ls_edidd INDEX ld_idx.
ENDLOOP.
However, be aware that your logic might fail in case of repetitive segments.
Regards
Uwe -
File to multiple Idocs using external definitions.
Hi all,
I have to create multiple idocs based on one field from source side.
Inorder to do this..I have decided to change the occurance of Idoc from 1 to 1..unbounded , in the xsd i have downloaded from standard Idoc.
which i have a plan to map to the filed , based on that i need to create new Idoc.
I have tried importing the modified xsd into external definition. but how i should relate it to standard idoc which I have mapped earlier?.
Thanks,
venu.HI Venu,
<i>
I have tried importing the modified xsd into external definition. but how i should relate it to standard idoc which I have mapped earlier?.</i>
After changing the Idoc occurence , you have imported the xsd into external definition. So this will act as as new message type for you in the mapping.
You can not use old mapping here.
Regards,
Moorthy -
A better way of building the fixed-length String
I created the following code to build a fixed length string. I checked other posts for the same topic, but I found mine is better. The code below converts a double numeric value to a fixed length string with padding of white spaces (or other types):
Line 15 initializes the char array to while space; line 13 creates a character array; lines 17, 18 copy the array created in line 13 to the one initialized in line 15.
Any comment is welcomed.
1. import java.text.*;
2.
3. public class jformat {
4.
5. public static void main(String[] args) {
6.
7. char[] fb=new char[14];
8. char[] tb;
9. int c, f;
10. DecimalFormat fmt=new DecimalFormat("########0.00");
11. double dbl=12345.66;
12.
13. tb=fmt.format(dbl).toCharArray();
14.
15. for(c=0; c<fb.length; c++) fb[c]=' ';// this line is not required in JDK 1.5
16.
17. for(c=tb.length-1, f=fb.length-1; c>=0; c--, f--){
18. fb[f]=tb[c];
19. }
20. System.out.println(new String(fb));
21.
22. }
23.
24. }Here's a couple of alternatives. One uses a StringBuffer and the second, for Java 5 only, uses the Formatter capabilities.
import java.text.DecimalFormat;
public class jformat
public static void main(String[] args)
int fieldSize = 14;
double dbl = 12345.66;
String dblString = new DecimalFormat("0.00").format(dbl);
StringBuffer sb = new StringBuffer();
for (int j = 0; j < fieldSize - dblString.length(); j++)
sb = sb.append(' ');
System.out.println(sb.append(dblString).toString());
* The above code works in Java versions 1.3, 1.4, and 1.5.
* However, 1.5 provides the Formatter class, and the single
* line below can replace the preceeding code.
System.out.printf("%14.2f%n", dbl);
} -
Modify the standard segment value
Hi Experts,
I have a piece of code to modify the standard idoc segment value.
wa_idoc_data_mon-segnam = c_segale_e1edl24.
wa_in_e1edl24 = idoc_data-sdata.
wa_in_e1edl24-matnr = wa_in_e1edl24-matnr+11(7).
wa_idoc_data_mon-sdata = wa_in_e1edl24.
MODIFY idoc_data FROM wa_idoc_data_mon INDEX g_indx.
This modify statement works but it will change the normal structure of idoc type as we have in WE30 and put the status in RED.
If i use transporting sdata then it will not modify the material to last 7 char.
Thanks,
SahilHi,
It's not advisable to modify the standard tables through program. If you want you can do using MODIFY.
MODIFY database_table FROM TABLE itab.
Thanks,
Sri. -
Replaced value is not getting relected in IDOC segment field
Hi,
Need your help for the below issue.
I am replacing the PO # with Delivery Doc # . But the replaced value is not getting reflected in the IDOC segment field(e1bp2017_gm_item_create-po_number.).
Function Module which I am using is IDOC_INPUT_MBGMCR as a copy.
Here is my code given below:
SELECT
SINGLE vbeln
INTO lx_vbeln
FROM lips
WHERE vgbel EQ e1bp2017_gm_item_create-po_number.
Move lx_vbeln TO e1bp2017_gm_item_create-po_number.
MOVE-CORRESPONDING e1bp2017_gm_item_create
TO goodsmvt_item.
Then this is passed as TABLE in "BAPI_GOODSMVT_CREATE".
Please do the needful.Hi Dheepa,
Check it in debug whether the filed is empty or having po#, when ur code is executed for the replacement. if it is empty, po# is populated after ur code. in this case you need to write the code in suitable place.
Reddy -
Unable to change the length of field in idoc segment
Dear all,
My requirement is to change the length of a field(Z field) in a segment (Z Segment). I tried the following but in vain
1)Tried to Cancel the release and then change the length of the domain. Unfortunately it is givin an error saying "Error while resetting release of segment ZC9DEMARA01".
I also tried cancelling hte release of extension and then cancelled the release of segment
2) Created a new version, but in new version the earlier fields are diabled. So I am unable to edit.
I have gone through some of the links available in SDN but I could not solve as I am unable to cancel the release in the first step.
[Idoc segment field length changes]
Could you please help me.
Thanks in advance!
regards,
AravindHello Aravind,
I Have created one Segment type with some fields, changed the field length also its working.
just try to cancel the release and change the length of the filed and do it set release again.
Try it .
Thanks,
santhosh
Maybe you are looking for
-
I am trying to run iTunes on a PC with Windows 8.1, but the setup wizard tells me there is no space on the D:/ drive, which makes sense, since my D:/ drive is a CD-ROM. When it gives me the option to save on a different drive, I click it, and it tel
-
REG:USER EXIT FOR DATA SOURCE 0HR_LSO_1
Hi , I have to write the enhancement ABAP code for data source 0HR_LSO_1 which is related to module " training and event management "(also known as LMS or LSO) in ECC 6.0 . So how can I find out appropriate user exit for the same .I have to concentra
-
Security manager not used with JNDI ?!
Hi, I have a simple stand-alone java app that does a JNDI lookup and subsequent method invocation on the returned session bean. I never explicitly install a security manager and am wondering why there are no security problems getting the bean proxy a
-
i really need help!!!
-
Center movie clips dynamically, as3.0
Hi. I have seen this discussed both on Adobe Forums and other sites but I can't seem to make sense of the code supplied by what I have seen thus far. I am trying to center display objects that are added to the stage at runtime dynamically through a