2013 May 15 7:29 PM
Hello Gurus,
I have an issue with the ABAP coding on the user exits. The requirement is as follows
IF <FS>-wrttp = '10'.
SELECT SINGLE copa_bwzpt frwae kursf
INTO (<FS>-zzbwzpt, <FS>-zzfrwae,<FS>-ZZKURSF)
FROM ce1ashi
WHERE belnr = <FS>-belnr.
PALEDGER = <fs>-CURTYPE.
the problem I have is with the field PALEDGER which is from table CE1ASHI
Here the base table CE1ASHI - PALEDGER holds the value 01, 02 which actually referes to
02 --- > 10( company code )
01 ----> B0( Operating concern currency )
CURTYPE has the values 10 and B0 for sales documents directly.
as the values in base table CE1ASHI are not straight forward like 10 and B0. Instead the 01 and 02 refer to 10 and B0 hence the code has been failing. I request you to let me know if there is any way to add a code before PALEDGER = <fs>-CURTYPE so that 02 would imply to 10 directly and 01 to B0 so that the above code would successfully work.
2013 May 16 3:29 AM
Hi,
The CURTYPE field will usually have a limited number of currency types maintained in its domain RSCURTYPE. The values are visible in the Value range tab in SE11 for the domain.
You can either map it yourself in a CASE statement before the query or you can also check the Search help that gives that popup of the possible values when viewing table ce1ashi. there you will get the table which does this conversion.
Cheers,
Arindam
2013 May 16 1:22 AM
Hi Sri,
I don't have this table in my system, but I can say it's probably a conversion_exit issue. In the ABAP dictionary go to the table CE1ASHI, than double click in the data element for the field PALEDGER and then in the domain. You will see in definition a conversion routine, something like this (for material number):
If you double click again on the conversion routine, in this case on MATN1, you will see the conversion exit function modules:
The input FM converts the external value to internal, and the output FM does the other way around. Use this FMs before comparing PALEDGER to CURRTYPE.
Cheers,
Custodio
2013 May 16 1:41 AM
Thanks a lot Custodio, I have checked the data element and conversion routine as per the above screenshots It has a functional module. I could see it after I double clicked on the data element. I could check the functional modules, there are two of them as input and output functional modules. I do not see the conversion from input to output like MATNR. I request you to let me know if it because of the absense of conversion ranage this is failing ?
2013 May 16 7:08 AM
Hi Sri,
No, thje MATN1 was for my example, MATNR (material number). In your case you have to call this FM CONVERSION_EXIT_LEDBO_OUTPUT:
Cheers,
Custodio
2013 May 16 3:29 AM
Hi,
The CURTYPE field will usually have a limited number of currency types maintained in its domain RSCURTYPE. The values are visible in the Value range tab in SE11 for the domain.
You can either map it yourself in a CASE statement before the query or you can also check the Search help that gives that popup of the possible values when viewing table ce1ashi. there you will get the table which does this conversion.
Cheers,
Arindam
2013 May 16 4:34 AM
Thanks for the reply Arindam. I have checked the CURTYPE it does not have any conversion table but the PALEDGER has table in data element attributes which is TKEL, I am not sure on what
condition I can write before the line PALEDGER = <fs>-CURTYPE.. I am a bit confused with this
scenario. I request you to help me out with this.
b
2013 May 16 7:08 AM
Double click on the domain LEDBO, you will find the conversion routine : LEDBO
--> CONVERSION_EXIT_LEDBO_INPUT
--> CONVERSION_EXIT_LEDBO_OUTPUT
so you will be able to convert what you see in what SAP store
Fred
2013 May 16 7:29 AM
Hi
Check the conversion routines of your domain use them to convert before you do the select.
Cheers,
Arindam
2013 May 17 1:26 AM
Thank you Federic, Arindam, Custodio.. I have tried calling the functional module and check if the records were being pulled but I could not extract the records through that code. I have tried working on the code by writing if statement else statement to check if this approach work. But still the code if not helping to extract the records. I request you to let me know if I am making any mistakes in the below code. The highlighted code are the lines which I added. the line PALEDGER = <FS>-CURTYPE in the select statement if this commented then records are getting extraced. If this line is uncommented then records are not being extracted. I am learning to write such scenarios I request you to help me out in this.
FORM FORM_1_CO_PA_AAFI1 TABLES I_T_DATA.
FIELD-SYMBOLS: <FS> LIKE ZOXDEV0201.
Data: l_msgv TYPE symsgv,
l_subrc LIKE sy-subrc.
* PALEDGER LIKE CE1ASHI-PALEDGER.
DATA : Begin of temppaledger,
paledger like ce1ashi-paledger,
end of temppaledger.
LOOP AT I_T_DATA ASSIGNING <FS>.
* Call to line item table to get Point of Valuation for COS Revaluation
* recon. Make call only for actual (not plan) data.
IF <FS>-wrttp = '10'.
SELECT SINGLE copa_bwzpt frwae
INTO (<FS>-zzbwzpt, <FS>-zzfrwae)
FROM ce1ashi
WHERE belnr = <FS>-belnr
IF <fs>-curtype = '10'.
tEMPPALEDGER = '02'.
tempPALEDGER = <fs>-CURTYPE.
ELSEIF <fs>-curtype = 'B0'.
temppaledger = '01'.
tempPALEDGER = <fs>-CURTYPE.
endif.
clear temppaledger.
SELECT SINGLE KURSF
INTO <fs>-zzkursF
FROM CE1ASHI
WHERE belnr = <fs>-belnr and
PALEDGER = <FS>-CURTYPE.
IF <fs>-curtype = '10'.
tEMPPALEDGER = '02'.
tempPALEDGER = <fs>-CURTYPE.
ELSEIF <fs>-curtype = 'B0'.
temppaledger = '01'.
tempPALEDGER = <fs>-CURTYPE.
endif.
clear temppaledger.
CASE sy-subrc.
when 0.
when others.
clear:<FS>-zzbwzpt,
<FS>-zzfrwae.
l_subrc = sy-subrc.
l_msgv = <FS>-belnr.
MESSAGE ID 'ZBW' TYPE 'X' NUMBER '000'
WITH 'BELNR' l_msgv l_subrc.
ENDCASE.
ENDIF.
2013 May 17 5:47 AM
Try this:
CALL FUNCTION 'CONVERSION_EXIT_LEDBO_INPUT'
EXPORTING
input = <fs>-curtype
IMPORTING
output = temppaledger
EXCEPTIONS
invalid_input = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
2013 May 17 5:54 AM
Hi.
As per conversion,
02 --- > 10( company code )
01 ----> B0( Operating concern currency )
IF <FS>-wrttp = '02'.(Instead of 10 change as 02)
SELECT SINGLE copa_bwzpt frwae kursf
INTO (<FS>-zzbwzpt, <FS>-zzfrwae,<FS>-ZZKURSF)
FROM ce1ashi
WHERE belnr = <FS>-belnr.
PALEDGER = <fs>-CURTYPE.
Thanks
NJ
2013 May 22 10:15 PM
Thank you Cutodio, Nagraj. the change has been made to If statements, this is currently pulling the data with this code.
DATA : Begin of temppaledger,
paledger like ce1ashi-paledger,
end of temppaledger.
LOOP AT I_T_DATA ASSIGNING <FS>.
IF <FS>-wrttp = '10'.
IF <fs>-curtype = '10'.
tEMPPALEDGER = '02'.
ELSEIF <fs>-curtype = 'B0'.
temppaledger = '01'.
ENDIF.
SELECT SINGLE copa_bwzpt kursf frwae
INTO (<FS>-zzbwzpt,<FS>-zzkursf,<FS>-zzfrwae)
FROM ce1ashi
WHERE belnr = <FS>-belnr AND
PALEDGER = temppaledger.
2013 May 23 2:32 AM
Hi Sri,
The problem I see with this is that you are hard coding it. If tomorrow there's a new currtype, you will need to adjust your code. If you use conversion exit you don't need to worry about it. But it's your call anyway
Cheers,
Custodio