Application Development 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: 

GET PARAMETER ID not working

Former Member
0 Kudos

Hi,

I am creating a BADI implementation wherein I need to use the purchase order in my logic. I need to use purchase order from EKKO where the field is EBELN. the Parameter ID for EBELN is BES. So i used this in my BADI. Below is the code that I have written to fetch the parameter id in my BADI.

DATA: l_ebeln TYPE ekko-ebeln.
GET PARAMETER ID 'BES' FIELD l_ebeln.

SELECT SINGLE * FROM ekpv INTO wa_ekpv
                                WHERE ebeln = l_ebeln

However, when i check in debugging, I can see that the field l_ebeln is blank. No value has been fetched. What could be the problem?

1 ACCEPTED SOLUTION

dirk_wittenberg
Contributor
0 Kudos

Has the parameter id ever been set?

-> SET PARAMETER ID 'BES' FIELD <some value>

And wouldn't it be better to pass the PO-number as parameter to the BADI ?

Parameter-Ids always smell a bit like a poker-face rather than an interface and they are visible cross sessions, so if your user works with multiple sessions you can get surprising results.

Regards,

Dirk

14 REPLIES 14

dirk_wittenberg
Contributor
0 Kudos

Has the parameter id ever been set?

-> SET PARAMETER ID 'BES' FIELD <some value>

And wouldn't it be better to pass the PO-number as parameter to the BADI ?

Parameter-Ids always smell a bit like a poker-face rather than an interface and they are visible cross sessions, so if your user works with multiple sessions you can get surprising results.

Regards,

Dirk

0 Kudos

Hi Dirk,

The value for ekko-ebeln is populated inside and enhancement point before it reached the BADI. When I check with a break point at the enhancement, i can see the value of ekko-ebeln and then when i see l_ebeln, it is populated. The GET PARAMETER ID gets the value. But strangely enough when I execute without breakpoint in the enhancement point, I can see that the parameter id is not getting populted. What difference does the break point make? With breakpoint i am getting the field and without breakpoint i am not getting the field. I did not explicitly SET the PARAMETER ID.

0 Kudos

Hi,

due to the break-point the debugger is being called. This might include a COMMIT-WORK what makes then the difference.

Dirk

0 Kudos

Thanks for the suggestions. Though the value was being fetched in the program, it was behaving randomly. I was getting the correct output only for that session. So taking into consideration the idea to set the parameter id, I found an enhancement point before my BADI was getting triggered and where i could see the value of EKKO-EBELN. I set the parameter id at this point and its working.

0 Kudos

Hi,

you should also consider that SET/GET Parameters are visible in all your sessions you might have in parallel. In your case here the time between setting and getting the parameter is so short that you're not running any risk of changing the value in another session.

Else "export to memory" and "import from memory" are the better choice as they are session-dependent.

Regards

Dirk

Former Member
0 Kudos

Sometimes a parameter id has not been set to any value prior to getting it.  If that is the case, then the get parameter statement would return a blank.

Former Member
0 Kudos

Rather than debugging, you should be checking sy-subrc to see if it was set. If sy-subrc is zero, then it was set to a space; otherwise, it was not set.

Rob

Former Member
0 Kudos

I did not get the correct scenario you are in.

If you want to get the 'ebeln' value from the transaction screen with GET PARAMETER statement you will not get the value of the ebeln.

In that case you better use few bdc lines for retrieving the 'ebeln' value.

-- Raja Sekhar

0 Kudos

Hi Neena,

Please check if the BAdI interface method has any parameter, there might be some parameter you can use to get the data you need.

For example on BAdI ME_PROCESS_PO_CUST method PROCESS_HEADER there is parameter IM_HEADER. And we can use method GET_DATA on this IM_HEADER parameter to get PO Header Data.

Regards,

Oki

former_member189779
Active Contributor
0 Kudos

Hi,

EKPV data is already avialable.

Check BADI ME_PROCESS_PO_CUST method Process_item

DATA ls_sdata TYPE ekpv.

data ls_mepoitem TYPE mepoitem

ls_sdata = im_item->get_shipping_data( ). For EKPV

0 Kudos

The BADI that I am using is LE_SHP_DELIVERY_PROC and the method in which I have written the code is IF_EX_LE_SHP_DELIVERY_PROC~SAVE_DOCUMENT_PREPARE. There are no structures in it for EKPV. In fact I do not see any structure that holds the Purchase Order. Can I still use the logic that you explained?

0 Kudos

What is that you are trying to do? Are you creating Inbound delivery against PO?

0 Kudos

I am trying to get the forwarding agent automatically in a Delivery. I have written the following code in my z implementation for BADI LE_SHP_DELIVERY_PROC in method SAVE_DOCUMENT_PREPARE.

    DATA: flag TYPE c.
    DATA:l_ebeln TYPE ekko-ebeln.
    DATA:wa_ekpa TYPE ekpa.
    DATA: wa_ekpv TYPE ekpv.
    DATA:wa_vbpavb TYPE vbpavb.
    DATA:wa_vbpavb2 TYPE vbpavb.
    DATA:wa_lfa1 TYPE lfa1.
    DATA:wa_adrc TYPE adrc.
    DATA:wa_sadrvb TYPE sadrvb.
    DATA:wa_ekko TYPE ekko.
    DATA:wa_knvp TYPE knvp.

    IMPORT flag1 TO flag FROM MEMORY ID 'FLAG'.

    IF flag NE 'X'.


      GET PARAMETER ID 'BES' FIELD l_ebeln.

      SELECT SINGLE * FROM ekpv INTO wa_ekpv
                                WHERE ebeln = l_ebeln.


      SELECT SINGLE * FROM ekko INTO wa_ekko
                                WHERE ebeln = l_ebeln.

     IF wa_ekko-bsart EQ 'UB'.

            SELECT SINGLE * FROM knvp INTO wa_knvp WHERE
                                           kunnr = wa_ekpv-kunnr and parvw = 'SP'.



            SELECT SINGLE * FROM lfa1 INTO wa_lfa1 WHERE
                                           lifnr = wa_knvp-lifnr.


            READ TABLE ct_xvbpa INTO wa_vbpavb2 INDEX 1.

            wa_vbpavb = wa_vbpavb2.
            wa_vbpavb-lifnr = wa_lfa1-lifnr.
            wa_vbpavb-parvw = wa_knvp-parvw.
            MOVE-CORRESPONDING wa_lfa1 TO wa_vbpavb.
            APPEND wa_vbpavb TO ct_xvbpa.


            wa_sadrvb-adrnr = wa_lfa1-adrnr.
            wa_sadrvb-name1 = wa_lfa1-name1.

            MOVE-CORRESPONDING wa_lfa1 TO wa_sadrvb.
            APPEND wa_sadrvb TO ct_xvbadr.

            flag = 'X'.
            EXPORT flag1 FROM flag TO MEMORY ID 'FLAG'.

          ENDIF.
        ENDIF.
         ENDIF.

This code works when i try it in Debugging by putting a breakpoint at some user exits. I get the purchase order in l_ebeln and I am getting the partner function in the header of the delivery. But when I directly execute it in VL10B, it does not fetch any value in PARAMETER ID as a result the rest of my code is failing and no partner function is determined. So I wanted to know if there is some way I can get the value of purchase order that I can use in the rest of my code.

0 Kudos

Hi

Check Method IF_EX_LE_SHP_DELIVERY_PROC~DELIVERY_FINAL_CHECK. Check document flow tables if you have PO information.

Also check

Check SAP Note 198137.

Check if Include LV50R_VIEWF62 Helps you.