Skip to Content

Flatfile formating related issues in APD

List of issues faced during the flat file generation from APD.

1> Header name for key figures displaying with technical names in flat file.

2> Negative sign of key figures like amount and quantity displaying post values in flat file.

      Which will result in wrong Total Amount in flat file.

      i.e.     Amount

                 $1000 –

3> Leading zeros has been added in to the key figures of APD.

4> Values are getting rounded off. No decimal places displayed in the flat file.

Solution:

First create Z info objects as per your header field names length.

  1. i.e. ZCHAR20 for field name length 20

Assign these Z info objects in your target field of APD Routine as below,

             

Capture.PNG

Write following login in routine tab,

DATA: ls_source TYPE y_source_fields,
ls_target
TYPE y_target_fields.

ls_targetChar1 = ‘ABC’.
ls_target
Char2 = ‘XYZ’.

APPEND ls_target to et_target.

data : lv_value type p length 16 DECIMALS 2(Add decimal places as per your need)

LOOP AT it_source INTO ls_source.
    

           *    MOVE-CORRESPONDING ls_source TO ls_target.
                    ls_target
Char1 = ls_sourceChar1.
                    ls_target
Char2 = ls_sourceChar2.
          
*    ls_target-KYF_0001 = ls_source-KYF_0001.
                    
clear : lv_value.
                    
if ls_sourceKYF_0001 is not initial.
                        lv_value
= ls_sourceKYF_0001.
                              
if lv_value is not initial.
                                  ls_target
KYF_0001 = lv_value.
                                   
if lv_value lt 0.
                                        
SHIFT ls_targetKYF_0001 RIGHT DELETING TRAILING ‘-‘.
                                        
SHIFT ls_targetKYF_0001 LEFT DELETING LEADING ‘ ‘.
                                        
CONCATENATE ‘-‘ ls_targetKYF_0001 INTO ls_targetKYF_0001.
                                   
endif.
                              
endif.
                      
else.
                             ls_target
KYF_0001 = ‘0.00’.
                      
endif.

Note: Here Char1, Char2 is your info object technical name.

           ABC, XYZ is field name which you want to display in header field of flat file.

/
Capture.PNG
3 Comments
You must be Logged on to comment or reply to a post.