Skip to Content
avatar image
Former Member

Regarding Sap-script.

Hello Gurus..

kindly help in this issue....

in my sap-script..

my country key is DE depending on this i have to get country name Germany...

how I will write subroutine in sap script...

kindly send code please....

Thanks and Regards

Nagaraju Chintam

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Oct 25, 2007 at 04:41 PM

    there are 2 possible solutions:

    - in your printprogram you will add a global variant, let's say G_COUNTRY_NAME, and you will determine it inside the program. After that you will add it to a window in the sapscript as &G_COUNTRY_NAME&

    - you can also to a PERFORM directly from the sapscript to determine the country name.

    regards,

    Hans

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Check the program :

      You can write simple code :

      Goto SE71 -> Window ( where you want to get the data).

      /: PERFORM GET_COUNTRY IN PROGRAM ZGET_COUNTRY

      /: USING &COUNTRY&

      /: CHANGING &COUNTRY_NAME&

      /: ENDPERFORM.

      Goto SE38 -> create program (ZGET_COUNTRY)

      FORM GET_COUNTRY

      tables in_tab structure itcsy

      out_tab structure itcsy.

      tables : t005,

      t005t.

      data : LAND1 like t005-LAND1,

      landx like t005t-landx.

      clear :land1,

      landx.

      read table in_tab with key NAME = 'COUNTRY'.

      if sy-subrc eq 0.

      land1 = in_tab-value.

      endif.

      select single landx from t005t into landx

      where land1 = land1

      and spras = sy-langu.

      read table out_tab with key NAME = 'COUNTRY_NAME'.

      if sy-subrc eq 0.

      out_tab-value = landx.

      modify out_tab index sy-tabix.

      endif.

      ENDFORM.

      Thanks

      Seshu

  • Oct 26, 2007 at 02:39 AM

    Call external sub-routine as shown below....

    select <b>landx</b> from<b> t005t</b> into landx

    where land1 = land1

    and spras = sy-langu.

    Ex:

    Go through this example

    Ex.

    /: PERFORM <Subroutine name> IN PROGRAM <subroutine prog name>

    /:USING &<field name>&

    /:CHANGING &<field name1&

    /:ENDPERFORM

    Then create subroutine pool program and you have to write the code.

    FORM ><subroutine name> tables int_cond structure itcsy

    outt_cond structure itcsy.

    data : value(20), value1(20). "do your own declarations

    Read int_cond table index 1.

    value = int_cond-value.

    value1 = value1 + value.

    Read outt_cond table index 1.

    outt_cond-value = value1.

    Modify outt_cond index 1.

    ENDFORM.

    Just rough idea given above.

    Regards,

    SaiRam

    Add comment
    10|10000 characters needed characters exceeded