cancel
Showing results for 
Search instead for 
Did you mean: 

How to get VBELN in run time

Former Member
0 Kudos

I have developped a custom driver program and a smartfor layout for sales order confirmation. And configured the program and layout against a output type.

I go to VA02>Type an order number>

Choose 'Issue output to' from Sales document menu. Then I will select the output type and press print preview button.

In this case my custom driver program is called. My question is during this run time how do I get the VBELN for the current document that I have entered? Based on this VBELN, I am going to fetch the required data.

Regds

Rajesh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Rajesh,

Check the Parameter Id <b>AUN</b>.

I think, this will hold the VBELN.

Thanks

Kam

Answers (2)

Answers (2)

Former Member
0 Kudos

Declaration part

Data: V_COLLECT(85) value '(Prog name)tablename-fiend name'. "

Data: V_PROCTR(85) value '(Prog name)tablename-fiend name'.

FIELD-SYMBOLS: <FS_COLLECT> TYPE ANY,

<FS_PROCTR> TYPE ANY.

This is the Code, write this where you want that value

ASSIGN (V_COLLECT) TO <FS_COLLECT>.

ASSIGN (V_PROCTR) TO <FS_PROCTR>.

here FS_COLLECT will contain the value of the Field

try this and let me know if you fail..

Thanks

Sudheer

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

I believe it should be coming in thru NAST as the object key? In our custom print programs for sales documents, there is entry routine in the program which is defined in config. The subroutine is called and NAST is avaiable during runtime, the OBJKY is the field with the sales document number in it.

tables:
        nast,                          "Messages
        *nast.                         "Messages
       


form entry using return_code us_screen.

  clear retcode.
  xscreen = us_screen.

* Retrieve misc data.
  select single vbpa~vbeln vbpa~kunnr adrc~name1 adrc~street adrc~city1
                adrc~region adrc~post_code1 adrc~tel_number
                adrc~fax_number
                   into corresponding fields of formdata
                      from vbpa
                        inner join adrc
                           on  vbpa~adrnr = adrc~addrnumber
                              where vbpa~vbeln = <b>nast-objky</b>                                and vbpa~parvw = 'AG'
                                and adrc~date_to = '99991231'.


endform.

Regards,

Rich Heilman