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: line items

Former Member
0 Likes
883

Hi Experts,

In my script . am using subroutine pool to acess the data. In that for line items am using save_text function module to save the line items in so10 and calling the include in the layout(se71) for display. so the problem z now that like if i select 1 doc number 100 its displaying the line items correctly but if i select it in range.. like 100 to 101 then only the 100 doc number line item r printing in both . But i found out in deburging that both the line items r coming in the subroutine pool. but in se71 its not displaying. plz help me.

here is the code.

/:	 	PERFORM DATA IN PROGRAM ZRFI007
/:	 	USING &BKPF-BELNR&
/:	 	USING &BKPF-BUKRS&
/:	 	USING &BKPF-GJAHR&
/:	 	CHANGING &GV_BELNR&
/:	 	ENDPERFORM
/:	 	INCLUDE ZPAYMENT_VOUCHER OBJECT TEXT ID ST LANGUAGE EN

DATA: BEGIN OF lt_record OCCURS 0,
          belnr LIKE bkpf-belnr,
        END OF lt_record.

  DATA: wa_output LIKE LINE OF out_par.

  DATA: zbelnr LIKE bkpf-belnr,
        zbukrs LIKE bkpf-bukrs.

  DATA: v_date(10).
  DATA: zam LIKE bsak-wrbtr.
  DATA: lv_num(2) TYPE c.
  DATA: curr(20) TYPE c.

  TYPES : BEGIN OF t_bsak,
          zid  LIKE bsak-bldat,
          zin  LIKE bsak-belnr,
          zpo  LIKE bsak-ebeln,
          zde  LIKE bsak-sgtxt,
          zam1 LIKE bsak-wrbtr,
          END OF t_bsak.

  DATA : wa_bsak TYPE t_bsak,
         it_bsak TYPE STANDARD TABLE OF t_bsak INITIAL SIZE 0.

  DATA: i_text TYPE STANDARD TABLE OF tline INITIAL SIZE 0,
        w_header LIKE  thead,
        w_text TYPE tline.

  DATA: lv_lines LIKE sy-index.

  CONSTANTS: c_par(2) TYPE c VALUE ',,'.

  CLEAR: zbelnr, zbukrs.
  break sirish.
  READ TABLE in_par INDEX 1.
  CHECK sy-subrc = 0.
  zbelnr = in_par-value.

  READ TABLE in_par INDEX 2.
  CHECK sy-subrc = 0.
  zbukrs = in_par-value.

  CLEAR it_bsak. REFRESH it_bsak.

  SELECT bldat belnr ebeln sgtxt wrbtr
  FROM bsak INTO TABLE it_bsak WHERE augbl = zbelnr AND
                                     bukrs = zbukrs
                                 AND    buzei = '1'.
*  SELECT bldat belnr ebeln sgtxt wrbtr
*    INTO TABLE it_bsak
*    FROM bsak
*    WHERE augbl EQ zbelnr
*      AND bukrs EQ zbukrs
*      AND buzei = '1'.

  CLEAR i_text. REFRESH i_text.

  LOOP AT it_bsak INTO wa_bsak.

    CONCATENATE wa_bsak-zid+6(2) wa_bsak-zid+4(2) wa_bsak-zid+0(4) INTO v_date SEPARATED BY '.'.

    w_text-tdformat = 'T4'.

    CLEAR curr.
    WRITE: wa_bsak-zam1 TO curr CURRENCY 'MYR' LEFT-JUSTIFIED.

    gt_record-amount = wa_bsak-zam1.
    APPEND gt_record. CLEAR gt_record.

    CONCATENATE v_date wa_bsak-zin wa_bsak-zpo wa_bsak-zde curr
         INTO w_text-tdline SEPARATED BY c_par.

    APPEND w_text TO i_text.
    CLEAR: wa_bsak, w_text.

  ENDLOOP.

  w_header-tdobject = 'TEXT'.
  w_header-tdname   = 'ZPAYMENT_VOUCHER'.
  w_header-tdid     = 'ST'.
  w_header-tdspras  = 'E'.
  w_header-tdform   = 'ZCFI004'.

  CALL FUNCTION 'SAVE_TEXT'
    EXPORTING
      client          = sy-mandt
      header          = w_header
      insert          = 'X'
      savemode_direct = space
      owner_specified = 'X'
*    IMPORTING
*      function        =
    TABLES
      lines           = i_text
    EXCEPTIONS
      id              = 1
      language        = 2
      name            = 3
      object          = 4
      OTHERS          = 5.

correct answers will be appriciated with good points.

Regards

Sunita.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
834

can u tell me which variable contains the user selection.

and the code for subroutine.

secondly is ur subroutine filling the LONG TEXT Which is included in your script.

i cant where the multiple documents are getting processed.

since

SELECT bldat belnr ebeln sgtxt wrbtr

FROM bsak INTO TABLE it_bsak WHERE augbl = zbelnr AND

bukrs = zbukrs

AND buzei = '1'.

here u are specifying augbl = zbelnr so it will have only one document.

shouldnt u say augbl in select_options?

secondly


  READ TABLE in_par INDEX 1.
  CHECK sy-subrc = 0.
  zbelnr = in_par-value.
 
  READ TABLE in_par INDEX 2.
  CHECK sy-subrc = 0.
  zbukrs = in_par-value.

what is in_par

Edited by: Khusro Habib on Aug 6, 2008 7:54 AM

7 REPLIES 7
Read only

Former Member
0 Likes
834

Hi Experts,

Anybody plz help me.

Regards

Sunita.

Read only

Former Member
0 Likes
834

Sunita,

after SAVE_TEXT call COMMIT_TEXT for commit your work.

Amit.

Read only

0 Likes
834

Hi Amit,

Can u please tell me how to use commit_text... what all inputs to b given....

Hope you hav undestood my query perfectly ..right?

Regards

Sunita.

Read only

Former Member
0 Likes
835

can u tell me which variable contains the user selection.

and the code for subroutine.

secondly is ur subroutine filling the LONG TEXT Which is included in your script.

i cant where the multiple documents are getting processed.

since

SELECT bldat belnr ebeln sgtxt wrbtr

FROM bsak INTO TABLE it_bsak WHERE augbl = zbelnr AND

bukrs = zbukrs

AND buzei = '1'.

here u are specifying augbl = zbelnr so it will have only one document.

shouldnt u say augbl in select_options?

secondly


  READ TABLE in_par INDEX 1.
  CHECK sy-subrc = 0.
  zbelnr = in_par-value.
 
  READ TABLE in_par INDEX 2.
  CHECK sy-subrc = 0.
  zbukrs = in_par-value.

what is in_par

Edited by: Khusro Habib on Aug 6, 2008 7:54 AM

Read only

Former Member
0 Likes
834

Hi Experts,

Anybody plz can help me ??

Regards

Sunita.

Read only

Former Member
0 Likes
834

hi Experts.

can any answer?

Correct answers will be appriciated with good points.

Regards

Sunita.

Read only

0 Likes
834

if u can answer the questions i posted i would be able to answer u, since i think u are calling fix indexes from the tables so it is always picking the first one.

or paste the complete program