Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Re : Coding betwee the base tables

sri_harsha2
Participant
0 Likes
5,610

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.

1 ACCEPTED SOLUTION
Read only

arindam_m
Active Contributor
0 Likes
4,846

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

12 REPLIES 12
Read only

custodio_deoliveira
Active Contributor
0 Likes
4,846

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

@zcust01

Read only

0 Likes
4,846

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 ?

Read only

0 Likes
4,846

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

Read only

arindam_m
Active Contributor
0 Likes
4,847

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

Read only

0 Likes
4,846

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

Read only

0 Likes
4,846

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

Read only

arindam_m
Active Contributor
0 Likes
4,846

Hi

Check the conversion routines of your domain use them to convert before you do the select.

Cheers,

Arindam

Read only

0 Likes
4,846

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.

Read only

0 Likes
4,846

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.

Read only

Former Member
0 Likes
4,846

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

Read only

0 Likes
4,846

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.

Read only

0 Likes
4,846

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