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

Script Driver program and paramenter change

Former Member
0 Likes
969

This is coding part of driver program for script.

FORM bank_number TABLES intab STRUCTURE itcsy

outtab STRUCTURE itcsy.

DATA : v_bank(40),

v_bankl(15),

v_bankn(18),

v_koinh(60),

V_NAME2(40),

v_belnr TYPE bsec-belnr,

v_gjahr TYPE bsec-gjahr.

READ TABLE intab WITH KEY name = 'REGUP-GJAHR' .

IF sy-subrc IS INITIAL.

CONDENSE intab-value.

v_gjahr = intab-value.

ENDIF.

ENDFORM.

The Script coding part follows as,

PERFORM BANK_NUMBER IN PROGRAM 'Z_FI_L_CHKPNT_NEW'

USING &REGUH-LIFNR&

USING &REGUH-VBLNR&

USING &REGUH-ZBUKR&

USING &REGUP-GJAHR&

USING &REGUH-ZNME1&

CHANGING &V_NAME&

CHANGING &V_BANK&

CHANGING &V_ZNME1&

ENDPERFORM

Now my requirement is, i need to change the REGUP-GJAHR into PAYR-GJAHR, ie i have to pass the GJAHR value from the PAYR table.

I tried both of the coding part, but its not working, what could be the reason, pls explain me on this.

Thanks in advance.

Regards

Rajaram

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
939

Hi

Try this format

*&---------------------------------------------------------------------*
*& Report  Z_SN_SCRIPT1                                                *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

REPORT  Z_SN_SCRIPT1                            .

TABLES : BSEG.
DATA : BELNR LIKE BSEG-BELNR,
       BUKRS LIKE BSEG-BUKRS,
       GJAHR LIKE BSEG-GJAHR,
       BUZEI LIKE BSEG-BUZEI.

*DATA : TXT LIKE BSEG-SGTXT.
data: txt like bseg-hkont.

*---------------------------------------------------------------------*
*       FORM GET_TOTAL                                                *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  -->  IN_PAR                                                        *
*  -->  OUT_PAR                                                       *
*---------------------------------------------------------------------*
FORM GET_TOTAL TABLES IN_PAR STRUCTURE ITCSY
                   OUT_PAR STRUCTURE ITCSY.
  CLEAR TXT.
  READ TABLE IN_PAR WITH KEY 'ITAB-BELNR'.
  CHECK SY-SUBRC = 0.
  BELNR = IN_PAR-VALUE.
  READ TABLE IN_PAR WITH KEY 'ITAB-BUKRS'.
  CHECK SY-SUBRC = 0.
  BUKRS = IN_PAR-VALUE.
  READ TABLE IN_PAR WITH KEY 'ITAB-GJAHR'.
  CHECK SY-SUBRC = 0.
  GJAHR = IN_PAR-VALUE.
  READ TABLE IN_PAR WITH KEY 'ITAB-BUZEI'.
  CHECK SY-SUBRC = 0.
  BUZEI = IN_PAR-VALUE.
  UNPACK BELNR TO BELNR.
  SELECT SINGLE * FROM BSEG WHERE "belnr = docno and
                                  BUKRS = BUKRS AND
                                  BELNR EQ BELNR AND
                                  GJAHR EQ GJAHR AND
                                  BUZEI EQ BUZEI .
*  TXT = BSEG-SGTXT.
  TXT = BSEG-hkont.
  READ TABLE OUT_PAR WITH KEY 'TXT'.
  CHECK SY-SUBRC EQ 0.
  OUT_PAR-VALUE = TXT.
  MODIFY OUT_PAR INDEX SY-TABIX.
ENDFORM.

/E   ELEM2
*
/:   DEFINE &TXT&
*    &itab-bukrs&,,,,&itab-gjahr&,,,,&itab-buzei&,,,,&itab-belnr&
/:   PERFORM GET_TOTAL IN PROGRAM Z_SN_SCRIPT1
/:   USING       &ITAB-BELNR&
/:   USING       &ITAB-BUKRS&
/:   USING       &ITAB-GJAHR&
/:   USING       &ITAB-BUZEI&
/:   CHANGING    &TXT&
/:   ENDPERFORM
=    ,,,,&TXT&

S.Nehru.

9 REPLIES 9
Read only

Former Member
0 Likes
940

Hi

Try this format

*&---------------------------------------------------------------------*
*& Report  Z_SN_SCRIPT1                                                *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

REPORT  Z_SN_SCRIPT1                            .

TABLES : BSEG.
DATA : BELNR LIKE BSEG-BELNR,
       BUKRS LIKE BSEG-BUKRS,
       GJAHR LIKE BSEG-GJAHR,
       BUZEI LIKE BSEG-BUZEI.

*DATA : TXT LIKE BSEG-SGTXT.
data: txt like bseg-hkont.

*---------------------------------------------------------------------*
*       FORM GET_TOTAL                                                *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  -->  IN_PAR                                                        *
*  -->  OUT_PAR                                                       *
*---------------------------------------------------------------------*
FORM GET_TOTAL TABLES IN_PAR STRUCTURE ITCSY
                   OUT_PAR STRUCTURE ITCSY.
  CLEAR TXT.
  READ TABLE IN_PAR WITH KEY 'ITAB-BELNR'.
  CHECK SY-SUBRC = 0.
  BELNR = IN_PAR-VALUE.
  READ TABLE IN_PAR WITH KEY 'ITAB-BUKRS'.
  CHECK SY-SUBRC = 0.
  BUKRS = IN_PAR-VALUE.
  READ TABLE IN_PAR WITH KEY 'ITAB-GJAHR'.
  CHECK SY-SUBRC = 0.
  GJAHR = IN_PAR-VALUE.
  READ TABLE IN_PAR WITH KEY 'ITAB-BUZEI'.
  CHECK SY-SUBRC = 0.
  BUZEI = IN_PAR-VALUE.
  UNPACK BELNR TO BELNR.
  SELECT SINGLE * FROM BSEG WHERE "belnr = docno and
                                  BUKRS = BUKRS AND
                                  BELNR EQ BELNR AND
                                  GJAHR EQ GJAHR AND
                                  BUZEI EQ BUZEI .
*  TXT = BSEG-SGTXT.
  TXT = BSEG-hkont.
  READ TABLE OUT_PAR WITH KEY 'TXT'.
  CHECK SY-SUBRC EQ 0.
  OUT_PAR-VALUE = TXT.
  MODIFY OUT_PAR INDEX SY-TABIX.
ENDFORM.

/E   ELEM2
*
/:   DEFINE &TXT&
*    &itab-bukrs&,,,,&itab-gjahr&,,,,&itab-buzei&,,,,&itab-belnr&
/:   PERFORM GET_TOTAL IN PROGRAM Z_SN_SCRIPT1
/:   USING       &ITAB-BELNR&
/:   USING       &ITAB-BUKRS&
/:   USING       &ITAB-GJAHR&
/:   USING       &ITAB-BUZEI&
/:   CHANGING    &TXT&
/:   ENDPERFORM
=    ,,,,&TXT&

S.Nehru.

Read only

0 Likes
939

still its not working, the read statement in the driver program returns the value 4, and the intab internal table value also not changed, advise me.

Read only

0 Likes
939

Hi,

please check that value for PAYR-GJAHR is coming in Script @ Debugging mode and let me know???

Regards

Lakshmiraj

Read only

0 Likes
939

yea PAYR-GJAHR value is coming in debugging mode, but one thing, i have changed the script that PAYR-GJAHR in the USING statement, but that changes is not taking effect while i do debugging, what could be the reason actually.

can you pls explain me.

Regards

Rajaram

Read only

0 Likes
939

Hi,

From your code...

PERFORM BANK_NUMBER IN PROGRAM 'Z_FI_L_CHKPNT_NEW'

USING &REGUH-LIFNR&

USING &REGUH-VBLNR&

USING &REGUH-ZBUKR&

USING &REGUP-GJAHR&

USING &REGUH-ZNME1&

CHANGING &V_NAME&

CHANGING &V_BANK&

CHANGING &V_ZNME1&

ENDPERFORM

remove the single quotes .. Z_FI_L_CHKPNT_NEW

and put break point in the same program under that PERFORM BANK_NUMBER module. and see what is coming in intab[].

check whether u ACTIVATED the SCRIPT !

Edited by: LAKSHMIRAJ on Apr 7, 2008 5:40 AM

Read only

0 Likes
939

Hi Lakshmi

Thank you very much, now its working, actually i have not activated the script. I thought that there is no activation in script.

Now i activated and its working fine. thank you very much.

Regards

Rajaram

Read only

0 Likes
939

Hi,

Good job raja !

In SDN , the best way to say Thanks is by rewarding POINTS for the helpful and useful replies.

Rgds

Lakshmiraj.A

Read only

abapdeveloper20
Contributor
0 Likes
939

Hi,

Read by using the index value . It will work.

Check my sample code below.



In SCRIPT 

PERFORM GET_DATA_ADRC IN PROGRAM Z_RFFOUS_C
USING &LFA1-ADRNR&
CHANGING &STREET&
CHANGING &STR_SUPPL1&
CHANGING &TEMP&
ENDPERFORM

In PROGRAM

form get_data_adrc tables it_using structure itcsy
                       it_changing structure itcsy.

  data : adrnr like lfa1-adrnr.

  data : l_street like adrc-street,
         l_str_suppl1 like adrc-str_suppl1,
         l_str_suppl2 like adrc-str_suppl2,
         l_str_suppl3 like adrc-str_suppl3,
         l_locat  like adrc-location.

  data : temp(220).

  read table it_using index 1.
  move it_using-value to adrnr.

  unpack adrnr to adrnr.

  select single street
                str_suppl1
                str_suppl2
                str_suppl3
                location
       from   adrc
       into   (l_street,
              l_str_suppl1,
              l_str_suppl2,
              l_str_suppl3,
              l_locat)
       where
              addrnumber = adrnr.



  read table it_changing index 1.
  it_changing-value = l_street.
  modify it_changing index 1.

  read table it_changing index 2.
  it_changing-value = l_str_suppl1.
  modify it_changing index 2.

  concatenate l_str_suppl2
              ','
              l_str_suppl3
              ','
              l_locat into  temp.


  while sy-subrc = 0.
    replace ',' with ' ' into temp.
  endwhile.

  read table it_changing index 3.
  it_changing-value = temp.
  modify it_changing index 3.


endform.

Reward points if helpful

~Lakshmiraj~

Read only

0 Likes
939

still its not working, the read statement in the driver program returns the value 4, and the intab internal table value also not changed, advise me.