2015 Jan 18 5:42 AM
Hi All,
Let me explain this scenario.
I have a flat file which will be uploaded for a BDC. Based on which type pf business is operating we have two types of flat file template ->
Business 1 : Template
Land1
LIFNR
Bank details
Business 2 Template
LIFNR
BANK DETAILS.
In any case for further processing , I need the first column to be there which is LAND1. How do in create column 1 to my internal table at runtime and proceed.Also the other columns are fixed and will not change.
Please help.
Thanks
AS
Hi All,
Let me explain this scenario.
I have a flat file which will be uploaded for a BDC. Based on which type pf business is operating we have two types of flat file template ->
Business 1 : Template
Land1
LIFNR
Bank details
Business 2 Template
LIFNR
BANK DETAILS.
In any case for further processing , I need the first column to be there which is LAND1. How do in create column 1 to my internal table at runtime and proceed.Also the other columns are fixed and will not change.
Please help.
Thanks
AS
2015 Jan 18 6:42 AM
Hi Swarna,
I think it is difficult to generate LAND1 column at runtime while reading dataset into internal table.
Did you try offset method to determin whether your first column is LAND1 or LIFNR?
May be based on that you can pass you record into respective internal table.
2015 Jan 18 9:04 AM
2015 Jan 18 10:11 AM
Hi ,
In case of Business 1
LAND1 LIFNR TAXID NAME1 SORT1 etc
In case of Business 2
LIFNR TAXID NAME1 SORT1.
Here in case of business 2 i need to add a column LAND1 at run time after uploading the flat file and set it to a specific country value.
Could you please help,
Thanks
AS
2015 Jan 18 10:26 AM
Hi swarna,
Did you try offset method? You can get the content of read dataset into a string type first and check the first field whether it is LAND1 or LIFNR. Further you can divide it as per your requirement.
2015 Jan 18 10:39 AM
thank you
ok,
you will concatenate the desired value to the beginning of the record
2015 Jan 18 11:55 AM
Hi Archana,
Could you please explain as im a bit confused here.
Thanks
AS
2015 Jan 18 12:12 PM
Hi Swarna,
Data element LIFNR is char10 and LAND1 is char3. So, define a work area type string.
Then read dataset into work area.
After reading into work area, split your work area at your file separator e.g. ' '(space) into 2 variables.
Read the length of first variable, if its 3, then it is LAND1 field and if it is more than 3 that means field is LIFNR.
Below is sample code.
DATA: wa_text TYPE string,
lv_text1 TYPE char10,
lv_text2 TYPE char10,
lv_count TYPE i.
READ DATASET lv_path INTO wa_text.
split wa_text at ' ' into lv_text1 lv_text2.
lv_count = strlen( lv_text1 ).
if lv_count eq 3.
*- read dataset again to internal table with LAND1 and remaining columns.
else.
*- read dataset again to internal table for LIFNR.
ENDIF.
Hope it helps. It should work.
2015 Jan 20 6:41 AM
2015 Jan 18 5:07 PM
Hi,
Try with the Excel format using FM ALSM_EXCEL_TO_INTERNAL_TABLE .
Hope it helpful.
Regards,
Venkat.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |